diff --git a/AddressBookDialog.cpp b/AddressBookDialog.cpp deleted file mode 100644 index 7e853ede..00000000 --- a/AddressBookDialog.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "AddressBookDialog.h" - -AddressBookDialog::AddressBookDialog(QWidget *parent) : - QDialog(parent) -{ -} - diff --git a/OptionsDialog.cpp b/OptionsDialog.cpp deleted file mode 100644 index 891b43f4..00000000 --- a/OptionsDialog.cpp +++ /dev/null @@ -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) -{ -} diff --git a/SendCoinsDialog.cpp b/SendCoinsDialog.cpp deleted file mode 100644 index a89a58dc..00000000 --- a/SendCoinsDialog.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "SendCoinsDialog.h" - -SendCoinsDialog::SendCoinsDialog(QWidget *parent) : - QDialog(parent) -{ -} diff --git a/SettingsDialog.cpp b/SettingsDialog.cpp deleted file mode 100644 index d2ce01ee..00000000 --- a/SettingsDialog.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "SettingsDialog.h" - -SettingsDialog::SettingsDialog(QWidget *parent) : - QDialog(parent) -{ -} - diff --git a/SettingsDialog.h b/SettingsDialog.h deleted file mode 100644 index 7bbfb1f8..00000000 --- a/SettingsDialog.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef SETTINGSDIALOG_H -#define SETTINGSDIALOG_H - -#include - -class SettingsDialog : public QDialog -{ - Q_OBJECT -public: - explicit SettingsDialog(QWidget *parent = 0); - -signals: - -public slots: - -}; - -#endif // SETTINGSDIALOG_H diff --git a/TODO b/TODO index 4729921c..3d1785cd 100644 --- a/TODO +++ b/TODO @@ -51,3 +51,6 @@ AboutDialog - Translation +- Toolbar icon + +- 'notify' on incoming transaction diff --git a/AboutDialog.cpp b/aboutdialog.cpp similarity index 100% rename from AboutDialog.cpp rename to aboutdialog.cpp diff --git a/AboutDialog.h b/aboutdialog.h similarity index 100% rename from AboutDialog.h rename to aboutdialog.h diff --git a/addressbookdialog.cpp b/addressbookdialog.cpp new file mode 100644 index 00000000..ca74159d --- /dev/null +++ b/addressbookdialog.cpp @@ -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) +{ + +} diff --git a/AddressBookDialog.h b/addressbookdialog.h similarity index 52% rename from AddressBookDialog.h rename to addressbookdialog.h index 3a27aa62..a51c02a7 100644 --- a/AddressBookDialog.h +++ b/addressbookdialog.h @@ -3,16 +3,26 @@ #include +namespace Ui { + class AddressBookDialog; +} + class AddressBookDialog : public QDialog { Q_OBJECT + public: explicit AddressBookDialog(QWidget *parent = 0); + ~AddressBookDialog(); -signals: - -public slots: + enum { + SendingTab = 0, + ReceivingTab = 1 + } Tabs; + void setTab(int tab); +private: + Ui::AddressBookDialog *ui; }; #endif // ADDRESSBOOKDIALOG_H diff --git a/addressbookdialog.ui b/addressbookdialog.ui new file mode 100644 index 00000000..e646b08e --- /dev/null +++ b/addressbookdialog.ui @@ -0,0 +1,77 @@ + + + AddressBookDialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + AddressBookDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AddressBookDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/AddressTableModel.cpp b/addresstablemodel.cpp similarity index 100% rename from AddressTableModel.cpp rename to addresstablemodel.cpp diff --git a/AddressTableModel.h b/addresstablemodel.h similarity index 100% rename from AddressTableModel.h rename to addresstablemodel.h diff --git a/bitcoin.pro b/bitcoin.pro index 99a2601e..01d93ddb 100644 --- a/bitcoin.pro +++ b/bitcoin.pro @@ -10,20 +10,24 @@ INCLUDEPATH += . # Input HEADERS += BitcoinGUI.h \ TransactionTableModel.h \ - SendCoinsDialog.h \ - SettingsDialog.h \ - AddressBookDialog.h \ AboutDialog.h \ AddressTableModel.h \ - OptionsDialog.h + OptionsDialog.h \ + MainOptionsPage.h \ + SendCoinsDialog.h \ + addressbookdialog.h SOURCES += bitcoin.cpp BitcoinGUI.cpp \ TransactionTableModel.cpp \ - SendCoinsDialog.cpp \ - SettingsDialog.cpp \ - AddressBookDialog.cpp \ AboutDialog.cpp \ AddressTableModel.cpp \ - OptionsDialog.cpp + OptionsDialog.cpp \ + MainOptionsPage.cpp \ + SendCoinsDialog.cpp \ + addressbookdialog.cpp RESOURCES += \ bitcoin.qrc + +FORMS += \ + sendcoinsdialog.ui \ + addressbookdialog.ui diff --git a/BitcoinGUI.cpp b/bitcoingui.cpp similarity index 93% rename from BitcoinGUI.cpp rename to bitcoingui.cpp index 0f122377..a3b346ed 100644 --- a/BitcoinGUI.cpp +++ b/bitcoingui.cpp @@ -5,8 +5,7 @@ */ #include "BitcoinGUI.h" #include "TransactionTableModel.h" -#include "AddressBookDialog.h" -#include "SettingsDialog.h" +#include "addressbookdialog.h" #include "SendCoinsDialog.h" #include "OptionsDialog.h" #include "AboutDialog.h" @@ -144,15 +143,15 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): /* Status bar */ 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->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->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->setMinimumWidth(100); @@ -166,8 +165,8 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): connect(addressbook, SIGNAL(triggered()), this, SLOT(addressbookClicked())); connect(receiving_addresses, SIGNAL(triggered()), this, SLOT(receivingAddressesClicked())); connect(options, SIGNAL(triggered()), this, SLOT(optionsClicked())); - connect(button_new, SIGNAL(triggered()), this, SLOT(newAddressClicked())); - connect(button_clipboard, SIGNAL(triggered()), this, SLOT(copyClipboardClicked())); + connect(button_new, SIGNAL(clicked()), this, SLOT(newAddressClicked())); + connect(button_clipboard, SIGNAL(clicked()), this, SLOT(copyClipboardClicked())); connect(about, SIGNAL(triggered()), this, SLOT(aboutClicked())); } @@ -182,7 +181,7 @@ void BitcoinGUI::addressbookClicked() { qDebug() << "Address book clicked"; AddressBookDialog dlg; - /* TODO: Set tab to "Sending" */ + dlg.setTab(AddressBookDialog::SendingTab); dlg.exec(); } @@ -190,7 +189,7 @@ void BitcoinGUI::receivingAddressesClicked() { qDebug() << "Receiving addresses clicked"; AddressBookDialog dlg; - /* TODO: Set tab to "Receiving" */ + dlg.setTab(AddressBookDialog::ReceivingTab); dlg.exec(); } diff --git a/BitcoinGUI.h b/bitcoingui.h similarity index 100% rename from BitcoinGUI.h rename to bitcoingui.h diff --git a/mainoptionspage.cpp b/mainoptionspage.cpp new file mode 100644 index 00000000..d833a793 --- /dev/null +++ b/mainoptionspage.cpp @@ -0,0 +1,67 @@ +#include "MainOptionsPage.h" + +#include +#include +#include +#include +#include + +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); +} + diff --git a/mainoptionspage.h b/mainoptionspage.h new file mode 100644 index 00000000..de2ef9fc --- /dev/null +++ b/mainoptionspage.h @@ -0,0 +1,18 @@ +#ifndef MAINOPTIONSPAGE_H +#define MAINOPTIONSPAGE_H + +#include + +class MainOptionsPage : public QWidget +{ + Q_OBJECT +public: + explicit MainOptionsPage(QWidget *parent = 0); + +signals: + +public slots: + +}; + +#endif // MAINOPTIONSPAGE_H diff --git a/optionsdialog.cpp b/optionsdialog.cpp new file mode 100644 index 00000000..a70eadd5 --- /dev/null +++ b/optionsdialog.cpp @@ -0,0 +1,55 @@ +#include "OptionsDialog.h" +#include "MainOptionsPage.h" + +#include +#include +#include + +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)); + } +} diff --git a/OptionsDialog.h b/optionsdialog.h similarity index 50% rename from OptionsDialog.h rename to optionsdialog.h index 529eb214..2a4beacc 100644 --- a/OptionsDialog.h +++ b/optionsdialog.h @@ -2,6 +2,8 @@ #define OPTIONSDIALOG_H #include +#include +#include class OptionsDialog : public QDialog { @@ -12,7 +14,12 @@ public: signals: public slots: + void changePage(QListWidgetItem *current, QListWidgetItem *previous); +private: + QListWidget *contents_widget; + QStackedWidget *pages_widget; + void setupMainPage(); }; #endif // OPTIONSDIALOG_H diff --git a/sendcoinsdialog.cpp b/sendcoinsdialog.cpp new file mode 100644 index 00000000..ef3ade68 --- /dev/null +++ b/sendcoinsdialog.cpp @@ -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; +} diff --git a/SendCoinsDialog.h b/sendcoinsdialog.h similarity index 67% rename from SendCoinsDialog.h rename to sendcoinsdialog.h index f2720c37..82fae9cf 100644 --- a/SendCoinsDialog.h +++ b/sendcoinsdialog.h @@ -3,16 +3,20 @@ #include +namespace Ui { + class SendCoinsDialog; +} + class SendCoinsDialog : public QDialog { Q_OBJECT + public: explicit SendCoinsDialog(QWidget *parent = 0); + ~SendCoinsDialog(); -signals: - -public slots: - +private: + Ui::SendCoinsDialog *ui; }; #endif // SENDCOINSDIALOG_H diff --git a/sendcoinsdialog.ui b/sendcoinsdialog.ui new file mode 100644 index 00000000..56ec6d3d --- /dev/null +++ b/sendcoinsdialog.ui @@ -0,0 +1,146 @@ + + + SendCoinsDialog + + + + 0 + 0 + 736 + 129 + + + + Dialog + + + + + + + + &Amount: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + pay_amount + + + + + + + Pay &To: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + pay_to + + + + + + + + + + + 145 + 16777215 + + + + + + + + &Paste + + + + + + + Address &Book... + + + + + + + + 9 + + + + Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L) + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + SendCoinsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + SendCoinsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/TransactionTableModel.cpp b/transactiontablemodel.cpp similarity index 100% rename from TransactionTableModel.cpp rename to transactiontablemodel.cpp diff --git a/TransactionTableModel.h b/transactiontablemodel.h similarity index 100% rename from TransactionTableModel.h rename to transactiontablemodel.h