mirror of
https://github.com/AskDavis/Casinotest.git
synced 2026-03-02 01:27:14 -08:00
a few fixes:
1. coredump on closing app 2. not resizing toolbar 3. added cards image to the right side of toolbar + 'visit our website' link 4. removed odd white stripe in adverts widget 5. unified offline data resource directory
This commit is contained in:
@@ -30,7 +30,7 @@ GUIBannerWidget::GUIBannerWidget(QWidget *parent)
|
||||
|
||||
GUIBannerWidget::~GUIBannerWidget()
|
||||
{
|
||||
|
||||
// member objects are moved to qml engine and it manages their instances
|
||||
}
|
||||
|
||||
void GUIBannerWidget::registerCustomQmlTypes()
|
||||
@@ -43,25 +43,31 @@ void GUIBannerWidget::registerCustomQmlTypes()
|
||||
QWidget* GUIBannerWidget::dockQmlToWidget()
|
||||
{
|
||||
QQuickView* pBannerWindow = new QQuickView;
|
||||
pBannerWindow->setSource( QUrl( QStringLiteral( "qrc:/qml/qtquick_controls/qml/QmlGUIBannerWindow.qml" ) ) );
|
||||
QQmlEngine* pEngine = pBannerWindow->engine();
|
||||
if ( pEngine )
|
||||
QWidget* pPlaceHolder = 0;
|
||||
if ( pBannerWindow )
|
||||
{
|
||||
m_pQmlImageProvider = new QmlImageProvider();
|
||||
pEngine->addImageProvider( "advertImages", m_pQmlImageProvider );
|
||||
}
|
||||
QWidget* pPlaceHolder = QWidget::createWindowContainer( pBannerWindow, this );
|
||||
pPlaceHolder->setMinimumSize( 445, 120 );
|
||||
pPlaceHolder->setMaximumSize( 445, 120 );
|
||||
pPlaceHolder->setStyleSheet( "background-color: rgb(242, 241, 240);");
|
||||
QQuickItem* pRootObject = pBannerWindow->rootObject();
|
||||
if ( pRootObject )
|
||||
{
|
||||
m_pBannerControl = pRootObject->findChild<GUIBannerControl*>();
|
||||
if ( m_pBannerControl )
|
||||
pBannerWindow->setSource( QUrl( QStringLiteral( "qrc:/qml/qtquick_controls/qml/QmlGUIBannerWindow.qml" ) ) );
|
||||
QQmlEngine* pEngine = pBannerWindow->engine();
|
||||
if ( pEngine )
|
||||
{
|
||||
m_pBannerControl->setWidth( ( 115 * 3 ) + ( 4 * 10 ) + 60 );
|
||||
m_pBannerControl->setHeight( 115 );
|
||||
m_pQmlImageProvider = new QmlImageProvider();
|
||||
pEngine->addImageProvider( "advertImages", m_pQmlImageProvider );
|
||||
}
|
||||
pPlaceHolder = QWidget::createWindowContainer( pBannerWindow, this );
|
||||
if ( pPlaceHolder )
|
||||
{
|
||||
pPlaceHolder->setMinimumSize( 445, 115 );
|
||||
pPlaceHolder->setMaximumSize( 445, 115 );
|
||||
}
|
||||
QQuickItem* pRootObject = pBannerWindow->rootObject();
|
||||
if ( pRootObject )
|
||||
{
|
||||
m_pBannerControl = pRootObject->findChild<GUIBannerControl*>();
|
||||
if ( m_pBannerControl )
|
||||
{
|
||||
m_pBannerControl->setWidth( ( 115 * 3 ) + ( 4 * 10 ) + 60 );
|
||||
m_pBannerControl->setHeight( 115 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
GUIMenuToolbarControl::GUIMenuToolbarControl( QQuickItem* a_pParent )
|
||||
: QQuickItem( a_pParent )
|
||||
, m_pMenuToolbarView( 0 )
|
||||
, m_strVisitWebsiteText( tr( "Visit our website" ) )
|
||||
, m_strWebsiteURL( tr( "casinocoin.org" ) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -51,6 +53,24 @@ void GUIMenuToolbarControl::InitializeMenuToolbarView( GUIMenuToolbarListView* a
|
||||
}
|
||||
}
|
||||
|
||||
void GUIMenuToolbarControl::SetVisitWebsiteText( QString a_strNewText )
|
||||
{
|
||||
if ( m_strVisitWebsiteText != a_strNewText )
|
||||
{
|
||||
m_strVisitWebsiteText = a_strNewText;
|
||||
emit signalVisitWebsiteTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void GUIMenuToolbarControl::SetWebsiteURL( QString a_strNewText )
|
||||
{
|
||||
if ( m_strWebsiteURL != a_strNewText )
|
||||
{
|
||||
m_strWebsiteURL = a_strNewText;
|
||||
emit signalWebsiteURLChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void GUIMenuToolbarControl::ConnectListViewSignals()
|
||||
{
|
||||
if ( m_pMenuToolbarView )
|
||||
|
||||
@@ -8,6 +8,10 @@ class GUIMenuToolbarListView;
|
||||
class GUIMenuToolbarControl : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY( QString p_strVisitWebsiteText MEMBER m_strVisitWebsiteText NOTIFY signalVisitWebsiteTextChanged )
|
||||
Q_PROPERTY( QString p_strWebsiteURL MEMBER m_strWebsiteURL NOTIFY signalWebsiteURLChanged )
|
||||
|
||||
Q_ENUMS( EMenuToolbarItemTypes )
|
||||
public:
|
||||
|
||||
@@ -27,16 +31,27 @@ public:
|
||||
Q_INVOKABLE void InitializeMenuToolbarView( GUIMenuToolbarListView* a_pView );
|
||||
GUIMenuToolbarListView* GetMenuToolbarView() const { return m_pMenuToolbarView; }
|
||||
|
||||
void SetVisitWebsiteText( QString a_strNewText );
|
||||
void SetWebsiteURL( QString a_strNewText );
|
||||
|
||||
QString GetVisitWebsiteText() const { return m_strVisitWebsiteText; }
|
||||
QString GetWebsiteURL() const { return m_strWebsiteURL; }
|
||||
|
||||
public slots:
|
||||
|
||||
signals:
|
||||
void signalCurrentItemIndexChanged();
|
||||
public slots:
|
||||
void signalVisitWebsiteTextChanged();
|
||||
void signalWebsiteURLChanged();
|
||||
void signalOurWebsiteURLClicked();
|
||||
|
||||
private:
|
||||
GUIMenuToolbarListView* m_pMenuToolbarView;
|
||||
QString m_strVisitWebsiteText;
|
||||
QString m_strWebsiteURL;
|
||||
|
||||
void ConnectListViewSignals();
|
||||
|
||||
private slots:
|
||||
void slotCurrentItemIndexChanged();
|
||||
};
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include <QQuickView>
|
||||
#include <QQmlContext>
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
GUIMenuToolbarWidget::GUIMenuToolbarWidget( QWidget *a_pParent )
|
||||
: QWidget( a_pParent )
|
||||
, m_pToolbarControl( 0 )
|
||||
@@ -21,16 +24,7 @@ GUIMenuToolbarWidget::GUIMenuToolbarWidget( QWidget *a_pParent )
|
||||
|
||||
GUIMenuToolbarWidget::~GUIMenuToolbarWidget()
|
||||
{
|
||||
if ( m_pQmlImageProvider )
|
||||
{
|
||||
delete m_pQmlImageProvider;
|
||||
m_pQmlImageProvider = 0;
|
||||
}
|
||||
if( m_pToolbarControl )
|
||||
{
|
||||
delete m_pToolbarControl;
|
||||
m_pToolbarControl = 0;
|
||||
}
|
||||
// member objects are moved to qml engine and it manages their instances
|
||||
}
|
||||
|
||||
void GUIMenuToolbarWidget::registerCustomQmlTypes()
|
||||
@@ -56,34 +50,53 @@ void GUIMenuToolbarWidget::slotCurrentItemChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void GUIMenuToolbarWidget::slotOurWebsiteURLClicked()
|
||||
{
|
||||
qDebug() << "clicked";
|
||||
if ( m_pToolbarControl )
|
||||
{
|
||||
QString strUrl = m_pToolbarControl->GetWebsiteURL();
|
||||
if ( !strUrl.contains( "http" ) )
|
||||
{
|
||||
strUrl.prepend( "http://" );
|
||||
}
|
||||
QDesktopServices::openUrl( QUrl( strUrl ) );
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* GUIMenuToolbarWidget::dockQmlToWidget()
|
||||
{
|
||||
QQuickView* pMenuToolbarWindow = new QQuickView;
|
||||
QQmlContext* pContext = pMenuToolbarWindow->rootContext();
|
||||
if ( pContext )
|
||||
QWidget* pPlaceHolder = 0;
|
||||
if ( pMenuToolbarWindow )
|
||||
{
|
||||
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 )
|
||||
QQmlContext* pContext = pMenuToolbarWindow->rootContext();
|
||||
if ( pContext )
|
||||
{
|
||||
connect( m_pToolbarControl, SIGNAL( signalCurrentItemIndexChanged() ), this, SLOT( slotCurrentItemChanged() ), Qt::UniqueConnection );
|
||||
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 );
|
||||
connect( m_pToolbarControl, SIGNAL( signalOurWebsiteURLClicked() ), this, SLOT( slotOurWebsiteURLClicked() ), Qt::UniqueConnection );
|
||||
}
|
||||
}
|
||||
pPlaceHolder = QWidget::createWindowContainer( pMenuToolbarWindow );
|
||||
if ( pPlaceHolder )
|
||||
{
|
||||
pPlaceHolder->setMinimumHeight( 82 );
|
||||
}
|
||||
}
|
||||
QWidget* pPlaceHolder = QWidget::createWindowContainer( pMenuToolbarWindow, this );
|
||||
if ( pPlaceHolder )
|
||||
{
|
||||
pPlaceHolder->setMinimumHeight( 82 );
|
||||
}
|
||||
return pPlaceHolder;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ private:
|
||||
|
||||
private slots:
|
||||
void slotCurrentItemChanged();
|
||||
void slotOurWebsiteURLClicked();
|
||||
};
|
||||
|
||||
#endif // GUIMENUTOOLBARWIDGET_H
|
||||
|
||||
@@ -5,7 +5,7 @@ GUIBannerControl
|
||||
{
|
||||
id: id_bannerControl
|
||||
|
||||
property color colorBackgroundInWidget: "#F2F0F1"
|
||||
property color colorBackgroundInWidget: "#FFFFFF"
|
||||
Rectangle
|
||||
{
|
||||
id: id_leftArrow
|
||||
|
||||
@@ -7,6 +7,7 @@ Rectangle
|
||||
{
|
||||
id: id_bannerControlMain
|
||||
}
|
||||
color: "transparent"
|
||||
width: id_bannerControlMain.width
|
||||
height: id_bannerControlMain.height
|
||||
}
|
||||
|
||||
@@ -53,5 +53,52 @@ GUIMenuToolbarControl
|
||||
NumberAnimation { duration: 300; easing.type: Easing.InOutQuad }
|
||||
}
|
||||
}
|
||||
Image
|
||||
{
|
||||
id: id_cardsImage
|
||||
anchors.top: id_toolbarRect.top
|
||||
anchors.right: id_toolbarRect.right
|
||||
source: "qrc:/images/res/images/GUI20_mainToolBar_cards.png"
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
id: id_visitWebsiteBox
|
||||
height: id_visitWebsiteText.height + id_visitWebsiteURL.height
|
||||
width: id_visitWebsiteText.width
|
||||
anchors.rightMargin: 20
|
||||
anchors.right: id_toolbarRect.right
|
||||
anchors.topMargin: 25
|
||||
anchors.top: id_toolbarRect.top
|
||||
color: "transparent"
|
||||
Column
|
||||
{
|
||||
anchors.right: id_visitWebsiteBox.right
|
||||
anchors.top: id_visitWebsiteBox.top
|
||||
Text
|
||||
{
|
||||
id: id_visitWebsiteText
|
||||
text: id_toolbarControl.p_strVisitWebsiteText
|
||||
color: GUI20Skin.colorToolbarMainTextVisitWebsite
|
||||
}
|
||||
Text
|
||||
{
|
||||
id: id_visitWebsiteURL
|
||||
text: id_toolbarControl.p_strWebsiteURL
|
||||
font.bold: true
|
||||
color: GUI20Skin.colorToolbarMainTextWebsiteURL
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: id_visitWebsiteMouseArea
|
||||
anchors.fill: id_visitWebsiteBox
|
||||
onClicked:
|
||||
{
|
||||
console.log( "clicked hehe" )
|
||||
signalOurWebsiteURLClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ import QtQuick 2.0
|
||||
Rectangle
|
||||
{
|
||||
id: id_toolbarRoot
|
||||
width: 1280
|
||||
height: 77 + 5
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
QmlGUIMenuToolbarControl
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user