From afee36d379868f81705c960e389aa90d6f546940 Mon Sep 17 00:00:00 2001 From: Roman Mindalev Date: Sat, 23 Mar 2013 08:20:51 +0400 Subject: [PATCH 1/3] Fix transaction fee in uBTC Step for buttons 'up' and 'down' - 0.001. With BTC and mBTC all ok, but 0.001 uBTC is lower than minimal value (satoshi) User should press 10 times on 'up' button to get 0.01 uBTC --- src/qt/bitcoinamountfield.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index ddf185c41..4fa2ca508 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -145,6 +145,11 @@ void BitcoinAmountField::unitChanged(int idx) amount->setDecimals(BitcoinUnits::decimals(currentUnit)); amount->setMaximum(qPow(10, BitcoinUnits::amountDigits(currentUnit)) - qPow(10, -amount->decimals())); + if(currentUnit == BitcoinUnits::uBTC) + amount->setSingleStep(0.01); + else + amount->setSingleStep(0.001); + if(valid) { // If value was valid, re-place it in the widget with the new unit From e11f1806b6d722e2ae016bba053ac0c91616d800 Mon Sep 17 00:00:00 2001 From: Roman Mindalev Date: Thu, 21 Mar 2013 00:03:21 +0400 Subject: [PATCH 2/3] Save & restore window size and position --- src/qt/bitcoingui.cpp | 20 +++++++++++++++++++- src/qt/bitcoingui.h | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4f97a4815..89ce7d4a8 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include @@ -69,7 +70,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): rpcConsole(0), prevBlocks(0) { - resize(850, 550); + restoreWindowGeometry(); setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet")); #ifndef Q_OS_MAC qApp->setWindowIcon(QIcon(":icons/bitcoin")); @@ -185,6 +186,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): BitcoinGUI::~BitcoinGUI() { + saveWindowGeometry(); if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu) trayIcon->hide(); #ifdef Q_OS_MAC @@ -466,6 +468,22 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason) } #endif +void BitcoinGUI::saveWindowGeometry() +{ + QSettings settings; + settings.setValue("nWindowPos", pos()); + settings.setValue("nWindowSize", size()); +} + +void BitcoinGUI::restoreWindowGeometry() +{ + QSettings settings; + QPoint pos = settings.value("nWindowPos").toPoint(); + QSize size = settings.value("nWindowSize", QSize(850, 550)).toSize(); + resize(size); + move(pos); +} + void BitcoinGUI::optionsClicked() { if(!clientModel || !clientModel->getOptionsModel()) diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index b992bfdc6..77aa7ec99 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -108,6 +108,10 @@ private: void createTrayIcon(); /** Create system tray menu (or setup the dock menu) */ void createTrayIconMenu(); + /** Save window size and position */ + void saveWindowGeometry(); + /** Restore window size and position */ + void restoreWindowGeometry(); public slots: /** Set number of connections shown in the UI */ From f688056f9d4958b50911933496bf1fa2e602d396 Mon Sep 17 00:00:00 2001 From: Roman Mindalev Date: Thu, 21 Mar 2013 00:05:50 +0400 Subject: [PATCH 3/3] Show window in center of screen on first launch --- src/qt/bitcoingui.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 89ce7d4a8..8bbea6901 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include @@ -480,6 +481,12 @@ void BitcoinGUI::restoreWindowGeometry() QSettings settings; QPoint pos = settings.value("nWindowPos").toPoint(); QSize size = settings.value("nWindowSize", QSize(850, 550)).toSize(); + if (!pos.x() && !pos.y()) + { + QRect screen = qApp->desktop()->screenGeometry(); + pos.setX((screen.width()-size.width())/2); + pos.setY((screen.height()-size.height())/2); + } resize(size); move(pos); }