Merge pull request #1314 from Diapolo/Wallet_Transaction_state_Overviewpage

GUI: add 2 labels to the overviewpage that display Wallet and Transaction status
This commit is contained in:
Wladimir J. van der Laan 2012-05-17 14:13:23 -07:00
commit f0fc95a143
4 changed files with 98 additions and 46 deletions

View File

@ -574,12 +574,16 @@ void BitcoinGUI::setNumBlocks(int count)
{ {
tooltip = tr("Up to date") + QString(".<br>") + tooltip; tooltip = tr("Up to date") + QString(".<br>") + tooltip;
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
overviewPage->showOutOfSyncWarning(false);
} }
else else
{ {
tooltip = tr("Catching up...") + QString("<br>") + tooltip; tooltip = tr("Catching up...") + QString("<br>") + tooltip;
labelBlocksIcon->setMovie(syncIconMovie); labelBlocksIcon->setMovie(syncIconMovie);
syncIconMovie->start(); syncIconMovie->start();
overviewPage->showOutOfSyncWarning(true);
} }
if(!text.isEmpty()) if(!text.isEmpty())

View File

@ -34,14 +34,44 @@
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>12</number> <number>12</number>
</property> </property>
<item row="2" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Wallet</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelWalletStatus">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="toolTip">
<string>The displayed information may be out of date. Your wallet automatically synchronizes with the Bitcoin network after a connection is established, but this process has not completed yet.</string>
</property>
<property name="text">
<string notr="true">(out of sync)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Balance:</string> <string>Balance:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="1" column="1">
<widget class="QLabel" name="labelBalance"> <widget class="QLabel" name="labelBalance">
<property name="font"> <property name="font">
<font> <font>
@ -63,31 +93,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Number of transactions:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="labelNumTransactions">
<property name="toolTip">
<string>Total number of transactions in wallet</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Unconfirmed:</string> <string>Unconfirmed:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="2" column="1">
<widget class="QLabel" name="labelUnconfirmed"> <widget class="QLabel" name="labelUnconfirmed">
<property name="font"> <property name="font">
<font> <font>
@ -109,17 +122,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_2">
<property name="font"> <property name="text">
<font> <string>Number of transactions:</string>
<pointsize>11</pointsize> </property>
<weight>75</weight> </widget>
<bold>true</bold> </item>
</font> <item row="3" column="1">
<widget class="QLabel" name="labelNumTransactions">
<property name="toolTip">
<string>Total number of transactions in wallet</string>
</property> </property>
<property name="text"> <property name="text">
<string>Wallet</string> <string notr="true">0</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -151,36 +167,52 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QFormLayout" name="formLayout">
<item> <item row="0" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>&lt;b&gt;Recent transactions&lt;/b&gt;</string> <string>&lt;b&gt;Recent transactions&lt;/b&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="QListView" name="listTransactions"> <widget class="QLabel" name="labelTransactionsStatus">
<property name="styleSheet"> <property name="font">
<string notr="true">QListView { background:transparent }</string> <font>
<weight>75</weight>
<bold>true</bold>
</font>
</property> </property>
<property name="frameShape"> <property name="toolTip">
<enum>QFrame::NoFrame</enum> <string>The displayed information may be out of date. Your wallet automatically synchronizes with the Bitcoin network after a connection is established, but this process has not completed yet.</string>
</property> </property>
<property name="verticalScrollBarPolicy"> <property name="text">
<enum>Qt::ScrollBarAlwaysOff</enum> <string notr="true">(out of sync)</string>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QListView" name="listTransactions">
<property name="styleSheet">
<string notr="true">QListView { background: transparent; }</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">

View File

@ -105,6 +105,15 @@ OverviewPage::OverviewPage(QWidget *parent) :
ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false); ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false);
connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex))); connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex)));
// init "out of sync" warning labels
ui->labelWalletStatus->setText("(" + tr("out of sync") + ")");
ui->labelWalletStatus->setStyleSheet("QLabel { color: red; }");
ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")");
ui->labelTransactionsStatus->setStyleSheet("QLabel { color: red; }");
// start with displaying the "out of sync" warnings
showOutOfSyncWarning(true);
} }
void OverviewPage::handleTransactionClicked(const QModelIndex &index) void OverviewPage::handleTransactionClicked(const QModelIndex &index)
@ -169,3 +178,9 @@ void OverviewPage::displayUnitChanged()
txdelegate->unit = model->getOptionsModel()->getDisplayUnit(); txdelegate->unit = model->getOptionsModel()->getDisplayUnit();
ui->listTransactions->update(); ui->listTransactions->update();
} }
void OverviewPage::showOutOfSyncWarning(bool fShow)
{
ui->labelWalletStatus->setVisible(fShow);
ui->labelTransactionsStatus->setVisible(fShow);
}

View File

@ -24,6 +24,7 @@ public:
~OverviewPage(); ~OverviewPage();
void setModel(WalletModel *model); void setModel(WalletModel *model);
void showOutOfSyncWarning(bool fShow);
public slots: public slots:
void setBalance(qint64 balance, qint64 unconfirmedBalance); void setBalance(qint64 balance, qint64 unconfirmedBalance);