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>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
|
||||
@@ -13,8 +13,8 @@ using namespace std;
|
||||
|
||||
InfoPage::InfoPage(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
exchangesWidget( 0 ),
|
||||
ui(new Ui::InfoPage)
|
||||
ui(new Ui::InfoPage),
|
||||
exchangesWidget( 0 )
|
||||
{
|
||||
ui->setupUi(this);
|
||||
// ui->casinoInfoBox->setVisible(false);
|
||||
@@ -116,6 +116,6 @@ InfoPage::~InfoPage()
|
||||
void InfoPage::createExchangesWidget()
|
||||
{
|
||||
exchangesWidget = new GUIExchangesWidget( this );
|
||||
exchangesWidget->PopulateExchangesFromWeb();
|
||||
exchangesWidget->slotPopulateExchangesFromWeb();
|
||||
ui->verticalLayoutExchanges->addWidget( exchangesWidget->dockQmlToWidget() );
|
||||
}
|
||||
|
||||
@@ -32,10 +32,12 @@ void GUIBannerControl::InitializeAdvertsView( GUIBannerListView* a_pView )
|
||||
|
||||
void GUIBannerControl::slotPopulateListView( JsonActivePromotionsParser* a_pActivePromotions )
|
||||
{
|
||||
if ( m_pAdvertsView )
|
||||
if ( m_pAdvertsView && a_pActivePromotions )
|
||||
{
|
||||
QmlBannerListModel* pAdvertsModel = new QmlBannerListModel( *a_pActivePromotions );
|
||||
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 )
|
||||
{
|
||||
if ( m_pExchangesView )
|
||||
if ( m_pExchangesView && a_pActiveExchanges )
|
||||
{
|
||||
QmlExchangesListModel* pExchangesModel = new QmlExchangesListModel( *a_pActiveExchanges );
|
||||
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( 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 );
|
||||
|
||||
SetupRefreshTimer();
|
||||
m_timerRefresh.start();
|
||||
}
|
||||
|
||||
GUIExchangesWidget::~GUIExchangesWidget()
|
||||
@@ -44,6 +47,13 @@ void GUIExchangesWidget::registerCustomQmlTypes()
|
||||
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()
|
||||
{
|
||||
QQuickView* pExchangesWindow = new QQuickView;
|
||||
@@ -81,7 +91,7 @@ QWidget* GUIExchangesWidget::dockQmlToWidget()
|
||||
return pPlaceHolder;
|
||||
}
|
||||
|
||||
void GUIExchangesWidget::PopulateExchangesFromWeb()
|
||||
void GUIExchangesWidget::slotPopulateExchangesFromWeb()
|
||||
{
|
||||
if ( m_pWebApiTemporary )
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QNetworkReply>
|
||||
#include <QTimer>
|
||||
|
||||
class CasinoCoinWebAPIParser;
|
||||
class CasinoCoinWebAPI;
|
||||
@@ -20,17 +21,21 @@ public:
|
||||
|
||||
QWidget* dockQmlToWidget();
|
||||
|
||||
void PopulateExchangesFromWeb();
|
||||
void PopulateExchangesLocally();
|
||||
|
||||
public slots:
|
||||
void slotPopulateExchangesFromWeb();
|
||||
|
||||
private:
|
||||
void registerCustomQmlTypes();
|
||||
void SetupRefreshTimer();
|
||||
|
||||
GUIExchangesControl* m_pExchangesControl;
|
||||
|
||||
CasinoCoinWebAPIParser* m_pWebApiParserTemporary;
|
||||
CasinoCoinWebAPI* m_pWebApiTemporary;
|
||||
QmlImageProvider* m_pQmlImageProvider;
|
||||
QTimer m_timerRefresh;
|
||||
private slots:
|
||||
void slotPopulateFromWeb( JsonActiveExchangesParser* a_pExchangesParser );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user