Menu Toolbar version 1.1

This commit is contained in:
Jakub Rojek
2015-11-04 19:25:04 +01:00
parent 85a611ed19
commit 5db81053ef
34 changed files with 794 additions and 8 deletions

View File

@@ -44,6 +44,20 @@
<file>res/icons/adverts_arrow_left_hover.png</file>
<file>res/icons/adverts_arrow_right.png</file>
<file>res/icons/adverts_arrow_right_hover.png</file>
<file>res/icons/GUI20_mainToolBar_transactions.png</file>
<file>res/icons/GUI20_mainToolBar_transactions_hover.png</file>
<file>res/icons/GUI20_mainToolBar_send.png</file>
<file>res/icons/GUI20_mainToolBar_send_hover.png</file>
<file>res/icons/GUI20_mainToolBar_redeemprypto.png</file>
<file>res/icons/GUI20_mainToolBar_redeemprypto_hover.png</file>
<file>res/icons/GUI20_mainToolBar_receive.png</file>
<file>res/icons/GUI20_mainToolBar_receive_hover.png</file>
<file>res/icons/GUI20_mainToolBar_overview.png</file>
<file>res/icons/GUI20_mainToolBar_overview_hover.png</file>
<file>res/icons/GUI20_mainToolBar_info.png</file>
<file>res/icons/GUI20_mainToolBar_info_hover.png</file>
<file>res/icons/GUI20_mainToolBar_contacts.png</file>
<file>res/icons/GUI20_mainToolBar_contacts_hover.png</file>
</qresource>
<qresource prefix="/images">
<file alias="about">res/images/about.png</file>
@@ -107,5 +121,8 @@
<file>qtquick_controls/qml/QmlGUIBannerControl.qml</file>
<file>qtquick_controls/qml/QmlGUIBannerListView.qml</file>
<file>qtquick_controls/qml/QmlGUIBannerWindow.qml</file>
<file>qtquick_controls/qml/QmlGUIMenuToolbarWindow.qml</file>
<file>qtquick_controls/qml/QmlGUIMenuToolbarListView.qml</file>
<file>qtquick_controls/qml/QmlGUIMenuToolbarControl.qml</file>
</qresource>
</RCC>

View File

@@ -26,6 +26,8 @@
#include "wallet.h"
#include "init.h"
#include "qtquick_controls/cpp/guimenutoolbarwidget.h"
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
#endif
@@ -60,6 +62,7 @@ const QString BitcoinGUI::DEFAULT_WALLET = "~Default";
BitcoinGUI::BitcoinGUI(QWidget *parent) :
QMainWindow(parent),
clientModel(0),
menuBar_new(0),
encryptWalletAction(0),
changePassphraseAction(0),
aboutQtAction(0),
@@ -77,9 +80,20 @@ BitcoinGUI::BitcoinGUI(QWidget *parent) :
setUnifiedTitleAndToolBarOnMac(true);
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
// Create wallet frame and make it the central widget
walletFrame = new WalletFrame(this);
setCentralWidget(walletFrame);
// Create wallet frame with main menu
walletFrame = new WalletFrame(this);
menuBar_new = new GUIMenuToolbarWidget( this );
connect( menuBar_new, SIGNAL( signalItemClicked( GUIMenuToolbarControl::EMenuToolbarItemTypes ) ), this, SLOT( slotMenuToolbarItemClicked( GUIMenuToolbarControl::EMenuToolbarItemTypes ) ), Qt::UniqueConnection );
// envelope them in another widget
QWidget* pCentralWidget = new QWidget( this );
QVBoxLayout* pBoxLayout = new QVBoxLayout();
pBoxLayout->addWidget( menuBar_new->dockQmlToWidget() );
pBoxLayout->addWidget( walletFrame );
pCentralWidget->setLayout( pBoxLayout );
// and make it the central widget
setCentralWidget(pCentralWidget);
// Accept D&D of URIs
setAcceptDrops(true);
@@ -92,7 +106,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent) :
createMenuBar();
// Create the toolbars
createToolBars();
// createToolBars();
// Create system tray icon and notification
createTrayIcon();
@@ -295,6 +309,7 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(addressBookAction);
}
void BitcoinGUI::setClientModel(ClientModel *clientModel)
@@ -466,34 +481,49 @@ void BitcoinGUI::optionsClicked()
void BitcoinGUI::aboutClicked()
{
AboutDialog dlg;
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::INFO );
AboutDialog dlg;
dlg.setModel(clientModel);
dlg.exec();
}
// TODO
//void BitcoinGUI::redeemPryptoClicked()
//{
// if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::INFO );
// RedeemPryptoDialog dlg;
// dlg.setModel(clientModel);
// dlg.exec();
//}
void BitcoinGUI::gotoOverviewPage()
{
if (walletFrame) walletFrame->gotoOverviewPage();
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::OVERVIEW );
}
void BitcoinGUI::gotoHistoryPage()
{
if (walletFrame) walletFrame->gotoHistoryPage();
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::TRANSACTIONS );
}
void BitcoinGUI::gotoAddressBookPage()
{
if (walletFrame) walletFrame->gotoAddressBookPage();
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::CONTACTS );
}
void BitcoinGUI::gotoReceiveCoinsPage()
{
if (walletFrame) walletFrame->gotoReceiveCoinsPage();
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::RECEIVE );
}
void BitcoinGUI::gotoSendCoinsPage(QString addr)
{
if (walletFrame) walletFrame->gotoSendCoinsPage(addr);
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::SEND );
}
void BitcoinGUI::gotoSignMessageTab(QString addr)
@@ -834,5 +864,48 @@ void BitcoinGUI::toggleHidden()
void BitcoinGUI::detectShutdown()
{
if (ShutdownRequested())
QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection);
QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection);
}
void BitcoinGUI::slotMenuToolbarItemClicked( GUIMenuToolbarControl::EMenuToolbarItemTypes a_eType )
{
switch( a_eType )
{
case GUIMenuToolbarControl::OVERVIEW:
{
emit overviewAction->triggered();
break;
}
case GUIMenuToolbarControl::SEND:
{
emit sendCoinsAction->triggered();
break;
}
case GUIMenuToolbarControl::RECEIVE:
{
emit receiveCoinsAction->triggered();
break;
}
case GUIMenuToolbarControl::TRANSACTIONS:
{
emit historyAction->triggered();
break;
}
case GUIMenuToolbarControl::CONTACTS:
{
emit addressBookAction->triggered();
break;
}
case GUIMenuToolbarControl::REDEEM_PRYPTO:
{
// TODO
// emit pryptoRedeemAction->triggered();
break;
}
case GUIMenuToolbarControl::INFO:
{
emit aboutAction->triggered();
break;
}
}
}

View File

@@ -5,6 +5,8 @@
#include <QSystemTrayIcon>
#include <QMap>
#include "qtquick_controls/cpp/guimenutoolbarcontrol.h"
class TransactionTableModel;
class WalletFrame;
class WalletView;
@@ -19,6 +21,8 @@ class SignVerifyMessageDialog;
class Notificator;
class RPCConsole;
class GUIMenuToolbarWidget;
class CWallet;
QT_BEGIN_NAMESPACE
@@ -78,6 +82,7 @@ protected:
private:
ClientModel *clientModel;
WalletFrame *walletFrame;
GUIMenuToolbarWidget *menuBar_new;
QLabel *labelEncryptionIcon;
QLabel *labelConnectionsIcon;
@@ -195,6 +200,9 @@ private slots:
/** called by a timer to check if fRequestShutdown has been set **/
void detectShutdown();
/** called from new Qml menu toolbar on user click **/
void slotMenuToolbarItemClicked( GUIMenuToolbarControl::EMenuToolbarItemTypes a_eType );
};
#endif // BITCOINGUI_H

28
src/qt/gui20_skin.cpp Normal file
View File

@@ -0,0 +1,28 @@
#include "gui20_skin.h"
GUI20Skin::GUI20Skin( QObject* a_pParent )
: QObject( a_pParent )
, colorToolbarMainGradientBegin( "#9c181c" )
, colorToolbarMainGradientEnd( "#ae1e22" )
, colorToolbarMainCurrent( "#761316" )
, colorToolbarMainBottomCurrent( "#e1252b" )
, colorToolbarMainTextCurrent( "#ffffff" )
, colorToolbarMainTextNormal( "#3f0a0c" )
, colorToolbarMainTextShadow( "#c72427" )
, colorMainWindowBackground( "#afafaf" )
, colorMainWindowFrameBackground( "#ffffff" )
{
}
GUI20Skin& GUI20Skin::Instance()
{
static GUI20Skin m_oInstance;
return m_oInstance;
}
GUI20Skin::~GUI20Skin()
{
}

69
src/qt/gui20_skin.h Normal file
View File

@@ -0,0 +1,69 @@
#ifndef GUI20_SKIN_H
#define GUI20_SKIN_H
#include <QColor>
#include <QString>
#include <QMutex>
#include <QObject>
class GUI20Skin : public QObject
{
Q_OBJECT
Q_PROPERTY( QColor colorToolbarMainGradientBegin READ GetColorToolbarMainGradientBegin CONSTANT )
Q_PROPERTY( QColor colorToolbarMainGradientEnd READ GetColorToolbarMainGradientEnd CONSTANT )
Q_PROPERTY( QColor colorToolbarMainCurrent READ GetColorToolbarMainCurrent CONSTANT )
Q_PROPERTY( QColor colorToolbarMainBottomCurrent READ GetColorToolbarBottomCurrent CONSTANT )
Q_PROPERTY( QColor colorToolbarMainTextCurrent READ GetColorToolbarMainTextCurrent CONSTANT )
Q_PROPERTY( QColor colorToolbarMainTextNormal READ GetColorToolbarMainTextNormal CONSTANT )
Q_PROPERTY( QColor colorToolbarMainTextShadow READ GetColorToolbarMainTextShadow CONSTANT )
Q_ENUMS( ESizeConstants )
public:
enum ESizeConstants
{
ToolbarMainHeight = 77,
ToolbarMainBottomPartHeight = 5
};
const QColor GetColorToolbarMainGradientBegin() const {return colorToolbarMainGradientBegin;}
const QColor GetColorToolbarMainGradientEnd() const {return colorToolbarMainGradientEnd;}
const QColor GetColorToolbarMainCurrent() const {return colorToolbarMainCurrent;}
const QColor GetColorToolbarBottomCurrent() const {return colorToolbarMainBottomCurrent;}
const QColor GetColorToolbarMainTextCurrent() const {return colorToolbarMainTextCurrent;}
const QColor GetColorToolbarMainTextNormal() const {return colorToolbarMainTextNormal;}
const QColor GetColorToolbarMainTextShadow() const {return colorToolbarMainTextShadow;}
private:
const QColor colorToolbarMainGradientBegin;
const QColor colorToolbarMainGradientEnd;
const QColor colorToolbarMainCurrent;
const QColor colorToolbarMainBottomCurrent;
const QColor colorToolbarMainTextCurrent;
const QColor colorToolbarMainTextNormal;
const QColor colorToolbarMainTextShadow;
const QColor colorMainWindowBackground;
const QColor colorMainWindowFrameBackground;
public:
static GUI20Skin& Instance();
private:
GUI20Skin( QObject* a_pParent = 0 );
virtual ~GUI20Skin();
};
#endif // GUI20_SKIN_H

View File

@@ -0,0 +1,70 @@
#include "guimenutoolbarcontrol.h"
#include "guimenutoolbarlistview.h"
#include "qmlmenutoolbarmodel.h"
#include "qmlmenutoolbaritem.h"
#include "gui20_skin.h"
GUIMenuToolbarControl::GUIMenuToolbarControl( QQuickItem* a_pParent )
: QQuickItem( a_pParent )
, m_pMenuToolbarView( 0 )
{
}
GUIMenuToolbarControl::~GUIMenuToolbarControl()
{
if ( m_pMenuToolbarView )
{
delete m_pMenuToolbarView;
m_pMenuToolbarView = 0;
}
}
void GUIMenuToolbarControl::InitializeMenuToolbarView( GUIMenuToolbarListView* a_pView )
{
if ( a_pView )
{
if ( m_pMenuToolbarView )
{
delete m_pMenuToolbarView;
}
m_pMenuToolbarView = a_pView;
if ( m_pMenuToolbarView )
{
QmlMenuToolbarModel* pStandardMenuModel = new QmlMenuToolbarModel( m_pMenuToolbarView );
if ( pStandardMenuModel )
{
pStandardMenuModel->append( new QmlMenuToolbarItem( tr( "Overview" ), tr( "Overview description" ), "qrc:/icons/res/icons/GUI20_mainToolBar_overview_hover.png", "qrc:/icons/res/icons/GUI20_mainToolBar_overview.png" , OVERVIEW ) );
pStandardMenuModel->append( new QmlMenuToolbarItem( tr( "Send" ), tr( "Send description" ), "qrc:/icons/res/icons/GUI20_mainToolBar_send_hover.png", "qrc:/icons/res/icons/GUI20_mainToolBar_send.png" , SEND ) );
pStandardMenuModel->append( new QmlMenuToolbarItem( tr( "Receive" ), tr( "Receive description" ), "qrc:/icons/res/icons/GUI20_mainToolBar_receive_hover.png", "qrc:/icons/res/icons/GUI20_mainToolBar_receive.png" , RECEIVE ) );
pStandardMenuModel->append( new QmlMenuToolbarItem( tr( "Transactions" ), tr( "Transactions description" ), "qrc:/icons/res/icons/GUI20_mainToolBar_transactions_hover.png", "qrc:/icons/res/icons/GUI20_mainToolBar_transactions.png" , TRANSACTIONS ) );
pStandardMenuModel->append( new QmlMenuToolbarItem( tr( "Contacts" ), tr( "Contacts description" ), "qrc:/icons/res/icons/GUI20_mainToolBar_contacts_hover.png", "qrc:/icons/res/icons/GUI20_mainToolBar_contacts.png" , CONTACTS ) );
pStandardMenuModel->append( new QmlMenuToolbarItem( tr( "Redeem Prypto" ), tr( "Redeem Prypto description" ), "qrc:/icons/res/icons/GUI20_mainToolBar_redeemprypto_hover.png", "qrc:/icons/res/icons/GUI20_mainToolBar_redeemprypto.png" , REDEEM_PRYPTO ) );
pStandardMenuModel->append( new QmlMenuToolbarItem( tr( "Info" ), tr( "Info description" ), "qrc:/icons/res/icons/GUI20_mainToolBar_info_hover.png", "qrc:/icons/res/icons/GUI20_mainToolBar_info.png" , INFO ) );
pStandardMenuModel->SetCurrentItemIndex( 0 );
m_pMenuToolbarView->SetModel( pStandardMenuModel );
ConnectListViewSignals();
}
}
}
}
void GUIMenuToolbarControl::ConnectListViewSignals()
{
if ( m_pMenuToolbarView )
{
disconnect( m_pMenuToolbarView );
QmlMenuToolbarModel* pModel = m_pMenuToolbarView->GetModel();
if ( pModel )
{
connect( pModel, SIGNAL( signalCurrentItemIndexChanged() ), this, SLOT( slotCurrentItemIndexChanged() ), Qt::UniqueConnection );
}
}
}
void GUIMenuToolbarControl::slotCurrentItemIndexChanged()
{
emit signalCurrentItemIndexChanged();
}

View File

@@ -0,0 +1,44 @@
#ifndef GUIMENUTOOLBARCONTROL_H
#define GUIMENUTOOLBARCONTROL_H
#include <QQuickItem>
class GUIMenuToolbarListView;
class GUIMenuToolbarControl : public QQuickItem
{
Q_OBJECT
Q_ENUMS( EMenuToolbarItemTypes )
public:
enum EMenuToolbarItemTypes
{ OVERVIEW
, SEND
, RECEIVE
, TRANSACTIONS
, CONTACTS
, REDEEM_PRYPTO
, INFO
};
GUIMenuToolbarControl( QQuickItem* a_pParent = 0 );
virtual ~GUIMenuToolbarControl();
Q_INVOKABLE void InitializeMenuToolbarView( GUIMenuToolbarListView* a_pView );
GUIMenuToolbarListView* GetMenuToolbarView() const { return m_pMenuToolbarView; }
public slots:
signals:
void signalCurrentItemIndexChanged();
public slots:
private:
GUIMenuToolbarListView* m_pMenuToolbarView;
void ConnectListViewSignals();
private slots:
void slotCurrentItemIndexChanged();
};
#endif // GUIMENUTOOLBARCONTROL_H

View File

@@ -0,0 +1,47 @@
#include "guimenutoolbarlistview.h"
#include "qmlmenutoolbarmodel.h"
#include "qmlmenutoolbaritem.h"
GUIMenuToolbarListView::GUIMenuToolbarListView( QQuickItem* a_pParent )
: QQuickItem( a_pParent )
, m_pModel( 0 )
{
}
void GUIMenuToolbarListView::Clear()
{
if ( m_pModel )
{
m_pModel->clear();
}
}
void GUIMenuToolbarListView::OnClicked( int a_iItemIndex )
{
if ( m_pModel )
{
m_pModel->SetCurrentItemIndex( a_iItemIndex );
}
}
GUIMenuToolbarListView::~GUIMenuToolbarListView()
{
if ( m_pModel )
{
delete m_pModel;
m_pModel = 0;
}
}
void GUIMenuToolbarListView::SetModel( QmlMenuToolbarModel* a_pModel )
{
if ( m_pModel )
{
delete m_pModel;
}
m_pModel = a_pModel;
emit signalModelChanged();
}

View File

@@ -0,0 +1,36 @@
#ifndef GUIMENUTOOLBARLISTVIEW_H
#define GUIMENUTOOLBARLISTVIEW_H
#include <QQuickItem>
class QmlListModel;
class QmlMenuToolbarModel;
class QmlMenuToolbarItem;
class GUIMenuToolbarListView : public QQuickItem
{
Q_OBJECT
Q_PROPERTY( QmlMenuToolbarModel* p_pListModel MEMBER m_pModel NOTIFY signalModelChanged )
public:
explicit GUIMenuToolbarListView( QQuickItem *a_pParent = 0 );
virtual ~GUIMenuToolbarListView(); /** Destructor **/
void SetModel( QmlMenuToolbarModel* a_pModel );
QmlMenuToolbarModel* GetModel() const { return m_pModel; }
void Clear();
Q_INVOKABLE void OnClicked( int a_iItemIndex );
signals:
void signalModelChanged();
public slots:
private:
QmlMenuToolbarModel* m_pModel;
};
#endif // GUIMENUTOOLBARLISTVIEW_H

View File

@@ -0,0 +1,106 @@
#include "guimenutoolbarwidget.h"
#include "guimenutoolbarcontrol.h"
#include "guimenutoolbarlistview.h"
#include "qmlmenutoolbarmodel.h"
#include "qmlmenutoolbaritem.h"
#include "qmlimageprovider.h"
#include "gui20_skin.h"
#include <QQuickView>
#include <QQmlContext>
GUIMenuToolbarWidget::GUIMenuToolbarWidget( QWidget *a_pParent )
: QWidget( a_pParent )
, m_pToolbarControl( 0 )
, m_pQmlImageProvider( 0 )
{
registerCustomQmlTypes();
}
GUIMenuToolbarWidget::~GUIMenuToolbarWidget()
{
if ( m_pQmlImageProvider )
{
delete m_pQmlImageProvider;
m_pQmlImageProvider = 0;
}
if( m_pToolbarControl )
{
delete m_pToolbarControl;
m_pToolbarControl = 0;
}
}
void GUIMenuToolbarWidget::registerCustomQmlTypes()
{
qmlRegisterType<GUIMenuToolbarControl>("CasinoCoinControls", 1, 0, "GUIMenuToolbarControl" );
qmlRegisterType<GUIMenuToolbarListView>("CasinoCoinControls", 1, 0, "GUIMenuToolbarListView" );
qmlRegisterType<QmlMenuToolbarModel>("CasinoCoinControls", 1, 0, "QmlMenuToolbarModel" );
}
void GUIMenuToolbarWidget::slotCurrentItemChanged()
{
if ( m_pToolbarControl )
{
GUIMenuToolbarListView* pListView = m_pToolbarControl->GetMenuToolbarView();
if ( pListView )
{
QmlMenuToolbarModel* pModel = pListView->GetModel();
if ( pModel )
{
emit signalItemClicked( static_cast<GUIMenuToolbarControl::EMenuToolbarItemTypes>( pModel->GetData( pModel->GetCurrentItemIndex(), QmlMenuToolbarItem::ROLE_INTERNAL_TYPE ).toInt() ) );
}
}
}
}
QWidget* GUIMenuToolbarWidget::dockQmlToWidget()
{
QQuickView* pMenuToolbarWindow = new QQuickView;
QQmlContext* pContext = pMenuToolbarWindow->rootContext();
if ( pContext )
{
pContext->setContextProperty( "GUI20Skin", &GUI20Skin::Instance() );
}
QQmlEngine* pEngine = pMenuToolbarWindow->engine();
if ( pEngine )
{
m_pQmlImageProvider = new QmlImageProvider();
pEngine->addImageProvider( "mainToolBarImages", m_pQmlImageProvider );
}
pMenuToolbarWindow->setSource( QUrl( QStringLiteral( "qrc:/qml/qtquick_controls/qml/QmlGUIMenuToolbarWindow.qml" ) ) );
QQuickItem* pRootObject = pMenuToolbarWindow->rootObject();
if ( pRootObject )
{
m_pToolbarControl = pRootObject->findChild<GUIMenuToolbarControl*>();
if ( m_pToolbarControl )
{
connect( m_pToolbarControl, SIGNAL( signalCurrentItemIndexChanged() ), this, SLOT( slotCurrentItemChanged() ), Qt::UniqueConnection );
}
}
QWidget* pPlaceHolder = QWidget::createWindowContainer( pMenuToolbarWindow, this );
if ( pPlaceHolder )
{
pPlaceHolder->setMinimumHeight( 82 );
}
return pPlaceHolder;
}
void GUIMenuToolbarWidget::SetCurrentItemType( GUIMenuToolbarControl::EMenuToolbarItemTypes a_eType )
{
if ( m_pToolbarControl )
{
GUIMenuToolbarListView* pListView = m_pToolbarControl->GetMenuToolbarView();
if ( pListView )
{
QmlMenuToolbarModel* pModel = pListView->GetModel();
if ( pModel )
{
pModel->SetCurrentItemIndex( pModel->GetItemIndex( QmlMenuToolbarItem::ROLE_INTERNAL_TYPE, QVariant( a_eType ) ) );
}
}
}
}

View File

@@ -0,0 +1,34 @@
#ifndef GUIMENUTOOLBARWIDGET_H
#define GUIMENUTOOLBARWIDGET_H
#include <QWidget>
#include "guimenutoolbarcontrol.h"
class QmlImageProvider;
class GUIMenuToolbarWidget : public QWidget
{
Q_OBJECT
public:
explicit GUIMenuToolbarWidget( QWidget* a_pParent = 0 );
virtual ~GUIMenuToolbarWidget();
QWidget* dockQmlToWidget();
void SetCurrentItemType( GUIMenuToolbarControl::EMenuToolbarItemTypes a_eType );
signals:
void signalItemClicked( GUIMenuToolbarControl::EMenuToolbarItemTypes a_eType );
public slots:
private:
void registerCustomQmlTypes();
GUIMenuToolbarControl* m_pToolbarControl;
QmlImageProvider* m_pQmlImageProvider;
private slots:
void slotCurrentItemChanged();
};
#endif // GUIMENUTOOLBARWIDGET_H

View File

@@ -22,8 +22,9 @@ void QmlImageProvider::AddToImagePool( const QMap<QString, QImage>& a_aImages )
}
}
QImage QmlImageProvider::requestImage( const QString& a_rImageID, QSize* a_pSize, const QSize& a_ra_rRequestedSize )
QImage QmlImageProvider::requestImage( const QString& a_rImageID, QSize* a_pSize, const QSize& a_rRequestedSize )
{
Q_UNUSED( a_rRequestedSize );
QImage oImage( m_aImagePool.value( a_rImageID ) );
if ( a_pSize )
{

View File

@@ -0,0 +1,37 @@
#include "qmlmenutoolbaritem.h"
#include <QDebug>
QmlMenuToolbarItem::QmlMenuToolbarItem
( QString a_strText
, QString a_strDescription
, QString a_strImageHoverSource
, QString a_strImageNormalSource
, int a_iType
, QObject *a_pParent
)
: QmlListItem( QVariant( a_strText ), QVariant( a_strDescription ), QVariant( a_strImageHoverSource ), QVariant( a_strImageNormalSource ), QVariant( a_iType ), a_pParent )
{
}
QmlMenuToolbarItem::QmlMenuToolbarItem( QObject* a_pParent )
: QmlListItem( QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( "" ), QVariant( -1 ), a_pParent )
{
}
QmlMenuToolbarItem::~QmlMenuToolbarItem()
{
}
QHash<int, QByteArray> QmlMenuToolbarItem::RoleNames() const
{
QHash<int, QByteArray> aRoleNames;
aRoleNames[ROLE_TEXT] = "m_text";
aRoleNames[ROLE_DESCRIPTION] = "m_description";
aRoleNames[ROLE_IMAGE_HOVER_SOURCE] = "m_imageHoverSource";
aRoleNames[ROLE_IMAGE_NORMAL_SOURCE] = "m_imageNormalSource";
aRoleNames[ROLE_INTERNAL_TYPE] = "m_internalType";
return aRoleNames;
}

View File

@@ -0,0 +1,36 @@
#ifndef QMLMENUTOOLBARITEM_H
#define QMLMENUTOOLBARITEM_H
#include "qmllistitem.h"
class QmlMenuToolbarItem : public QmlListItem
{
Q_OBJECT
Q_ENUMS( EMenuToolbarRoles )
public:
enum EMenuToolbarRoles /** User-specific model roles **/
{ ROLE_TEXT = ROLE_1
, ROLE_DESCRIPTION = ROLE_2
, ROLE_IMAGE_HOVER_SOURCE = ROLE_3
, ROLE_IMAGE_NORMAL_SOURCE = ROLE_4
, ROLE_INTERNAL_TYPE = ROLE_5
};
explicit QmlMenuToolbarItem
( QString a_strText
, QString a_strDescription
, QString a_strImageHoverSource
, QString a_strImageNormalSource
, int a_iType
, QObject *a_pParent = 0
);
explicit QmlMenuToolbarItem( QObject *a_pParent = 0 );
virtual ~QmlMenuToolbarItem();
virtual QHash<int, QByteArray> RoleNames() const; /** Define class-specific roles **/
};
#endif // QMLMENUTOOLBARITEM_H

View File

@@ -0,0 +1,15 @@
#include "qmlmenutoolbarmodel.h"
#include "qmlmenutoolbaritem.h"
#include <QDebug>
QmlMenuToolbarModel::QmlMenuToolbarModel( QObject* a_pParent )
: QmlListModel( new QmlMenuToolbarItem(), a_pParent )
{
}
QmlMenuToolbarModel::~QmlMenuToolbarModel()
{
}

View File

@@ -0,0 +1,16 @@
#ifndef QMLMENUTOOLBARMODEL_H
#define QMLMENUTOOLBARMODEL_H
#include "qmllistmodel.h"
class QmlMenuToolbarItem;
class QmlMenuToolbarModel : public QmlListModel
{
Q_OBJECT
public:
explicit QmlMenuToolbarModel( QObject* a_pParent = 0 );
virtual ~QmlMenuToolbarModel(); /** Destructor **/
};
#endif // QMLMENUTOOLBARMODEL_H

View File

@@ -7,7 +7,6 @@ Rectangle
{
id: id_bannerControlMain
}
color: "#F2F0F1"
width: id_bannerControlMain.width
height: id_bannerControlMain.height
}

View File

@@ -0,0 +1,57 @@
import QtQuick 2.0
import CasinoCoinControls 1.0
GUIMenuToolbarControl
{
id: id_toolbarControl
Rectangle
{
id: id_toolbarRect
anchors.top: id_toolbarControl.top
anchors.left: id_toolbarControl.left
width: id_toolbarControl.width
height: id_toolbarControl.height - id_toolbarBottomStripe.height
gradient:
Gradient
{
GradientStop { position: 0.0; color: GUI20Skin.colorToolbarMainGradientBegin }
GradientStop { position: 1.0; color: GUI20Skin.colorToolbarMainGradientEnd }
}
z: 0
QmlGUIMenuToolbarListView
{
id: id_menuToolbarListView
width: id_toolbarControl.width
anchors.left: id_toolbarRect.left
anchors.top: id_toolbarRect.top
Component.onCompleted:
{
id_toolbarControl.InitializeMenuToolbarView( id_menuToolbarListView )
}
z: 2
}
Rectangle
{
id: id_currentSelectionIndicator
height: id_toolbarControl.height
width: height
color: GUI20Skin.colorToolbarMainCurrent
z: 1
x: id_menuToolbarListView.m_iCurrentItemXProperty
Rectangle
{
id: id_toolbarBottomStripe
width: id_currentSelectionIndicator.width
height: 5
anchors.bottom: id_currentSelectionIndicator.bottom
color: GUI20Skin.colorToolbarMainBottomCurrent
}
Behavior on x
{
NumberAnimation { duration: 300; easing.type: Easing.InOutQuad }
}
}
}
}

View File

@@ -0,0 +1,79 @@
import QtQuick 2.0
import CasinoCoinControls 1.0
GUIMenuToolbarListView
{
id: id_ListViewItem
property alias m_ListModel: id_ListView.model
property alias m_ListView: id_ListView
property real m_iCurrentItemXProperty: id_ListView.currentIndex * id_toolbarControl.height
property real m_iCppCurrentIndex: p_pListModel.p_iCurrentElementIndex
ListView
{
id: id_ListView
anchors.fill: id_ListViewItem
model: p_pListModel
delegate: id_menuToolbarViewDelegate
orientation: ListView.Horizontal
currentIndex: m_iCppCurrentIndex
}
Component
{
id: id_menuToolbarViewDelegate
Rectangle
{
id: id_delegateRect
height: id_toolbarControl.height
width: height
color: "transparent"
z: 1
Rectangle
{
id: id_singleButton
height: id_toolbarControl.height - id_toolbarBottomStripe.height
width: id_delegateRect.width
color: "transparent"
Image
{
id: id_singleButtonImage
source: id_delegateMouseArea.containsMouse ? m_imageHoverSource : p_pListModel.p_iCurrentElementIndex == index ? m_imageHoverSource : m_imageNormalSource
anchors.centerIn: id_singleButton
}
Text
{
id: id_singleButtonText
text: m_text
wrapMode: Text.Wrap
color: id_delegateMouseArea.containsMouse ? GUI20Skin.colorToolbarMainTextCurrent : p_pListModel.p_iCurrentElementIndex == index ? GUI20Skin.colorToolbarMainTextCurrent : GUI20Skin.colorToolbarMainTextNormal
style: Text.Sunken
styleColor: GUI20Skin.colorToolbarMainTextShadow
font.pixelSize: 10
anchors.bottom: id_singleButton.bottom
anchors.bottomMargin: 5
anchors.horizontalCenter: id_singleButton.horizontalCenter
}
}
MouseArea
{
id: id_delegateMouseArea
anchors.fill: id_singleButton
hoverEnabled: true
onClicked:
{
OnClicked( index )
}
}
}
}
}

View File

@@ -0,0 +1,14 @@
import QtQuick 2.0
Rectangle
{
id: id_toolbarRoot
width: 1280
height: 77 + 5
color: "transparent"
QmlGUIMenuToolbarControl
{
id: id_toolbarControlMain
anchors.fill: id_toolbarRoot
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B