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() void StartShutdown()
{ {
Sleep(1000);
fRequestShutdown = true; fRequestShutdown = true;
} }
bool ShutdownRequested() bool ShutdownRequested()

View File

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

View File

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

View File

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

View File

@@ -70,6 +70,7 @@ public:
QAction * getHistoryAction() { return historyAction; } QAction * getHistoryAction() { return historyAction; }
QAction * getAddressBookAction() { return addressBookAction; } QAction * getAddressBookAction() { return addressBookAction; }
QAction * getPryptoRedeemAction() { return pryptoRedeemAction; } QAction * getPryptoRedeemAction() { return pryptoRedeemAction; }
QAction * getInfoPageAction() { return infoPageAction; }
QAction * getReceiveCoinsAction() { return receiveCoinsAction; } QAction * getReceiveCoinsAction() { return receiveCoinsAction; }
QAction * getSendCoinsAction() { return sendCoinsAction; } QAction * getSendCoinsAction() { return sendCoinsAction; }
@@ -109,6 +110,7 @@ private:
QAction *aboutQtAction; QAction *aboutQtAction;
QAction *openRPCConsoleAction; QAction *openRPCConsoleAction;
QAction *pryptoRedeemAction; QAction *pryptoRedeemAction;
QAction *infoPageAction;
QSystemTrayIcon *trayIcon; QSystemTrayIcon *trayIcon;
Notificator *notificator; Notificator *notificator;
@@ -180,6 +182,8 @@ private slots:
void gotoReceiveCoinsPage(); void gotoReceiveCoinsPage();
/** Switch to send coins page */ /** Switch to send coins page */
void gotoSendCoinsPage(QString addr = ""); void gotoSendCoinsPage(QString addr = "");
/** Switch to info page */
void gotoInfoPage();
/** Show Sign/Verify Message dialog and switch to sign message tab */ /** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = ""); 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"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>7</number>
</property>
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="minimumSize"> <property name="minimumSize">
@@ -49,6 +52,12 @@
</size> </size>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<property name="topMargin">
<number>7</number>
</property>
<property name="bottomMargin">
<number>7</number>
</property>
<item> <item>
<layout class="QFormLayout" name="formLayout_2"> <layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy"> <property name="fieldGrowthPolicy">
@@ -66,7 +75,7 @@
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>10</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@@ -121,7 +130,7 @@
<widget class="QLabel" name="labelBalance"> <widget class="QLabel" name="labelBalance">
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>10</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@@ -267,13 +276,19 @@
</size> </size>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="topMargin">
<number>7</number>
</property>
<property name="bottomMargin">
<number>7</number>
</property>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>10</pointsize>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">

View File

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

View File

@@ -16,7 +16,9 @@ static const int STATUSBAR_ICONSIZE = 16;
/* Transaction list -- unconfirmed transaction */ /* Transaction list -- unconfirmed transaction */
#define COLOR_UNCONFIRMED QColor(128, 128, 128) #define COLOR_UNCONFIRMED QColor(128, 128, 128)
/* Transaction list -- negative amount */ /* 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) */ /* Transaction list -- bare address (without label) */
#define COLOR_BAREADDRESS QColor(140, 140, 140) #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 else
{ {
foreground = option.palette.color(QPalette::Text); foreground = COLOR_POSITIVE;
} }
painter->setPen(foreground); painter->setPen(foreground);
QString amountText = BitcoinUnits::formatWithUnit(unit, amount, true); QString amountText = BitcoinUnits::formatWithUnit(unit, amount, true);
QFont amountFont = painter->font();
if(!confirmed) if(!confirmed)
{ {
amountText = QString("[") + amountText + QString("]"); amountText = QString("[") + amountText + QString("]");
} }
else
{
amountFont.setWeight(QFont::Bold);
painter->setFont(amountFont);
}
painter->drawText(amountRect, Qt::AlignRight|Qt::AlignVCenter, amountText); painter->drawText(amountRect, Qt::AlignRight|Qt::AlignVCenter, amountText);
amountFont.setWeight(QFont::Bold);
painter->setFont(amountFont);
painter->setPen(option.palette.color(QPalette::Text)); painter->setPen(option.palette.color(QPalette::Text));
painter->drawText(amountRect, Qt::AlignLeft|Qt::AlignVCenter, GUIUtil::dateTimeStr(date)); painter->drawText(amountRect, Qt::AlignLeft|Qt::AlignVCenter, GUIUtil::dateTimeStr(date));
@@ -106,13 +113,13 @@ OverviewPage::OverviewPage(QWidget *parent) :
currentUnconfirmedBalance(-1), currentUnconfirmedBalance(-1),
currentImmatureBalance(-1), currentImmatureBalance(-1),
txdelegate(new TxViewDelegate()), txdelegate(new TxViewDelegate()),
filter(0), filter(0),
advertsWidget(0), advertsWidget(0),
cscWebApiParser( new CasinoCoinWebAPIParser( this ) ), cscWebApiParser( new CasinoCoinWebAPIParser( this ) ),
cscWebApi( new CasinoCoinWebAPI( this ) ) cscWebApi( new CasinoCoinWebAPI( this ) )
{ {
ui->setupUi(this); ui->setupUi(this);
createAdvertsWidget(); createAdvertsWidget();
// Recent transactions // Recent transactions
ui->listTransactions->setItemDelegate(txdelegate); ui->listTransactions->setItemDelegate(txdelegate);
@@ -142,11 +149,6 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index)
emit transactionClicked(filter->mapToSource(index)); emit transactionClicked(filter->mapToSource(index));
} }
OverviewPage::~OverviewPage()
{
delete ui;
}
void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance) void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance)
{ {
int unit = walletModel->getOptionsModel()->getDisplayUnit(); int unit = walletModel->getOptionsModel()->getDisplayUnit();
@@ -258,7 +260,10 @@ void OverviewPage::updateCoinInfoFromWeb( JsonCoinInfoParser* coinInfoParser )
// save the coin information // save the coin information
coinInformation = coinInfoParser->getCoinInfo(); coinInformation = coinInfoParser->getCoinInfo();
// calculate and set the estimated fiat balance // calculate and set the estimated fiat balance
updateFiatBalance(walletModel->getOptionsModel()->getDisplayFiatCurrency()); if(walletModel)
{
updateFiatBalance(walletModel->getOptionsModel()->getDisplayFiatCurrency());
}
} }
void OverviewPage::updateFiatBalance(int currency) void OverviewPage::updateFiatBalance(int currency)
@@ -268,7 +273,6 @@ void OverviewPage::updateFiatBalance(int currency)
QString conversionCurrency = QString("Price").append(Currencies::name(currency)); QString conversionCurrency = QString("Price").append(Currencies::name(currency));
double currencyValue = coinInformation.find(conversionCurrency).value().toDouble(); double currencyValue = coinInformation.find(conversionCurrency).value().toDouble();
double fiatBalance = currentBalance * currencyValue; double fiatBalance = currentBalance * currencyValue;
qDebug() << "updateFiatBalance: " << QString::number(fiatBalance,'f',2);
ui->labelBalanceFiat->setText(Currencies::format(currency,fiatBalance,true)); 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 "addresstablemodel.h"
#include <QSsl> #include <QSsl>
#include <QMessageBox> #include <QMessageBox>
#include <QDebug>
const QString PryptoPage::strAPIEndpoint = "https://prypto.com/merchants/api/"; const QString PryptoPage::strAPIEndpoint = "https://prypto.com/merchants/api/";
const QString PryptoPage::strMerchantToken = "35616ab118fa557b77fdac78ef09d5632d302609"; 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(); walletStack->gotoPryptoPage();
} }
void WalletFrame::gotoInfoPage()
{
WalletView *walletView = currentWalletView();
if (walletView)
walletStack->gotoInfoPage();
}
void WalletFrame::gotoReceiveCoinsPage() void WalletFrame::gotoReceiveCoinsPage()
{ {
walletStack->gotoReceiveCoinsPage(); walletStack->gotoReceiveCoinsPage();

View File

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

View File

@@ -103,6 +103,13 @@ void WalletStack::gotoPryptoPage()
i.value()->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() void WalletStack::gotoReceiveCoinsPage()
{ {
QMap<QString, WalletView*>::const_iterator i; QMap<QString, WalletView*>::const_iterator i;

View File

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

View File

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

View File

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