mirror of
https://github.com/AskDavis/Casinotest.git
synced 2026-01-01 05:05:57 -08:00
Exchanges refreshed every minute
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>600</height>
|
<height>480</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ using namespace std;
|
|||||||
|
|
||||||
InfoPage::InfoPage(QWidget *parent) :
|
InfoPage::InfoPage(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
exchangesWidget( 0 ),
|
ui(new Ui::InfoPage),
|
||||||
ui(new Ui::InfoPage)
|
exchangesWidget( 0 )
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
// ui->casinoInfoBox->setVisible(false);
|
// ui->casinoInfoBox->setVisible(false);
|
||||||
@@ -116,6 +116,6 @@ InfoPage::~InfoPage()
|
|||||||
void InfoPage::createExchangesWidget()
|
void InfoPage::createExchangesWidget()
|
||||||
{
|
{
|
||||||
exchangesWidget = new GUIExchangesWidget( this );
|
exchangesWidget = new GUIExchangesWidget( this );
|
||||||
exchangesWidget->PopulateExchangesFromWeb();
|
exchangesWidget->slotPopulateExchangesFromWeb();
|
||||||
ui->verticalLayoutExchanges->addWidget( exchangesWidget->dockQmlToWidget() );
|
ui->verticalLayoutExchanges->addWidget( exchangesWidget->dockQmlToWidget() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,12 @@ void GUIBannerControl::InitializeAdvertsView( GUIBannerListView* a_pView )
|
|||||||
|
|
||||||
void GUIBannerControl::slotPopulateListView( JsonActivePromotionsParser* a_pActivePromotions )
|
void GUIBannerControl::slotPopulateListView( JsonActivePromotionsParser* a_pActivePromotions )
|
||||||
{
|
{
|
||||||
if ( m_pAdvertsView )
|
if ( m_pAdvertsView && a_pActivePromotions )
|
||||||
{
|
{
|
||||||
QmlBannerListModel* pAdvertsModel = new QmlBannerListModel( *a_pActivePromotions );
|
QmlBannerListModel* pAdvertsModel = new QmlBannerListModel( *a_pActivePromotions );
|
||||||
m_pAdvertsView->setModel( pAdvertsModel );
|
m_pAdvertsView->setModel( pAdvertsModel );
|
||||||
|
delete a_pActivePromotions;
|
||||||
|
a_pActivePromotions = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,12 @@ void GUIExchangesControl::initializeExchangesView( GUIExchangesListView* a_pView
|
|||||||
|
|
||||||
void GUIExchangesControl::slotPopulateListView( JsonActiveExchangesParser* a_pActiveExchanges )
|
void GUIExchangesControl::slotPopulateListView( JsonActiveExchangesParser* a_pActiveExchanges )
|
||||||
{
|
{
|
||||||
if ( m_pExchangesView )
|
if ( m_pExchangesView && a_pActiveExchanges )
|
||||||
{
|
{
|
||||||
QmlExchangesListModel* pExchangesModel = new QmlExchangesListModel( *a_pActiveExchanges );
|
QmlExchangesListModel* pExchangesModel = new QmlExchangesListModel( *a_pActiveExchanges );
|
||||||
m_pExchangesView->setModel( pExchangesModel );
|
m_pExchangesView->setModel( pExchangesModel );
|
||||||
|
delete a_pActiveExchanges;
|
||||||
|
a_pActiveExchanges = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ GUIExchangesWidget::GUIExchangesWidget(QWidget *parent)
|
|||||||
connect( m_pWebApiTemporary, SIGNAL( signalResponseReady(const QByteArray&)), m_pWebApiParserTemporary, SLOT( slotParseAnswer(const QByteArray&)), Qt::UniqueConnection );
|
connect( m_pWebApiTemporary, SIGNAL( signalResponseReady(const QByteArray&)), m_pWebApiParserTemporary, SLOT( slotParseAnswer(const QByteArray&)), Qt::UniqueConnection );
|
||||||
connect( m_pWebApiTemporary, SIGNAL( signalNetworkError(QNetworkReply::NetworkError,const QUrl)), m_pWebApiParserTemporary, SLOT( slotNetworkError(QNetworkReply::NetworkError,const QUrl)), Qt::UniqueConnection );
|
connect( m_pWebApiTemporary, SIGNAL( signalNetworkError(QNetworkReply::NetworkError,const QUrl)), m_pWebApiParserTemporary, SLOT( slotNetworkError(QNetworkReply::NetworkError,const QUrl)), Qt::UniqueConnection );
|
||||||
connect( m_pWebApiParserTemporary, SIGNAL( signalActiveExchangesParsed(JsonActiveExchangesParser*)), this, SLOT( slotPopulateFromWeb(JsonActiveExchangesParser*)), Qt::UniqueConnection );
|
connect( m_pWebApiParserTemporary, SIGNAL( signalActiveExchangesParsed(JsonActiveExchangesParser*)), this, SLOT( slotPopulateFromWeb(JsonActiveExchangesParser*)), Qt::UniqueConnection );
|
||||||
|
|
||||||
|
SetupRefreshTimer();
|
||||||
|
m_timerRefresh.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
GUIExchangesWidget::~GUIExchangesWidget()
|
GUIExchangesWidget::~GUIExchangesWidget()
|
||||||
@@ -44,6 +47,13 @@ void GUIExchangesWidget::registerCustomQmlTypes()
|
|||||||
qmlRegisterType<QmlExchangesListModel>("CasinoCoinControls", 1, 0, "QmlExchangesListModel" );
|
qmlRegisterType<QmlExchangesListModel>("CasinoCoinControls", 1, 0, "QmlExchangesListModel" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUIExchangesWidget::SetupRefreshTimer()
|
||||||
|
{
|
||||||
|
m_timerRefresh.setSingleShot( false );
|
||||||
|
m_timerRefresh.setInterval( 1000 * 60 );
|
||||||
|
connect( &m_timerRefresh, SIGNAL( timeout() ), this, SLOT( slotPopulateExchangesFromWeb() ), Qt::UniqueConnection );
|
||||||
|
}
|
||||||
|
|
||||||
QWidget* GUIExchangesWidget::dockQmlToWidget()
|
QWidget* GUIExchangesWidget::dockQmlToWidget()
|
||||||
{
|
{
|
||||||
QQuickView* pExchangesWindow = new QQuickView;
|
QQuickView* pExchangesWindow = new QQuickView;
|
||||||
@@ -81,7 +91,7 @@ QWidget* GUIExchangesWidget::dockQmlToWidget()
|
|||||||
return pPlaceHolder;
|
return pPlaceHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIExchangesWidget::PopulateExchangesFromWeb()
|
void GUIExchangesWidget::slotPopulateExchangesFromWeb()
|
||||||
{
|
{
|
||||||
if ( m_pWebApiTemporary )
|
if ( m_pWebApiTemporary )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
class CasinoCoinWebAPIParser;
|
class CasinoCoinWebAPIParser;
|
||||||
class CasinoCoinWebAPI;
|
class CasinoCoinWebAPI;
|
||||||
@@ -20,17 +21,21 @@ public:
|
|||||||
|
|
||||||
QWidget* dockQmlToWidget();
|
QWidget* dockQmlToWidget();
|
||||||
|
|
||||||
void PopulateExchangesFromWeb();
|
|
||||||
void PopulateExchangesLocally();
|
void PopulateExchangesLocally();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slotPopulateExchangesFromWeb();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void registerCustomQmlTypes();
|
void registerCustomQmlTypes();
|
||||||
|
void SetupRefreshTimer();
|
||||||
|
|
||||||
GUIExchangesControl* m_pExchangesControl;
|
GUIExchangesControl* m_pExchangesControl;
|
||||||
|
|
||||||
CasinoCoinWebAPIParser* m_pWebApiParserTemporary;
|
CasinoCoinWebAPIParser* m_pWebApiParserTemporary;
|
||||||
CasinoCoinWebAPI* m_pWebApiTemporary;
|
CasinoCoinWebAPI* m_pWebApiTemporary;
|
||||||
QmlImageProvider* m_pQmlImageProvider;
|
QmlImageProvider* m_pQmlImageProvider;
|
||||||
|
QTimer m_timerRefresh;
|
||||||
private slots:
|
private slots:
|
||||||
void slotPopulateFromWeb( JsonActiveExchangesParser* a_pExchangesParser );
|
void slotPopulateFromWeb( JsonActiveExchangesParser* a_pExchangesParser );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user