Browse Source

add connection meter

miguelfreitas
Wladimir J. van der Laan 14 years ago
parent
commit
b1ef1b24ce
  1. 5
      src/qt/bitcoin.qrc
  2. 18
      src/qt/bitcoingui.cpp
  3. 1
      src/qt/bitcoingui.h
  4. BIN
      src/qt/res/icons/connect0_16.png
  5. BIN
      src/qt/res/icons/connect1_16.png
  6. BIN
      src/qt/res/icons/connect2_16.png
  7. BIN
      src/qt/res/icons/connect3_16.png
  8. BIN
      src/qt/res/icons/connect4_16.png

5
src/qt/bitcoin.qrc

@ -5,6 +5,11 @@
<file alias="quit">res/icons/quit.png</file> <file alias="quit">res/icons/quit.png</file>
<file alias="send">res/icons/send.png</file> <file alias="send">res/icons/send.png</file>
<file alias="toolbar">res/icons/toolbar.png</file> <file alias="toolbar">res/icons/toolbar.png</file>
<file alias="connect0">res/icons/connect0_16.png</file>
<file alias="connect1">res/icons/connect1_16.png</file>
<file alias="connect2">res/icons/connect2_16.png</file>
<file alias="connect3">res/icons/connect3_16.png</file>
<file alias="connect4">res/icons/connect4_16.png</file>
</qresource> </qresource>
<qresource prefix="/images"> <qresource prefix="/images">
<file alias="about">res/images/about.png</file> <file alias="about">res/images/about.png</file>

18
src/qt/bitcoingui.cpp

@ -108,12 +108,12 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
// Create status bar // Create status bar
statusBar(); statusBar();
labelConnections = new QLabel(); labelConnections = new QLabel();
labelConnections->setFrameStyle(QFrame::Panel | QFrame::Sunken); labelConnections->setFrameStyle(QFrame::Panel | QFrame::Sunken);
labelConnections->setMinimumWidth(130); labelConnections->setMinimumWidth(150);
labelConnections->setToolTip(tr("Number of connections to other clients")); labelConnections->setToolTip(tr("Number of connections to other clients"));
labelBlocks = new QLabel(); labelBlocks = new QLabel();
labelBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken); labelBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken);
labelBlocks->setMinimumWidth(130); labelBlocks->setMinimumWidth(130);
@ -345,7 +345,17 @@ void BitcoinGUI::setAddress(const QString &addr)
void BitcoinGUI::setNumConnections(int count) void BitcoinGUI::setNumConnections(int count)
{ {
labelConnections->setText(QLocale::system().toString(count)+" "+tr("connections(s)", "", count)); QString icon;
switch(count)
{
case 0: icon = ":/icons/connect0"; break;
case 1: icon = ":/icons/connect1"; break;
case 2: icon = ":/icons/connect2"; break;
case 3: icon = ":/icons/connect3"; break;
default: icon = ":/icons/connect4"; break;
}
labelConnections->setTextFormat(Qt::RichText);
labelConnections->setText("<img src=\""+icon+"\"> " + QLocale::system().toString(count)+" "+tr("connection(s)", "", count));
} }
void BitcoinGUI::setNumBlocks(int count) void BitcoinGUI::setNumBlocks(int count)

1
src/qt/bitcoingui.h

@ -40,6 +40,7 @@ private:
QLineEdit *address; QLineEdit *address;
QLabel *labelBalance; QLabel *labelBalance;
QLabel *labelConnections; QLabel *labelConnections;
QLabel *labelConnectionsIcon;
QLabel *labelBlocks; QLabel *labelBlocks;
QLabel *labelTransactions; QLabel *labelTransactions;

BIN
src/qt/res/icons/connect0_16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

BIN
src/qt/res/icons/connect1_16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

BIN
src/qt/res/icons/connect2_16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

BIN
src/qt/res/icons/connect3_16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

BIN
src/qt/res/icons/connect4_16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Loading…
Cancel
Save