mirror of
https://github.com/AskDavis/Casinotest.git
synced 2026-01-08 21:59:47 -08:00
Exchanges view updates
This commit is contained in:
@@ -35,7 +35,7 @@ void GUIBannerControl::slotPopulateListView( JsonActivePromotionsParser* a_pActi
|
||||
if ( m_pAdvertsView )
|
||||
{
|
||||
QmlBannerListModel* pAdvertsModel = new QmlBannerListModel( *a_pActivePromotions );
|
||||
m_pAdvertsView->SetModel( pAdvertsModel );
|
||||
m_pAdvertsView->setModel( pAdvertsModel );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ GUIBannerListView::GUIBannerListView( QQuickItem* a_pParent )
|
||||
{
|
||||
}
|
||||
|
||||
void GUIBannerListView::Clear()
|
||||
void GUIBannerListView::clear()
|
||||
{
|
||||
if ( m_pModel )
|
||||
{
|
||||
@@ -21,7 +21,7 @@ void GUIBannerListView::Clear()
|
||||
}
|
||||
}
|
||||
|
||||
void GUIBannerListView::OnClicked( int a_iItemIndex )
|
||||
void GUIBannerListView::onClicked( int a_iItemIndex )
|
||||
{
|
||||
if ( m_pModel )
|
||||
{
|
||||
@@ -39,7 +39,7 @@ GUIBannerListView::~GUIBannerListView()
|
||||
}
|
||||
}
|
||||
|
||||
void GUIBannerListView::SetModel( QmlBannerListModel* a_pModel )
|
||||
void GUIBannerListView::setModel( QmlBannerListModel* a_pModel )
|
||||
{
|
||||
if ( m_pModel )
|
||||
{
|
||||
|
||||
@@ -16,12 +16,12 @@ public:
|
||||
explicit GUIBannerListView( QQuickItem *a_pParent = 0 );
|
||||
virtual ~GUIBannerListView(); /** Destructor **/
|
||||
|
||||
void SetModel( QmlBannerListModel* a_pModel );
|
||||
QmlBannerListModel* GetModel() const { return m_pModel; }
|
||||
void setModel( QmlBannerListModel* a_pModel );
|
||||
QmlBannerListModel* setModel() const { return m_pModel; }
|
||||
|
||||
void Clear();
|
||||
void clear();
|
||||
|
||||
Q_INVOKABLE void OnClicked( int a_iItemIndex );
|
||||
Q_INVOKABLE void onClicked( int a_iItemIndex );
|
||||
signals:
|
||||
void signalModelChanged();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ GUIExchangesControl::~GUIExchangesControl()
|
||||
}
|
||||
}
|
||||
|
||||
void GUIExchangesControl::InitializeExchangesView( GUIExchangesListView* a_pView )
|
||||
void GUIExchangesControl::initializeExchangesView( GUIExchangesListView* a_pView )
|
||||
{
|
||||
if ( a_pView )
|
||||
{
|
||||
@@ -35,7 +35,7 @@ void GUIExchangesControl::slotPopulateListView( JsonActiveExchangesParser* a_pAc
|
||||
if ( m_pExchangesView )
|
||||
{
|
||||
QmlExchangesListModel* pExchangesModel = new QmlExchangesListModel( *a_pActiveExchanges );
|
||||
m_pExchangesView->SetModel( pExchangesModel );
|
||||
m_pExchangesView->setModel( pExchangesModel );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ public:
|
||||
GUIExchangesControl( QQuickItem* a_pParent = 0 );
|
||||
virtual ~GUIExchangesControl();
|
||||
|
||||
Q_INVOKABLE void InitializeExchangesView( GUIExchangesListView* a_pView );
|
||||
GUIExchangesListView* GetExchangesView() const { return m_pExchangesView; }
|
||||
Q_INVOKABLE void initializeExchangesView( GUIExchangesListView* a_pView );
|
||||
GUIExchangesListView* getExchangesView() const { return m_pExchangesView; }
|
||||
|
||||
public slots:
|
||||
void slotPopulateListView( JsonActiveExchangesParser* a_pActiveExchanges );
|
||||
|
||||
@@ -13,7 +13,7 @@ GUIExchangesListView::GUIExchangesListView( QQuickItem* a_pParent )
|
||||
{
|
||||
}
|
||||
|
||||
void GUIExchangesListView::Clear()
|
||||
void GUIExchangesListView::clear()
|
||||
{
|
||||
if ( m_pModel )
|
||||
{
|
||||
@@ -21,7 +21,7 @@ void GUIExchangesListView::Clear()
|
||||
}
|
||||
}
|
||||
|
||||
void GUIExchangesListView::OnClicked( int a_iItemIndex )
|
||||
void GUIExchangesListView::onClicked( int a_iItemIndex )
|
||||
{
|
||||
if ( m_pModel )
|
||||
{
|
||||
@@ -39,7 +39,7 @@ GUIExchangesListView::~GUIExchangesListView()
|
||||
}
|
||||
}
|
||||
|
||||
void GUIExchangesListView::SetModel( QmlExchangesListModel* a_pModel )
|
||||
void GUIExchangesListView::setModel( QmlExchangesListModel* a_pModel )
|
||||
{
|
||||
if ( m_pModel )
|
||||
{
|
||||
|
||||
@@ -16,12 +16,13 @@ public:
|
||||
explicit GUIExchangesListView( QQuickItem *a_pParent = 0 );
|
||||
virtual ~GUIExchangesListView(); /** Destructor **/
|
||||
|
||||
void SetModel( QmlExchangesListModel* a_pModel );
|
||||
QmlExchangesListModel* GetModel() const { return m_pModel; }
|
||||
void setModel( QmlExchangesListModel* a_pModel );
|
||||
QmlExchangesListModel* getModel() const { return m_pModel; }
|
||||
|
||||
void Clear();
|
||||
void clear();
|
||||
|
||||
Q_INVOKABLE void onClicked( int a_iItemIndex );
|
||||
|
||||
Q_INVOKABLE void OnClicked( int a_iItemIndex );
|
||||
signals:
|
||||
void signalModelChanged();
|
||||
|
||||
|
||||
@@ -68,14 +68,14 @@ QWidget* GUIExchangesWidget::dockQmlToWidget()
|
||||
m_pExchangesControl = pRootObject->findChild<GUIExchangesControl*>();
|
||||
if ( m_pExchangesControl )
|
||||
{
|
||||
m_pExchangesControl->setWidth( 400 );
|
||||
m_pExchangesControl->setHeight( 120 );
|
||||
m_pExchangesControl->setWidth( 500 );
|
||||
m_pExchangesControl->setHeight( 200 );
|
||||
}
|
||||
}
|
||||
pPlaceHolder = QWidget::createWindowContainer( pExchangesWindow, this );
|
||||
if ( pPlaceHolder )
|
||||
{
|
||||
pPlaceHolder->setMinimumSize( 400, 120 );
|
||||
pPlaceHolder->setMinimumSize( 500, 200 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,27 @@
|
||||
#include "qmlexchangeslistitem.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
|
||||
QmlExchangesListItem::QmlExchangesListItem(QString a_strImageSource, QString a_strDestinationUrl, QString a_strExchangesName, double a_dBidPrice, double a_dAskPrice, double a_dLastPrice, QString a_strDescription, QObject* a_pParent )
|
||||
QmlExchangesListItem::QmlExchangesListItem(QString a_strImageSource,
|
||||
QString a_strDestinationUrl,
|
||||
QString a_strExchangesName,
|
||||
double a_dBidPrice,
|
||||
double a_dAskPrice,
|
||||
double a_dLastPrice,
|
||||
QString a_strDescription,
|
||||
double a_dVolume24H,
|
||||
QString a_strLastUpdateTime,
|
||||
QObject* a_pParent )
|
||||
: QmlListItem ( QVariant( a_strImageSource )
|
||||
, QVariant( a_strDestinationUrl )
|
||||
, QVariant( a_strExchangesName )
|
||||
, QVariant( GetFormattedPrice( a_dBidPrice ) )
|
||||
, QVariant( GetFormattedPrice( a_dAskPrice ) )
|
||||
, QVariant( GetFormattedPrice( a_dLastPrice ) )
|
||||
, QVariant( getFormattedPrice( a_dBidPrice ) )
|
||||
, QVariant( getFormattedPrice( a_dAskPrice ) )
|
||||
, QVariant( getFormattedPrice( a_dLastPrice ) )
|
||||
, QVariant( a_strDescription )
|
||||
, QVariant( QString::number(a_dVolume24H) )
|
||||
, QVariant( getFormattedDateTime(a_strLastUpdateTime) )
|
||||
, a_pParent
|
||||
)
|
||||
{
|
||||
@@ -19,17 +31,19 @@ QmlExchangesListItem::QmlExchangesListItem( const JsonSingleActiveExchange& a_rE
|
||||
: QmlListItem ( QVariant( a_rExchangeDescription.getImageName() )
|
||||
, QVariant( a_rExchangeDescription.getAccessUrl() )
|
||||
, QVariant( a_rExchangeDescription.getExchangeName() )
|
||||
, QVariant( GetFormattedPrice( a_rExchangeDescription.getLastBidPriceBTC() ) )
|
||||
, QVariant( GetFormattedPrice( a_rExchangeDescription.getLastAskPriceBTC() ) )
|
||||
, QVariant( GetFormattedPrice( a_rExchangeDescription.getLastPriceBTC() ) )
|
||||
, QVariant( getFormattedPrice( a_rExchangeDescription.getLastBidPriceBTC() ) )
|
||||
, QVariant( getFormattedPrice( a_rExchangeDescription.getLastAskPriceBTC() ) )
|
||||
, QVariant( getFormattedPrice( a_rExchangeDescription.getLastPriceBTC() ) )
|
||||
, QVariant( a_rExchangeDescription.getDescription() )
|
||||
, QVariant( QString::number(a_rExchangeDescription.getVolume24H()) )
|
||||
, QVariant( getFormattedDateTime( a_rExchangeDescription.getLastUpdateTime() ) )
|
||||
, a_pParent
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
QmlExchangesListItem::QmlExchangesListItem( QObject* a_pParent )
|
||||
: QmlListItem( QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), a_pParent )
|
||||
: QmlListItem( QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), a_pParent )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -48,10 +62,18 @@ QHash<int, QByteArray> QmlExchangesListItem::RoleNames() const
|
||||
aRoleNames[ROLE_ASK_PRICE] = "m_askPrice";
|
||||
aRoleNames[ROLE_LAST_PRICE] = "m_lastPrice";
|
||||
aRoleNames[ROLE_DESCRIPTION] = "m_description";
|
||||
aRoleNames[ROLE_VOLUME24H] = "m_volume24H";
|
||||
aRoleNames[ROLE_LAST_UPDATE_TIME] = "m_lastUpdateTime";
|
||||
return aRoleNames;
|
||||
}
|
||||
|
||||
QString QmlExchangesListItem::GetFormattedPrice(double a_dPrice)
|
||||
QString QmlExchangesListItem::getFormattedPrice(double a_dPrice)
|
||||
{
|
||||
return QString::number( a_dPrice, 'f', 8 );
|
||||
}
|
||||
|
||||
QString QmlExchangesListItem::getFormattedDateTime( QString isoDateTime)
|
||||
{
|
||||
QDateTime datetime = QDateTime::fromString(isoDateTime, Qt::ISODate);
|
||||
return datetime.toString("dd-MM-yyyy HH:mm:ss");
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ public:
|
||||
, ROLE_ASK_PRICE = ROLE_5
|
||||
, ROLE_LAST_PRICE = ROLE_6
|
||||
, ROLE_DESCRIPTION = ROLE_7
|
||||
, ROLE_VOLUME24H = ROLE_8
|
||||
, ROLE_LAST_UPDATE_TIME = ROLE_9
|
||||
};
|
||||
|
||||
explicit QmlExchangesListItem
|
||||
@@ -26,6 +28,8 @@ public:
|
||||
, double a_dAskPrice
|
||||
, double a_dLastPrice
|
||||
, QString a_strDescription
|
||||
, double a_dVolume24H
|
||||
, QString a_strLastUpdateTime
|
||||
, QObject *a_pParent = 0
|
||||
);
|
||||
explicit QmlExchangesListItem ( const JsonSingleActiveExchange& a_rExchangeDescription
|
||||
@@ -41,7 +45,8 @@ signals:
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QString GetFormattedPrice( double a_dPrice );
|
||||
QString getFormattedPrice( double a_dPrice );
|
||||
QString getFormattedDateTime( QString isoDateTime);
|
||||
};
|
||||
|
||||
#endif // QMLEXCHANGESLISTITEM_H
|
||||
|
||||
@@ -191,6 +191,7 @@ QHash<int, QByteArray> QmlListItem::RoleNames() const
|
||||
aRoleNames[ROLE_6] = "m_role6";
|
||||
aRoleNames[ROLE_7] = "m_role7";
|
||||
aRoleNames[ROLE_8] = "m_role8";
|
||||
aRoleNames[ROLE_9] = "m_role9";
|
||||
return aRoleNames;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user