Added InfoPage implementation

This commit is contained in:
Andre Jochems
2015-11-25 10:21:12 +01:00
parent 93b1e17402
commit eb5c432b9f
20 changed files with 825 additions and 20 deletions

View File

@@ -78,6 +78,7 @@ volatile bool fRequestShutdown = false;
void StartShutdown()
{
Sleep(1000);
fRequestShutdown = true;
}
bool ShutdownRequested()

View File

@@ -1,6 +1,7 @@
#include "casinocoinwebapi.h"
#include <QSsl>
#include <QDebug>
const QString CasinoCoinWebAPI::s_strServerAddress = "http://api.csc.dig0.com/";
const QString CasinoCoinWebAPI::s_strServerEndpoint = "CSCPublicAPI";

View File

@@ -292,12 +292,14 @@ int main(int argc, char *argv[])
threadGroup.interrupt_all();
threadGroup.join_all();
Shutdown();
pollShutdownTimer->stop();
}
else
{
threadGroup.interrupt_all();
threadGroup.join_all();
Shutdown();
pollShutdownTimer->stop();
return 1;
}
} catch (std::exception& e) {

View File

@@ -227,6 +227,13 @@ void BitcoinGUI::createActions()
pryptoRedeemAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
tabGroup->addAction(pryptoRedeemAction);
infoPageAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Information"), this);
infoPageAction->setStatusTip(tr("Show all Casinocoin related information"));
infoPageAction->setToolTip(infoPageAction->statusTip());
infoPageAction->setCheckable(true);
infoPageAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7));
tabGroup->addAction(infoPageAction);
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
@@ -239,6 +246,8 @@ void BitcoinGUI::createActions()
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
connect(pryptoRedeemAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(pryptoRedeemAction, SIGNAL(triggered()), this, SLOT(gotoPryptoPage()));
connect(infoPageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(infoPageAction, SIGNAL(triggered()), this, SLOT(gotoInfoPage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setStatusTip(tr("Quit application"));
@@ -388,6 +397,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
verifyMessageAction->setEnabled(enabled);
addressBookAction->setEnabled(enabled);
pryptoRedeemAction->setEnabled(enabled);
infoPageAction->setEnabled(enabled);
}
void BitcoinGUI::createTrayIcon()
@@ -523,6 +533,12 @@ void BitcoinGUI::gotoPryptoPage()
if ( toolbarGUI20 ) toolbarGUI20->SetCurrentItemType( GUIMenuToolbarControl::REDEEM_PRYPTO );
}
void BitcoinGUI::gotoInfoPage()
{
if (walletFrame) walletFrame->gotoInfoPage();
if ( toolbarGUI20 ) toolbarGUI20->SetCurrentItemType( GUIMenuToolbarControl::INFO );
}
void BitcoinGUI::gotoReceiveCoinsPage()
{
if (walletFrame) walletFrame->gotoReceiveCoinsPage();
@@ -912,7 +928,7 @@ void BitcoinGUI::slotMenuToolbarItemClicked( GUIMenuToolbarControl::EMenuToolbar
}
case GUIMenuToolbarControl::INFO:
{
emit aboutAction->triggered();
emit infoPageAction->triggered();
break;
}
}

View File

@@ -70,6 +70,7 @@ public:
QAction * getHistoryAction() { return historyAction; }
QAction * getAddressBookAction() { return addressBookAction; }
QAction * getPryptoRedeemAction() { return pryptoRedeemAction; }
QAction * getInfoPageAction() { return infoPageAction; }
QAction * getReceiveCoinsAction() { return receiveCoinsAction; }
QAction * getSendCoinsAction() { return sendCoinsAction; }
@@ -109,6 +110,7 @@ private:
QAction *aboutQtAction;
QAction *openRPCConsoleAction;
QAction *pryptoRedeemAction;
QAction *infoPageAction;
QSystemTrayIcon *trayIcon;
Notificator *notificator;
@@ -180,6 +182,8 @@ private slots:
void gotoReceiveCoinsPage();
/** Switch to send coins page */
void gotoSendCoinsPage(QString addr = "");
/** Switch to info page */
void gotoInfoPage();
/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");

572
src/qt/forms/infopage.ui Normal file
View File

@@ -0,0 +1,572 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InfoPage</class>
<widget class="QDialog" name="InfoPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>15</number>
</property>
<property name="topMargin">
<number>15</number>
</property>
<property name="rightMargin">
<number>15</number>
</property>
<property name="bottomMargin">
<number>15</number>
</property>
<property name="horizontalSpacing">
<number>15</number>
</property>
<item row="1" column="1">
<widget class="QFrame" name="casinoInfoBox">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(166, 27, 31); background-color: rgb(255,255,255);</string>
</property>
<widget class="QLabel" name="lblCasinosHeader">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>351</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(166, 27, 31);</string>
</property>
<property name="text">
<string>Casinos</string>
</property>
</widget>
</widget>
</item>
<item row="0" column="1">
<widget class="QFrame" name="newsItemsBox">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(166, 27, 31); background-color: rgb(255,255,255);</string>
</property>
<widget class="QLabel" name="lblNewsHeader">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>351</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(166, 27, 31);</string>
</property>
<property name="text">
<string>News</string>
</property>
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="exchangeInfoBox">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(166, 27, 31); background-color: rgb(255,255,255);</string>
</property>
<widget class="QLabel" name="lblExchangesHeader">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>351</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(166, 27, 31);</string>
</property>
<property name="text">
<string>Exchanges</string>
</property>
</widget>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="coinInfoBox">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(166, 27, 31); background-color: rgb(255,255,255);</string>
</property>
<widget class="QWidget" name="formLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>41</y>
<width>351</width>
<height>192</height>
</rect>
</property>
<layout class="QFormLayout" name="formCoinDetails">
<property name="horizontalSpacing">
<number>15</number>
</property>
<property name="verticalSpacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblBlockHeight">
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string>Current number of blocks</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblLastBlockTime">
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string>Last block time</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblCoinSupply">
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string>Coin Supply</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblConnections">
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string>Number of connections</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lblDifficulty">
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string>Difficulty</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="txtBlockHeight">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string notr="true">-</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="txtLastBlockTime">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string notr="true">-</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="txtCoinSupply">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string notr="true">-</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="txtConnections">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string notr="true">-</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="txtDifficulty">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string notr="true">-</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lblHashRate">
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string>Network Hashrate</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="txtHashRate">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string notr="true">-</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="lblTransactionCount">
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string>Transactions</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="txtTransactionCount">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string notr="true">-</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="lblCasinosHeader_2">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>341</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<family>MS Shell Dlg 2</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(166, 27, 31);</string>
</property>
<property name="text">
<string>Information</string>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -34,6 +34,9 @@
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>7</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
@@ -49,6 +52,12 @@
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="topMargin">
<number>7</number>
</property>
<property name="bottomMargin">
<number>7</number>
</property>
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
@@ -66,7 +75,7 @@
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<pointsize>14</pointsize>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
@@ -121,7 +130,7 @@
<widget class="QLabel" name="labelBalance">
<property name="font">
<font>
<pointsize>14</pointsize>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
@@ -267,13 +276,19 @@
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="topMargin">
<number>7</number>
</property>
<property name="bottomMargin">
<number>7</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>14</pointsize>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">

View File

@@ -79,12 +79,13 @@
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<string notr="true">color: rgb(166, 27, 31);</string>
</property>
<property name="text">
<string>Coin Control Features</string>
@@ -130,7 +131,7 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">color:red;font-weight:bold;</string>
<string notr="true">color: rgb(166, 27, 31);</string>
</property>
<property name="text">
<string>Insufficient funds!</string>
@@ -634,8 +635,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>830</width>
<height>167</height>
<width>826</width>
<height>138</height>
</rect>
</property>
<property name="styleSheet">

View File

@@ -16,7 +16,9 @@ static const int STATUSBAR_ICONSIZE = 16;
/* Transaction list -- unconfirmed transaction */
#define COLOR_UNCONFIRMED QColor(128, 128, 128)
/* Transaction list -- negative amount */
#define COLOR_NEGATIVE QColor(255, 0, 0)
#define COLOR_NEGATIVE QColor(166, 27, 31)
/* Transaction list -- positive amount */
#define COLOR_POSITIVE QColor(27, 166, 31)
/* Transaction list -- bare address (without label) */
#define COLOR_BAREADDRESS QColor(140, 140, 140)

109
src/qt/infopage.cpp Normal file
View File

@@ -0,0 +1,109 @@
#include "infopage.h"
#include "ui_infopage.h"
#include "walletmodel.h"
#include "clientmodel.h"
#include "bitcoinrpc.h"
#include <QDateTime>
#include "bitcoinunits.h"
#include "main.h"
using namespace std;
InfoPage::InfoPage(QWidget *parent) :
QDialog(parent),
ui(new Ui::InfoPage)
{
ui->setupUi(this);
ui->casinoInfoBox->setVisible(false);
ui->newsItemsBox->setVisible(false);
}
void InfoPage::setWalletModel(WalletModel *model)
{
this->walletModel = model;
if(model)
{
// subscribe to transaction changes
connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int)));
setNumTransactions(model->getNumTransactions());
}
}
void InfoPage::setClientModel(ClientModel *model)
{
this->clientModel = model;
if(model)
{
// Subscribe to information, replies, messages, errors
connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
connect(model, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
setNumConnections(model->getNumConnections());
setNumBlocks(model->getNumBlocks(), model->getNumBlocksOfPeers());
}
}
void InfoPage::setNumConnections(int count)
{
ui->txtConnections->setText(QString::number(count));
}
void InfoPage::setNumBlocks(int count, int countOfPeers)
{
ui->txtBlockHeight->setText(QString::number(count));
// block height changed so update all possible values as well
if(clientModel)
{
ui->txtLastBlockTime->setText(clientModel->getLastBlockDate().toString());
ui->txtDifficulty->setText(QString::number(GetDifficulty()));
ui->txtCoinSupply->setText(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, GetTotalCoinSupply(count, false)));
double megaHash = GetNetworkHashRate(-1, count) / 1000000;
ui->txtHashRate->setText(QString::number(megaHash,'f',0).append(" MHash/sec"));
}
}
void InfoPage::setNumTransactions(int count)
{
ui->txtTransactionCount->setText(QString::number(count));
}
double InfoPage::GetNetworkHashRate(int lookup, int height) {
CBlockIndex *pb = pindexBest;
if (height >= 0 && height < nBestHeight)
pb = FindBlockByHeight(height);
if (pb == NULL || !pb->nHeight)
return 0;
// If lookup is -1, then use blocks since last difficulty change.
if (lookup <= 0)
lookup = pb->nHeight % 2016 + 1;
// If lookup is larger than chain, then set it to chain length.
if (lookup > pb->nHeight)
lookup = pb->nHeight;
CBlockIndex *pb0 = pb;
int64 minTime = pb0->GetBlockTime();
int64 maxTime = minTime;
for (int i = 0; i < lookup; i++) {
pb0 = pb0->pprev;
int64 time = pb0->GetBlockTime();
minTime = std::min(time, minTime);
maxTime = std::max(time, maxTime);
}
// In case there's a situation where minTime == maxTime, we don't want a divide by zero exception.
if (minTime == maxTime)
return 0;
uint256 workDiff = pb->nChainWork - pb0->nChainWork;
int64 timeDiff = maxTime - minTime;
double workDiffDouble = workDiff.getdouble();
return workDiffDouble / timeDiff;
}
InfoPage::~InfoPage()
{
delete ui;
}

38
src/qt/infopage.h Normal file
View File

@@ -0,0 +1,38 @@
#ifndef INFOPAGE_H
#define INFOPAGE_H
#include <QDialog>
class WalletModel;
class ClientModel;
namespace Ui {
class InfoPage;
}
class InfoPage : public QDialog
{
Q_OBJECT
public slots:
/** Set number of connections shown in the UI */
void setNumConnections(int count);
/** Set number of blocks shown in the UI */
void setNumBlocks(int count, int countOfPeers);
/** Set number of transactions shown in the UI */
void setNumTransactions(int count);
public:
explicit InfoPage(QWidget *parent = 0);
void setWalletModel(WalletModel *model);
void setClientModel(ClientModel *model);
~InfoPage();
private:
Ui::InfoPage *ui;
WalletModel *walletModel;
ClientModel *clientModel;
double GetNetworkHashRate(int lookup, int height);
};
#endif // INFOPAGE_H

View File

@@ -71,16 +71,23 @@ public:
}
else
{
foreground = option.palette.color(QPalette::Text);
foreground = COLOR_POSITIVE;
}
painter->setPen(foreground);
QString amountText = BitcoinUnits::formatWithUnit(unit, amount, true);
QFont amountFont = painter->font();
if(!confirmed)
{
amountText = QString("[") + amountText + QString("]");
}
else
{
amountFont.setWeight(QFont::Bold);
painter->setFont(amountFont);
}
painter->drawText(amountRect, Qt::AlignRight|Qt::AlignVCenter, amountText);
amountFont.setWeight(QFont::Bold);
painter->setFont(amountFont);
painter->setPen(option.palette.color(QPalette::Text));
painter->drawText(amountRect, Qt::AlignLeft|Qt::AlignVCenter, GUIUtil::dateTimeStr(date));
@@ -106,13 +113,13 @@ OverviewPage::OverviewPage(QWidget *parent) :
currentUnconfirmedBalance(-1),
currentImmatureBalance(-1),
txdelegate(new TxViewDelegate()),
filter(0),
filter(0),
advertsWidget(0),
cscWebApiParser( new CasinoCoinWebAPIParser( this ) ),
cscWebApi( new CasinoCoinWebAPI( this ) )
{
ui->setupUi(this);
createAdvertsWidget();
createAdvertsWidget();
// Recent transactions
ui->listTransactions->setItemDelegate(txdelegate);
@@ -142,11 +149,6 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index)
emit transactionClicked(filter->mapToSource(index));
}
OverviewPage::~OverviewPage()
{
delete ui;
}
void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance)
{
int unit = walletModel->getOptionsModel()->getDisplayUnit();
@@ -258,7 +260,10 @@ void OverviewPage::updateCoinInfoFromWeb( JsonCoinInfoParser* coinInfoParser )
// save the coin information
coinInformation = coinInfoParser->getCoinInfo();
// calculate and set the estimated fiat balance
updateFiatBalance(walletModel->getOptionsModel()->getDisplayFiatCurrency());
if(walletModel)
{
updateFiatBalance(walletModel->getOptionsModel()->getDisplayFiatCurrency());
}
}
void OverviewPage::updateFiatBalance(int currency)
@@ -268,7 +273,6 @@ void OverviewPage::updateFiatBalance(int currency)
QString conversionCurrency = QString("Price").append(Currencies::name(currency));
double currencyValue = coinInformation.find(conversionCurrency).value().toDouble();
double fiatBalance = currentBalance * currencyValue;
qDebug() << "updateFiatBalance: " << QString::number(fiatBalance,'f',2);
ui->labelBalanceFiat->setText(Currencies::format(currency,fiatBalance,true));
}
}
@@ -285,3 +289,8 @@ void OverviewPage::updateDisplayPromotions(bool checked)
}
}
}
OverviewPage::~OverviewPage()
{
delete ui;
}

View File

@@ -4,6 +4,7 @@
#include "addresstablemodel.h"
#include <QSsl>
#include <QMessageBox>
#include <QDebug>
const QString PryptoPage::strAPIEndpoint = "https://prypto.com/merchants/api/";
const QString PryptoPage::strMerchantToken = "35616ab118fa557b77fdac78ef09d5632d302609";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 625 B

View File

@@ -102,6 +102,13 @@ void WalletFrame::gotoPryptoPage()
walletStack->gotoPryptoPage();
}
void WalletFrame::gotoInfoPage()
{
WalletView *walletView = currentWalletView();
if (walletView)
walletStack->gotoInfoPage();
}
void WalletFrame::gotoReceiveCoinsPage()
{
walletStack->gotoReceiveCoinsPage();

View File

@@ -50,6 +50,8 @@ public slots:
void gotoAddressBookPage();
/** Switch to redeem prypto page */
void gotoPryptoPage();
/** Switch to info page */
void gotoInfoPage();
/** Switch to receive coins page */
void gotoReceiveCoinsPage();
/** Switch to send coins page */

View File

@@ -103,6 +103,13 @@ void WalletStack::gotoPryptoPage()
i.value()->gotoPryptoPage();
}
void WalletStack::gotoInfoPage()
{
QMap<QString, WalletView*>::const_iterator i;
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i)
i.value()->gotoInfoPage();
}
void WalletStack::gotoReceiveCoinsPage()
{
QMap<QString, WalletView*>::const_iterator i;

View File

@@ -76,6 +76,8 @@ public slots:
void gotoAddressBookPage();
/** Switch to redeem prypto page */
void gotoPryptoPage();
/** Switch to info page */
void gotoInfoPage();
/** Switch to receive coins page */
void gotoReceiveCoinsPage();
/** Switch to send coins page */

View File

@@ -9,6 +9,7 @@
#include "transactiontablemodel.h"
#include "addressbookpage.h"
#include "pryptopage.h"
#include "infopage.h"
#include "sendcoinsdialog.h"
#include "signverifymessagedialog.h"
#include "clientmodel.h"
@@ -58,6 +59,8 @@ WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
pryptoPage = new PryptoPage(gui);
infoPage = new InfoPage(gui);
receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);
sendCoinsPage = new SendCoinsDialog(gui);
@@ -68,6 +71,7 @@ WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
addWidget(transactionsPage);
addWidget(addressBookPage);
addWidget(pryptoPage);
addWidget(infoPage);
addWidget(receiveCoinsPage);
addWidget(sendCoinsPage);
@@ -107,6 +111,7 @@ void WalletView::setClientModel(ClientModel *clientModel)
overviewPage->setClientModel(clientModel);
addressBookPage->setOptionsModel(clientModel->getOptionsModel());
receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel());
infoPage->setClientModel(clientModel);
}
}
@@ -126,6 +131,7 @@ void WalletView::setWalletModel(WalletModel *walletModel)
sendCoinsPage->setModel(walletModel);
signVerifyMessageDialog->setModel(walletModel);
pryptoPage->setWalletModel(walletModel);
infoPage->setWalletModel(walletModel);
setEncryptionStatus();
connect(walletModel, SIGNAL(encryptionStatusChanged(int)), gui, SLOT(setEncryptionStatus(int)));
@@ -179,6 +185,12 @@ void WalletView::gotoPryptoPage()
setCurrentWidget(pryptoPage);
}
void WalletView::gotoInfoPage()
{
gui->getInfoPageAction()->setChecked(true);
setCurrentWidget(infoPage);
}
void WalletView::gotoReceiveCoinsPage()
{
gui->getReceiveCoinsAction()->setChecked(true);

View File

@@ -16,6 +16,7 @@ class TransactionView;
class OverviewPage;
class AddressBookPage;
class PryptoPage;
class InfoPage;
class SendCoinsDialog;
class SignVerifyMessageDialog;
class RPCConsole;
@@ -63,6 +64,7 @@ private:
QWidget *transactionsPage;
AddressBookPage *addressBookPage;
PryptoPage *pryptoPage;
InfoPage *infoPage;
AddressBookPage *receiveCoinsPage;
SendCoinsDialog *sendCoinsPage;
SignVerifyMessageDialog *signVerifyMessageDialog;
@@ -78,6 +80,8 @@ public slots:
void gotoAddressBookPage();
/** Switch to redeem prypto page */
void gotoPryptoPage();
/** Switch to info page */
void gotoInfoPage();
/** Switch to receive coins page */
void gotoReceiveCoinsPage();
/** Switch to send coins page */