diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-14 21:34:51 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-14 21:34:51 +0200 |
commit | b1ef1b24ced1e8360d1bf62b9fefbc960cdd19be (patch) | |
tree | fd5074693583f71cad326214321dd855e040c104 | |
parent | a790ec5884bdec8eadcfc1f31c6a8c94a0240976 (diff) |
add connection meter
-rw-r--r-- | src/qt/bitcoin.qrc | 5 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 18 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 1 | ||||
-rw-r--r-- | src/qt/res/icons/connect0_16.png | bin | 0 -> 702 bytes | |||
-rw-r--r-- | src/qt/res/icons/connect1_16.png | bin | 0 -> 612 bytes | |||
-rw-r--r-- | src/qt/res/icons/connect2_16.png | bin | 0 -> 623 bytes | |||
-rw-r--r-- | src/qt/res/icons/connect3_16.png | bin | 0 -> 625 bytes | |||
-rw-r--r-- | src/qt/res/icons/connect4_16.png | bin | 0 -> 611 bytes |
8 files changed, 20 insertions, 4 deletions
diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index 80904b341c..8cf6c3252c 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -5,6 +5,11 @@ <file alias="quit">res/icons/quit.png</file> <file alias="send">res/icons/send.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 prefix="/images"> <file alias="about">res/images/about.png</file> diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 23640fe633..96afa41aa9 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -108,12 +108,12 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): // Create status bar statusBar(); - + labelConnections = new QLabel(); labelConnections->setFrameStyle(QFrame::Panel | QFrame::Sunken); - labelConnections->setMinimumWidth(130); + labelConnections->setMinimumWidth(150); labelConnections->setToolTip(tr("Number of connections to other clients")); - + labelBlocks = new QLabel(); labelBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken); labelBlocks->setMinimumWidth(130); @@ -345,7 +345,17 @@ void BitcoinGUI::setAddress(const QString &addr) 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) diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 96452ef18b..e1b3ef1783 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -40,6 +40,7 @@ private: QLineEdit *address; QLabel *labelBalance; QLabel *labelConnections; + QLabel *labelConnectionsIcon; QLabel *labelBlocks; QLabel *labelTransactions; diff --git a/src/qt/res/icons/connect0_16.png b/src/qt/res/icons/connect0_16.png Binary files differnew file mode 100644 index 0000000000..66f3ae4f86 --- /dev/null +++ b/src/qt/res/icons/connect0_16.png diff --git a/src/qt/res/icons/connect1_16.png b/src/qt/res/icons/connect1_16.png Binary files differnew file mode 100644 index 0000000000..76000beee2 --- /dev/null +++ b/src/qt/res/icons/connect1_16.png diff --git a/src/qt/res/icons/connect2_16.png b/src/qt/res/icons/connect2_16.png Binary files differnew file mode 100644 index 0000000000..6d9a37281a --- /dev/null +++ b/src/qt/res/icons/connect2_16.png diff --git a/src/qt/res/icons/connect3_16.png b/src/qt/res/icons/connect3_16.png Binary files differnew file mode 100644 index 0000000000..a211700785 --- /dev/null +++ b/src/qt/res/icons/connect3_16.png diff --git a/src/qt/res/icons/connect4_16.png b/src/qt/res/icons/connect4_16.png Binary files differnew file mode 100644 index 0000000000..e2fe97d496 --- /dev/null +++ b/src/qt/res/icons/connect4_16.png |