Exchanges view updates

This commit is contained in:
Andre Jochems
2015-11-30 11:21:55 +01:00
parent 239fd6afaf
commit b091799d44
17 changed files with 195 additions and 209 deletions

View File

@@ -29,17 +29,36 @@
<property name="horizontalSpacing">
<number>15</number>
</property>
<item row="0" column="1">
<widget class="QFrame" name="newsItemsBox">
<item row="1" column="0">
<widget class="QFrame" name="exchangeInfoBox">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayoutExchanges"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblNewsHeader">
<widget class="QLabel" name="lblExchangesHeader">
<property name="font">
<font>
<pointsize>10</pointsize>
@@ -51,70 +70,24 @@
<string notr="true">color: rgb(166, 27, 31);</string>
</property>
<property name="text">
<string>News</string>
<string>Exchanges</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QFrame" name="casinoInfoBox">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="lblCasinosHeader">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(166, 27, 31);</string>
</property>
<property name="text">
<string>Casinos</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="coinInfoBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
@@ -126,7 +99,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="lblCasinosHeader_2">
<widget class="QLabel" name="lblInformationHeader">
<property name="font">
<font>
<pointsize>10</pointsize>
@@ -138,14 +111,14 @@
<string notr="true">color: rgb(166, 27, 31);</string>
</property>
<property name="text">
<string>Casinos</string>
<string>Information</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QFormLayout" name="formCoinDetails">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>15</number>
@@ -167,14 +140,22 @@
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblBlockHeight">
<property name="font">
<font>
<kerning>true</kerning>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Current number of blocks</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@@ -206,7 +187,7 @@
<string>Last block time</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@@ -238,7 +219,7 @@
<string>Coin Supply</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@@ -442,7 +423,7 @@
<string>Number of connections</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@@ -474,7 +455,7 @@
<string>Difficulty</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@@ -506,7 +487,7 @@
<string>Network Hashrate</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@@ -563,64 +544,6 @@
</item>
</layout>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="exchangeInfoBox">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayoutExchanges"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblExchangesHeader">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(166, 27, 31);</string>
</property>
<property name="text">
<string>Exchanges</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -17,8 +17,8 @@ InfoPage::InfoPage(QWidget *parent) :
ui(new Ui::InfoPage)
{
ui->setupUi(this);
ui->casinoInfoBox->setVisible(false);
ui->newsItemsBox->setVisible(false);
// ui->casinoInfoBox->setVisible(false);
// ui->newsItemsBox->setVisible(false);
createExchangesWidget();
}

View File

@@ -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 );
}
}

View File

@@ -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 )
{

View File

@@ -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();

View File

@@ -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 );
}
}

View File

@@ -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 );

View File

@@ -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 )
{

View File

@@ -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();

View File

@@ -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 );
}
}

View File

@@ -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");
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -57,7 +57,7 @@ GUIBannerListView
anchors.fill: id_listElement
onClicked:
{
id_bannerView.OnClicked( index )
id_bannerView.onClicked( index )
}
}
}

View File

@@ -24,7 +24,7 @@ GUIExchangesControl
anchors.fill: id_ExchangessArea
Component.onCompleted:
{
id_ExchangesControl.InitializeExchangesView( id_ExchangesListView )
id_ExchangesControl.initializeExchangesView( id_ExchangesListView )
}
}
}

View File

@@ -1,5 +1,6 @@
import QtQuick 2.0
import QtQuick 2.2
import CasinoCoinControls 1.0
import QtQuick.Controls 1.4
GUIExchangesListView
{
@@ -10,18 +11,25 @@ GUIExchangesListView
property alias m_ListModel: id_listView.model
property alias m_PathView: id_listView
ListView
{
id: id_listView
anchors.fill: id_ExchangesView
ScrollView
{
id: id_ExchangesScrollView
anchors.fill: parent
clip: true
visible: true
interactive: contentHeight > id_listView.height ? true : false
ListView
{
id: id_listView
anchors.fill: id_ExchangesScrollView
height: 250
width: 500
clip: true
visible: true
interactive: contentHeight > id_listView.height ? true : false
model: id_ExchangesView.p_pListModel
delegate: id_elementDelegate
}
model: id_ExchangesView.p_pListModel
delegate: id_elementDelegate
}
}
Component
{
@@ -31,9 +39,9 @@ GUIExchangesListView
id: id_listElement
objectName: id_ExchangesView.objectName + "_Element" + index
width: 400
height: 100
Row
width: 750
height: 125
Row
{
id: id_row
anchors.fill: id_listElement
@@ -41,8 +49,8 @@ GUIExchangesListView
{
id: id_imageRectangle
width: id_listElement.width / 3
height: 80
width: id_listElement.width / 5
height: 100
anchors.verticalCenter: id_row.verticalCenter
Image
{
@@ -58,7 +66,7 @@ GUIExchangesListView
anchors.fill: id_imageRectangle
onClicked:
{
id_ExchangesView.OnClicked( index )
id_ExchangesView.onClicked( index )
}
}
}
@@ -67,7 +75,7 @@ GUIExchangesListView
id: id_otherInfoRectangle
width: id_listElement.width - id_imageRectangle.width
height: 90
height: 100
anchors.verticalCenter: id_row.verticalCenter
Column
{
@@ -77,7 +85,7 @@ GUIExchangesListView
{
id: id_exchangeNameRectangle
width: id_otherInfoRectangle.width
height: id_otherInfoRectangle.height / 3
height: id_otherInfoRectangle.height / 4
Text
{
id: id_exchangeNameText
@@ -89,7 +97,7 @@ GUIExchangesListView
{
id: id_pricesRectangle
width: id_otherInfoRectangle.width
height: id_otherInfoRectangle.height / 3
height: id_otherInfoRectangle.height / 4
Row
{
id: id_pricesRow
@@ -97,62 +105,86 @@ GUIExchangesListView
Rectangle
{
id: id_priceBid
width: id_pricesRectangle.width / 3
width: id_pricesRectangle.width / 4
height: id_pricesRectangle.height
Text
{
id: id_priceBidText
anchors.fill: id_priceBid
text: qsTr( m_bidPrice )
text: qsTr("Bid: %1").arg(m_bidPrice)
}
}
Rectangle
{
id: id_priceAsk
width: id_pricesRectangle.width / 3
width: id_pricesRectangle.width / 4
height: id_pricesRectangle.height
Text
{
id: id_priceAskText
anchors.fill: id_priceAsk
text: qsTr( m_askPrice )
text: qsTr("Ask: %1").arg(m_askPrice)
}
}
Rectangle
{
id: id_priceLast
width: id_pricesRectangle.width / 3
width: id_pricesRectangle.width / 4
height: id_pricesRectangle.height
Text
{
id: id_priceLastText
anchors.fill: id_priceLast
text: qsTr( m_lastPrice )
text: qsTr("Last: %1").arg(m_lastPrice)
}
}
Rectangle
{
id: id_volume24h
width: id_pricesRectangle.width / 4
height: id_pricesRectangle.height
Text
{
id: id_volume24hText
anchors.fill: id_volume24h
text: qsTr("Volume: %1").arg(m_volume24H)
}
}
}
}
Rectangle
{
id: id_exchangeLink
id: id_exchangeLastUpdateTime
width: id_otherInfoRectangle.width
height: id_otherInfoRectangle.height / 3
height: id_otherInfoRectangle.height / 4
Text
{
id: id_exchangeLinkText
anchors.fill: id_exchangeLink
text: qsTr( "Go to site" )
MouseArea
{
id: id_linkMouseArea
anchors.fill: id_exchangeLinkText
onClicked:
{
id_ExchangesView.OnClicked( index )
}
}
id: id_exchangeTime
anchors.fill: id_exchangeLastUpdateTime
text: qsTr( m_lastUpdateTime )
}
}
Rectangle
{
id: id_exchangeLink
width: id_otherInfoRectangle.width
height: id_otherInfoRectangle.height / 4
Text
{
id: id_exchangeLinkText
anchors.fill: id_exchangeLink
text: qsTr( "Go to site" )
MouseArea
{
id: id_linkMouseArea
anchors.fill: id_exchangeLinkText
onClicked:
{
id_ExchangesView.onClicked( index )
}
}
}
}
}
}
}

View File

@@ -3,12 +3,14 @@ import QtQuick 2.2
Rectangle
{
id: id_root
QmlGUIExchangesControl
{
id: id_ExchangesControlMain
}
QmlGUIExchangesControl
{
id: id_ExchangesControlMain
}
width: 500
height: 250
color: GUI20Skin.colorFrameBackground
width: id_ExchangesControlMain.width
height: id_ExchangesControlMain.height
}