mirror of
https://github.com/AskDavis/Casinotest.git
synced 2026-01-04 12:29:46 -08:00
Coin Information API integrated
This commit is contained in:
@@ -31,6 +31,11 @@ void CasinoCoinWebAPI::GetActiveExchanges()
|
|||||||
Get( s_strServerAddress + s_strServerEndpoint + "/ActiveExchanges" );
|
Get( s_strServerAddress + s_strServerEndpoint + "/ActiveExchanges" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CasinoCoinWebAPI::GetCoinInfo()
|
||||||
|
{
|
||||||
|
Get( s_strServerAddress + s_strServerEndpoint + "/CoinInfo" );
|
||||||
|
}
|
||||||
|
|
||||||
void CasinoCoinWebAPI::Get( const QString& a_rUrl )
|
void CasinoCoinWebAPI::Get( const QString& a_rUrl )
|
||||||
{
|
{
|
||||||
QUrl oUrl ( a_rUrl );
|
QUrl oUrl ( a_rUrl );
|
||||||
@@ -43,7 +48,7 @@ void CasinoCoinWebAPI::slotParseNetworkResponse( QNetworkReply *finished )
|
|||||||
if ( finished->error() != QNetworkReply::NoError )
|
if ( finished->error() != QNetworkReply::NoError )
|
||||||
{
|
{
|
||||||
// A communication error has occurred
|
// A communication error has occurred
|
||||||
qDebug() << finished->request().url();
|
qDebug() << "API Network Error: " << finished->errorString();
|
||||||
emit signalNetworkError( finished->error(), finished->request().url() );
|
emit signalNetworkError( finished->error(), finished->request().url() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public:
|
|||||||
void GetActiveCasinos();
|
void GetActiveCasinos();
|
||||||
void GetActiveNewsItems();
|
void GetActiveNewsItems();
|
||||||
void GetActiveExchanges();
|
void GetActiveExchanges();
|
||||||
|
void GetCoinInfo();
|
||||||
|
|
||||||
static const QString s_strServerAddress;
|
static const QString s_strServerAddress;
|
||||||
static const QString s_strServerEndpoint;
|
static const QString s_strServerEndpoint;
|
||||||
|
|||||||
@@ -48,8 +48,21 @@ void CasinoCoinWebAPIParser::slotParseAnswer( const QByteArray& a_rJsonFile )
|
|||||||
StoreFile( "ActiveExchanges", a_rJsonFile );
|
StoreFile( "ActiveExchanges", a_rJsonFile );
|
||||||
ParseExchanges( docAsObject );
|
ParseExchanges( docAsObject );
|
||||||
}
|
}
|
||||||
}
|
else if ( jsonObjectResult.find( "CoinInfo" ).value().isObject() )
|
||||||
|
{
|
||||||
|
StoreFile( "CoinInfo", a_rJsonFile );
|
||||||
|
ParseCoinInfo( docAsObject );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "CasinoCoinWebAPIParser -> No Result object found: " << docAsObject.begin().key();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "CasinoCoinWebAPIParser -> Parse Error: " << oError.errorString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CasinoCoinWebAPIParser::slotNetworkError( QNetworkReply::NetworkError a_eError
|
void CasinoCoinWebAPIParser::slotNetworkError( QNetworkReply::NetworkError a_eError
|
||||||
@@ -85,6 +98,12 @@ void CasinoCoinWebAPIParser::ParseNewsItems( const QJsonObject& a_rJsonNewsItems
|
|||||||
qDebug() << a_rJsonNewsItems;
|
qDebug() << a_rJsonNewsItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CasinoCoinWebAPIParser::ParseCoinInfo( const QJsonObject& a_rJsonCoinInfo )
|
||||||
|
{
|
||||||
|
qDebug() << "ParseCoinInfo";
|
||||||
|
emit signalCoinInfoParsed( new JsonCoinInfoParser( a_rJsonCoinInfo ) );
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray CasinoCoinWebAPIParser::ReadFile( QString a_strSourcePath )
|
QByteArray CasinoCoinWebAPIParser::ReadFile( QString a_strSourcePath )
|
||||||
{
|
{
|
||||||
QByteArray strAnswer;
|
QByteArray strAnswer;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "jsonactivepromotionsparser.h"
|
#include "jsonactivepromotionsparser.h"
|
||||||
#include "jsonsingleactivepromotion.h"
|
#include "jsonsingleactivepromotion.h"
|
||||||
|
#include "jsoncoininfoparser.h"
|
||||||
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalActivePromotionsParsed( JsonActivePromotionsParser* a_pActivePromotions );
|
void signalActivePromotionsParsed( JsonActivePromotionsParser* a_pActivePromotions );
|
||||||
|
void signalCoinInfoParsed( JsonCoinInfoParser* a_pCoinInfo );
|
||||||
// void signalActiveCasinosParsed( JsonActiveCasinosParser* a_pActivePromotions );
|
// void signalActiveCasinosParsed( JsonActiveCasinosParser* a_pActivePromotions );
|
||||||
// void signalActiveExchangesParsed( JsonActiveExchangesParser* a_pActivePromotions );
|
// void signalActiveExchangesParsed( JsonActiveExchangesParser* a_pActivePromotions );
|
||||||
// void signalActiveNewsItemsParsed( JsonActiveNewsItemsParser* a_pActivePromotions );
|
// void signalActiveNewsItemsParsed( JsonActiveNewsItemsParser* a_pActivePromotions );
|
||||||
@@ -32,6 +34,7 @@ private:
|
|||||||
void ParseCasinos ( const QJsonObject& a_rJsonCasinos );
|
void ParseCasinos ( const QJsonObject& a_rJsonCasinos );
|
||||||
void ParseExchanges ( const QJsonObject& a_rJsonExchanges );
|
void ParseExchanges ( const QJsonObject& a_rJsonExchanges );
|
||||||
void ParseNewsItems ( const QJsonObject& a_rJsonNewsItems );
|
void ParseNewsItems ( const QJsonObject& a_rJsonNewsItems );
|
||||||
|
void ParseCoinInfo ( const QJsonObject& a_rJsonCoinInfo );
|
||||||
|
|
||||||
QByteArray ReadFile( QString a_strSourcePath );
|
QByteArray ReadFile( QString a_strSourcePath );
|
||||||
void StoreFile( QString a_strDestinationPath, const QByteArray& a_rJsonFile );
|
void StoreFile( QString a_strDestinationPath, const QByteArray& a_rJsonFile );
|
||||||
|
|||||||
29
src/qt/CSCPublicAPI/jsoncoininfoparser.cpp
Normal file
29
src/qt/CSCPublicAPI/jsoncoininfoparser.cpp
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#include "jsoncoininfoparser.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
JsonCoinInfoParser::JsonCoinInfoParser()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonCoinInfoParser::JsonCoinInfoParser( const QJsonObject& apiResult )
|
||||||
|
: QJsonObject( apiResult )
|
||||||
|
{
|
||||||
|
qDebug() << "JsonCoinInfoParser: " << apiResult.begin().key();
|
||||||
|
if ( apiResult.find( "Result" ).value().isObject() )
|
||||||
|
{
|
||||||
|
if ( apiResult.find( "Result" ).value().toObject().find( "CoinInfo" ).value().isObject() )
|
||||||
|
{
|
||||||
|
coinInfoObject = apiResult.find( "Result" ).value().toObject().find( "CoinInfo" ).value().toObject();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug()<<"JsonCoinInfoParser first key: " << apiResult.find( "Result" ).value().toObject().begin().key();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const QJsonObject& JsonCoinInfoParser::getCoinInfo() const
|
||||||
|
{
|
||||||
|
return coinInfoObject;
|
||||||
|
}
|
||||||
20
src/qt/CSCPublicAPI/jsoncoininfoparser.h
Normal file
20
src/qt/CSCPublicAPI/jsoncoininfoparser.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef JSONCOININFOPARSER_H
|
||||||
|
#define JSONCOININFOPARSER_H
|
||||||
|
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonValue>
|
||||||
|
|
||||||
|
class JsonCoinInfoParser : public QJsonObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
JsonCoinInfoParser();
|
||||||
|
JsonCoinInfoParser( const QJsonObject& a_rOther );
|
||||||
|
virtual ~JsonCoinInfoParser(){}
|
||||||
|
|
||||||
|
const QJsonObject& getCoinInfo() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QJsonObject coinInfoObject;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // JSONCOININFOPARSER_H
|
||||||
87
src/qt/currencies.cpp
Normal file
87
src/qt/currencies.cpp
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#include "currencies.h"
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
Currencies::Currencies(QObject *parent):
|
||||||
|
QAbstractListModel(parent),
|
||||||
|
currencylist(availableCurrencies())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<Currencies::FiatCurrencyID> Currencies::availableCurrencies()
|
||||||
|
{
|
||||||
|
QList<Currencies::FiatCurrencyID> currencylist;
|
||||||
|
currencylist.append(USD);
|
||||||
|
currencylist.append(EUR);
|
||||||
|
currencylist.append(CNY);
|
||||||
|
currencylist.append(JPY);
|
||||||
|
currencylist.append(RUB);
|
||||||
|
return currencylist;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Currencies::valid(int currency)
|
||||||
|
{
|
||||||
|
switch(currency)
|
||||||
|
{
|
||||||
|
case USD:
|
||||||
|
case EUR:
|
||||||
|
case CNY:
|
||||||
|
case JPY:
|
||||||
|
case RUB:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Currencies::name(int currency)
|
||||||
|
{
|
||||||
|
switch(currency)
|
||||||
|
{
|
||||||
|
case USD: return QString("USD");
|
||||||
|
case EUR: return QString("EUR");
|
||||||
|
case CNY: return QString("CNY");
|
||||||
|
case JPY: return QString("JPY");
|
||||||
|
case RUB: return QString("RUB");
|
||||||
|
default: return QString("???");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Currencies::description(int currency)
|
||||||
|
{
|
||||||
|
switch(currency)
|
||||||
|
{
|
||||||
|
case USD: return QString("US Dollars");
|
||||||
|
case EUR: return QString("European Euro");
|
||||||
|
case CNY: return QString("Chinese Yuan");
|
||||||
|
case JPY: return QString("Japanese Yen");
|
||||||
|
case RUB: return QString("Russian Ruble");
|
||||||
|
default: return QString("???");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Currencies::rowCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent);
|
||||||
|
return currencylist.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant Currencies::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
int row = index.row();
|
||||||
|
if(row >= 0 && row < currencylist.size())
|
||||||
|
{
|
||||||
|
FiatCurrencyID currency = currencylist.at(row);
|
||||||
|
switch(role)
|
||||||
|
{
|
||||||
|
case Qt::EditRole:
|
||||||
|
case Qt::DisplayRole:
|
||||||
|
return QVariant(name(currency));
|
||||||
|
case Qt::ToolTipRole:
|
||||||
|
return QVariant(description(currency));
|
||||||
|
case CurrencyRole:
|
||||||
|
return QVariant(static_cast<int>(currency));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
46
src/qt/currencies.h
Normal file
46
src/qt/currencies.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#ifndef CURRENCIES_H
|
||||||
|
#define CURRENCIES_H
|
||||||
|
|
||||||
|
#include <QAbstractListModel>
|
||||||
|
|
||||||
|
class Currencies : public QAbstractListModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Currencies(QObject *parent);
|
||||||
|
|
||||||
|
enum FiatCurrencyID {
|
||||||
|
USD,
|
||||||
|
EUR,
|
||||||
|
CNY,
|
||||||
|
JPY,
|
||||||
|
RUB,
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Get list of currencies, for drop-down box
|
||||||
|
static QList<FiatCurrencyID> availableCurrencies();
|
||||||
|
//! Is currency ID valid?
|
||||||
|
static bool valid(int currency);
|
||||||
|
//! Short name
|
||||||
|
static QString name(int currency);
|
||||||
|
//! Longer description
|
||||||
|
static QString description(int unit);
|
||||||
|
|
||||||
|
//! @name AbstractListModel implementation
|
||||||
|
//! List model for currency drop-down selection box.
|
||||||
|
///@{
|
||||||
|
enum RoleIndex {
|
||||||
|
/** Currency identifier */
|
||||||
|
CurrencyRole = Qt::UserRole
|
||||||
|
};
|
||||||
|
int rowCount(const QModelIndex &parent) const;
|
||||||
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
///@}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<Currencies::FiatCurrencyID> currencylist;
|
||||||
|
};
|
||||||
|
typedef Currencies::FiatCurrencyID Currency;
|
||||||
|
|
||||||
|
#endif // CURRENCIES_H
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<enum>QTabWidget::North</enum>
|
<enum>QTabWidget::North</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tabMain">
|
<widget class="QWidget" name="tabMain">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -304,89 +304,137 @@
|
|||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>&Display</string>
|
<string>&Display</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_Display">
|
<widget class="QCheckBox" name="displayAddresses">
|
||||||
<item>
|
<property name="geometry">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_1_Display">
|
<rect>
|
||||||
<item>
|
<x>10</x>
|
||||||
<widget class="QLabel" name="langLabel">
|
<y>100</y>
|
||||||
<property name="text">
|
<width>230</width>
|
||||||
<string>User Interface &language:</string>
|
<height>20</height>
|
||||||
</property>
|
</rect>
|
||||||
<property name="textFormat">
|
</property>
|
||||||
<enum>Qt::PlainText</enum>
|
<property name="toolTip">
|
||||||
</property>
|
<string>Whether to show CasinoCoin addresses in the transaction list or not.</string>
|
||||||
<property name="buddy">
|
</property>
|
||||||
<cstring>lang</cstring>
|
<property name="text">
|
||||||
</property>
|
<string>&Display addresses in transaction list</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
<widget class="QCheckBox" name="coinControlFeatures">
|
||||||
<widget class="QValueComboBox" name="lang">
|
<property name="geometry">
|
||||||
<property name="toolTip">
|
<rect>
|
||||||
<string>The user interface language can be set here. This setting will take effect after restarting CasinoCoin.</string>
|
<x>10</x>
|
||||||
</property>
|
<y>127</y>
|
||||||
</widget>
|
<width>275</width>
|
||||||
</item>
|
<height>20</height>
|
||||||
</layout>
|
</rect>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
<property name="toolTip">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2_Display">
|
<string>Whether to show coin control features or not.</string>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QLabel" name="unitLabel">
|
<property name="text">
|
||||||
<property name="text">
|
<string>Display coin &control features (experts only!)</string>
|
||||||
<string>&Unit to show amounts in:</string>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="textFormat">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<enum>Qt::PlainText</enum>
|
<property name="geometry">
|
||||||
</property>
|
<rect>
|
||||||
<property name="buddy">
|
<x>10</x>
|
||||||
<cstring>unit</cstring>
|
<y>70</y>
|
||||||
</property>
|
<width>491</width>
|
||||||
</widget>
|
<height>24</height>
|
||||||
</item>
|
</rect>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QValueComboBox" name="unit">
|
<layout class="QHBoxLayout" name="horizontalLayout_2_Display_Currency">
|
||||||
<property name="toolTip">
|
<item>
|
||||||
<string>Choose the default subdivision unit to show in the interface and when sending coins.</string>
|
<widget class="QLabel" name="currencyLabel">
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>Currency to show amounts in:</string>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<property name="textFormat">
|
||||||
</item>
|
<enum>Qt::PlainText</enum>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QCheckBox" name="displayAddresses">
|
<property name="buddy">
|
||||||
<property name="toolTip">
|
<cstring>currency</cstring>
|
||||||
<string>Whether to show CasinoCoin addresses in the transaction list or not.</string>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>&Display addresses in transaction list</string>
|
<item>
|
||||||
</property>
|
<widget class="QValueComboBox" name="currency">
|
||||||
</widget>
|
<property name="toolTip">
|
||||||
</item>
|
<string>Choose the default currency in which to show your total coin value.</string>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QCheckBox" name="coinControlFeatures">
|
</widget>
|
||||||
<property name="toolTip">
|
</item>
|
||||||
<string>Whether to show coin control features or not.</string>
|
</layout>
|
||||||
</property>
|
</widget>
|
||||||
<property name="text">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<string>Display coin &control features (experts only!)</string>
|
<property name="geometry">
|
||||||
</property>
|
<rect>
|
||||||
</widget>
|
<x>11</x>
|
||||||
</item>
|
<y>11</y>
|
||||||
<item>
|
<width>491</width>
|
||||||
<spacer name="verticalSpacer_Display">
|
<height>24</height>
|
||||||
<property name="orientation">
|
</rect>
|
||||||
<enum>Qt::Vertical</enum>
|
</property>
|
||||||
</property>
|
<layout class="QHBoxLayout" name="horizontalLayout_1_Display">
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeConstraint">
|
||||||
<size>
|
<enum>QLayout::SetMaximumSize</enum>
|
||||||
<width>20</width>
|
</property>
|
||||||
<height>40</height>
|
<item>
|
||||||
</size>
|
<widget class="QLabel" name="langLabel">
|
||||||
</property>
|
<property name="text">
|
||||||
</spacer>
|
<string>User Interface &language:</string>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>lang</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QValueComboBox" name="lang">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The user interface language can be set here. This setting will take effect after restarting CasinoCoin.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="layoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>11</x>
|
||||||
|
<y>42</y>
|
||||||
|
<width>491</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2_Display">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="unitLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Unit to show amounts in:</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>unit</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QValueComboBox" name="unit">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Choose the default subdivision unit to show in the interface and when sending coins.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -60,6 +60,56 @@
|
|||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>12</number>
|
<number>12</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</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>Wallet</string>
|
||||||
|
</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>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelWalletStatus">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The displayed information may be out of date. Your wallet automatically synchronizes with the CasinoCoin network after a connection is established, but this process has not completed yet.</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(166, 27, 31);</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>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="labelBalanceText">
|
<widget class="QLabel" name="labelBalanceText">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -154,17 +204,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="6" column="0" colspan="2">
|
||||||
<widget class="QWidget" name="widgetBuyCSCButton" native="true">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>150</width>
|
|
||||||
<height>30</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0" colspan="2">
|
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@@ -177,7 +217,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="8" column="0" colspan="2">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayoutAdvertWidget"/>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0" colspan="2">
|
||||||
<widget class="QPushButton" name="pushButtonToggleAdverts">
|
<widget class="QPushButton" name="pushButtonToggleAdverts">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
@@ -196,58 +239,44 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="5" column="0" colspan="2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayoutAdvertWidget"/>
|
<widget class="QWidget" name="widgetBuyCSCButton" native="true">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="4" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<widget class="QLabel" name="labelBalanceFiatText">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QLabel" name="label_5">
|
<string>Estimated Fiat Balance:</string>
|
||||||
<property name="font">
|
</property>
|
||||||
<font>
|
</widget>
|
||||||
<pointsize>14</pointsize>
|
</item>
|
||||||
<weight>75</weight>
|
<item row="4" column="1">
|
||||||
<bold>true</bold>
|
<widget class="QLabel" name="labelBalanceFiat">
|
||||||
</font>
|
<property name="font">
|
||||||
</property>
|
<font>
|
||||||
<property name="styleSheet">
|
<weight>75</weight>
|
||||||
<string notr="true">color: rgb(166, 27, 31);</string>
|
<bold>true</bold>
|
||||||
</property>
|
</font>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Wallet</string>
|
<property name="toolTip">
|
||||||
</property>
|
<string>Estimated Fiat balance calculated against current market value</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="text">
|
||||||
<item>
|
<string notr="true">0</string>
|
||||||
<spacer name="horizontalSpacer_2">
|
</property>
|
||||||
<property name="orientation">
|
<property name="alignment">
|
||||||
<enum>Qt::Horizontal</enum>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="textInteractionFlags">
|
||||||
<size>
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||||
<width>40</width>
|
</property>
|
||||||
<height>20</height>
|
</widget>
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</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 CasinoCoin network after a connection is established, but this process has not completed yet.</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">color: rgb(166, 27, 31);</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>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "ui_optionsdialog.h"
|
#include "ui_optionsdialog.h"
|
||||||
|
|
||||||
#include "bitcoinunits.h"
|
#include "bitcoinunits.h"
|
||||||
|
#include "currencies.h"
|
||||||
#include "monitoreddatamapper.h"
|
#include "monitoreddatamapper.h"
|
||||||
#include "netbase.h"
|
#include "netbase.h"
|
||||||
#include "optionsmodel.h"
|
#include "optionsmodel.h"
|
||||||
@@ -80,6 +81,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui->unit->setModel(new BitcoinUnits(this));
|
ui->unit->setModel(new BitcoinUnits(this));
|
||||||
|
ui->currency->setModel(new Currencies(this));
|
||||||
|
|
||||||
/* Widget-to-option mapper */
|
/* Widget-to-option mapper */
|
||||||
mapper = new MonitoredDataMapper(this);
|
mapper = new MonitoredDataMapper(this);
|
||||||
@@ -145,6 +147,7 @@ void OptionsDialog::setMapper()
|
|||||||
/* Display */
|
/* Display */
|
||||||
mapper->addMapping(ui->lang, OptionsModel::Language);
|
mapper->addMapping(ui->lang, OptionsModel::Language);
|
||||||
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
|
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
|
||||||
|
mapper->addMapping(ui->currency, OptionsModel::DisplayFiatCurrency);
|
||||||
mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
|
mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
|
||||||
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
|
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "optionsmodel.h"
|
#include "optionsmodel.h"
|
||||||
|
|
||||||
#include "bitcoinunits.h"
|
#include "bitcoinunits.h"
|
||||||
|
#include "currencies.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
#include "walletdb.h"
|
#include "walletdb.h"
|
||||||
#include "guiutil.h"
|
#include "guiutil.h"
|
||||||
@@ -49,6 +50,7 @@ void OptionsModel::Init()
|
|||||||
nTransactionFee = settings.value("nTransactionFee").toLongLong();
|
nTransactionFee = settings.value("nTransactionFee").toLongLong();
|
||||||
language = settings.value("language", "").toString();
|
language = settings.value("language", "").toString();
|
||||||
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
|
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
|
||||||
|
nDisplayFiatCurrency = settings.value("nDisplayFiatCurrency", Currencies::USD).toInt();
|
||||||
|
|
||||||
// These are shared with core Bitcoin; we want
|
// These are shared with core Bitcoin; we want
|
||||||
// command-line options to override the GUI settings:
|
// command-line options to override the GUI settings:
|
||||||
@@ -199,6 +201,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
|||||||
return settings.value("language", "");
|
return settings.value("language", "");
|
||||||
case CoinControlFeatures:
|
case CoinControlFeatures:
|
||||||
return QVariant(fCoinControlFeatures);
|
return QVariant(fCoinControlFeatures);
|
||||||
|
case DisplayFiatCurrency:
|
||||||
|
return QVariant(nDisplayFiatCurrency);
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@@ -274,6 +278,10 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
|||||||
settings.setValue("nDisplayUnit", nDisplayUnit);
|
settings.setValue("nDisplayUnit", nDisplayUnit);
|
||||||
emit displayUnitChanged(nDisplayUnit);
|
emit displayUnitChanged(nDisplayUnit);
|
||||||
break;
|
break;
|
||||||
|
case DisplayFiatCurrency:
|
||||||
|
nDisplayFiatCurrency = value.toInt();
|
||||||
|
settings.setValue("nDisplayFiatCurrency", nDisplayFiatCurrency);
|
||||||
|
break;
|
||||||
case DisplayAddresses:
|
case DisplayAddresses:
|
||||||
bDisplayAddresses = value.toBool();
|
bDisplayAddresses = value.toBool();
|
||||||
settings.setValue("bDisplayAddresses", bDisplayAddresses);
|
settings.setValue("bDisplayAddresses", bDisplayAddresses);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public:
|
|||||||
ProxySocksVersion, // int
|
ProxySocksVersion, // int
|
||||||
Fee, // qint64
|
Fee, // qint64
|
||||||
DisplayUnit, // BitcoinUnits::Unit
|
DisplayUnit, // BitcoinUnits::Unit
|
||||||
|
DisplayFiatCurrency, // Currencies::FiatCurrencyID
|
||||||
DisplayAddresses, // bool
|
DisplayAddresses, // bool
|
||||||
Language, // QString
|
Language, // QString
|
||||||
CoinControlFeatures, // bool
|
CoinControlFeatures, // bool
|
||||||
@@ -51,6 +52,7 @@ public:
|
|||||||
bool getDisplayAddresses() { return bDisplayAddresses; }
|
bool getDisplayAddresses() { return bDisplayAddresses; }
|
||||||
QString getLanguage() { return language; }
|
QString getLanguage() { return language; }
|
||||||
bool getCoinControlFeatures();
|
bool getCoinControlFeatures();
|
||||||
|
int getDisplayFiatCurrency() { return nDisplayFiatCurrency; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int nDisplayUnit;
|
int nDisplayUnit;
|
||||||
@@ -59,6 +61,7 @@ private:
|
|||||||
bool fMinimizeOnClose;
|
bool fMinimizeOnClose;
|
||||||
QString language;
|
QString language;
|
||||||
bool fCoinControlFeatures;
|
bool fCoinControlFeatures;
|
||||||
|
int nDisplayFiatCurrency;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void displayUnitChanged(int unit);
|
void displayUnitChanged(int unit);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "clientmodel.h"
|
#include "clientmodel.h"
|
||||||
#include "walletmodel.h"
|
#include "walletmodel.h"
|
||||||
#include "bitcoinunits.h"
|
#include "bitcoinunits.h"
|
||||||
|
#include "currencies.h"
|
||||||
#include "optionsmodel.h"
|
#include "optionsmodel.h"
|
||||||
#include "transactiontablemodel.h"
|
#include "transactiontablemodel.h"
|
||||||
#include "transactionfilterproxy.h"
|
#include "transactionfilterproxy.h"
|
||||||
@@ -11,8 +12,12 @@
|
|||||||
#include "guiconstants.h"
|
#include "guiconstants.h"
|
||||||
#include "qtquick_controls/cpp/guibannerwidget.h"
|
#include "qtquick_controls/cpp/guibannerwidget.h"
|
||||||
|
|
||||||
|
#include "CSCPublicAPI/casinocoinwebapi.h"
|
||||||
|
#include "CSCPublicAPI/casinocoinwebapiparser.h"
|
||||||
|
|
||||||
#include <QAbstractItemDelegate>
|
#include <QAbstractItemDelegate>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#define DECORATION_SIZE 64
|
#define DECORATION_SIZE 64
|
||||||
#define NUM_ITEMS 3
|
#define NUM_ITEMS 3
|
||||||
@@ -102,7 +107,9 @@ OverviewPage::OverviewPage(QWidget *parent) :
|
|||||||
currentImmatureBalance(-1),
|
currentImmatureBalance(-1),
|
||||||
txdelegate(new TxViewDelegate()),
|
txdelegate(new TxViewDelegate()),
|
||||||
filter(0),
|
filter(0),
|
||||||
advertsWidget(0)
|
advertsWidget(0),
|
||||||
|
cscWebApiParser( new CasinoCoinWebAPIParser( this ) ),
|
||||||
|
cscWebApi( new CasinoCoinWebAPI( this ) )
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
createAdvertsWidget();
|
createAdvertsWidget();
|
||||||
@@ -114,6 +121,9 @@ 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)));
|
||||||
|
connect( cscWebApi, SIGNAL( signalResponseReady(const QByteArray&)), cscWebApiParser, SLOT( slotParseAnswer(const QByteArray&)), Qt::UniqueConnection );
|
||||||
|
connect( cscWebApi, SIGNAL( signalNetworkError(QNetworkReply::NetworkError,const QUrl)), cscWebApiParser, SLOT( slotNetworkError(QNetworkReply::NetworkError,const QUrl)), Qt::UniqueConnection );
|
||||||
|
connect( cscWebApiParser, SIGNAL( signalCoinInfoParsed(JsonCoinInfoParser*)), this, SLOT( updateCoinInfoFromWeb(JsonCoinInfoParser*)), Qt::UniqueConnection );
|
||||||
|
|
||||||
// init "out of sync" warning labels
|
// init "out of sync" warning labels
|
||||||
ui->labelWalletStatus->setText("(" + tr("out of sync") + ")");
|
ui->labelWalletStatus->setText("(" + tr("out of sync") + ")");
|
||||||
@@ -121,6 +131,9 @@ OverviewPage::OverviewPage(QWidget *parent) :
|
|||||||
|
|
||||||
// start with displaying the "out of sync" warnings
|
// start with displaying the "out of sync" warnings
|
||||||
showOutOfSyncWarning(true);
|
showOutOfSyncWarning(true);
|
||||||
|
|
||||||
|
// get CoinInfo from the web
|
||||||
|
getCoinInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverviewPage::handleTransactionClicked(const QModelIndex &index)
|
void OverviewPage::handleTransactionClicked(const QModelIndex &index)
|
||||||
@@ -149,6 +162,8 @@ void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64
|
|||||||
bool showImmature = immatureBalance != 0;
|
bool showImmature = immatureBalance != 0;
|
||||||
ui->labelImmature->setVisible(showImmature);
|
ui->labelImmature->setVisible(showImmature);
|
||||||
ui->labelImmatureText->setVisible(showImmature);
|
ui->labelImmatureText->setVisible(showImmature);
|
||||||
|
// set fiat balance
|
||||||
|
updateFiatBalance();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverviewPage::createAdvertsWidget()
|
void OverviewPage::createAdvertsWidget()
|
||||||
@@ -244,3 +259,34 @@ void OverviewPage::on_pushButtonToggleAdverts_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OverviewPage::getCoinInfo()
|
||||||
|
{
|
||||||
|
if ( cscWebApi )
|
||||||
|
{
|
||||||
|
cscWebApi->GetCoinInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OverviewPage::updateCoinInfoFromWeb( JsonCoinInfoParser* coinInfoParser )
|
||||||
|
{
|
||||||
|
qDebug() << "CoinInfo ID: " << coinInfoParser->getCoinInfo().find("ID").value().toDouble();
|
||||||
|
qDebug() << "CoinInfo InfoTime: " <<coinInfoParser->getCoinInfo().find("InfoTime").value().toString();
|
||||||
|
// save the coin information
|
||||||
|
coinInformation = coinInfoParser->getCoinInfo();
|
||||||
|
// calculate and set the estimated fiat balance
|
||||||
|
updateFiatBalance();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OverviewPage::updateFiatBalance()
|
||||||
|
{
|
||||||
|
if(!coinInformation.isEmpty())
|
||||||
|
{
|
||||||
|
int currency = walletModel->getOptionsModel()->getDisplayFiatCurrency();
|
||||||
|
QString conversionCurrency = QString("Price").append(Currencies::name(currency));
|
||||||
|
double currencyValue = coinInformation.find(conversionCurrency).value().toDouble();
|
||||||
|
double fiatBalance = currentBalance * currencyValue * 0.00000001;
|
||||||
|
qDebug() << "updateFiatBalance: " << QString::number(fiatBalance,'f',2);
|
||||||
|
ui->labelBalanceFiat->setText(QString::number(fiatBalance,'f',2).append(" ").append(Currencies::name(currency)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define OVERVIEWPAGE_H
|
#define OVERVIEWPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class OverviewPage;
|
class OverviewPage;
|
||||||
@@ -11,6 +12,9 @@ class WalletModel;
|
|||||||
class TxViewDelegate;
|
class TxViewDelegate;
|
||||||
class TransactionFilterProxy;
|
class TransactionFilterProxy;
|
||||||
class GUIBannerWidget;
|
class GUIBannerWidget;
|
||||||
|
class CasinoCoinWebAPIParser;
|
||||||
|
class CasinoCoinWebAPI;
|
||||||
|
class JsonCoinInfoParser;
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
@@ -49,12 +53,19 @@ private:
|
|||||||
GUIBannerWidget* advertsWidget;
|
GUIBannerWidget* advertsWidget;
|
||||||
/** Create widget to populate adverts */
|
/** Create widget to populate adverts */
|
||||||
void createAdvertsWidget();
|
void createAdvertsWidget();
|
||||||
|
/** Get the CoinInfo from REST service */
|
||||||
|
CasinoCoinWebAPIParser* cscWebApiParser;
|
||||||
|
CasinoCoinWebAPI* cscWebApi;
|
||||||
|
void getCoinInfo();
|
||||||
|
QJsonObject coinInformation;
|
||||||
|
void updateFiatBalance();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateDisplayUnit();
|
void updateDisplayUnit();
|
||||||
void handleTransactionClicked(const QModelIndex &index);
|
void handleTransactionClicked(const QModelIndex &index);
|
||||||
void updateAlerts(const QString &warnings);
|
void updateAlerts(const QString &warnings);
|
||||||
void on_pushButtonToggleAdverts_clicked();
|
void on_pushButtonToggleAdverts_clicked();
|
||||||
|
void updateCoinInfoFromWeb( JsonCoinInfoParser* coinInfoParser );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OVERVIEWPAGE_H
|
#endif // OVERVIEWPAGE_H
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ PryptoPage::PryptoPage(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect( &networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseAPINetworkResponse(QNetworkReply*)) );
|
connect( &networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseAPINetworkResponse(QNetworkReply*)) );
|
||||||
connect( this, SIGNAL(apiResponseReady(QByteArray)), this, SLOT(showAPIResult(QByteArray)) );
|
connect( this, SIGNAL(apiResponseReady(QByteArray)), this, SLOT(showAPIResult(QByteArray)) );
|
||||||
connect( this, SIGNAL(apiNetworkError(QNetworkReply::NetworkError*)), this, SLOT(showAPINetworkError(QNetworkReply*)) );
|
connect( this, SIGNAL(apiNetworkError(QNetworkReply::NetworkError)), this, SLOT(showAPINetworkError(QNetworkReply::NetworkError)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PryptoPage::setWalletModel(WalletModel *model)
|
void PryptoPage::setWalletModel(WalletModel *model)
|
||||||
@@ -81,10 +81,11 @@ void PryptoPage::parseAPINetworkResponse( QNetworkReply *finished )
|
|||||||
emit apiResponseReady( data );
|
emit apiResponseReady( data );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PryptoPage::showAPINetworkError(QNetworkReply *reply)
|
void PryptoPage::showAPINetworkError(QNetworkReply::NetworkError error)
|
||||||
{
|
{
|
||||||
|
qDebug() << "PryptoPage::showAPINetworkError: " << error;
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText("Error redeeming Prypto Card: " + reply->errorString());
|
msgBox.setText("Error redeeming Prypto Card.");
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void apiResponseReady( const QByteArray& content );
|
void apiResponseReady( const QByteArray& content );
|
||||||
void apiNetworkError( QNetworkReply::NetworkError error );
|
void apiNetworkError( const QNetworkReply::NetworkError& error );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_butRedeem_clicked();
|
void on_butRedeem_clicked();
|
||||||
void parseAPINetworkResponse( QNetworkReply *finished );
|
void parseAPINetworkResponse( QNetworkReply *finished );
|
||||||
void showAPIResult(QByteArray data);
|
void showAPIResult(QByteArray data);
|
||||||
void showAPINetworkError(QNetworkReply *reply);
|
void showAPINetworkError(QNetworkReply::NetworkError error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const QString strAPIEndpoint;
|
static const QString strAPIEndpoint;
|
||||||
|
|||||||
Reference in New Issue
Block a user