diff options
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoin.cpp | 10 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 10 | ||||
-rw-r--r-- | src/qt/clientmodel.cpp | 7 | ||||
-rw-r--r-- | src/qt/clientmodel.h | 4 | ||||
-rw-r--r-- | src/qt/coincontroldialog.cpp | 12 | ||||
-rw-r--r-- | src/qt/forms/rpcconsole.ui | 24 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 1 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 2 | ||||
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 57 | ||||
-rw-r--r-- | src/qt/sendcoinsentry.cpp | 7 | ||||
-rw-r--r-- | src/qt/splashscreen.cpp | 7 | ||||
-rw-r--r-- | src/qt/splashscreen.h | 2 |
12 files changed, 81 insertions, 62 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index b74452d4c6..657b42d16a 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -17,6 +17,7 @@ #include "main.h" #include "ui_interface.h" #include "util.h" +#include "wallet.h" #include <stdint.h> @@ -197,9 +198,10 @@ int main(int argc, char *argv[]) // Application identification (must be set before OptionsModel is initialized, // as it is used to locate QSettings) + bool isaTestNet = TestNet() || RegTest(); QApplication::setOrganizationName("Bitcoin"); QApplication::setOrganizationDomain("bitcoin.org"); - if (TestNet()) // Separate UI settings for testnet + if (isaTestNet) // Separate UI settings for testnets QApplication::setApplicationName("Bitcoin-Qt-testnet"); else QApplication::setApplicationName("Bitcoin-Qt"); @@ -230,7 +232,7 @@ int main(int argc, char *argv[]) PaymentServer* paymentServer = new PaymentServer(&app); // User language is set up: pick a data directory - Intro::pickDataDirectory(TestNet()); + Intro::pickDataDirectory(isaTestNet); // Install global event filter that makes sure that long tooltips can be word-wrapped app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app)); @@ -258,7 +260,7 @@ int main(int argc, char *argv[]) return 1; } - SplashScreen splash(QPixmap(), 0); + SplashScreen splash(QPixmap(), 0, isaTestNet); if (GetBoolArg("-splash", true) && !GetBoolArg("-min", false)) { splash.show(); @@ -280,7 +282,7 @@ int main(int argc, char *argv[]) boost::thread_group threadGroup; - BitcoinGUI window(TestNet(), 0); + BitcoinGUI window(isaTestNet, 0); guiref = &window; QTimer* pollShutdownTimer = new QTimer(guiref); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 2c40310de0..6be5a64015 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -215,6 +215,8 @@ void BitcoinGUI::createActions(bool fIsTestnet) historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); + // These showNormalIfMinimized are needed because Send Coins and Receive Coins + // can be triggered from the tray menu, and need to show the GUI to be useful. connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); @@ -331,6 +333,7 @@ void BitcoinGUI::createToolBars() toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); + overviewAction->setChecked(true); } void BitcoinGUI::setClientModel(ClientModel *clientModel) @@ -681,8 +684,11 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK))) buttons = QMessageBox::Ok; - // Ensure we get users attention - showNormalIfMinimized(); + // Ensure we get users attention, but only if main window is visible + // as we don't want to pop up the main window for messages that happen before + // initialization is finished. + if(!(style & CClientUIInterface::NOSHOWGUI)) + showNormalIfMinimized(); QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons, this); int r = mBox.exec(); if (ret != NULL) diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index c64e411bca..f273b9ea46 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -123,9 +123,12 @@ void ClientModel::updateAlert(const QString &hash, int status) emit alertsChanged(getStatusBarWarnings()); } -bool ClientModel::isTestNet() const +QString ClientModel::getNetworkName() const { - return TestNet(); + QString netname(QString::fromStdString(Params().DataDir())); + if(netname.isEmpty()) + netname = "main"; + return netname; } bool ClientModel::inInitialBlockDownload() const diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 05e8412528..ca735f14ce 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -46,8 +46,8 @@ public: double getVerificationProgress() const; QDateTime getLastBlockDate() const; - //! Return true if client connected to testnet - bool isTestNet() const; + //! Return network (main, testnet3, regtest) + QString getNetworkName() const; //! Return true if core is doing initial block download bool inInitialBlockDownload() const; //! Return true if core is importing blocks diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index b4e6aeb1dd..e1a9140f45 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -449,7 +449,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) } } - QString sPriorityLabel = ""; + QString sPriorityLabel = tr("none"); int64_t nAmount = 0; int64_t nPayFee = 0; int64_t nAfterFee = 0; @@ -593,10 +593,10 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change // turn labels "red" - l5->setStyleSheet((nBytes >= 1000) ? "color:red;" : ""); // Bytes >= 1000 - l6->setStyleSheet((!AllowFree(dPriority)) ? "color:red;" : ""); // Priority < "medium" - l7->setStyleSheet((fLowOutput) ? "color:red;" : ""); // Low Output = "yes" - l8->setStyleSheet((nChange > 0 && nChange < CENT) ? "color:red;" : ""); // Change < 0.01BTC + l5->setStyleSheet((nBytes >= 1000) ? "color:red;" : ""); // Bytes >= 1000 + l6->setStyleSheet((dPriority > 0 && !AllowFree(dPriority)) ? "color:red;" : ""); // Priority < "medium" + l7->setStyleSheet((fLowOutput) ? "color:red;" : ""); // Low Output = "yes" + l8->setStyleSheet((nChange > 0 && nChange < CENT) ? "color:red;" : ""); // Change < 0.01BTC // tool tips QString toolTip1 = tr("This label turns red, if the transaction size is greater than 1000 bytes.") + "<br /><br />"; @@ -604,7 +604,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) toolTip1 += tr("Can vary +/- 1 byte per input."); QString toolTip2 = tr("Transactions with higher priority are more likely to get included into a block.") + "<br /><br />"; - toolTip2 += tr("This label turns red, if the priority is smaller than \"medium\"") + "<br /><br />"; + toolTip2 += tr("This label turns red, if the priority is smaller than \"medium\".") + "<br /><br />"; toolTip2 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)); QString toolTip3 = tr("This label turns red, if any recipient receives an amount smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)) + "<br /><br />"; diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index 83e51b275e..69504f3159 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -172,14 +172,14 @@ </widget> </item> <item row="7" column="0"> - <widget class="QLabel" name="label_7"> + <widget class="QLabel" name="label_8"> <property name="text"> - <string>Number of connections</string> + <string>Name</string> </property> </widget> </item> <item row="7" column="1"> - <widget class="QLabel" name="numberOfConnections"> + <widget class="QLabel" name="networkName"> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> @@ -195,19 +195,25 @@ </widget> </item> <item row="8" column="0"> - <widget class="QLabel" name="label_8"> + <widget class="QLabel" name="label_7"> <property name="text"> - <string>On testnet</string> + <string>Number of connections</string> </property> </widget> </item> <item row="8" column="1"> - <widget class="QCheckBox" name="isTestNet"> - <property name="enabled"> - <bool>false</bool> + <widget class="QLabel" name="numberOfConnections"> + <property name="cursor"> + <cursorShape>IBeamCursor</cursorShape> </property> <property name="text"> - <string/> + <string>N/A</string> + </property> + <property name="textFormat"> + <enum>Qt::PlainText</enum> + </property> + <property name="textInteractionFlags"> + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> </property> </widget> </item> diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 15a873d2bd..363f432d62 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -14,6 +14,7 @@ #include "init.h" #include "main.h" #include "net.h" +#include "wallet.h" #include "walletdb.h" #include <QSettings> diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index d43cdc7e5f..a8470572dd 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -284,7 +284,7 @@ void RPCConsole::setClientModel(ClientModel *model) ui->buildDate->setText(model->formatBuildDate()); ui->startupTime->setText(model->formatClientStartupTime()); - ui->isTestNet->setChecked(model->isTestNet()); + ui->networkName->setText(model->getNetworkName()); } } diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 4bf5c3c479..92be835c56 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -546,44 +546,45 @@ void SendCoinsDialog::coinControlChangeChecked(int state) // Coin Control: custom change address changed void SendCoinsDialog::coinControlChangeEdited(const QString& text) { - if (model) + if (model && model->getAddressTableModel()) { - CoinControlDialog::coinControl->destChange = CBitcoinAddress(text.toStdString()).Get(); + // Default to no change address until verified + CoinControlDialog::coinControl->destChange = CNoDestination(); + ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); + + CBitcoinAddress addr = CBitcoinAddress(text.toStdString()); - // label for the change address - ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}"); - if (text.isEmpty()) + if (text.isEmpty()) // Nothing entered + { ui->labelCoinControlChangeLabel->setText(""); - else if (!CBitcoinAddress(text.toStdString()).IsValid()) + } + else if (!addr.IsValid()) // Invalid address { - // invalid change address - CoinControlDialog::coinControl->destChange = CNoDestination(); - ui->lineEditCoinControlChange->setValid(false); - ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Bitcoin address")); } - else + else // Valid address { - QString associatedLabel = model->getAddressTableModel()->labelForAddress(text); - if (!associatedLabel.isEmpty()) - ui->labelCoinControlChangeLabel->setText(associatedLabel); - else + CPubKey pubkey; + CKeyID keyid; + addr.GetKeyID(keyid); + if (!model->getPubKey(keyid, pubkey)) // Unknown change address { - CPubKey pubkey; - CKeyID keyid; - CBitcoinAddress(text.toStdString()).GetKeyID(keyid); - if (model->getPubKey(keyid, pubkey)) - ui->labelCoinControlChangeLabel->setText(tr("(no label)")); + ui->lineEditCoinControlChange->setValid(false); + ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address")); + } + else // Known change address + { + ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}"); + + // Query label + QString associatedLabel = model->getAddressTableModel()->labelForAddress(text); + if (!associatedLabel.isEmpty()) + ui->labelCoinControlChangeLabel->setText(associatedLabel); else - { - // unknown change address - CoinControlDialog::coinControl->destChange = CNoDestination(); - - ui->lineEditCoinControlChange->setValid(false); - ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); - ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address")); - } + ui->labelCoinControlChangeLabel->setText(tr("(no label)")); + + CoinControlDialog::coinControl->destChange = addr.Get(); } } } diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 4d28f68861..3f5d0cda3a 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -155,11 +155,12 @@ SendCoinsRecipient SendCoinsEntry::getValue() QWidget *SendCoinsEntry::setupTabChain(QWidget *prev) { QWidget::setTabOrder(prev, ui->payTo); - QWidget::setTabOrder(ui->payTo, ui->addressBookButton); + QWidget::setTabOrder(ui->payTo, ui->addAsLabel); + QWidget *w = ui->payAmount->setupTabChain(ui->addAsLabel); + QWidget::setTabOrder(w, ui->addressBookButton); QWidget::setTabOrder(ui->addressBookButton, ui->pasteButton); QWidget::setTabOrder(ui->pasteButton, ui->deleteButton); - QWidget::setTabOrder(ui->deleteButton, ui->addAsLabel); - return ui->payAmount->setupTabChain(ui->addAsLabel); + return ui->deleteButton; } void SendCoinsEntry::setValue(const SendCoinsRecipient &value) diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 4528c3477c..6fb834c045 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -4,14 +4,13 @@ #include "splashscreen.h" -#include "chainparams.h" #include "clientversion.h" #include "util.h" #include <QApplication> #include <QPainter> -SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) : +SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet) : QSplashScreen(pixmap, f) { // set reference point, paddings @@ -32,7 +31,7 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) : // load the bitmap for writing some text over it QPixmap newPixmap; - if(TestNet()) { + if(isTestNet) { newPixmap = QPixmap(":/images/splash_testnet"); } else { @@ -72,7 +71,7 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) : pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText); // draw testnet string if testnet is on - if(TestNet()) { + if(isTestNet) { QFont boldFont = QFont(font, 10*fontFactor); boldFont.setWeight(QFont::Bold); pixPaint.setFont(boldFont); diff --git a/src/qt/splashscreen.h b/src/qt/splashscreen.h index ddf040593d..070e376c95 100644 --- a/src/qt/splashscreen.h +++ b/src/qt/splashscreen.h @@ -14,7 +14,7 @@ class SplashScreen : public QSplashScreen Q_OBJECT public: - explicit SplashScreen(const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = 0); + explicit SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet); }; #endif // SPLASHSCREEN_H |