#include "optionsdialog.h"
#include "optionsmodel.h"
+#include "bitcoinamountfield.h"
#include "monitoreddatamapper.h"
#include "guiutil.h"
#include <QIntValidator>
#include <QDoubleValidator>
#include <QRegExpValidator>
+#include <QDialogButtonBox>
/* First (currently only) page of options */
class MainOptionsPage : public QWidget
QCheckBox *connect_socks4;
QLineEdit *proxy_ip;
QLineEdit *proxy_port;
- QLineEdit *fee_edit;
+ BitcoinAmountField *fee_edit;
signals:
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);
- apply_button = new QPushButton(tr("Apply"));
- apply_button->setEnabled(false);
- buttons->addWidget(apply_button);
-
- layout->addLayout(buttons);
+ QDialogButtonBox *buttonbox = new QDialogButtonBox();
+ buttonbox->setStandardButtons(QDialogButtonBox::Apply|QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
+ apply_button = buttonbox->button(QDialogButtonBox::Apply);
+ layout->addWidget(buttonbox);
setLayout(layout);
setWindowTitle(tr("Options"));
connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApply()));
/* Event bindings */
- connect(ok_button, SIGNAL(clicked()), this, SLOT(okClicked()));
- connect(cancel_button, SIGNAL(clicked()), this, SLOT(cancelClicked()));
- connect(apply_button, SIGNAL(clicked()), this, SLOT(applyClicked()));
+ connect(buttonbox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(okClicked()));
+ connect(buttonbox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(cancelClicked()));
+ connect(buttonbox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(applyClicked()));
}
void OptionsDialog::setModel(OptionsModel *model)
fee_hbox->addSpacing(18);
QLabel *fee_label = new QLabel(tr("Pay transaction &fee"));
fee_hbox->addWidget(fee_label);
- fee_edit = new QLineEdit();
- fee_edit->setMaximumWidth(100);
+ fee_edit = new BitcoinAmountField();
fee_edit->setToolTip(tr("Optional transaction fee per KB that helps make sure your transactions are processed quickly. Most transactions are 1KB. Fee 0.01 recommended."));
- GUIUtil::setupAmountWidget(fee_edit, this);
-
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 */
+ layout->addStretch(1); // Extra space at bottom
setLayout(layout);
void MainOptionsPage::setMapper(MonitoredDataMapper *mapper)
{
- /* Map model to widgets */
+ // Map model to widgets
mapper->addMapping(bitcoin_at_startup, OptionsModel::StartAtStartup);
mapper->addMapping(minimize_to_tray, OptionsModel::MinimizeToTray);
mapper->addMapping(map_port_upnp, OptionsModel::MapPortUPnP);