mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
enhance Qt5 compatibility
- replace Q_WS_MAC (not supported anymore in Qt5) with Q_OS_MAC (supported in Qt4/5)
This commit is contained in:
parent
e96a8c7d86
commit
81605d90f5
@ -27,7 +27,7 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
#ifdef Q_WS_MAC // Icons on push buttons are very uncommon on Mac
|
#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
|
||||||
ui->newAddressButton->setIcon(QIcon());
|
ui->newAddressButton->setIcon(QIcon());
|
||||||
ui->copyToClipboard->setIcon(QIcon());
|
ui->copyToClipboard->setIcon(QIcon());
|
||||||
ui->deleteButton->setIcon(QIcon());
|
ui->deleteButton->setIcon(QIcon());
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "guiutil.h"
|
#include "guiutil.h"
|
||||||
#include "rpcconsole.h"
|
#include "rpcconsole.h"
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include "macdockiconhandler.h"
|
#include "macdockiconhandler.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||||||
{
|
{
|
||||||
resize(850, 550);
|
resize(850, 550);
|
||||||
setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet"));
|
setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet"));
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_OS_MAC
|
||||||
qApp->setWindowIcon(QIcon(":icons/bitcoin"));
|
qApp->setWindowIcon(QIcon(":icons/bitcoin"));
|
||||||
setWindowIcon(QIcon(":icons/bitcoin"));
|
setWindowIcon(QIcon(":icons/bitcoin"));
|
||||||
#else
|
#else
|
||||||
@ -183,7 +183,7 @@ BitcoinGUI::~BitcoinGUI()
|
|||||||
{
|
{
|
||||||
if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
|
if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
|
||||||
trayIcon->hide();
|
trayIcon->hide();
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
delete appMenuBar;
|
delete appMenuBar;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ void BitcoinGUI::createActions()
|
|||||||
|
|
||||||
void BitcoinGUI::createMenuBar()
|
void BitcoinGUI::createMenuBar()
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
// Create a decoupled menu bar on Mac which stays even if the window is closed
|
// Create a decoupled menu bar on Mac which stays even if the window is closed
|
||||||
appMenuBar = new QMenuBar();
|
appMenuBar = new QMenuBar();
|
||||||
#else
|
#else
|
||||||
@ -330,7 +330,7 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
|
|||||||
if(clientModel->isTestNet())
|
if(clientModel->isTestNet())
|
||||||
{
|
{
|
||||||
setWindowTitle(windowTitle() + QString(" ") + tr("[testnet]"));
|
setWindowTitle(windowTitle() + QString(" ") + tr("[testnet]"));
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_OS_MAC
|
||||||
qApp->setWindowIcon(QIcon(":icons/bitcoin_testnet"));
|
qApp->setWindowIcon(QIcon(":icons/bitcoin_testnet"));
|
||||||
setWindowIcon(QIcon(":icons/bitcoin_testnet"));
|
setWindowIcon(QIcon(":icons/bitcoin_testnet"));
|
||||||
#else
|
#else
|
||||||
@ -394,7 +394,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
|
|||||||
void BitcoinGUI::createTrayIcon()
|
void BitcoinGUI::createTrayIcon()
|
||||||
{
|
{
|
||||||
QMenu *trayIconMenu;
|
QMenu *trayIconMenu;
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_OS_MAC
|
||||||
trayIcon = new QSystemTrayIcon(this);
|
trayIcon = new QSystemTrayIcon(this);
|
||||||
trayIconMenu = new QMenu(this);
|
trayIconMenu = new QMenu(this);
|
||||||
trayIcon->setContextMenu(trayIconMenu);
|
trayIcon->setContextMenu(trayIconMenu);
|
||||||
@ -420,7 +420,7 @@ void BitcoinGUI::createTrayIcon()
|
|||||||
trayIconMenu->addSeparator();
|
trayIconMenu->addSeparator();
|
||||||
trayIconMenu->addAction(optionsAction);
|
trayIconMenu->addAction(optionsAction);
|
||||||
trayIconMenu->addAction(openRPCConsoleAction);
|
trayIconMenu->addAction(openRPCConsoleAction);
|
||||||
#ifndef Q_WS_MAC // This is built-in on Mac
|
#ifndef Q_OS_MAC // This is built-in on Mac
|
||||||
trayIconMenu->addSeparator();
|
trayIconMenu->addSeparator();
|
||||||
trayIconMenu->addAction(quitAction);
|
trayIconMenu->addAction(quitAction);
|
||||||
#endif
|
#endif
|
||||||
@ -428,7 +428,7 @@ void BitcoinGUI::createTrayIcon()
|
|||||||
notificator = new Notificator(qApp->applicationName(), trayIcon);
|
notificator = new Notificator(qApp->applicationName(), trayIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_OS_MAC
|
||||||
void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
||||||
{
|
{
|
||||||
if(reason == QSystemTrayIcon::Trigger)
|
if(reason == QSystemTrayIcon::Trigger)
|
||||||
@ -589,7 +589,7 @@ void BitcoinGUI::error(const QString &title, const QString &message, bool modal)
|
|||||||
void BitcoinGUI::changeEvent(QEvent *e)
|
void BitcoinGUI::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
QMainWindow::changeEvent(e);
|
QMainWindow::changeEvent(e);
|
||||||
#ifndef Q_WS_MAC // Ignored on Mac
|
#ifndef Q_OS_MAC // Ignored on Mac
|
||||||
if(e->type() == QEvent::WindowStateChange)
|
if(e->type() == QEvent::WindowStateChange)
|
||||||
{
|
{
|
||||||
if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray())
|
if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray())
|
||||||
@ -609,7 +609,7 @@ void BitcoinGUI::closeEvent(QCloseEvent *event)
|
|||||||
{
|
{
|
||||||
if(clientModel)
|
if(clientModel)
|
||||||
{
|
{
|
||||||
#ifndef Q_WS_MAC // Ignored on Mac
|
#ifndef Q_OS_MAC // Ignored on Mac
|
||||||
if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
|
if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
|
||||||
!clientModel->getOptionsModel()->getMinimizeOnClose())
|
!clientModel->getOptionsModel()->getMinimizeOnClose())
|
||||||
{
|
{
|
||||||
|
@ -152,7 +152,7 @@ private slots:
|
|||||||
void optionsClicked();
|
void optionsClicked();
|
||||||
/** Show about dialog */
|
/** Show about dialog */
|
||||||
void aboutClicked();
|
void aboutClicked();
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_OS_MAC
|
||||||
/** Handle tray icon clicked */
|
/** Handle tray icon clicked */
|
||||||
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
extern bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret);
|
extern bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret);
|
||||||
#endif
|
#endif
|
||||||
@ -46,7 +46,7 @@ Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon,
|
|||||||
mode = Freedesktop;
|
mode = Freedesktop;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
// Check if Growl is installed (based on Qt's tray icon implementation)
|
// Check if Growl is installed (based on Qt's tray icon implementation)
|
||||||
CFURLRef cfurl;
|
CFURLRef cfurl;
|
||||||
OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl);
|
OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl);
|
||||||
@ -225,7 +225,7 @@ void Notificator::notifySystray(Class cls, const QString &title, const QString &
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Based on Qt's tray icon implementation
|
// Based on Qt's tray icon implementation
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
void Notificator::notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon)
|
void Notificator::notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon)
|
||||||
{
|
{
|
||||||
const QString script(
|
const QString script(
|
||||||
@ -285,7 +285,7 @@ void Notificator::notify(Class cls, const QString &title, const QString &text, c
|
|||||||
case QSystemTray:
|
case QSystemTray:
|
||||||
notifySystray(cls, title, text, icon, millisTimeout);
|
notifySystray(cls, title, text, icon, millisTimeout);
|
||||||
break;
|
break;
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
case Growl12:
|
case Growl12:
|
||||||
case Growl13:
|
case Growl13:
|
||||||
notifyGrowl(cls, title, text, icon);
|
notifyGrowl(cls, title, text, icon);
|
||||||
|
@ -61,7 +61,7 @@ private:
|
|||||||
void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
|
void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
|
||||||
#endif
|
#endif
|
||||||
void notifySystray(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
|
void notifySystray(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
void notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon);
|
void notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -46,7 +46,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
|
|||||||
ui->proxyIp->installEventFilter(this);
|
ui->proxyIp->installEventFilter(this);
|
||||||
|
|
||||||
/* Window elements init */
|
/* Window elements init */
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
ui->tabWindow->setVisible(false);
|
ui->tabWindow->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ RPCConsole::RPCConsole(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_OS_MAC
|
||||||
ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export"));
|
ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export"));
|
||||||
ui->showCLOptionsButton->setIcon(QIcon(":/icons/options"));
|
ui->showCLOptionsButton->setIcon(QIcon(":/icons/options"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,7 +21,7 @@ SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
#ifdef Q_WS_MAC // Icons on push buttons are very uncommon on Mac
|
#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
|
||||||
ui->addButton->setIcon(QIcon());
|
ui->addButton->setIcon(QIcon());
|
||||||
ui->clearButton->setIcon(QIcon());
|
ui->clearButton->setIcon(QIcon());
|
||||||
ui->sendButton->setIcon(QIcon());
|
ui->sendButton->setIcon(QIcon());
|
||||||
|
@ -17,7 +17,7 @@ SendCoinsEntry::SendCoinsEntry(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
ui->payToLayout->setSpacing(4);
|
ui->payToLayout->setSpacing(4);
|
||||||
#endif
|
#endif
|
||||||
#if QT_VERSION >= 0x040700
|
#if QT_VERSION >= 0x040700
|
||||||
|
@ -38,7 +38,7 @@ TransactionView::TransactionView(QWidget *parent) :
|
|||||||
|
|
||||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||||
hlayout->setContentsMargins(0,0,0,0);
|
hlayout->setContentsMargins(0,0,0,0);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
hlayout->setSpacing(5);
|
hlayout->setSpacing(5);
|
||||||
hlayout->addSpacing(26);
|
hlayout->addSpacing(26);
|
||||||
#else
|
#else
|
||||||
@ -47,7 +47,7 @@ TransactionView::TransactionView(QWidget *parent) :
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
dateWidget = new QComboBox(this);
|
dateWidget = new QComboBox(this);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
dateWidget->setFixedWidth(121);
|
dateWidget->setFixedWidth(121);
|
||||||
#else
|
#else
|
||||||
dateWidget->setFixedWidth(120);
|
dateWidget->setFixedWidth(120);
|
||||||
@ -62,7 +62,7 @@ TransactionView::TransactionView(QWidget *parent) :
|
|||||||
hlayout->addWidget(dateWidget);
|
hlayout->addWidget(dateWidget);
|
||||||
|
|
||||||
typeWidget = new QComboBox(this);
|
typeWidget = new QComboBox(this);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
typeWidget->setFixedWidth(121);
|
typeWidget->setFixedWidth(121);
|
||||||
#else
|
#else
|
||||||
typeWidget->setFixedWidth(120);
|
typeWidget->setFixedWidth(120);
|
||||||
@ -91,7 +91,7 @@ TransactionView::TransactionView(QWidget *parent) :
|
|||||||
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
|
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
|
||||||
amountWidget->setPlaceholderText(tr("Min amount"));
|
amountWidget->setPlaceholderText(tr("Min amount"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
amountWidget->setFixedWidth(97);
|
amountWidget->setFixedWidth(97);
|
||||||
#else
|
#else
|
||||||
amountWidget->setFixedWidth(100);
|
amountWidget->setFixedWidth(100);
|
||||||
@ -110,7 +110,7 @@ TransactionView::TransactionView(QWidget *parent) :
|
|||||||
vlayout->setSpacing(0);
|
vlayout->setSpacing(0);
|
||||||
int width = view->verticalScrollBar()->sizeHint().width();
|
int width = view->verticalScrollBar()->sizeHint().width();
|
||||||
// Cover scroll bar width with spacing
|
// Cover scroll bar width with spacing
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
hlayout->addSpacing(width+2);
|
hlayout->addSpacing(width+2);
|
||||||
#else
|
#else
|
||||||
hlayout->addSpacing(width);
|
hlayout->addSpacing(width);
|
||||||
|
Loading…
Reference in New Issue
Block a user