Added active exchanges parser

This commit is contained in:
Andre Jochems
2015-11-26 14:30:24 +01:00
parent f7a752473b
commit 849a807d38
14 changed files with 653 additions and 447 deletions

23
QmlImports.qml Normal file
View File

@@ -0,0 +1,23 @@
import QtQuick 2.0
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.1
import QtQuick.Layouts 1.1
import QtQuick.Window 2.1
import QtQuick.Controls.Styles 1.2
/*
QmlImports.qml
Declaration of QML Imports required by project.
This is necessary if we want to keep qml files in a folder
separate from .pro file because of the way qmlimportscanner works.
If these imports are not declared, qmake will not recognize them,
and QtQuick will not be packaged with statically built apps and imported
at runtime.
This must be kept in the same directory as your .pro file
*/
QtObject {}

View File

@@ -0,0 +1,14 @@
// This file is autogenerated by qmake. It imports static plugin classes for
// static plugins used by QML imports.
#include <QtPlugin>
Q_IMPORT_PLUGIN(QtQuick2Plugin)
Q_IMPORT_PLUGIN(QtQuickControlsPlugin)
Q_IMPORT_PLUGIN(QtQuick2DialogsPlugin)
Q_IMPORT_PLUGIN(QtQuickLayoutsPlugin)
Q_IMPORT_PLUGIN(QtQuick2WindowPlugin)
Q_IMPORT_PLUGIN(QmlFolderListModelPlugin)
Q_IMPORT_PLUGIN(QmlSettingsPlugin)
Q_IMPORT_PLUGIN(QtQuick2DialogsPrivatePlugin)
Q_IMPORT_PLUGIN(QtQuickExtrasPlugin)
Q_IMPORT_PLUGIN(QtQmlModelsPlugin)
Q_IMPORT_PLUGIN(QtQuick2PrivateWidgetsPlugin)

View File

@@ -88,8 +88,8 @@ void CasinoCoinWebAPIParser::ParseCasinos( const QJsonObject& a_rJsonCasinos )
void CasinoCoinWebAPIParser::ParseExchanges( const QJsonObject& a_rJsonExchanges ) void CasinoCoinWebAPIParser::ParseExchanges( const QJsonObject& a_rJsonExchanges )
{ {
qDebug() << "Coming soon - ParseExchanges"; qDebug() << "ParseExchanges";
qDebug() << a_rJsonExchanges; emit signalActiveExchangesParsed( new JsonActiveExchangesParser( a_rJsonExchanges ) );
} }
void CasinoCoinWebAPIParser::ParseNewsItems( const QJsonObject& a_rJsonNewsItems ) void CasinoCoinWebAPIParser::ParseNewsItems( const QJsonObject& a_rJsonNewsItems )

View File

@@ -6,6 +6,8 @@
#include "jsonactivepromotionsparser.h" #include "jsonactivepromotionsparser.h"
#include "jsonsingleactivepromotion.h" #include "jsonsingleactivepromotion.h"
#include "jsoncoininfoparser.h" #include "jsoncoininfoparser.h"
#include "jsonactiveexchangesparser.h"
#include "jsonsingleactiveexchange.h"
#include <QNetworkReply> #include <QNetworkReply>
@@ -20,7 +22,7 @@ signals:
void signalActivePromotionsParsed( JsonActivePromotionsParser* a_pActivePromotions ); void signalActivePromotionsParsed( JsonActivePromotionsParser* a_pActivePromotions );
void signalCoinInfoParsed( JsonCoinInfoParser* a_pCoinInfo ); void signalCoinInfoParsed( JsonCoinInfoParser* a_pCoinInfo );
// void signalActiveCasinosParsed( JsonActiveCasinosParser* a_pActivePromotions ); // void signalActiveCasinosParsed( JsonActiveCasinosParser* a_pActivePromotions );
// void signalActiveExchangesParsed( JsonActiveExchangesParser* a_pActivePromotions ); void signalActiveExchangesParsed( JsonActiveExchangesParser* a_pActiveExchanges );
// void signalActiveNewsItemsParsed( JsonActiveNewsItemsParser* a_pActivePromotions ); // void signalActiveNewsItemsParsed( JsonActiveNewsItemsParser* a_pActivePromotions );
public slots: public slots:

View File

@@ -0,0 +1,54 @@
#include "jsonactiveexchangesparser.h"
#include "../qtquick_controls/cpp/qmlimageprovider.h"
#include <QDebug>
JsonActiveExchangesParser::JsonActiveExchangesParser()
{
}
JsonActiveExchangesParser::JsonActiveExchangesParser( const QJsonObject& a_rOther )
: QJsonObject( a_rOther )
{
ResolveExchangesArray();
}
void JsonActiveExchangesParser::ResolveExchangesArray()
{
if ( find( "Result" ).value().isObject() )
{
if ( find( "Result" ).value().toObject().find( "ActiveExchanges" ).value().isArray() )
{
QJsonArray arrayOfExchangeDescriptors( find( "Result" ).value().toObject().find( "ActiveExchanges" ).value().toArray() );
foreach( QJsonValue singleExchangeDescriptor, arrayOfExchangeDescriptors )
{
if ( singleExchangeDescriptor.isObject() )
{
m_aActiveExchanges.append( JsonSingleActiveExchange( singleExchangeDescriptor.toObject() ) );
}
}
}
}
}
const QList<JsonSingleActiveExchange>& JsonActiveExchangesParser::GetExchanges() const
{
return m_aActiveExchanges;
}
QList<JsonSingleActiveExchange>& JsonActiveExchangesParser::GetExchanges()
{
return m_aActiveExchanges;
}
void JsonActiveExchangesParser::AddImagesToPool( QmlImageProvider* a_pImageProvider )
{
if ( a_pImageProvider )
{
foreach( JsonSingleActiveExchange oExchange, m_aActiveExchanges )
{
a_pImageProvider->AddToImagePool( oExchange.getImageName(), oExchange.getExchangeImage() );
}
}
}

View File

@@ -0,0 +1,31 @@
#ifndef JSONACTIVEEXCHANGESPARSER_H
#define JSONACTIVEEXCHANGESPARSER_H
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonArray>
#include <QList>
#include "jsonsingleactiveexchange.h"
class QmlImageProvider;
class JsonActiveExchangesParser : public QJsonObject
{
public:
JsonActiveExchangesParser();
JsonActiveExchangesParser( const QJsonObject& a_rOther );
virtual ~JsonActiveExchangesParser(){}
const QList<JsonSingleActiveExchange>& GetExchanges() const;
QList<JsonSingleActiveExchange>& GetExchanges();
void AddImagesToPool( QmlImageProvider* a_pImageProvider );
private:
void ResolveExchangesArray();
QList<JsonSingleActiveExchange> m_aActiveExchanges;
};
#endif // JSONACTIVEEXCHANGESPARSER_H

View File

@@ -0,0 +1,42 @@
#include "jsonsingleactiveexchange.h"
#include <QFile>
#include <QImage>
#include <QDir>
#include <QDebug>
JsonSingleActiveExchange::JsonSingleActiveExchange()
{
}
JsonSingleActiveExchange::JsonSingleActiveExchange( const QJsonObject& a_rOther )
: QJsonObject( a_rOther )
{
m_strImageName = find( "exchange_name" ).value().toString().remove( getRestrictedCharacters() );
storeImage();
m_strExchangeName = find( "exchange_name" ).value().toString().remove( getRestrictedCharacters() );
m_strAccessUrl = find( "access_url" ).value().toString();
m_strDescription = find( "description" ).value().toString();
m_dblLastBidPriceBTC = find( "last_bid_price_btc" ).value().toDouble();
m_dblLastAskPriceBTC = find( "last_ask_price_btc" ).value().toDouble();
m_dblLastPriceBTC = find( "last_price_btc" ).value().toDouble();
m_dblVolume24H = find( "volume24h" ).value().toDouble();
m_strLastUpdateTime = find( "last_update_time" ).value().toString();
}
QRegExp JsonSingleActiveExchange::getRestrictedCharacters()
{
return QRegExp( "[<,>|\\:()&;#?*% ]" );
}
void JsonSingleActiveExchange::storeImage()
{
if ( find( "image_mime_type" ).value().toString().split( "/" ).first().contains( "image" ) )
{
QByteArray binaryData = QByteArray::fromBase64( find( "exchange_image" ).value().toString().toLocal8Bit() );
m_oExchangeImage = QImage::fromData( binaryData );
}
}

View File

@@ -0,0 +1,46 @@
#ifndef JSONSINGLEACTIVEEXCHANGE_H
#define JSONSINGLEACTIVEEXCHANGE_H
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonArray>
#include <QImage>
class JsonSingleActiveExchange : public QJsonObject
{
public:
JsonSingleActiveExchange();
JsonSingleActiveExchange( const QJsonObject& a_rOther );
virtual ~JsonSingleActiveExchange(){}
QString getImageName() const{ return m_strImageName; }
QImage getExchangeImage() const { return m_oExchangeImage; }
QString getExchangeName() const{ return m_strExchangeName; }
QString getAccessUrl() const{ return m_strAccessUrl; }
QString getDescription() const{ return m_strDescription; }
double getLastBidPriceBTC() const{ return m_dblLastBidPriceBTC; }
double getLastAskPriceBTC() const{ return m_dblLastAskPriceBTC; }
double getLastPriceBTC() const{ return m_dblLastBidPriceBTC; }
double getVolume24H() const{ return m_dblVolume24H; }
QString getLastUpdateTime() const{ return m_strLastUpdateTime; }
private:
void storeImage();
static QRegExp getRestrictedCharacters();
QString m_strImageName;
QImage m_oExchangeImage;
QString m_strExchangeName;
QString m_strAccessUrl;
QString m_strDescription;
double m_dblLastBidPriceBTC;
double m_dblLastAskPriceBTC;
double m_dblLastPriceBTC;
double m_dblVolume24H;
QString m_strLastUpdateTime;
};
#endif // JSONSINGLEACTIVEEXCHANGE_H

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>500</height> <height>600</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -159,456 +159,429 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QScrollArea" name="scrollArea"> <layout class="QGridLayout" name="gridLayout_3">
<property name="sizePolicy"> <item row="0" column="0">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <layout class="QFormLayout" name="formCoinDetails">
<horstretch>0</horstretch> <property name="fieldGrowthPolicy">
<verstretch>0</verstretch> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</sizepolicy> </property>
</property> <property name="horizontalSpacing">
<property name="verticalScrollBarPolicy"> <number>15</number>
<enum>Qt::ScrollBarAlwaysOn</enum> </property>
</property> <property name="verticalSpacing">
<property name="horizontalScrollBarPolicy"> <number>10</number>
<enum>Qt::ScrollBarAsNeeded</enum> </property>
</property> <property name="leftMargin">
<property name="widgetResizable"> <number>10</number>
<bool>true</bool> </property>
</property> <property name="topMargin">
<widget class="QWidget" name="scrollAreaWidgetContents_2"> <number>10</number>
<property name="geometry"> </property>
<rect> <property name="rightMargin">
<x>0</x> <number>10</number>
<y>0</y> </property>
<width>343</width> <property name="bottomMargin">
<height>217</height> <number>10</number>
</rect> </property>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QFormLayout" name="formCoinDetails"> <widget class="QLabel" name="lblBlockHeight">
<property name="fieldGrowthPolicy"> <property name="styleSheet">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> <string notr="true"/>
</property> </property>
<property name="horizontalSpacing"> <property name="text">
<number>15</number> <string>Current number of blocks</string>
</property> </property>
<property name="verticalSpacing"> <property name="wordWrap">
<number>10</number> <bool>true</bool>
</property> </property>
<property name="leftMargin"> </widget>
<number>10</number> </item>
<item row="0" column="1">
<widget class="QLabel" name="txtBlockHeight">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property> </property>
<property name="topMargin"> <property name="styleSheet">
<number>10</number> <string notr="true"/>
</property> </property>
<property name="rightMargin"> <property name="text">
<number>10</number> <string notr="true">-</string>
</property> </property>
<property name="bottomMargin"> <property name="wordWrap">
<number>10</number> <bool>true</bool>
</property> </property>
<item row="0" column="0"> </widget>
<widget class="QLabel" name="lblBlockHeight"> </item>
<property name="styleSheet"> <item row="1" column="0">
<string notr="true"/> <widget class="QLabel" name="lblLastBlockTime">
</property> <property name="styleSheet">
<property name="text"> <string notr="true"/>
<string>Current number of blocks</string> </property>
</property> <property name="text">
<property name="wordWrap"> <string>Last block time</string>
<bool>true</bool> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
</item> </property>
<item row="0" column="1"> </widget>
<widget class="QLabel" name="txtBlockHeight"> </item>
<property name="font"> <item row="1" column="1">
<font> <widget class="QLabel" name="txtLastBlockTime">
<weight>75</weight> <property name="font">
<bold>true</bold> <font>
</font> <weight>75</weight>
</property> <bold>true</bold>
<property name="styleSheet"> </font>
<string notr="true"/> </property>
</property> <property name="styleSheet">
<property name="text"> <string notr="true"/>
<string notr="true">-</string> </property>
</property> <property name="text">
<property name="wordWrap"> <string notr="true">-</string>
<bool>true</bool> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
</item> </property>
<item row="1" column="0"> </widget>
<widget class="QLabel" name="lblLastBlockTime"> </item>
<property name="styleSheet"> <item row="2" column="0">
<string notr="true"/> <widget class="QLabel" name="lblCoinSupply">
</property> <property name="styleSheet">
<property name="text"> <string notr="true"/>
<string>Last block time</string> </property>
</property> <property name="text">
<property name="wordWrap"> <string>Coin Supply</string>
<bool>true</bool> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
</item> </property>
<item row="1" column="1"> </widget>
<widget class="QLabel" name="txtLastBlockTime"> </item>
<property name="font"> <item row="2" column="1">
<font> <widget class="QLabel" name="txtCoinSupply">
<weight>75</weight> <property name="palette">
<bold>true</bold> <palette>
</font> <active>
</property> <colorrole role="WindowText">
<property name="styleSheet"> <brush brushstyle="SolidPattern">
<string notr="true"/> <color alpha="255">
</property> <red>0</red>
<property name="text"> <green>0</green>
<string notr="true">-</string> <blue>0</blue>
</property> </color>
<property name="wordWrap"> </brush>
<bool>true</bool> </colorrole>
</property> <colorrole role="Button">
</widget> <brush brushstyle="SolidPattern">
</item> <color alpha="255">
<item row="2" column="0"> <red>255</red>
<widget class="QLabel" name="lblCoinSupply"> <green>255</green>
<property name="styleSheet"> <blue>255</blue>
<string notr="true"/> </color>
</property> </brush>
<property name="text"> </colorrole>
<string>Coin Supply</string> <colorrole role="Text">
</property> <brush brushstyle="SolidPattern">
<property name="wordWrap"> <color alpha="255">
<bool>true</bool> <red>0</red>
</property> <green>0</green>
</widget> <blue>0</blue>
</item> </color>
<item row="2" column="1"> </brush>
<widget class="QLabel" name="txtCoinSupply"> </colorrole>
<property name="palette"> <colorrole role="ButtonText">
<palette> <brush brushstyle="SolidPattern">
<active> <color alpha="255">
<colorrole role="WindowText"> <red>0</red>
<brush brushstyle="SolidPattern"> <green>0</green>
<color alpha="255"> <blue>0</blue>
<red>0</red> </color>
<green>0</green> </brush>
<blue>0</blue> </colorrole>
</color> <colorrole role="Base">
</brush> <brush brushstyle="SolidPattern">
</colorrole> <color alpha="255">
<colorrole role="Button"> <red>255</red>
<brush brushstyle="SolidPattern"> <green>255</green>
<color alpha="255"> <blue>255</blue>
<red>255</red> </color>
<green>255</green> </brush>
<blue>255</blue> </colorrole>
</color> <colorrole role="Window">
</brush> <brush brushstyle="SolidPattern">
</colorrole> <color alpha="255">
<colorrole role="Text"> <red>255</red>
<brush brushstyle="SolidPattern"> <green>255</green>
<color alpha="255"> <blue>255</blue>
<red>0</red> </color>
<green>0</green> </brush>
<blue>0</blue> </colorrole>
</color> </active>
</brush> <inactive>
</colorrole> <colorrole role="WindowText">
<colorrole role="ButtonText"> <brush brushstyle="SolidPattern">
<brush brushstyle="SolidPattern"> <color alpha="255">
<color alpha="255"> <red>0</red>
<red>0</red> <green>0</green>
<green>0</green> <blue>0</blue>
<blue>0</blue> </color>
</color> </brush>
</brush> </colorrole>
</colorrole> <colorrole role="Button">
<colorrole role="Base"> <brush brushstyle="SolidPattern">
<brush brushstyle="SolidPattern"> <color alpha="255">
<color alpha="255"> <red>255</red>
<red>255</red> <green>255</green>
<green>255</green> <blue>255</blue>
<blue>255</blue> </color>
</color> </brush>
</brush> </colorrole>
</colorrole> <colorrole role="Text">
<colorrole role="Window"> <brush brushstyle="SolidPattern">
<brush brushstyle="SolidPattern"> <color alpha="255">
<color alpha="255"> <red>0</red>
<red>255</red> <green>0</green>
<green>255</green> <blue>0</blue>
<blue>255</blue> </color>
</color> </brush>
</brush> </colorrole>
</colorrole> <colorrole role="ButtonText">
</active> <brush brushstyle="SolidPattern">
<inactive> <color alpha="255">
<colorrole role="WindowText"> <red>0</red>
<brush brushstyle="SolidPattern"> <green>0</green>
<color alpha="255"> <blue>0</blue>
<red>0</red> </color>
<green>0</green> </brush>
<blue>0</blue> </colorrole>
</color> <colorrole role="Base">
</brush> <brush brushstyle="SolidPattern">
</colorrole> <color alpha="255">
<colorrole role="Button"> <red>255</red>
<brush brushstyle="SolidPattern"> <green>255</green>
<color alpha="255"> <blue>255</blue>
<red>255</red> </color>
<green>255</green> </brush>
<blue>255</blue> </colorrole>
</color> <colorrole role="Window">
</brush> <brush brushstyle="SolidPattern">
</colorrole> <color alpha="255">
<colorrole role="Text"> <red>255</red>
<brush brushstyle="SolidPattern"> <green>255</green>
<color alpha="255"> <blue>255</blue>
<red>0</red> </color>
<green>0</green> </brush>
<blue>0</blue> </colorrole>
</color> </inactive>
</brush> <disabled>
</colorrole> <colorrole role="WindowText">
<colorrole role="ButtonText"> <brush brushstyle="SolidPattern">
<brush brushstyle="SolidPattern"> <color alpha="255">
<color alpha="255"> <red>0</red>
<red>0</red> <green>0</green>
<green>0</green> <blue>0</blue>
<blue>0</blue> </color>
</color> </brush>
</brush> </colorrole>
</colorrole> <colorrole role="Button">
<colorrole role="Base"> <brush brushstyle="SolidPattern">
<brush brushstyle="SolidPattern"> <color alpha="255">
<color alpha="255"> <red>255</red>
<red>255</red> <green>255</green>
<green>255</green> <blue>255</blue>
<blue>255</blue> </color>
</color> </brush>
</brush> </colorrole>
</colorrole> <colorrole role="Text">
<colorrole role="Window"> <brush brushstyle="SolidPattern">
<brush brushstyle="SolidPattern"> <color alpha="255">
<color alpha="255"> <red>0</red>
<red>255</red> <green>0</green>
<green>255</green> <blue>0</blue>
<blue>255</blue> </color>
</color> </brush>
</brush> </colorrole>
</colorrole> <colorrole role="ButtonText">
</inactive> <brush brushstyle="SolidPattern">
<disabled> <color alpha="255">
<colorrole role="WindowText"> <red>0</red>
<brush brushstyle="SolidPattern"> <green>0</green>
<color alpha="255"> <blue>0</blue>
<red>0</red> </color>
<green>0</green> </brush>
<blue>0</blue> </colorrole>
</color> <colorrole role="Base">
</brush> <brush brushstyle="SolidPattern">
</colorrole> <color alpha="255">
<colorrole role="Button"> <red>255</red>
<brush brushstyle="SolidPattern"> <green>255</green>
<color alpha="255"> <blue>255</blue>
<red>255</red> </color>
<green>255</green> </brush>
<blue>255</blue> </colorrole>
</color> <colorrole role="Window">
</brush> <brush brushstyle="SolidPattern">
</colorrole> <color alpha="255">
<colorrole role="Text"> <red>255</red>
<brush brushstyle="SolidPattern"> <green>255</green>
<color alpha="255"> <blue>255</blue>
<red>0</red> </color>
<green>0</green> </brush>
<blue>0</blue> </colorrole>
</color> </disabled>
</brush> </palette>
</colorrole> </property>
<colorrole role="ButtonText"> <property name="font">
<brush brushstyle="SolidPattern"> <font>
<color alpha="255"> <weight>75</weight>
<red>0</red> <bold>true</bold>
<green>0</green> </font>
<blue>0</blue> </property>
</color> <property name="styleSheet">
</brush> <string notr="true"/>
</colorrole> </property>
<colorrole role="Base"> <property name="text">
<brush brushstyle="SolidPattern"> <string notr="true">-</string>
<color alpha="255"> </property>
<red>255</red> <property name="wordWrap">
<green>255</green> <bool>true</bool>
<blue>255</blue> </property>
</color> </widget>
</brush> </item>
</colorrole> <item row="3" column="0">
<colorrole role="Window"> <widget class="QLabel" name="lblConnections">
<brush brushstyle="SolidPattern"> <property name="styleSheet">
<color alpha="255"> <string notr="true"/>
<red>255</red> </property>
<green>255</green> <property name="text">
<blue>255</blue> <string>Number of connections</string>
</color> </property>
</brush> <property name="wordWrap">
</colorrole> <bool>true</bool>
</disabled> </property>
</palette> </widget>
</property> </item>
<property name="font"> <item row="3" column="1">
<font> <widget class="QLabel" name="txtConnections">
<weight>75</weight> <property name="font">
<bold>true</bold> <font>
</font> <weight>75</weight>
</property> <bold>true</bold>
<property name="styleSheet"> </font>
<string notr="true"/> </property>
</property> <property name="styleSheet">
<property name="text"> <string notr="true"/>
<string notr="true">-</string> </property>
</property> <property name="text">
<property name="wordWrap"> <string notr="true">-</string>
<bool>true</bool> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
</item> </property>
<item row="3" column="0"> </widget>
<widget class="QLabel" name="lblConnections"> </item>
<property name="styleSheet"> <item row="4" column="0">
<string notr="true"/> <widget class="QLabel" name="lblDifficulty">
</property> <property name="styleSheet">
<property name="text"> <string notr="true"/>
<string>Number of connections</string> </property>
</property> <property name="text">
<property name="wordWrap"> <string>Difficulty</string>
<bool>true</bool> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
</item> </property>
<item row="3" column="1"> </widget>
<widget class="QLabel" name="txtConnections"> </item>
<property name="font"> <item row="4" column="1">
<font> <widget class="QLabel" name="txtDifficulty">
<weight>75</weight> <property name="font">
<bold>true</bold> <font>
</font> <weight>75</weight>
</property> <bold>true</bold>
<property name="styleSheet"> </font>
<string notr="true"/> </property>
</property> <property name="styleSheet">
<property name="text"> <string notr="true"/>
<string notr="true">-</string> </property>
</property> <property name="text">
<property name="wordWrap"> <string notr="true">-</string>
<bool>true</bool> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
</item> </property>
<item row="4" column="0"> </widget>
<widget class="QLabel" name="lblDifficulty"> </item>
<property name="styleSheet"> <item row="5" column="0">
<string notr="true"/> <widget class="QLabel" name="lblHashRate">
</property> <property name="styleSheet">
<property name="text"> <string notr="true"/>
<string>Difficulty</string> </property>
</property> <property name="text">
<property name="wordWrap"> <string>Network Hashrate</string>
<bool>true</bool> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
</item> </property>
<item row="4" column="1"> </widget>
<widget class="QLabel" name="txtDifficulty"> </item>
<property name="font"> <item row="5" column="1">
<font> <widget class="QLabel" name="txtHashRate">
<weight>75</weight> <property name="font">
<bold>true</bold> <font>
</font> <weight>75</weight>
</property> <bold>true</bold>
<property name="styleSheet"> </font>
<string notr="true"/> </property>
</property> <property name="styleSheet">
<property name="text"> <string notr="true"/>
<string notr="true">-</string> </property>
</property> <property name="text">
<property name="wordWrap"> <string notr="true">-</string>
<bool>true</bool> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
</item> </property>
<item row="5" column="0"> </widget>
<widget class="QLabel" name="lblHashRate"> </item>
<property name="styleSheet"> <item row="6" column="0">
<string notr="true"/> <widget class="QLabel" name="lblTransactionCount">
</property> <property name="styleSheet">
<property name="text"> <string notr="true"/>
<string>Network Hashrate</string> </property>
</property> <property name="text">
<property name="wordWrap"> <string>Transactions</string>
<bool>true</bool> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
</item> </property>
<item row="5" column="1"> </widget>
<widget class="QLabel" name="txtHashRate"> </item>
<property name="font"> <item row="6" column="1">
<font> <widget class="QLabel" name="txtTransactionCount">
<weight>75</weight> <property name="font">
<bold>true</bold> <font>
</font> <weight>75</weight>
</property> <bold>true</bold>
<property name="styleSheet"> </font>
<string notr="true"/> </property>
</property> <property name="styleSheet">
<property name="text"> <string notr="true"/>
<string notr="true">-</string> </property>
</property> <property name="text">
<property name="wordWrap"> <string notr="true">-</string>
<bool>true</bool> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
</item> </property>
<item row="6" column="0"> </widget>
<widget class="QLabel" name="lblTransactionCount">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Transactions</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</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"/>
</property>
<property name="text">
<string notr="true">-</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </item>
</widget> </layout>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@@ -83,6 +83,14 @@
</item> </item>
<item row="4" column="1"> <item row="4" column="1">
<widget class="QPushButton" name="butRedeem"> <widget class="QPushButton" name="butRedeem">
<property name="styleSheet">
<string notr="true">background-color: rgb(166, 27, 31);
color: rgb(255, 255, 255);
pressed
{
background-color: rgb(166, 27, 31);
}</string>
</property>
<property name="text"> <property name="text">
<string>Redeem</string> <string>Redeem</string>
</property> </property>
@@ -91,7 +99,10 @@
<normaloff>:/icons/res/icons/prypto.png</normaloff>:/icons/res/icons/prypto.png</iconset> <normaloff>:/icons/res/icons/prypto.png</normaloff>:/icons/res/icons/prypto.png</iconset>
</property> </property>
<property name="autoDefault"> <property name="autoDefault">
<bool>false</bool> <bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -730,11 +730,11 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgb(170, 28, 33); <string notr="true">background-color: rgb(166, 27, 31);
color: rgb(255, 255, 255); color: rgb(255, 255, 255);
pressed pressed
{ {
background-color: rgb(170, 28, 33); background-color: rgb(166, 27, 31);
}</string> }</string>
</property> </property>
<property name="text"> <property name="text">

View File

@@ -5,6 +5,7 @@
#include <QSsl> #include <QSsl>
#include <QMessageBox> #include <QMessageBox>
#include <QDebug> #include <QDebug>
#include <QListIterator>
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";
@@ -18,6 +19,7 @@ PryptoPage::PryptoPage(QWidget *parent) :
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::NetworkError)) ); connect( this, SIGNAL(apiNetworkError(QNetworkReply::NetworkError)), this, SLOT(showAPINetworkError(QNetworkReply::NetworkError)) );
connect( &networkAccessManager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> & )), this, SLOT(sslErrorHandler(QNetworkReply*, const QList<QSslError> & )));
} }
void PryptoPage::setWalletModel(WalletModel *model) void PryptoPage::setWalletModel(WalletModel *model)
@@ -82,6 +84,12 @@ void PryptoPage::parseAPINetworkResponse( QNetworkReply *finished )
emit apiResponseReady( data ); emit apiResponseReady( data );
} }
void PryptoPage::sslErrorHandler(QNetworkReply* qnr, const QList<QSslError> & errlist)
{
qDebug() << "---PryptoPage::sslErrorHandler: ";
qnr->ignoreSslErrors();
}
void PryptoPage::showAPINetworkError(QNetworkReply::NetworkError error) void PryptoPage::showAPINetworkError(QNetworkReply::NetworkError error)
{ {
qDebug() << "PryptoPage::showAPINetworkError: " << error; qDebug() << "PryptoPage::showAPINetworkError: " << error;

View File

@@ -6,6 +6,7 @@
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
#include <QProgressDialog> #include <QProgressDialog>
#include <QList>
class WalletModel; class WalletModel;
@@ -31,6 +32,7 @@ private slots:
void parseAPINetworkResponse( QNetworkReply *finished ); void parseAPINetworkResponse( QNetworkReply *finished );
void showAPIResult(QByteArray data); void showAPIResult(QByteArray data);
void showAPINetworkError(QNetworkReply::NetworkError error); void showAPINetworkError(QNetworkReply::NetworkError error);
void sslErrorHandler(QNetworkReply* qnr, const QList<QSslError> & errlist);
private: private:
static const QString strAPIEndpoint; static const QString strAPIEndpoint;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 26 KiB