QMainWindow(parent),
clientModel(0),
walletModel(0),
+ dummyWidget(0),
encryptWalletAction(0),
changePassphraseAction(0),
+ aboutQtAction(0),
trayIcon(0),
notificator(0)
{
// Create the tray icon (or setup the dock icon)
createTrayIcon();
+ // Dummy widget used when restoring window state after minimization
+ dummyWidget = new QWidget();
+
// Create tabs
overviewPage = new OverviewPage();
#ifdef Q_WS_MAC
delete appMenuBar;
#endif
+ delete dummyWidget;
}
void BitcoinGUI::createActions()
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
+ connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
+ connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
+ connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
+ connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
+ connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setMenuRole(QAction::QuitRole);
aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About %1").arg(qApp->applicationName()), this);
aboutAction->setToolTip(tr("Show information about Bitcoin"));
- aboutAction->setMenuRole(QAction::AboutQtRole);
+ aboutAction->setMenuRole(QAction::AboutRole);
+ aboutQtAction = new QAction(tr("About &Qt"), this);
+ aboutQtAction->setToolTip(tr("Show information about Qt"));
+ aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setToolTip(tr("Modify configuration options for bitcoin"));
optionsAction->setMenuRole(QAction::PreferencesRole);
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
+ connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(openBitcoinAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
QMenu *help = appMenuBar->addMenu(tr("&Help"));
help->addAction(aboutAction);
+ help->addAction(aboutQtAction);
}
void BitcoinGUI::createToolBars()
// Click on system tray icon triggers "open bitcoin"
openBitcoinAction->trigger();
}
-
}
#endif
+void BitcoinGUI::showNormal()
+{
+ // Reparent window to the desktop (in case it was hidden on minimize)
+ if(parent() != NULL)
+ setParent(NULL, Qt::Window);
+ QMainWindow::showNormal();
+}
+
void BitcoinGUI::optionsClicked()
{
if(!clientModel || !clientModel->getOptionsModel())
{
if(!clientModel)
return;
- int initTotal = clientModel->getNumBlocksAtStartup();
int total = clientModel->getNumBlocksOfPeers();
QString tooltip;
progressBarLabel->setVisible(true);
progressBarLabel->setText(tr("Synchronizing with network..."));
progressBar->setVisible(true);
- progressBar->setMaximum(total - initTotal);
- progressBar->setValue(count - initTotal);
+ progressBar->setMaximum(total);
+ progressBar->setValue(count);
}
else
{
{
if(isMinimized())
{
- hide();
- e->ignore();
+ // Hiding the window from taskbar
+ setParent(dummyWidget, Qt::SubWindow);
+ return;
}
else
{
- show();
- e->accept();
+ showNormal();
}
}
}
void BitcoinGUI::gotoOverviewPage()
{
- show();
overviewAction->setChecked(true);
centralWidget->setCurrentWidget(overviewPage);
void BitcoinGUI::gotoHistoryPage()
{
- show();
historyAction->setChecked(true);
centralWidget->setCurrentWidget(transactionsPage);
void BitcoinGUI::gotoAddressBookPage()
{
- show();
addressBookAction->setChecked(true);
centralWidget->setCurrentWidget(addressBookPage);
void BitcoinGUI::gotoReceiveCoinsPage()
{
- show();
receiveCoinsAction->setChecked(true);
centralWidget->setCurrentWidget(receiveCoinsPage);
void BitcoinGUI::gotoSendCoinsPage()
{
- show();
sendCoinsAction->setChecked(true);
centralWidget->setCurrentWidget(sendCoinsPage);