diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 708fb3e..7eae9d3 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -139,8 +139,13 @@ OverviewPage::OverviewPage(QWidget *parent) : // start with displaying the "out of sync" warnings showOutOfSyncWarning(true); - // get CoinInfo from the web + // get CoinInfo on startup getCoinInfo(); + // start timer to get CoinInfo from the web every interval + coinInfoRefreshTimer.setSingleShot( false ); + coinInfoRefreshTimer.setInterval( 1000 * 300 ); // every 5 minuts + connect( &coinInfoRefreshTimer, SIGNAL( timeout() ), this, SLOT(getCoinInfo()), Qt::UniqueConnection ); + coinInfoRefreshTimer.start(); } void OverviewPage::handleTransactionClicked(const QModelIndex &index) diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index c60f1f4..e2f9d05 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -3,6 +3,7 @@ #include #include +#include namespace Ui { class OverviewPage; @@ -56,8 +57,8 @@ private: /** Get the CoinInfo from REST service */ CasinoCoinWebAPIParser* cscWebApiParser; CasinoCoinWebAPI* cscWebApi; - void getCoinInfo(); QJsonObject coinInformation; + QTimer coinInfoRefreshTimer; private slots: void updateDisplayUnit(); @@ -66,6 +67,7 @@ private slots: void updateCoinInfoFromWeb( JsonCoinInfoParser* coinInfoParser ); void updateFiatBalance(int currency); void updateDisplayPromotions(bool checked); + void getCoinInfo(); }; #endif // OVERVIEWPAGE_H