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:
42
src/qt/CSCPublicAPI/jsonactivepromotionsparser.cpp
Normal file
42
src/qt/CSCPublicAPI/jsonactivepromotionsparser.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "jsonactivepromotionsparser.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
JsonActivePromotionsParser::JsonActivePromotionsParser()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JsonActivePromotionsParser::JsonActivePromotionsParser( const QJsonObject& a_rOther )
|
||||
: QJsonObject( a_rOther )
|
||||
{
|
||||
ResolvePromotionsArray();
|
||||
}
|
||||
|
||||
void JsonActivePromotionsParser::ResolvePromotionsArray()
|
||||
{
|
||||
if ( find( "Result" ).value().isObject() )
|
||||
{
|
||||
if ( find( "Result" ).value().toObject().find( "ActivePromotions" ).value().isArray() )
|
||||
{
|
||||
QJsonArray arrayOfCasinoDescriptors( find( "Result" ).value().toObject().find( "ActivePromotions" ).value().toArray() );
|
||||
foreach( QJsonValue singleCasinoDescriptor, arrayOfCasinoDescriptors )
|
||||
{
|
||||
if ( singleCasinoDescriptor.isObject() )
|
||||
{
|
||||
m_aActiveCasinos.append( JsonSingleActivePromotion( singleCasinoDescriptor.toObject() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const QList<JsonSingleActivePromotion>& JsonActivePromotionsParser::GetPromotions() const
|
||||
{
|
||||
return m_aActiveCasinos;
|
||||
}
|
||||
|
||||
QList<JsonSingleActivePromotion>& JsonActivePromotionsParser::GetPromotions()
|
||||
{
|
||||
return m_aActiveCasinos;
|
||||
}
|
||||
Reference in New Issue
Block a user