rename to qt standard

This commit is contained in:
Wladimir J. van der Laan 2011-05-12 14:44:52 +02:00
parent 8812ce7b27
commit df577886e4
25 changed files with 447 additions and 69 deletions

View File

@ -1,7 +0,0 @@
#include "AddressBookDialog.h"
AddressBookDialog::AddressBookDialog(QWidget *parent) :
QDialog(parent)
{
}

View File

@ -1,7 +0,0 @@
#include "OptionsDialog.h"
/* TODO example: http://doc.trolltech.com/4.7/dialogs-configdialog-configdialog-cpp.html */
OptionsDialog::OptionsDialog(QWidget *parent) :
QDialog(parent)
{
}

View File

@ -1,6 +0,0 @@
#include "SendCoinsDialog.h"
SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
QDialog(parent)
{
}

View File

@ -1,7 +0,0 @@
#include "SettingsDialog.h"
SettingsDialog::SettingsDialog(QWidget *parent) :
QDialog(parent)
{
}

View File

@ -1,18 +0,0 @@
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include <QDialog>
class SettingsDialog : public QDialog
{
Q_OBJECT
public:
explicit SettingsDialog(QWidget *parent = 0);
signals:
public slots:
};
#endif // SETTINGSDIALOG_H

3
TODO
View File

@ -51,3 +51,6 @@ AboutDialog
- Translation - Translation
- Toolbar icon
- 'notify' on incoming transaction

19
addressbookdialog.cpp Normal file
View File

@ -0,0 +1,19 @@
#include "addressbookdialog.h"
#include "ui_addressbookdialog.h"
AddressBookDialog::AddressBookDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AddressBookDialog)
{
ui->setupUi(this);
}
AddressBookDialog::~AddressBookDialog()
{
delete ui;
}
void AddressBookDialog::setTab(int tab)
{
}

View File

@ -3,16 +3,26 @@
#include <QDialog> #include <QDialog>
namespace Ui {
class AddressBookDialog;
}
class AddressBookDialog : public QDialog class AddressBookDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AddressBookDialog(QWidget *parent = 0); explicit AddressBookDialog(QWidget *parent = 0);
~AddressBookDialog();
signals: enum {
SendingTab = 0,
public slots: ReceivingTab = 1
} Tabs;
void setTab(int tab);
private:
Ui::AddressBookDialog *ui;
}; };
#endif // ADDRESSBOOKDIALOG_H #endif // ADDRESSBOOKDIALOG_H

77
addressbookdialog.ui Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddressBookDialog</class>
<widget class="QDialog" name="AddressBookDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AddressBookDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AddressBookDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -10,20 +10,24 @@ INCLUDEPATH += .
# Input # Input
HEADERS += BitcoinGUI.h \ HEADERS += BitcoinGUI.h \
TransactionTableModel.h \ TransactionTableModel.h \
SendCoinsDialog.h \
SettingsDialog.h \
AddressBookDialog.h \
AboutDialog.h \ AboutDialog.h \
AddressTableModel.h \ AddressTableModel.h \
OptionsDialog.h OptionsDialog.h \
MainOptionsPage.h \
SendCoinsDialog.h \
addressbookdialog.h
SOURCES += bitcoin.cpp BitcoinGUI.cpp \ SOURCES += bitcoin.cpp BitcoinGUI.cpp \
TransactionTableModel.cpp \ TransactionTableModel.cpp \
SendCoinsDialog.cpp \
SettingsDialog.cpp \
AddressBookDialog.cpp \
AboutDialog.cpp \ AboutDialog.cpp \
AddressTableModel.cpp \ AddressTableModel.cpp \
OptionsDialog.cpp OptionsDialog.cpp \
MainOptionsPage.cpp \
SendCoinsDialog.cpp \
addressbookdialog.cpp
RESOURCES += \ RESOURCES += \
bitcoin.qrc bitcoin.qrc
FORMS += \
sendcoinsdialog.ui \
addressbookdialog.ui

View File

@ -5,8 +5,7 @@
*/ */
#include "BitcoinGUI.h" #include "BitcoinGUI.h"
#include "TransactionTableModel.h" #include "TransactionTableModel.h"
#include "AddressBookDialog.h" #include "addressbookdialog.h"
#include "SettingsDialog.h"
#include "SendCoinsDialog.h" #include "SendCoinsDialog.h"
#include "OptionsDialog.h" #include "OptionsDialog.h"
#include "AboutDialog.h" #include "AboutDialog.h"
@ -144,15 +143,15 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
/* Status bar */ /* Status bar */
statusBar(); statusBar();
QLabel *label_connections = new QLabel("6 connections", this); QLabel *label_connections = new QLabel("6 connections");
label_connections->setFrameStyle(QFrame::Panel | QFrame::Sunken); label_connections->setFrameStyle(QFrame::Panel | QFrame::Sunken);
label_connections->setMinimumWidth(100); label_connections->setMinimumWidth(100);
QLabel *label_blocks = new QLabel("6 blocks", this); QLabel *label_blocks = new QLabel("6 blocks");
label_blocks->setFrameStyle(QFrame::Panel | QFrame::Sunken); label_blocks->setFrameStyle(QFrame::Panel | QFrame::Sunken);
label_blocks->setMinimumWidth(100); label_blocks->setMinimumWidth(100);
QLabel *label_transactions = new QLabel("6 transactions", this); QLabel *label_transactions = new QLabel("6 transactions");
label_transactions->setFrameStyle(QFrame::Panel | QFrame::Sunken); label_transactions->setFrameStyle(QFrame::Panel | QFrame::Sunken);
label_transactions->setMinimumWidth(100); label_transactions->setMinimumWidth(100);
@ -166,8 +165,8 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
connect(addressbook, SIGNAL(triggered()), this, SLOT(addressbookClicked())); connect(addressbook, SIGNAL(triggered()), this, SLOT(addressbookClicked()));
connect(receiving_addresses, SIGNAL(triggered()), this, SLOT(receivingAddressesClicked())); connect(receiving_addresses, SIGNAL(triggered()), this, SLOT(receivingAddressesClicked()));
connect(options, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(options, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(button_new, SIGNAL(triggered()), this, SLOT(newAddressClicked())); connect(button_new, SIGNAL(clicked()), this, SLOT(newAddressClicked()));
connect(button_clipboard, SIGNAL(triggered()), this, SLOT(copyClipboardClicked())); connect(button_clipboard, SIGNAL(clicked()), this, SLOT(copyClipboardClicked()));
connect(about, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(about, SIGNAL(triggered()), this, SLOT(aboutClicked()));
} }
@ -182,7 +181,7 @@ void BitcoinGUI::addressbookClicked()
{ {
qDebug() << "Address book clicked"; qDebug() << "Address book clicked";
AddressBookDialog dlg; AddressBookDialog dlg;
/* TODO: Set tab to "Sending" */ dlg.setTab(AddressBookDialog::SendingTab);
dlg.exec(); dlg.exec();
} }
@ -190,7 +189,7 @@ void BitcoinGUI::receivingAddressesClicked()
{ {
qDebug() << "Receiving addresses clicked"; qDebug() << "Receiving addresses clicked";
AddressBookDialog dlg; AddressBookDialog dlg;
/* TODO: Set tab to "Receiving" */ dlg.setTab(AddressBookDialog::ReceivingTab);
dlg.exec(); dlg.exec();
} }

67
mainoptionspage.cpp Normal file
View File

@ -0,0 +1,67 @@
#include "MainOptionsPage.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QLabel>
#include <QLineEdit>
MainOptionsPage::MainOptionsPage(QWidget *parent):
QWidget(parent)
{
QVBoxLayout *layout = new QVBoxLayout();
QCheckBox *bitcoin_at_startup = new QCheckBox(tr("&Start Bitcoin on window system startup"));
layout->addWidget(bitcoin_at_startup);
QCheckBox *minimize_to_tray = new QCheckBox(tr("&Minimize to the tray instead of the taskbar"));
layout->addWidget(minimize_to_tray);
QCheckBox *map_port_upnp = new QCheckBox(tr("Map port using &UPnP"));
layout->addWidget(map_port_upnp);
QCheckBox *minimize_on_close = new QCheckBox(tr("M&inimize on close"));
layout->addWidget(minimize_on_close);
QCheckBox *connect_socks4 = new QCheckBox(tr("&Connect through socks4 proxy:"));
layout->addWidget(connect_socks4);
QHBoxLayout *proxy_hbox = new QHBoxLayout();
proxy_hbox->addSpacing(18);
QLabel *proxy_ip_label = new QLabel(tr("Proxy &IP: "));
proxy_hbox->addWidget(proxy_ip_label);
QLineEdit *proxy_ip = new QLineEdit();
proxy_ip->setMaximumWidth(140);
proxy_ip_label->setBuddy(proxy_ip);
proxy_hbox->addWidget(proxy_ip);
QLabel *proxy_port_label = new QLabel(tr("&Port: "));
proxy_hbox->addWidget(proxy_port_label);
QLineEdit *proxy_port = new QLineEdit();
proxy_port->setMaximumWidth(55);
proxy_port_label->setBuddy(proxy_port);
proxy_hbox->addWidget(proxy_port);
proxy_hbox->addStretch(1);
layout->addLayout(proxy_hbox);
QLabel *fee_help = new QLabel(tr("Optional transaction fee per KB that helps make sure your transactions are processed quickly. Most transactions are 1KB. Fee 0.01 recommended."));
fee_help->setWordWrap(true);
layout->addWidget(fee_help);
QHBoxLayout *fee_hbox = new QHBoxLayout();
fee_hbox->addSpacing(18);
QLabel *fee_label = new QLabel(tr("Pay transaction &fee"));
fee_hbox->addWidget(fee_label);
QLineEdit *fee_edit = new QLineEdit();
fee_edit->setMaximumWidth(70);
fee_label->setBuddy(fee_edit);
fee_hbox->addWidget(fee_edit);
fee_hbox->addStretch(1);
layout->addLayout(fee_hbox);
layout->addStretch(1); /* Extra space at bottom */
setLayout(layout);
}

18
mainoptionspage.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef MAINOPTIONSPAGE_H
#define MAINOPTIONSPAGE_H
#include <QWidget>
class MainOptionsPage : public QWidget
{
Q_OBJECT
public:
explicit MainOptionsPage(QWidget *parent = 0);
signals:
public slots:
};
#endif // MAINOPTIONSPAGE_H

55
optionsdialog.cpp Normal file
View File

@ -0,0 +1,55 @@
#include "OptionsDialog.h"
#include "MainOptionsPage.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
OptionsDialog::OptionsDialog(QWidget *parent) :
QDialog(parent), contents_widget(0), pages_widget(0)
{
contents_widget = new QListWidget();
contents_widget->setMaximumWidth(128);
pages_widget = new QStackedWidget();
pages_widget->setMinimumWidth(300);
QListWidgetItem *item_main = new QListWidgetItem(tr("Main"));
contents_widget->addItem(item_main);
pages_widget->addWidget(new MainOptionsPage(this));
contents_widget->setCurrentRow(0);
QHBoxLayout *main_layout = new QHBoxLayout();
main_layout->addWidget(contents_widget);
main_layout->addWidget(pages_widget, 1);
QVBoxLayout *layout = new QVBoxLayout();
layout->addLayout(main_layout);
QHBoxLayout *buttons = new QHBoxLayout();
buttons->addStretch(1);
QPushButton *ok_button = new QPushButton(tr("OK"));
buttons->addWidget(ok_button);
QPushButton *cancel_button = new QPushButton(tr("Cancel"));
buttons->addWidget(cancel_button);
QPushButton *apply_button = new QPushButton(tr("Apply"));
buttons->addWidget(apply_button);
layout->addLayout(buttons);
setLayout(layout);
setWindowTitle(tr("Options"));
}
void OptionsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
{
Q_UNUSED(previous);
if(current)
{
pages_widget->setCurrentIndex(contents_widget->row(current));
}
}

View File

@ -2,6 +2,8 @@
#define OPTIONSDIALOG_H #define OPTIONSDIALOG_H
#include <QDialog> #include <QDialog>
#include <QStackedWidget>
#include <QListWidget>
class OptionsDialog : public QDialog class OptionsDialog : public QDialog
{ {
@ -12,7 +14,12 @@ public:
signals: signals:
public slots: public slots:
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
private:
QListWidget *contents_widget;
QStackedWidget *pages_widget;
void setupMainPage();
}; };
#endif // OPTIONSDIALOG_H #endif // OPTIONSDIALOG_H

14
sendcoinsdialog.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "SendCoinsDialog.h"
#include "ui_sendcoinsdialog.h"
SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SendCoinsDialog)
{
ui->setupUi(this);
}
SendCoinsDialog::~SendCoinsDialog()
{
delete ui;
}

View File

@ -3,16 +3,20 @@
#include <QDialog> #include <QDialog>
namespace Ui {
class SendCoinsDialog;
}
class SendCoinsDialog : public QDialog class SendCoinsDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SendCoinsDialog(QWidget *parent = 0); explicit SendCoinsDialog(QWidget *parent = 0);
~SendCoinsDialog();
signals: private:
Ui::SendCoinsDialog *ui;
public slots:
}; };
#endif // SENDCOINSDIALOG_H #endif // SENDCOINSDIALOG_H

146
sendcoinsdialog.ui Normal file
View File

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SendCoinsDialog</class>
<widget class="QDialog" name="SendCoinsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>736</width>
<height>129</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Amount:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>pay_amount</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Pay &amp;To:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>pay_to</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="pay_to"/>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="pay_amount">
<property name="maximumSize">
<size>
<width>145</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>&amp;Paste</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Address &amp;Book...</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SendCoinsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SendCoinsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>