X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fbitcoingui.cpp;h=3e0a12b9cf14cb6a0fd97f2fb922faad0ae18238;hb=2bc4fd609ca00d5a5cb0b6b3eba5f35cb334b967;hp=1c496833648802e841aa60c01b1bcdeea82912d3;hpb=fc90967876a0b8c762cba4a9f40a80db7a8b0432;p=novacoin.git diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 1c49683..3e0a12b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -8,6 +8,7 @@ #include "transactiontablemodel.h" #include "addressbookpage.h" #include "sendcoinsdialog.h" +#include "messagepage.h" #include "optionsdialog.h" #include "aboutdialog.h" #include "clientmodel.h" @@ -99,12 +100,17 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): sendCoinsPage = new SendCoinsDialog(this); + messagePage = new MessagePage(this); + centralWidget = new QStackedWidget(this); centralWidget->addWidget(overviewPage); centralWidget->addWidget(transactionsPage); centralWidget->addWidget(addressBookPage); centralWidget->addWidget(receiveCoinsPage); centralWidget->addWidget(sendCoinsPage); +#ifdef FIRST_CLASS_MESSAGING + centralWidget->addWidget(messagePage); +#endif setCentralWidget(centralWidget); // Create status bar @@ -112,7 +118,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): // Status bar notification icons QFrame *frameBlocks = new QFrame(); - //frameBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken); frameBlocks->setContentsMargins(0,0,0,0); frameBlocks->setMinimumWidth(56); frameBlocks->setMaximumWidth(56); @@ -193,6 +198,13 @@ void BitcoinGUI::createActions() sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); + messageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message"), this); + messageAction->setToolTip(tr("Prove you control an address")); +#ifdef FIRST_CLASS_MESSAGING + messageAction->setCheckable(true); +#endif + tabGroup->addAction(messageAction); + connect(overviewAction, SIGNAL(triggered()), this, SLOT(show())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(show())); @@ -203,6 +215,8 @@ void BitcoinGUI::createActions() connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(show())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); + connect(messageAction, SIGNAL(triggered()), this, SLOT(show())); + connect(messageAction, SIGNAL(triggered()), this, SLOT(gotoMessagePage())); quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setToolTip(tr("Quit application")); @@ -248,6 +262,10 @@ void BitcoinGUI::createMenuBar() // Configure the menus QMenu *file = appMenuBar->addMenu(tr("&File")); +#ifndef FIRST_CLASS_MESSAGING + file->addAction(messageAction); + file->addSeparator(); +#endif file->addAction(quitAction); QMenu *settings = appMenuBar->addMenu(tr("&Settings")); @@ -270,6 +288,9 @@ void BitcoinGUI::createToolBars() toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); +#ifdef FIRST_CLASS_MESSAGING + toolbar->addAction(messageAction); +#endif QToolBar *toolbar2 = addToolBar(tr("Actions toolbar")); toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); @@ -324,6 +345,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel) addressBookPage->setModel(walletModel->getAddressTableModel()); receiveCoinsPage->setModel(walletModel->getAddressTableModel()); sendCoinsPage->setModel(walletModel); + messagePage->setModel(walletModel); setEncryptionStatus(walletModel->getEncryptionStatus()); connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int))); @@ -359,6 +381,10 @@ void BitcoinGUI::createTrayIcon() // Configuration of the tray icon (or dock icon) icon menu trayIconMenu->addAction(openBitcoinAction); trayIconMenu->addSeparator(); + trayIconMenu->addAction(messageAction); +#ifndef FIRST_CLASS_MESSAGING + trayIconMenu->addSeparator(); +#endif trayIconMenu->addAction(receiveCoinsAction); trayIconMenu->addAction(sendCoinsAction); trayIconMenu->addSeparator(); @@ -418,7 +444,6 @@ void BitcoinGUI::setNumBlocks(int count) { if(!clientModel) return; - int initTotal = clientModel->getNumBlocksAtStartup(); int total = clientModel->getNumBlocksOfPeers(); QString tooltip; @@ -429,8 +454,8 @@ void BitcoinGUI::setNumBlocks(int count) 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 { @@ -650,6 +675,26 @@ void BitcoinGUI::gotoSendCoinsPage() disconnect(exportAction, SIGNAL(triggered()), 0, 0); } +void BitcoinGUI::gotoMessagePage() +{ +#ifdef FIRST_CLASS_MESSAGING + messageAction->setChecked(true); + centralWidget->setCurrentWidget(messagePage); + + exportAction->setEnabled(false); + disconnect(exportAction, SIGNAL(triggered()), 0, 0); +#else + messagePage->show(); + messagePage->setFocus(); +#endif +} + +void BitcoinGUI::gotoMessagePage(QString addr) +{ + gotoMessagePage(); + messagePage->setAddress(addr); +} + void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event) { // Accept only URLs @@ -672,6 +717,13 @@ void BitcoinGUI::dropEvent(QDropEvent *event) event->acceptProposedAction(); } +void BitcoinGUI::handleURL(QString strURL) +{ + gotoSendCoinsPage(); + QUrl url = QUrl(strURL); + sendCoinsPage->handleURL(&url); +} + void BitcoinGUI::setEncryptionStatus(int status) { switch(status)