Browse Source

Show warning when using prerelease version

Implements #1948

- Add macro `CLIENT_VERSION_IS_RELEASE` to clientversion.h
- When running a prerelease (the above macro is `false`):
  - In UI, show an orange warning bar at the top. This will be used for other
    warnings (and alerts) as well, instead of the status bar.
  - For `bitcoind`, show the warning in the "errors" field in `getinfo`
    response.
0.8
Wladimir J. van der Laan 12 years ago
parent
commit
62e21fb5d0
  1. 2
      doc/release-process.txt
  2. 3
      src/clientversion.h
  3. 4
      src/main.cpp
  4. 31
      src/qt/bitcoingui.cpp
  5. 9
      src/qt/clientmodel.cpp
  6. 2
      src/qt/clientmodel.h
  7. 533
      src/qt/forms/overviewpage.ui
  8. 30
      src/qt/overviewpage.cpp
  9. 8
      src/qt/overviewpage.h

2
doc/release-process.txt

@ -2,7 +2,7 @@
* update (commit) version in sources * update (commit) version in sources
bitcoin-qt.pro bitcoin-qt.pro
src/clientversion.h src/clientversion.h (change CLIENT_VERSION_IS_RELEASE to true)
share/setup.nsi share/setup.nsi
doc/README* doc/README*

3
src/clientversion.h

@ -11,6 +11,9 @@
#define CLIENT_VERSION_REVISION 99 #define CLIENT_VERSION_REVISION 99
#define CLIENT_VERSION_BUILD 0 #define CLIENT_VERSION_BUILD 0
// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE false
// Converts the parameter X to a string after macro replacement on X has been performed. // Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro! // Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X) #define STRINGIZE(X) DO_STRINGIZE(X)

4
src/main.cpp

@ -2617,9 +2617,13 @@ string GetWarnings(string strFor)
int nPriority = 0; int nPriority = 0;
string strStatusBar; string strStatusBar;
string strRPC; string strRPC;
if (GetBoolArg("-testsafemode")) if (GetBoolArg("-testsafemode"))
strRPC = "test"; strRPC = "test";
if (!CLIENT_VERSION_IS_RELEASE)
strStatusBar = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications");
// Misc warnings like out of disk space and clock is wrong // Misc warnings like out of disk space and clock is wrong
if (strMiscWarning != "") if (strMiscWarning != "")
{ {

31
src/qt/bitcoingui.cpp

@ -356,6 +356,7 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
// Report errors from network/worker thread // Report errors from network/worker thread
connect(clientModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool))); connect(clientModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
overviewPage->setClientModel(clientModel);
rpcConsole->setClientModel(clientModel); rpcConsole->setClientModel(clientModel);
addressBookPage->setOptionsModel(clientModel->getOptionsModel()); addressBookPage->setOptionsModel(clientModel->getOptionsModel());
receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel()); receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel());
@ -372,8 +373,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
// Put transaction list in tabs // Put transaction list in tabs
transactionView->setModel(walletModel); transactionView->setModel(walletModel);
overviewPage->setWalletModel(walletModel);
overviewPage->setModel(walletModel);
addressBookPage->setModel(walletModel->getAddressTableModel()); addressBookPage->setModel(walletModel->getAddressTableModel());
receiveCoinsPage->setModel(walletModel->getAddressTableModel()); receiveCoinsPage->setModel(walletModel->getAddressTableModel());
sendCoinsPage->setModel(walletModel); sendCoinsPage->setModel(walletModel);
@ -481,7 +481,6 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
return; return;
} }
QString strStatusBarWarnings = clientModel->getStatusBarWarnings();
QString tooltip; QString tooltip;
if(count < nTotalBlocks) if(count < nTotalBlocks)
@ -489,35 +488,23 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
int nRemainingBlocks = nTotalBlocks - count; int nRemainingBlocks = nTotalBlocks - count;
float nPercentageDone = count / (nTotalBlocks * 0.01f); float nPercentageDone = count / (nTotalBlocks * 0.01f);
if (strStatusBarWarnings.isEmpty()) progressBarLabel->setText(tr(clientModel->isImporting() ? "Importing blocks..." : "Synchronizing with network..."));
{ progressBarLabel->setVisible(true);
progressBarLabel->setText(tr(clientModel->isImporting() ? "Importing blocks..." : "Synchronizing with network...")); progressBar->setFormat(tr("~%n block(s) remaining", "", nRemainingBlocks));
progressBarLabel->setVisible(true); progressBar->setMaximum(nTotalBlocks);
progressBar->setFormat(tr("~%n block(s) remaining", "", nRemainingBlocks)); progressBar->setValue(count);
progressBar->setMaximum(nTotalBlocks); progressBar->setVisible(true);
progressBar->setValue(count);
progressBar->setVisible(true);
}
tooltip = tr("Downloaded %1 of %2 blocks of transaction history (%3% done).").arg(count).arg(nTotalBlocks).arg(nPercentageDone, 0, 'f', 2); tooltip = tr("Downloaded %1 of %2 blocks of transaction history (%3% done).").arg(count).arg(nTotalBlocks).arg(nPercentageDone, 0, 'f', 2);
} }
else else
{ {
if (strStatusBarWarnings.isEmpty()) progressBarLabel->setVisible(false);
progressBarLabel->setVisible(false);
progressBar->setVisible(false); progressBar->setVisible(false);
tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count); tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count);
} }
// Override progressBarLabel text and hide progress bar, when we have warnings to display
if (!strStatusBarWarnings.isEmpty())
{
progressBarLabel->setText(strStatusBarWarnings);
progressBarLabel->setVisible(true);
progressBar->setVisible(false);
}
QDateTime lastBlockDate = clientModel->getLastBlockDate(); QDateTime lastBlockDate = clientModel->getLastBlockDate();
int secs = lastBlockDate.secsTo(QDateTime::currentDateTime()); int secs = lastBlockDate.secsTo(QDateTime::currentDateTime());
QString text; QString text;

9
src/qt/clientmodel.cpp

@ -88,9 +88,7 @@ void ClientModel::updateAlert(const QString &hash, int status)
} }
} }
// Emit a numBlocksChanged when the status message changes, emit alertsChanged(getStatusBarWarnings());
// so that the view recomputes and updates the status bar.
emit numBlocksChanged(getNumBlocks(), getNumBlocksOfPeers());
} }
bool ClientModel::isTestNet() const bool ClientModel::isTestNet() const
@ -133,6 +131,11 @@ QString ClientModel::formatBuildDate() const
return QString::fromStdString(CLIENT_DATE); return QString::fromStdString(CLIENT_DATE);
} }
bool ClientModel::isReleaseVersion() const
{
return CLIENT_VERSION_IS_RELEASE;
}
QString ClientModel::clientName() const QString ClientModel::clientName() const
{ {
return QString::fromStdString(CLIENT_NAME); return QString::fromStdString(CLIENT_NAME);

2
src/qt/clientmodel.h

@ -42,6 +42,7 @@ public:
QString formatFullVersion() const; QString formatFullVersion() const;
QString formatBuildDate() const; QString formatBuildDate() const;
bool isReleaseVersion() const;
QString clientName() const; QString clientName() const;
QString formatClientStartupTime() const; QString formatClientStartupTime() const;
@ -60,6 +61,7 @@ private:
signals: signals:
void numConnectionsChanged(int count); void numConnectionsChanged(int count);
void numBlocksChanged(int count, int countOfPeers); void numBlocksChanged(int count, int countOfPeers);
void alertsChanged(const QString &warnings);
//! Asynchronous error notification //! Asynchronous error notification
void error(const QString &title, const QString &message, bool modal); void error(const QString &title, const QString &message, bool modal);

533
src/qt/forms/overviewpage.ui

@ -13,282 +13,303 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1"> <layout class="QVBoxLayout" name="topLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <widget class="QLabel" name="labelAlerts">
<property name="visible">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop:0 #F0D0A0, stop:1 #F8D488); color:#000000
</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>3</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
<item> <item>
<widget class="QFrame" name="frame"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="frameShape"> <item>
<enum>QFrame::StyledPanel</enum> <widget class="QFrame" name="frame">
</property> <property name="frameShape">
<property name="frameShadow"> <enum>QFrame::StyledPanel</enum>
<enum>QFrame::Raised</enum> </property>
</property> <property name="frameShadow">
<layout class="QVBoxLayout" name="verticalLayout_4"> <enum>QFrame::Raised</enum>
<item> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<widget class="QLabel" name="label_5"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="font"> <item>
<font> <widget class="QLabel" name="label_5">
<pointsize>11</pointsize> <property name="font">
<weight>75</weight> <font>
<bold>true</bold> <pointsize>11</pointsize>
</font> <weight>75</weight>
</property> <bold>true</bold>
<property name="text"> </font>
<string>Wallet</string> </property>
</property> <property name="text">
</widget> <string>Wallet</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelWalletStatus">
<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="styleSheet">
<string notr="true">QLabel { color: red; }</string>
</property>
<property name="text">
<string notr="true">(out of sync)</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QLabel" name="labelWalletStatus"> <layout class="QFormLayout" name="formLayout_2">
<property name="toolTip"> <property name="fieldGrowthPolicy">
<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> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property> </property>
<property name="styleSheet"> <property name="horizontalSpacing">
<string notr="true">QLabel { color: red; }</string> <number>12</number>
</property> </property>
<property name="text"> <property name="verticalSpacing">
<string notr="true">(out of sync)</string> <number>12</number>
</property> </property>
<property name="alignment"> <item row="0" column="0">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <widget class="QLabel" name="label">
</property> <property name="text">
</widget> <string>Balance:</string>
</item> </property>
<item> </widget>
<spacer name="horizontalSpacer_2"> </item>
<property name="orientation"> <item row="0" column="1">
<enum>Qt::Horizontal</enum> <widget class="QLabel" name="labelBalance">
</property> <property name="font">
<property name="sizeHint" stdset="0"> <font>
<size> <weight>75</weight>
<width>40</width> <bold>true</bold>
<height>20</height> </font>
</size> </property>
</property> <property name="cursor">
</spacer> <cursorShape>IBeamCursor</cursorShape>
</item> </property>
</layout> <property name="toolTip">
</item> <string>Your current balance</string>
<item> </property>
<layout class="QFormLayout" name="formLayout_2"> <property name="text">
<property name="fieldGrowthPolicy"> <string notr="true">0 BTC</string>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> </property>
</property> <property name="textInteractionFlags">
<property name="horizontalSpacing"> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
<number>12</number> </property>
</property> </widget>
<property name="verticalSpacing"> </item>
<number>12</number> <item row="1" column="0">
</property> <widget class="QLabel" name="label_3">
<item row="0" column="0"> <property name="text">
<widget class="QLabel" name="label"> <string>Unconfirmed:</string>
<property name="text"> </property>
<string>Balance:</string> </widget>
</property> </item>
</widget> <item row="1" column="1">
</item> <widget class="QLabel" name="labelUnconfirmed">
<item row="0" column="1"> <property name="font">
<widget class="QLabel" name="labelBalance"> <font>
<property name="font"> <weight>75</weight>
<font> <bold>true</bold>
<weight>75</weight> </font>
<bold>true</bold> </property>
</font> <property name="cursor">
</property> <cursorShape>IBeamCursor</cursorShape>
<property name="cursor"> </property>
<cursorShape>IBeamCursor</cursorShape> <property name="toolTip">
</property> <string>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</string>
<property name="toolTip"> </property>
<string>Your current balance</string> <property name="text">
</property> <string notr="true">0 BTC</string>
<property name="text"> </property>
<string notr="true">0 BTC</string> <property name="textInteractionFlags">
</property> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
<property name="textInteractionFlags"> </property>
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> </widget>
</property> </item>
</widget> <item row="3" column="0">
</item> <widget class="QLabel" name="label_2">
<item row="1" column="0"> <property name="text">
<widget class="QLabel" name="label_3"> <string>Number of transactions:</string>
<property name="text"> </property>
<string>Unconfirmed:</string> </widget>
</property> </item>
</widget> <item row="3" column="1">
</item> <widget class="QLabel" name="labelNumTransactions">
<item row="1" column="1"> <property name="toolTip">
<widget class="QLabel" name="labelUnconfirmed"> <string>Total number of transactions in wallet</string>
<property name="font"> </property>
<font> <property name="text">
<weight>75</weight> <string notr="true">0</string>
<bold>true</bold> </property>
</font> </widget>
</property> </item>
<property name="cursor"> <item row="2" column="0">
<cursorShape>IBeamCursor</cursorShape> <widget class="QLabel" name="labelImmatureText">
</property> <property name="text">
<property name="toolTip"> <string>Immature:</string>
<string>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</string> </property>
</property> </widget>
<property name="text"> </item>
<string notr="true">0 BTC</string> <item row="2" column="1">
</property> <widget class="QLabel" name="labelImmature">
<property name="textInteractionFlags"> <property name="font">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> <font>
</property> <weight>75</weight>
</widget> <bold>true</bold>
</item> </font>
<item row="3" column="0"> </property>
<widget class="QLabel" name="label_2"> <property name="toolTip">
<property name="text"> <string>Mined balance that has not yet matured</string>
<string>Number of transactions:</string> </property>
</property> <property name="text">
</widget> <string notr="true">0 BTC</string>
</item> </property>
<item row="3" column="1"> <property name="textInteractionFlags">
<widget class="QLabel" name="labelNumTransactions"> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
<property name="toolTip"> </property>
<string>Total number of transactions in wallet</string> </widget>
</property> </item>
<property name="text"> </layout>
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelImmatureText">
<property name="text">
<string>Immature:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="labelImmature">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="toolTip">
<string>Mined balance that has not yet matured</string>
</property>
<property name="text">
<string notr="true">0 BTC</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </widget>
</layout> </item>
</widget> <item>
</item> <spacer name="verticalSpacer">
<item> <property name="orientation">
<spacer name="verticalSpacer"> <enum>Qt::Vertical</enum>
<property name="orientation"> </property>
<enum>Qt::Vertical</enum> <property name="sizeHint" stdset="0">
</property> <size>
<property name="sizeHint" stdset="0"> <width>20</width>
<size> <height>40</height>
<width>20</width> </size>
<height>40</height> </property>
</size> </spacer>
</property> </item>
</spacer> </layout>
</item> </item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<widget class="QFrame" name="frame_2"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="frameShape"> <item>
<enum>QFrame::StyledPanel</enum> <widget class="QFrame" name="frame_2">
</property> <property name="frameShape">
<property name="frameShadow"> <enum>QFrame::StyledPanel</enum>
<enum>QFrame::Raised</enum> </property>
</property> <property name="frameShadow">
<layout class="QVBoxLayout" name="verticalLayout"> <enum>QFrame::Raised</enum>
<item> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QLabel" name="label_4"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="text"> <item>
<string>&lt;b&gt;Recent transactions&lt;/b&gt;</string> <widget class="QLabel" name="label_4">
</property> <property name="text">
</widget> <string>&lt;b&gt;Recent transactions&lt;/b&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelTransactionsStatus">
<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="styleSheet">
<string notr="true">QLabel { color: red; }</string>
</property>
<property name="text">
<string notr="true">(out of sync)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QLabel" name="labelTransactionsStatus"> <widget class="QListView" name="listTransactions">
<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="styleSheet"> <property name="styleSheet">
<string notr="true">QLabel { color: red; }</string> <string notr="true">QListView { background: transparent; }</string>
</property> </property>
<property name="text"> <property name="frameShape">
<string notr="true">(out of sync)</string> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="alignment"> <property name="verticalScrollBarPolicy">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <enum>Qt::ScrollBarAlwaysOff</enum>
</property> </property>
</widget> <property name="horizontalScrollBarPolicy">
</item> <enum>Qt::ScrollBarAlwaysOff</enum>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="selectionMode">
<size> <enum>QAbstractItemView::NoSelection</enum>
<width>40</width>
<height>20</height>
</size>
</property> </property>
</spacer> </widget>
</item> </item>
</layout> </layout>
</item> </widget>
<item> </item>
<widget class="QListView" name="listTransactions"> <item>
<property name="styleSheet"> <spacer name="verticalSpacer_2">
<string notr="true">QListView { background: transparent; }</string> <property name="orientation">
</property> <enum>Qt::Vertical</enum>
<property name="frameShape"> </property>
<enum>QFrame::NoFrame</enum> <property name="sizeHint" stdset="0">
</property> <size>
<property name="verticalScrollBarPolicy"> <width>20</width>
<enum>Qt::ScrollBarAlwaysOff</enum> <height>40</height>
</property> </size>
<property name="horizontalScrollBarPolicy"> </property>
<enum>Qt::ScrollBarAlwaysOff</enum> </spacer>
</property> </item>
<property name="selectionMode"> </layout>
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</item> </item>

30
src/qt/overviewpage.cpp

@ -1,6 +1,7 @@
#include "overviewpage.h" #include "overviewpage.h"
#include "ui_overviewpage.h" #include "ui_overviewpage.h"
#include "clientmodel.h"
#include "walletmodel.h" #include "walletmodel.h"
#include "bitcoinunits.h" #include "bitcoinunits.h"
#include "optionsmodel.h" #include "optionsmodel.h"
@ -92,6 +93,8 @@ public:
OverviewPage::OverviewPage(QWidget *parent) : OverviewPage::OverviewPage(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::OverviewPage), ui(new Ui::OverviewPage),
clientModel(0),
walletModel(0),
currentBalance(-1), currentBalance(-1),
currentUnconfirmedBalance(-1), currentUnconfirmedBalance(-1),
currentImmatureBalance(-1), currentImmatureBalance(-1),
@ -129,7 +132,7 @@ OverviewPage::~OverviewPage()
void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance) void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance)
{ {
int unit = model->getOptionsModel()->getDisplayUnit(); int unit = walletModel->getOptionsModel()->getDisplayUnit();
currentBalance = balance; currentBalance = balance;
currentUnconfirmedBalance = unconfirmedBalance; currentUnconfirmedBalance = unconfirmedBalance;
currentImmatureBalance = immatureBalance; currentImmatureBalance = immatureBalance;
@ -149,9 +152,20 @@ void OverviewPage::setNumTransactions(int count)
ui->labelNumTransactions->setText(QLocale::system().toString(count)); ui->labelNumTransactions->setText(QLocale::system().toString(count));
} }
void OverviewPage::setModel(WalletModel *model) void OverviewPage::setClientModel(ClientModel *model)
{ {
this->model = model; this->clientModel = model;
if(model)
{
// Show warning if this is a prerelease version
connect(model, SIGNAL(alertsChanged(QString)), this, SLOT(updateAlerts(QString)));
updateAlerts(model->getStatusBarWarnings());
}
}
void OverviewPage::setWalletModel(WalletModel *model)
{
this->walletModel = model;
if(model && model->getOptionsModel()) if(model && model->getOptionsModel())
{ {
// Set up transaction list // Set up transaction list
@ -181,18 +195,24 @@ void OverviewPage::setModel(WalletModel *model)
void OverviewPage::updateDisplayUnit() void OverviewPage::updateDisplayUnit()
{ {
if(model && model->getOptionsModel()) if(walletModel && walletModel->getOptionsModel())
{ {
if(currentBalance != -1) if(currentBalance != -1)
setBalance(currentBalance, currentUnconfirmedBalance, currentImmatureBalance); setBalance(currentBalance, currentUnconfirmedBalance, currentImmatureBalance);
// Update txdelegate->unit with the current unit // Update txdelegate->unit with the current unit
txdelegate->unit = model->getOptionsModel()->getDisplayUnit(); txdelegate->unit = walletModel->getOptionsModel()->getDisplayUnit();
ui->listTransactions->update(); ui->listTransactions->update();
} }
} }
void OverviewPage::updateAlerts(const QString &warnings)
{
this->ui->labelAlerts->setVisible(!warnings.isEmpty());
this->ui->labelAlerts->setText(warnings);
}
void OverviewPage::showOutOfSyncWarning(bool fShow) void OverviewPage::showOutOfSyncWarning(bool fShow)
{ {
ui->labelWalletStatus->setVisible(fShow); ui->labelWalletStatus->setVisible(fShow);

8
src/qt/overviewpage.h

@ -10,6 +10,7 @@ QT_END_NAMESPACE
namespace Ui { namespace Ui {
class OverviewPage; class OverviewPage;
} }
class ClientModel;
class WalletModel; class WalletModel;
class TxViewDelegate; class TxViewDelegate;
class TransactionFilterProxy; class TransactionFilterProxy;
@ -23,7 +24,8 @@ public:
explicit OverviewPage(QWidget *parent = 0); explicit OverviewPage(QWidget *parent = 0);
~OverviewPage(); ~OverviewPage();
void setModel(WalletModel *model); void setClientModel(ClientModel *clientModel);
void setWalletModel(WalletModel *walletModel);
void showOutOfSyncWarning(bool fShow); void showOutOfSyncWarning(bool fShow);
public slots: public slots:
@ -35,7 +37,8 @@ signals:
private: private:
Ui::OverviewPage *ui; Ui::OverviewPage *ui;
WalletModel *model; ClientModel *clientModel;
WalletModel *walletModel;
qint64 currentBalance; qint64 currentBalance;
qint64 currentUnconfirmedBalance; qint64 currentUnconfirmedBalance;
qint64 currentImmatureBalance; qint64 currentImmatureBalance;
@ -46,6 +49,7 @@ private:
private slots: private slots:
void updateDisplayUnit(); void updateDisplayUnit();
void handleTransactionClicked(const QModelIndex &index); void handleTransactionClicked(const QModelIndex &index);
void updateAlerts(const QString &warnings);
}; };
#endif // OVERVIEWPAGE_H #endif // OVERVIEWPAGE_H

Loading…
Cancel
Save