mirror of
https://github.com/AskDavis/Casinotest.git
synced 2026-01-08 13:49:47 -08:00
Adverts widget v0.2 added:
*Querying webAPI for adverts content; *Starting browsers new tab with url specified in json file *Basic QML items and models *Overview tab layout changes *Storing images on harddrive (temporary solution) *Sending queries to webAPI straight from widget (temporary solution) coming next: -store whole json file as url/desription need to be stored for further use -display images of adverts from QImage, not from file stored on harddrive -hide/show adverts button tweaking -proper webAPI base class for querying various servers for data (prypto for instance) *
This commit is contained in:
52
src/qt/CSCPublicAPI/casinocoinwebapi.cpp
Normal file
52
src/qt/CSCPublicAPI/casinocoinwebapi.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include "casinocoinwebapi.h"
|
||||
|
||||
#include <QSsl>
|
||||
|
||||
const QString CasinoCoinWebAPI::s_strServerAddress = "http://119.81.188.59/";
|
||||
const QString CasinoCoinWebAPI::s_strServerEndpoint = "CSCPublicAPI";
|
||||
|
||||
CasinoCoinWebAPI::CasinoCoinWebAPI( QObject*a_pParent )
|
||||
: QObject(a_pParent )
|
||||
{
|
||||
connect( &m_oNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotParseNetworkResponse(QNetworkReply*)));
|
||||
}
|
||||
|
||||
void CasinoCoinWebAPI::GetActivePromotions()
|
||||
{
|
||||
Get( s_strServerAddress + "/" + s_strServerEndpoint + "/ActivePromotions" );
|
||||
}
|
||||
|
||||
void CasinoCoinWebAPI::GetActiveCasinos()
|
||||
{
|
||||
Get( s_strServerAddress + "/" + s_strServerEndpoint + "/ActiveCasinos" );
|
||||
}
|
||||
|
||||
void CasinoCoinWebAPI::GetActiveNewsItems()
|
||||
{
|
||||
Get( s_strServerAddress + "/" + s_strServerEndpoint + "/ActiveNewsItems" );
|
||||
}
|
||||
|
||||
void CasinoCoinWebAPI::GetActiveExchanges()
|
||||
{
|
||||
Get( s_strServerAddress + "/" + s_strServerEndpoint + "/ActiveExchanges" );
|
||||
}
|
||||
|
||||
void CasinoCoinWebAPI::Get( const QString& a_rUrl )
|
||||
{
|
||||
QUrl oUrl ( a_rUrl );
|
||||
QNetworkRequest oNetworkRequest ( oUrl );
|
||||
m_oNetworkAccessManager.get( oNetworkRequest );
|
||||
}
|
||||
|
||||
void CasinoCoinWebAPI::slotParseNetworkResponse( QNetworkReply *finished )
|
||||
{
|
||||
if ( finished->error() != QNetworkReply::NoError )
|
||||
{
|
||||
// A communication error has occurred
|
||||
emit signalNetworkError( finished->error() );
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray data = finished->readAll();
|
||||
emit signalResponseReady( data );
|
||||
}
|
||||
Reference in New Issue
Block a user