minimize amount of text in status bar; show only icons, if the user wants explanation...
[novacoin.git] / src / qt / bitcoingui.cpp
index bd80e42..c9feca5 100644 (file)
@@ -85,7 +85,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
     QVBoxLayout *vbox = new QVBoxLayout();
 
     transactionView = new TransactionView(this);
-    connect(transactionView, SIGNAL(doubleClicked(const QModelIndex&)), transactionView, SLOT(showDetails()));
+    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
     vbox->addWidget(transactionView);
 
     transactionsPage = new QWidget(this);
@@ -108,34 +108,21 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
     // Create status bar
     statusBar();
 
-    // Status bar "Connections" notification
-    QFrame *frameConnections = new QFrame();
-    frameConnections->setFrameStyle(QFrame::Panel | QFrame::Sunken);
-    frameConnections->setMinimumWidth(150);
-    frameConnections->setMaximumWidth(150);
-    QHBoxLayout *frameConnectionsLayout = new QHBoxLayout(frameConnections);
-    frameConnectionsLayout->setContentsMargins(3,0,3,0);
-    frameConnectionsLayout->setSpacing(3);
-    labelConnectionsIcon = new QLabel();
-    labelConnectionsIcon->setToolTip(tr("Number of connections to other clients"));
-    frameConnectionsLayout->addWidget(labelConnectionsIcon);
-    labelConnections = new QLabel();
-    labelConnections->setToolTip(tr("Number of connections to other clients"));
-    frameConnectionsLayout->addWidget(labelConnections);
-    frameConnectionsLayout->addStretch();
-
     // Status bar "Blocks" notification
     QFrame *frameBlocks = new QFrame();
-    frameBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken);
-    frameBlocks->setMinimumWidth(150);
-    frameBlocks->setMaximumWidth(150);
+    //frameBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+    frameBlocks->setContentsMargins(0,0,0,0);
+    frameBlocks->setMinimumWidth(56);
+    frameBlocks->setMaximumWidth(56);
     QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
     frameBlocksLayout->setContentsMargins(3,0,3,0);
     frameBlocksLayout->setSpacing(3);
+    labelConnectionsIcon = new QLabel();
     labelBlocksIcon = new QLabel();
+    frameBlocksLayout->addStretch();
+    frameBlocksLayout->addWidget(labelConnectionsIcon);
+    frameBlocksLayout->addStretch();
     frameBlocksLayout->addWidget(labelBlocksIcon);
-    labelBlocks = new QLabel();
-    frameBlocksLayout->addWidget(labelBlocks);
     frameBlocksLayout->addStretch();
 
     // Progress bar for blocks download
@@ -147,14 +134,16 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
 
     statusBar()->addWidget(progressBarLabel);
     statusBar()->addWidget(progressBar);
-    statusBar()->addPermanentWidget(frameConnections);
     statusBar()->addPermanentWidget(frameBlocks);
 
     createTrayIcon();
 
     syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
 
-    gotoOverviewPage();
+    // Clicking on a transaction simply sends you to transaction history page
+    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
+
+    gotoOverviewPage();    
 }
 
 void BitcoinGUI::createActions()
@@ -252,8 +241,8 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
     sendCoinsPage->setModel(walletModel);
 
     // Balloon popup for new transaction
-    connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
-            this, SLOT(incomingTransaction(const QModelIndex &, int, int)));
+    connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
+            this, SLOT(incomingTransaction(QModelIndex,int,int)));
 }
 
 void BitcoinGUI::createTrayIcon()
@@ -309,7 +298,7 @@ void BitcoinGUI::setNumConnections(int count)
     default: icon = ":/icons/connect_4"; break;
     }
     labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(16,16));
-    labelConnections->setText(tr("%n connection(s)", "", count));
+    labelConnectionsIcon->setToolTip(tr("%n active connections to Bitcoin network", "", count));
 }
 
 void BitcoinGUI::setNumBlocks(int count)
@@ -356,13 +345,16 @@ void BitcoinGUI::setNumBlocks(int count)
     }
 
     // In the label we want to be less specific
-    QString labelText = text;
     bool spinning = true;
     if(secs < 30*60)
     {
-        labelText = "Up to date";
+        tooltip = tr("Up to date") + QString("\n") + tooltip;
         spinning = false;
     }
+    else
+    {
+        tooltip = tr("Catching up...") + QString("\n") + tooltip;
+    }
 
     tooltip += QString("\n");
     tooltip += tr("Last received block was generated %1.").arg(text);
@@ -376,10 +368,8 @@ void BitcoinGUI::setNumBlocks(int count)
     {
         labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(16,16));
     }
-    labelBlocks->setText(labelText);
 
     labelBlocksIcon->setToolTip(tooltip);
-    labelBlocks->setToolTip(tooltip);
     progressBarLabel->setToolTip(tooltip);
     progressBar->setToolTip(tooltip);
 }
@@ -463,7 +453,7 @@ void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int
         trayIcon->showMessage((amount)<0 ? tr("Sent transaction") :
                                            tr("Incoming transaction"),
                               tr("Date: ") + date + "\n" +
-                              tr("Amount: ") + BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, amount, true) + "\n" +
+                              tr("Amount: ") + BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), amount, true) + "\n" +
                               tr("Type: ") + type + "\n" +
                               tr("Address: ") + address + "\n",
                               QSystemTrayIcon::Information);