aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoin.cpp13
-rw-r--r--src/qt/bitcoingui.cpp76
-rw-r--r--src/qt/bitcoingui.h6
3 files changed, 47 insertions, 48 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index b858e1c174..9bcac59798 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -15,9 +15,6 @@
#include "ui_interface.h"
#include "paymentserver.h"
#include "splashscreen.h"
-#ifdef Q_OS_MAC
-#include "macdockiconhandler.h"
-#endif
#include <QMessageBox>
#if QT_VERSION < 0x050000
@@ -205,14 +202,6 @@ int main(int argc, char *argv[])
return 1;
}
-#ifdef Q_OS_MAC
- // on mac, also change the icon now because it would look strange to have a testnet splash (green) and a std app icon (orange)
- if(GetBoolArg("-testnet", false))
- {
- MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
- }
-#endif
-
SplashScreen splash(QPixmap(), 0);
if (GetBoolArg("-splash", true) && !GetBoolArg("-min", false))
{
@@ -232,7 +221,7 @@ int main(int argc, char *argv[])
boost::thread_group threadGroup;
- BitcoinGUI window;
+ BitcoinGUI window(GetBoolArg("-testnet", false), 0);
guiref = &window;
QTimer* pollShutdownTimer = new QTimer(guiref);
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index a4589860bf..190da6caf8 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -57,7 +57,7 @@
const QString BitcoinGUI::DEFAULT_WALLET = "~Default";
-BitcoinGUI::BitcoinGUI(QWidget *parent) :
+BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
QMainWindow(parent),
clientModel(0),
encryptWalletAction(0),
@@ -69,14 +69,30 @@ BitcoinGUI::BitcoinGUI(QWidget *parent) :
prevBlocks(0)
{
restoreWindowGeometry();
- setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet"));
+
#ifndef Q_OS_MAC
- QApplication::setWindowIcon(QIcon(":icons/bitcoin"));
- setWindowIcon(QIcon(":icons/bitcoin"));
+ if (!fIsTestnet)
+ {
+ setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet"));
+ QApplication::setWindowIcon(QIcon(":icons/bitcoin"));
+ setWindowIcon(QIcon(":icons/bitcoin"));
+ }
+ else
+ {
+ setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet") + " " + tr("[testnet]"));
+ QApplication::setWindowIcon(QIcon(":icons/bitcoin_testnet"));
+ setWindowIcon(QIcon(":icons/bitcoin_testnet"));
+ }
#else
setUnifiedTitleAndToolBarOnMac(true);
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
+
+ if (!fIsTestnet)
+ MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin"));
+ else
+ MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
#endif
+
// Create wallet frame and make it the central widget
walletFrame = new WalletFrame(this);
setCentralWidget(walletFrame);
@@ -86,7 +102,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent) :
// Create actions for the toolbar, menu bar and tray/dock icon
// Needs walletFrame to be initialized
- createActions();
+ createActions(fIsTestnet);
// Create application menu bar
createMenuBar();
@@ -95,7 +111,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent) :
createToolBars();
// Create system tray icon and notification
- createTrayIcon();
+ createTrayIcon(fIsTestnet);
// Create status bar
statusBar();
@@ -159,7 +175,7 @@ BitcoinGUI::~BitcoinGUI()
#endif
}
-void BitcoinGUI::createActions()
+void BitcoinGUI::createActions(bool fIsTestnet)
{
QActionGroup *tabGroup = new QActionGroup(this);
@@ -213,7 +229,10 @@ void BitcoinGUI::createActions()
quitAction->setStatusTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
- aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About Bitcoin"), this);
+ if (!fIsTestnet)
+ aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About Bitcoin"), this);
+ else
+ aboutAction = new QAction(QIcon(":/icons/bitcoin_testnet"), tr("&About Bitcoin"), this);
aboutAction->setStatusTip(tr("Show information about Bitcoin"));
aboutAction->setMenuRole(QAction::AboutRole);
aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this);
@@ -222,7 +241,10 @@ void BitcoinGUI::createActions()
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setStatusTip(tr("Modify configuration options for Bitcoin"));
optionsAction->setMenuRole(QAction::PreferencesRole);
- toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this);
+ if (!fIsTestnet)
+ toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this);
+ else
+ toggleHideAction = new QAction(QIcon(":/icons/bitcoin_testnet"), tr("&Show / Hide"), this);
toggleHideAction->setStatusTip(tr("Show or hide the main Window"));
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
@@ -299,27 +321,6 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
this->clientModel = clientModel;
if(clientModel)
{
- // Replace some strings and icons, when using the testnet
- if(clientModel->isTestNet())
- {
- setWindowTitle(windowTitle() + QString(" ") + tr("[testnet]"));
-#ifndef Q_OS_MAC
- QApplication::setWindowIcon(QIcon(":icons/bitcoin_testnet"));
- setWindowIcon(QIcon(":icons/bitcoin_testnet"));
-#else
- MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
-#endif
- if(trayIcon)
- {
- // Just attach " [testnet]" to the existing tooltip
- trayIcon->setToolTip(trayIcon->toolTip() + QString(" ") + tr("[testnet]"));
- trayIcon->setIcon(QIcon(":/icons/toolbar_testnet"));
- }
-
- toggleHideAction->setIcon(QIcon(":/icons/toolbar_testnet"));
- aboutAction->setIcon(QIcon(":/icons/toolbar_testnet"));
- }
-
// Create system tray menu (or setup the dock menu) that late to prevent users from calling actions,
// while the client has not yet fully loaded
createTrayIconMenu();
@@ -354,13 +355,22 @@ void BitcoinGUI::removeAllWallets()
walletFrame->removeAllWallets();
}
-void BitcoinGUI::createTrayIcon()
+void BitcoinGUI::createTrayIcon(bool fIsTestnet)
{
#ifndef Q_OS_MAC
trayIcon = new QSystemTrayIcon(this);
- trayIcon->setToolTip(tr("Bitcoin client"));
- trayIcon->setIcon(QIcon(":/icons/toolbar"));
+ if (!fIsTestnet)
+ {
+ trayIcon->setToolTip(tr("Bitcoin client"));
+ trayIcon->setIcon(QIcon(":/icons/toolbar"));
+ }
+ else
+ {
+ trayIcon->setToolTip(tr("Bitcoin client") + " " + tr("[testnet]"));
+ trayIcon->setIcon(QIcon(":/icons/toolbar_testnet"));
+ }
+
trayIcon->show();
#endif
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index f361a62a41..685ce8b430 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -43,7 +43,7 @@ class BitcoinGUI : public QMainWindow
public:
static const QString DEFAULT_WALLET;
- explicit BitcoinGUI(QWidget *parent = 0);
+ explicit BitcoinGUI(bool fIsTestnet = false, QWidget *parent = 0);
~BitcoinGUI();
/** Set the client model.
@@ -113,13 +113,13 @@ private:
int prevBlocks;
/** Create the main UI actions. */
- void createActions();
+ void createActions(bool fIsTestnet);
/** Create the menu bar and sub-menus. */
void createMenuBar();
/** Create the toolbars */
void createToolBars();
/** Create system tray icon and notification */
- void createTrayIcon();
+ void createTrayIcon(bool fIsTestnet);
/** Create system tray menu (or setup the dock menu) */
void createTrayIconMenu();
/** Save window size and position */