mirror of
https://github.com/AskDavis/Casinotest.git
synced 2026-01-03 04:19:47 -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:
@@ -1,5 +1,10 @@
|
|||||||
#include "casinocoinwebapiparser.h"
|
#include "casinocoinwebapiparser.h"
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonValue>
|
#include <QJsonValue>
|
||||||
@@ -83,11 +88,9 @@ void CasinoCoinWebAPIParser::ParseNewsItems( const QJsonObject& a_rJsonNewsItems
|
|||||||
QByteArray CasinoCoinWebAPIParser::ReadFile( QString a_strSourcePath )
|
QByteArray CasinoCoinWebAPIParser::ReadFile( QString a_strSourcePath )
|
||||||
{
|
{
|
||||||
QByteArray strAnswer;
|
QByteArray strAnswer;
|
||||||
if ( !QDir( "offlineData" ).exists() )
|
boost::filesystem::path pathCasinoCoinAPIResources = GetDataDir() / "cscapires";
|
||||||
{
|
|
||||||
QDir().mkdir( "offlineData" );
|
QFile fileOutput( QDir( QString::fromStdString( pathCasinoCoinAPIResources.string() ) ).absoluteFilePath( a_strSourcePath ) );
|
||||||
}
|
|
||||||
QFile fileOutput( QDir( "offlineData" ).absoluteFilePath( a_strSourcePath ) );
|
|
||||||
if ( !fileOutput.open( QIODevice::ReadOnly ) )
|
if ( !fileOutput.open( QIODevice::ReadOnly ) )
|
||||||
{
|
{
|
||||||
qWarning() << "cannot open file to read: " << QDir::current().relativeFilePath( a_strSourcePath );
|
qWarning() << "cannot open file to read: " << QDir::current().relativeFilePath( a_strSourcePath );
|
||||||
@@ -102,11 +105,10 @@ QByteArray CasinoCoinWebAPIParser::ReadFile( QString a_strSourcePath )
|
|||||||
|
|
||||||
void CasinoCoinWebAPIParser::StoreFile( QString a_strDestinationPath, const QByteArray& a_rJsonFile )
|
void CasinoCoinWebAPIParser::StoreFile( QString a_strDestinationPath, const QByteArray& a_rJsonFile )
|
||||||
{
|
{
|
||||||
if ( !QDir( "offlineData" ).exists() )
|
boost::filesystem::path pathCasinoCoinAPIResources = GetDataDir() / "cscapires";
|
||||||
{
|
boost::filesystem::create_directories(pathCasinoCoinAPIResources);
|
||||||
QDir().mkdir( "offlineData" );
|
|
||||||
}
|
QFile fileOutput( QDir( QString::fromStdString( pathCasinoCoinAPIResources.string() ) ).absoluteFilePath( a_strDestinationPath ) );
|
||||||
QFile fileOutput( QDir( "offlineData" ).absoluteFilePath( a_strDestinationPath ) );
|
|
||||||
if ( !fileOutput.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
|
if ( !fileOutput.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
|
||||||
{
|
{
|
||||||
qWarning() << "cannot open file to write: " << QDir::current().relativeFilePath( a_strDestinationPath );
|
qWarning() << "cannot open file to write: " << QDir::current().relativeFilePath( a_strDestinationPath );
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
<file alias="splash">res/images/splash.png</file>
|
<file alias="splash">res/images/splash.png</file>
|
||||||
<file alias="splash_testnet">res/images/splash_testnet.png</file>
|
<file alias="splash_testnet">res/images/splash_testnet.png</file>
|
||||||
<file alias="backg">res/images/wallet.png</file>
|
<file alias="backg">res/images/wallet.png</file>
|
||||||
|
<file>res/images/GUI20_mainToolBar_cards.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/movies">
|
<qresource prefix="/movies">
|
||||||
<file alias="update_spinner">res/movies/update_spinner.mng</file>
|
<file alias="update_spinner">res/movies/update_spinner.mng</file>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const QString BitcoinGUI::DEFAULT_WALLET = "~Default";
|
|||||||
BitcoinGUI::BitcoinGUI(QWidget *parent) :
|
BitcoinGUI::BitcoinGUI(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
clientModel(0),
|
clientModel(0),
|
||||||
menuBar_new(0),
|
toolbarGUI20(0),
|
||||||
encryptWalletAction(0),
|
encryptWalletAction(0),
|
||||||
changePassphraseAction(0),
|
changePassphraseAction(0),
|
||||||
aboutQtAction(0),
|
aboutQtAction(0),
|
||||||
@@ -82,13 +82,13 @@ BitcoinGUI::BitcoinGUI(QWidget *parent) :
|
|||||||
#endif
|
#endif
|
||||||
// Create wallet frame with main menu
|
// Create wallet frame with main menu
|
||||||
walletFrame = new WalletFrame(this);
|
walletFrame = new WalletFrame(this);
|
||||||
menuBar_new = new GUIMenuToolbarWidget( this );
|
toolbarGUI20 = new GUIMenuToolbarWidget( this );
|
||||||
connect( menuBar_new, SIGNAL( signalItemClicked( GUIMenuToolbarControl::EMenuToolbarItemTypes ) ), this, SLOT( slotMenuToolbarItemClicked( GUIMenuToolbarControl::EMenuToolbarItemTypes ) ), Qt::UniqueConnection );
|
connect( toolbarGUI20, SIGNAL( signalItemClicked( GUIMenuToolbarControl::EMenuToolbarItemTypes ) ), this, SLOT( slotMenuToolbarItemClicked( GUIMenuToolbarControl::EMenuToolbarItemTypes ) ), Qt::UniqueConnection );
|
||||||
|
|
||||||
// envelope them in another widget
|
// envelope them in another widget
|
||||||
QWidget* pCentralWidget = new QWidget( this );
|
QWidget* pCentralWidget = new QWidget( this );
|
||||||
QVBoxLayout* pBoxLayout = new QVBoxLayout();
|
QVBoxLayout* pBoxLayout = new QVBoxLayout();
|
||||||
pBoxLayout->addWidget( menuBar_new->dockQmlToWidget() );
|
pBoxLayout->addWidget( toolbarGUI20->dockQmlToWidget() );
|
||||||
pBoxLayout->addWidget( walletFrame );
|
pBoxLayout->addWidget( walletFrame );
|
||||||
pCentralWidget->setLayout( pBoxLayout );
|
pCentralWidget->setLayout( pBoxLayout );
|
||||||
|
|
||||||
@@ -300,18 +300,6 @@ void BitcoinGUI::createMenuBar()
|
|||||||
help->addAction(aboutQtAction);
|
help->addAction(aboutQtAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::createToolBars()
|
|
||||||
{
|
|
||||||
QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
|
|
||||||
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
|
||||||
toolbar->addAction(overviewAction);
|
|
||||||
toolbar->addAction(sendCoinsAction);
|
|
||||||
toolbar->addAction(receiveCoinsAction);
|
|
||||||
toolbar->addAction(historyAction);
|
|
||||||
toolbar->addAction(addressBookAction);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BitcoinGUI::setClientModel(ClientModel *clientModel)
|
void BitcoinGUI::setClientModel(ClientModel *clientModel)
|
||||||
{
|
{
|
||||||
this->clientModel = clientModel;
|
this->clientModel = clientModel;
|
||||||
@@ -481,7 +469,7 @@ void BitcoinGUI::optionsClicked()
|
|||||||
|
|
||||||
void BitcoinGUI::aboutClicked()
|
void BitcoinGUI::aboutClicked()
|
||||||
{
|
{
|
||||||
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::INFO );
|
if ( toolbarGUI20 ) toolbarGUI20->SetCurrentItemType( GUIMenuToolbarControl::INFO );
|
||||||
AboutDialog dlg;
|
AboutDialog dlg;
|
||||||
dlg.setModel(clientModel);
|
dlg.setModel(clientModel);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
@@ -499,31 +487,31 @@ void BitcoinGUI::aboutClicked()
|
|||||||
void BitcoinGUI::gotoOverviewPage()
|
void BitcoinGUI::gotoOverviewPage()
|
||||||
{
|
{
|
||||||
if (walletFrame) walletFrame->gotoOverviewPage();
|
if (walletFrame) walletFrame->gotoOverviewPage();
|
||||||
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::OVERVIEW );
|
if ( toolbarGUI20 ) toolbarGUI20->SetCurrentItemType( GUIMenuToolbarControl::OVERVIEW );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::gotoHistoryPage()
|
void BitcoinGUI::gotoHistoryPage()
|
||||||
{
|
{
|
||||||
if (walletFrame) walletFrame->gotoHistoryPage();
|
if (walletFrame) walletFrame->gotoHistoryPage();
|
||||||
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::TRANSACTIONS );
|
if ( toolbarGUI20 ) toolbarGUI20->SetCurrentItemType( GUIMenuToolbarControl::TRANSACTIONS );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::gotoAddressBookPage()
|
void BitcoinGUI::gotoAddressBookPage()
|
||||||
{
|
{
|
||||||
if (walletFrame) walletFrame->gotoAddressBookPage();
|
if (walletFrame) walletFrame->gotoAddressBookPage();
|
||||||
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::CONTACTS );
|
if ( toolbarGUI20 ) toolbarGUI20->SetCurrentItemType( GUIMenuToolbarControl::CONTACTS );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::gotoReceiveCoinsPage()
|
void BitcoinGUI::gotoReceiveCoinsPage()
|
||||||
{
|
{
|
||||||
if (walletFrame) walletFrame->gotoReceiveCoinsPage();
|
if (walletFrame) walletFrame->gotoReceiveCoinsPage();
|
||||||
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::RECEIVE );
|
if ( toolbarGUI20 ) toolbarGUI20->SetCurrentItemType( GUIMenuToolbarControl::RECEIVE );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::gotoSendCoinsPage(QString addr)
|
void BitcoinGUI::gotoSendCoinsPage(QString addr)
|
||||||
{
|
{
|
||||||
if (walletFrame) walletFrame->gotoSendCoinsPage(addr);
|
if (walletFrame) walletFrame->gotoSendCoinsPage(addr);
|
||||||
if ( menuBar_new ) menuBar_new->SetCurrentItemType( GUIMenuToolbarControl::SEND );
|
if ( toolbarGUI20 ) toolbarGUI20->SetCurrentItemType( GUIMenuToolbarControl::SEND );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::gotoSignMessageTab(QString addr)
|
void BitcoinGUI::gotoSignMessageTab(QString addr)
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
ClientModel *clientModel;
|
ClientModel *clientModel;
|
||||||
WalletFrame *walletFrame;
|
WalletFrame *walletFrame;
|
||||||
GUIMenuToolbarWidget *menuBar_new;
|
GUIMenuToolbarWidget *toolbarGUI20;
|
||||||
|
|
||||||
QLabel *labelEncryptionIcon;
|
QLabel *labelEncryptionIcon;
|
||||||
QLabel *labelConnectionsIcon;
|
QLabel *labelConnectionsIcon;
|
||||||
@@ -121,8 +121,6 @@ private:
|
|||||||
void createActions();
|
void createActions();
|
||||||
/** Create the menu bar and sub-menus. */
|
/** Create the menu bar and sub-menus. */
|
||||||
void createMenuBar();
|
void createMenuBar();
|
||||||
/** Create the toolbars */
|
|
||||||
void createToolBars();
|
|
||||||
/** Create system tray icon and notification */
|
/** Create system tray icon and notification */
|
||||||
void createTrayIcon();
|
void createTrayIcon();
|
||||||
/** Create system tray menu (or setup the dock menu) */
|
/** Create system tray menu (or setup the dock menu) */
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ GUI20Skin::GUI20Skin( QObject* a_pParent )
|
|||||||
, colorToolbarMainBottomCurrent( "#e1252b" )
|
, colorToolbarMainBottomCurrent( "#e1252b" )
|
||||||
, colorToolbarMainTextCurrent( "#ffffff" )
|
, colorToolbarMainTextCurrent( "#ffffff" )
|
||||||
, colorToolbarMainTextNormal( "#3f0a0c" )
|
, colorToolbarMainTextNormal( "#3f0a0c" )
|
||||||
|
, colorToolbarMainTextWebsiteURL( colorToolbarMainTextCurrent )
|
||||||
|
, colorToolbarMainTextVisitWebsite( "#ffffaf" )
|
||||||
|
|
||||||
, colorToolbarMainTextShadow( "#c72427" )
|
, colorToolbarMainTextShadow( "#c72427" )
|
||||||
, colorMainWindowBackground( "#afafaf" )
|
, colorMainWindowBackground( "#afafaf" )
|
||||||
, colorMainWindowFrameBackground( "#ffffff" )
|
, colorMainWindowFrameBackground( "#ffffff" )
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ class GUI20Skin : public QObject
|
|||||||
Q_PROPERTY( QColor colorToolbarMainTextCurrent READ GetColorToolbarMainTextCurrent CONSTANT )
|
Q_PROPERTY( QColor colorToolbarMainTextCurrent READ GetColorToolbarMainTextCurrent CONSTANT )
|
||||||
Q_PROPERTY( QColor colorToolbarMainTextNormal READ GetColorToolbarMainTextNormal CONSTANT )
|
Q_PROPERTY( QColor colorToolbarMainTextNormal READ GetColorToolbarMainTextNormal CONSTANT )
|
||||||
Q_PROPERTY( QColor colorToolbarMainTextShadow READ GetColorToolbarMainTextShadow CONSTANT )
|
Q_PROPERTY( QColor colorToolbarMainTextShadow READ GetColorToolbarMainTextShadow CONSTANT )
|
||||||
|
Q_PROPERTY( QColor colorToolbarMainTextWebsiteURL READ GetColorToolbarMainTextWebsiteURL CONSTANT )
|
||||||
|
Q_PROPERTY( QColor colorToolbarMainTextVisitWebsite READ GetColorToolbarMainTextVisitWebsite CONSTANT )
|
||||||
|
|
||||||
|
|
||||||
Q_ENUMS( ESizeConstants )
|
Q_ENUMS( ESizeConstants )
|
||||||
@@ -41,8 +43,8 @@ public:
|
|||||||
const QColor GetColorToolbarMainTextCurrent() const {return colorToolbarMainTextCurrent;}
|
const QColor GetColorToolbarMainTextCurrent() const {return colorToolbarMainTextCurrent;}
|
||||||
const QColor GetColorToolbarMainTextNormal() const {return colorToolbarMainTextNormal;}
|
const QColor GetColorToolbarMainTextNormal() const {return colorToolbarMainTextNormal;}
|
||||||
const QColor GetColorToolbarMainTextShadow() const {return colorToolbarMainTextShadow;}
|
const QColor GetColorToolbarMainTextShadow() const {return colorToolbarMainTextShadow;}
|
||||||
|
const QColor GetColorToolbarMainTextWebsiteURL() const {return colorToolbarMainTextWebsiteURL;}
|
||||||
|
const QColor GetColorToolbarMainTextVisitWebsite() const {return colorToolbarMainTextVisitWebsite;}
|
||||||
private:
|
private:
|
||||||
const QColor colorToolbarMainGradientBegin;
|
const QColor colorToolbarMainGradientBegin;
|
||||||
const QColor colorToolbarMainGradientEnd;
|
const QColor colorToolbarMainGradientEnd;
|
||||||
@@ -53,6 +55,8 @@ private:
|
|||||||
const QColor colorToolbarMainTextCurrent;
|
const QColor colorToolbarMainTextCurrent;
|
||||||
const QColor colorToolbarMainTextNormal;
|
const QColor colorToolbarMainTextNormal;
|
||||||
const QColor colorToolbarMainTextShadow;
|
const QColor colorToolbarMainTextShadow;
|
||||||
|
const QColor colorToolbarMainTextWebsiteURL;
|
||||||
|
const QColor colorToolbarMainTextVisitWebsite;
|
||||||
|
|
||||||
const QColor colorMainWindowBackground;
|
const QColor colorMainWindowBackground;
|
||||||
const QColor colorMainWindowFrameBackground;
|
const QColor colorMainWindowFrameBackground;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ GUIBannerWidget::GUIBannerWidget(QWidget *parent)
|
|||||||
|
|
||||||
GUIBannerWidget::~GUIBannerWidget()
|
GUIBannerWidget::~GUIBannerWidget()
|
||||||
{
|
{
|
||||||
|
// member objects are moved to qml engine and it manages their instances
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIBannerWidget::registerCustomQmlTypes()
|
void GUIBannerWidget::registerCustomQmlTypes()
|
||||||
@@ -43,25 +43,31 @@ void GUIBannerWidget::registerCustomQmlTypes()
|
|||||||
QWidget* GUIBannerWidget::dockQmlToWidget()
|
QWidget* GUIBannerWidget::dockQmlToWidget()
|
||||||
{
|
{
|
||||||
QQuickView* pBannerWindow = new QQuickView;
|
QQuickView* pBannerWindow = new QQuickView;
|
||||||
pBannerWindow->setSource( QUrl( QStringLiteral( "qrc:/qml/qtquick_controls/qml/QmlGUIBannerWindow.qml" ) ) );
|
QWidget* pPlaceHolder = 0;
|
||||||
QQmlEngine* pEngine = pBannerWindow->engine();
|
if ( pBannerWindow )
|
||||||
if ( pEngine )
|
|
||||||
{
|
{
|
||||||
m_pQmlImageProvider = new QmlImageProvider();
|
pBannerWindow->setSource( QUrl( QStringLiteral( "qrc:/qml/qtquick_controls/qml/QmlGUIBannerWindow.qml" ) ) );
|
||||||
pEngine->addImageProvider( "advertImages", m_pQmlImageProvider );
|
QQmlEngine* pEngine = pBannerWindow->engine();
|
||||||
}
|
if ( pEngine )
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
m_pBannerControl->setWidth( ( 115 * 3 ) + ( 4 * 10 ) + 60 );
|
m_pQmlImageProvider = new QmlImageProvider();
|
||||||
m_pBannerControl->setHeight( 115 );
|
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 )
|
GUIMenuToolbarControl::GUIMenuToolbarControl( QQuickItem* a_pParent )
|
||||||
: QQuickItem( a_pParent )
|
: QQuickItem( a_pParent )
|
||||||
, m_pMenuToolbarView( 0 )
|
, 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()
|
void GUIMenuToolbarControl::ConnectListViewSignals()
|
||||||
{
|
{
|
||||||
if ( m_pMenuToolbarView )
|
if ( m_pMenuToolbarView )
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ class GUIMenuToolbarListView;
|
|||||||
class GUIMenuToolbarControl : public QQuickItem
|
class GUIMenuToolbarControl : public QQuickItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
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 )
|
Q_ENUMS( EMenuToolbarItemTypes )
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -27,16 +31,27 @@ public:
|
|||||||
Q_INVOKABLE void InitializeMenuToolbarView( GUIMenuToolbarListView* a_pView );
|
Q_INVOKABLE void InitializeMenuToolbarView( GUIMenuToolbarListView* a_pView );
|
||||||
GUIMenuToolbarListView* GetMenuToolbarView() const { return m_pMenuToolbarView; }
|
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:
|
public slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalCurrentItemIndexChanged();
|
void signalCurrentItemIndexChanged();
|
||||||
public slots:
|
void signalVisitWebsiteTextChanged();
|
||||||
|
void signalWebsiteURLChanged();
|
||||||
|
void signalOurWebsiteURLClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GUIMenuToolbarListView* m_pMenuToolbarView;
|
GUIMenuToolbarListView* m_pMenuToolbarView;
|
||||||
|
QString m_strVisitWebsiteText;
|
||||||
|
QString m_strWebsiteURL;
|
||||||
|
|
||||||
void ConnectListViewSignals();
|
void ConnectListViewSignals();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotCurrentItemIndexChanged();
|
void slotCurrentItemIndexChanged();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
|
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
GUIMenuToolbarWidget::GUIMenuToolbarWidget( QWidget *a_pParent )
|
GUIMenuToolbarWidget::GUIMenuToolbarWidget( QWidget *a_pParent )
|
||||||
: QWidget( a_pParent )
|
: QWidget( a_pParent )
|
||||||
, m_pToolbarControl( 0 )
|
, m_pToolbarControl( 0 )
|
||||||
@@ -21,16 +24,7 @@ GUIMenuToolbarWidget::GUIMenuToolbarWidget( QWidget *a_pParent )
|
|||||||
|
|
||||||
GUIMenuToolbarWidget::~GUIMenuToolbarWidget()
|
GUIMenuToolbarWidget::~GUIMenuToolbarWidget()
|
||||||
{
|
{
|
||||||
if ( m_pQmlImageProvider )
|
// member objects are moved to qml engine and it manages their instances
|
||||||
{
|
|
||||||
delete m_pQmlImageProvider;
|
|
||||||
m_pQmlImageProvider = 0;
|
|
||||||
}
|
|
||||||
if( m_pToolbarControl )
|
|
||||||
{
|
|
||||||
delete m_pToolbarControl;
|
|
||||||
m_pToolbarControl = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIMenuToolbarWidget::registerCustomQmlTypes()
|
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()
|
QWidget* GUIMenuToolbarWidget::dockQmlToWidget()
|
||||||
{
|
{
|
||||||
QQuickView* pMenuToolbarWindow = new QQuickView;
|
QQuickView* pMenuToolbarWindow = new QQuickView;
|
||||||
QQmlContext* pContext = pMenuToolbarWindow->rootContext();
|
QWidget* pPlaceHolder = 0;
|
||||||
if ( pContext )
|
if ( pMenuToolbarWindow )
|
||||||
{
|
{
|
||||||
pContext->setContextProperty( "GUI20Skin", &GUI20Skin::Instance() );
|
QQmlContext* pContext = pMenuToolbarWindow->rootContext();
|
||||||
}
|
if ( pContext )
|
||||||
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 );
|
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;
|
return pPlaceHolder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotCurrentItemChanged();
|
void slotCurrentItemChanged();
|
||||||
|
void slotOurWebsiteURLClicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GUIMENUTOOLBARWIDGET_H
|
#endif // GUIMENUTOOLBARWIDGET_H
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ GUIBannerControl
|
|||||||
{
|
{
|
||||||
id: id_bannerControl
|
id: id_bannerControl
|
||||||
|
|
||||||
property color colorBackgroundInWidget: "#F2F0F1"
|
property color colorBackgroundInWidget: "#FFFFFF"
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: id_leftArrow
|
id: id_leftArrow
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Rectangle
|
|||||||
{
|
{
|
||||||
id: id_bannerControlMain
|
id: id_bannerControlMain
|
||||||
}
|
}
|
||||||
|
color: "transparent"
|
||||||
width: id_bannerControlMain.width
|
width: id_bannerControlMain.width
|
||||||
height: id_bannerControlMain.height
|
height: id_bannerControlMain.height
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,5 +53,52 @@ GUIMenuToolbarControl
|
|||||||
NumberAnimation { duration: 300; easing.type: Easing.InOutQuad }
|
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
|
Rectangle
|
||||||
{
|
{
|
||||||
id: id_toolbarRoot
|
id: id_toolbarRoot
|
||||||
width: 1280
|
width: parent.width
|
||||||
height: 77 + 5
|
height: parent.height
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
QmlGUIMenuToolbarControl
|
QmlGUIMenuToolbarControl
|
||||||
{
|
{
|
||||||
|
|||||||
BIN
src/qt/res/images/GUI20_mainToolBar_cards.png
Normal file
BIN
src/qt/res/images/GUI20_mainToolBar_cards.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Reference in New Issue
Block a user