diff --git a/QmlImports.qml b/QmlImports.qml new file mode 100644 index 0000000..d0af3e6 --- /dev/null +++ b/QmlImports.qml @@ -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 {} diff --git a/casinocoin-qt_qml_plugin_import.cpp b/casinocoin-qt_qml_plugin_import.cpp new file mode 100644 index 0000000..736a76c --- /dev/null +++ b/casinocoin-qt_qml_plugin_import.cpp @@ -0,0 +1,14 @@ +// This file is autogenerated by qmake. It imports static plugin classes for +// static plugins used by QML imports. +#include +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) diff --git a/src/qt/CSCPublicAPI/casinocoinwebapiparser.cpp b/src/qt/CSCPublicAPI/casinocoinwebapiparser.cpp index 6665b7b..61cb935 100644 --- a/src/qt/CSCPublicAPI/casinocoinwebapiparser.cpp +++ b/src/qt/CSCPublicAPI/casinocoinwebapiparser.cpp @@ -88,8 +88,8 @@ void CasinoCoinWebAPIParser::ParseCasinos( const QJsonObject& a_rJsonCasinos ) void CasinoCoinWebAPIParser::ParseExchanges( const QJsonObject& a_rJsonExchanges ) { - qDebug() << "Coming soon - ParseExchanges"; - qDebug() << a_rJsonExchanges; + qDebug() << "ParseExchanges"; + emit signalActiveExchangesParsed( new JsonActiveExchangesParser( a_rJsonExchanges ) ); } void CasinoCoinWebAPIParser::ParseNewsItems( const QJsonObject& a_rJsonNewsItems ) diff --git a/src/qt/CSCPublicAPI/casinocoinwebapiparser.h b/src/qt/CSCPublicAPI/casinocoinwebapiparser.h index f5a19e2..ed3b237 100644 --- a/src/qt/CSCPublicAPI/casinocoinwebapiparser.h +++ b/src/qt/CSCPublicAPI/casinocoinwebapiparser.h @@ -6,6 +6,8 @@ #include "jsonactivepromotionsparser.h" #include "jsonsingleactivepromotion.h" #include "jsoncoininfoparser.h" +#include "jsonactiveexchangesparser.h" +#include "jsonsingleactiveexchange.h" #include @@ -20,7 +22,7 @@ signals: void signalActivePromotionsParsed( JsonActivePromotionsParser* a_pActivePromotions ); void signalCoinInfoParsed( JsonCoinInfoParser* a_pCoinInfo ); // void signalActiveCasinosParsed( JsonActiveCasinosParser* a_pActivePromotions ); -// void signalActiveExchangesParsed( JsonActiveExchangesParser* a_pActivePromotions ); + void signalActiveExchangesParsed( JsonActiveExchangesParser* a_pActiveExchanges ); // void signalActiveNewsItemsParsed( JsonActiveNewsItemsParser* a_pActivePromotions ); public slots: diff --git a/src/qt/CSCPublicAPI/jsonactiveexchangesparser.cpp b/src/qt/CSCPublicAPI/jsonactiveexchangesparser.cpp new file mode 100644 index 0000000..327f096 --- /dev/null +++ b/src/qt/CSCPublicAPI/jsonactiveexchangesparser.cpp @@ -0,0 +1,54 @@ +#include "jsonactiveexchangesparser.h" +#include "../qtquick_controls/cpp/qmlimageprovider.h" + +#include + +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& JsonActiveExchangesParser::GetExchanges() const +{ + return m_aActiveExchanges; +} + +QList& 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() ); + } + } +} diff --git a/src/qt/CSCPublicAPI/jsonactiveexchangesparser.h b/src/qt/CSCPublicAPI/jsonactiveexchangesparser.h new file mode 100644 index 0000000..a92b99a --- /dev/null +++ b/src/qt/CSCPublicAPI/jsonactiveexchangesparser.h @@ -0,0 +1,31 @@ +#ifndef JSONACTIVEEXCHANGESPARSER_H +#define JSONACTIVEEXCHANGESPARSER_H + +#include +#include +#include +#include + +#include "jsonsingleactiveexchange.h" + +class QmlImageProvider; + +class JsonActiveExchangesParser : public QJsonObject +{ +public: + JsonActiveExchangesParser(); + JsonActiveExchangesParser( const QJsonObject& a_rOther ); + virtual ~JsonActiveExchangesParser(){} + + const QList& GetExchanges() const; + QList& GetExchanges(); + + void AddImagesToPool( QmlImageProvider* a_pImageProvider ); + +private: + void ResolveExchangesArray(); + + QList m_aActiveExchanges; +}; + +#endif // JSONACTIVEEXCHANGESPARSER_H diff --git a/src/qt/CSCPublicAPI/jsonsingleactiveexchange.cpp b/src/qt/CSCPublicAPI/jsonsingleactiveexchange.cpp new file mode 100644 index 0000000..211bdef --- /dev/null +++ b/src/qt/CSCPublicAPI/jsonsingleactiveexchange.cpp @@ -0,0 +1,42 @@ +#include "jsonsingleactiveexchange.h" + +#include +#include +#include + +#include + +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 ); + } +} + diff --git a/src/qt/CSCPublicAPI/jsonsingleactiveexchange.h b/src/qt/CSCPublicAPI/jsonsingleactiveexchange.h new file mode 100644 index 0000000..1d2df3a --- /dev/null +++ b/src/qt/CSCPublicAPI/jsonsingleactiveexchange.h @@ -0,0 +1,46 @@ +#ifndef JSONSINGLEACTIVEEXCHANGE_H +#define JSONSINGLEACTIVEEXCHANGE_H + +#include +#include +#include + +#include + +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 diff --git a/src/qt/forms/infopage.ui b/src/qt/forms/infopage.ui index acef11b..636d747 100644 --- a/src/qt/forms/infopage.ui +++ b/src/qt/forms/infopage.ui @@ -7,7 +7,7 @@ 0 0 800 - 500 + 600 @@ -159,456 +159,429 @@ - - - - 0 - 0 - - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAsNeeded - - - true - - - - - 0 - 0 - 343 - 217 - - - + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 15 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + - - - QFormLayout::AllNonFixedFieldsGrow + + + - - 15 + + Current number of blocks - - 10 + + true - - 10 + + + + + + + 75 + true + - - 10 + + - - 10 + + - - - 10 + + true - - - - - - - Current number of blocks - - - true - - - - - - - - 75 - true - - - - - - - - - - - true - - - - - - - - - - Last block time - - - true - - - - - - - - 75 - true - - - - - - - - - - - true - - - - - - - - - - Coin Supply - - - true - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - - - 75 - true - - - - - - - - - - - true - - - - - - - - - - Number of connections - - - true - - - - - - - - 75 - true - - - - - - - - - - - true - - - - - - - - - - Difficulty - - - true - - - - - - - - 75 - true - - - - - - - - - - - true - - - - - - - - - - Network Hashrate - - - true - - - - - - - - 75 - true - - - - - - - - - - - true - - - - - - - - - - Transactions - - - true - - - - - - - - 75 - true - - - - - - - - - - - true - - - - + + + + + + + + + Last block time + + + true + + + + + + + + 75 + true + + + + + + + - + + + true + + + + + + + + + + Coin Supply + + + true + + + + + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 75 + true + + + + + + + - + + + true + + + + + + + + + + Number of connections + + + true + + + + + + + + 75 + true + + + + + + + - + + + true + + + + + + + + + + Difficulty + + + true + + + + + + + + 75 + true + + + + + + + - + + + true + + + + + + + + + + Network Hashrate + + + true + + + + + + + + 75 + true + + + + + + + - + + + true + + + + + + + + + + Transactions + + + true + + + + + + + + 75 + true + + + + + + + - + + + true + + - - + + diff --git a/src/qt/forms/pryptopage.ui b/src/qt/forms/pryptopage.ui index e79d4cb..8abbccb 100644 --- a/src/qt/forms/pryptopage.ui +++ b/src/qt/forms/pryptopage.ui @@ -83,6 +83,14 @@ + + background-color: rgb(166, 27, 31); +color: rgb(255, 255, 255); +pressed +{ +background-color: rgb(166, 27, 31); +} + Redeem @@ -91,7 +99,10 @@ :/icons/res/icons/prypto.png:/icons/res/icons/prypto.png - false + true + + + true diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 812d30b..3bbedda 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -730,11 +730,11 @@ false - background-color: rgb(170, 28, 33); + background-color: rgb(166, 27, 31); color: rgb(255, 255, 255); pressed { -background-color: rgb(170, 28, 33); +background-color: rgb(166, 27, 31); } diff --git a/src/qt/pryptopage.cpp b/src/qt/pryptopage.cpp index 0d7540a..452b59c 100644 --- a/src/qt/pryptopage.cpp +++ b/src/qt/pryptopage.cpp @@ -5,6 +5,7 @@ #include #include #include +#include const QString PryptoPage::strAPIEndpoint = "https://prypto.com/merchants/api/"; const QString PryptoPage::strMerchantToken = "35616ab118fa557b77fdac78ef09d5632d302609"; @@ -18,6 +19,7 @@ PryptoPage::PryptoPage(QWidget *parent) : connect( &networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseAPINetworkResponse(QNetworkReply*)) ); connect( this, SIGNAL(apiResponseReady(QByteArray)), this, SLOT(showAPIResult(QByteArray)) ); connect( this, SIGNAL(apiNetworkError(QNetworkReply::NetworkError)), this, SLOT(showAPINetworkError(QNetworkReply::NetworkError)) ); + connect( &networkAccessManager, SIGNAL(sslErrors(QNetworkReply*, const QList & )), this, SLOT(sslErrorHandler(QNetworkReply*, const QList & ))); } void PryptoPage::setWalletModel(WalletModel *model) @@ -82,6 +84,12 @@ void PryptoPage::parseAPINetworkResponse( QNetworkReply *finished ) emit apiResponseReady( data ); } +void PryptoPage::sslErrorHandler(QNetworkReply* qnr, const QList & errlist) +{ +qDebug() << "---PryptoPage::sslErrorHandler: "; +qnr->ignoreSslErrors(); +} + void PryptoPage::showAPINetworkError(QNetworkReply::NetworkError error) { qDebug() << "PryptoPage::showAPINetworkError: " << error; diff --git a/src/qt/pryptopage.h b/src/qt/pryptopage.h index 770da5a..c33f50f 100644 --- a/src/qt/pryptopage.h +++ b/src/qt/pryptopage.h @@ -6,6 +6,7 @@ #include #include #include +#include class WalletModel; @@ -31,6 +32,7 @@ private slots: void parseAPINetworkResponse( QNetworkReply *finished ); void showAPIResult(QByteArray data); void showAPINetworkError(QNetworkReply::NetworkError error); + void sslErrorHandler(QNetworkReply* qnr, const QList & errlist); private: static const QString strAPIEndpoint; diff --git a/src/qt/res/icons/prypto.png b/src/qt/res/icons/prypto.png index 7efe551..84ffb37 100644 Binary files a/src/qt/res/icons/prypto.png and b/src/qt/res/icons/prypto.png differ