Browse Source

minimize amount of text in status bar; show only icons, if the user wants explanation they can view the tooltip

miguelfreitas
Wladimir J. van der Laan 14 years ago
parent
commit
2351a3fc9f
  1. 41
      src/qt/bitcoingui.cpp
  2. 2
      src/qt/bitcoingui.h

41
src/qt/bitcoingui.cpp

@ -108,34 +108,21 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
// Create status bar // Create status bar
statusBar(); 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 // Status bar "Blocks" notification
QFrame *frameBlocks = new QFrame(); QFrame *frameBlocks = new QFrame();
frameBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken); //frameBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken);
frameBlocks->setMinimumWidth(150); frameBlocks->setContentsMargins(0,0,0,0);
frameBlocks->setMaximumWidth(150); frameBlocks->setMinimumWidth(56);
frameBlocks->setMaximumWidth(56);
QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
frameBlocksLayout->setContentsMargins(3,0,3,0); frameBlocksLayout->setContentsMargins(3,0,3,0);
frameBlocksLayout->setSpacing(3); frameBlocksLayout->setSpacing(3);
labelConnectionsIcon = new QLabel();
labelBlocksIcon = new QLabel(); labelBlocksIcon = new QLabel();
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelConnectionsIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelBlocksIcon); frameBlocksLayout->addWidget(labelBlocksIcon);
labelBlocks = new QLabel();
frameBlocksLayout->addWidget(labelBlocks);
frameBlocksLayout->addStretch(); frameBlocksLayout->addStretch();
// Progress bar for blocks download // Progress bar for blocks download
@ -147,7 +134,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
statusBar()->addWidget(progressBarLabel); statusBar()->addWidget(progressBarLabel);
statusBar()->addWidget(progressBar); statusBar()->addWidget(progressBar);
statusBar()->addPermanentWidget(frameConnections);
statusBar()->addPermanentWidget(frameBlocks); statusBar()->addPermanentWidget(frameBlocks);
createTrayIcon(); createTrayIcon();
@ -312,7 +298,7 @@ void BitcoinGUI::setNumConnections(int count)
default: icon = ":/icons/connect_4"; break; default: icon = ":/icons/connect_4"; break;
} }
labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(16,16)); 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) void BitcoinGUI::setNumBlocks(int count)
@ -359,13 +345,16 @@ void BitcoinGUI::setNumBlocks(int count)
} }
// In the label we want to be less specific // In the label we want to be less specific
QString labelText = text;
bool spinning = true; bool spinning = true;
if(secs < 30*60) if(secs < 30*60)
{ {
labelText = "Up to date"; tooltip = tr("Up to date") + QString("\n") + tooltip;
spinning = false; spinning = false;
} }
else
{
tooltip = tr("Catching up...") + QString("\n") + tooltip;
}
tooltip += QString("\n"); tooltip += QString("\n");
tooltip += tr("Last received block was generated %1.").arg(text); tooltip += tr("Last received block was generated %1.").arg(text);
@ -379,10 +368,8 @@ void BitcoinGUI::setNumBlocks(int count)
{ {
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(16,16)); labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(16,16));
} }
labelBlocks->setText(labelText);
labelBlocksIcon->setToolTip(tooltip); labelBlocksIcon->setToolTip(tooltip);
labelBlocks->setToolTip(tooltip);
progressBarLabel->setToolTip(tooltip); progressBarLabel->setToolTip(tooltip);
progressBar->setToolTip(tooltip); progressBar->setToolTip(tooltip);
} }

2
src/qt/bitcoingui.h

@ -54,9 +54,7 @@ private:
AddressBookPage *receiveCoinsPage; AddressBookPage *receiveCoinsPage;
SendCoinsDialog *sendCoinsPage; SendCoinsDialog *sendCoinsPage;
QLabel *labelConnections;
QLabel *labelConnectionsIcon; QLabel *labelConnectionsIcon;
QLabel *labelBlocks;
QLabel *labelBlocksIcon; QLabel *labelBlocksIcon;
QLabel *progressBarLabel; QLabel *progressBarLabel;
QProgressBar *progressBar; QProgressBar *progressBar;

Loading…
Cancel
Save