solve MacOS Catalina compile
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QComboBox>
|
||||
#include <QDateTime>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDragEnterEvent>
|
||||
@@ -47,7 +48,6 @@
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QMimeData>
|
||||
#include <QProgressBar>
|
||||
#include <QProgressDialog>
|
||||
#include <QSettings>
|
||||
#include <QShortcut>
|
||||
@@ -56,14 +56,8 @@
|
||||
#include <QStyle>
|
||||
#include <QTimer>
|
||||
#include <QToolBar>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QTextDocument>
|
||||
#include <QUrl>
|
||||
#else
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
#include <QVBoxLayout>
|
||||
|
||||
const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
|
||||
#if defined(Q_OS_MAC)
|
||||
@@ -143,20 +137,10 @@ BitcoinGUI::BitcoinGUI(const Config *cfg, const PlatformStyle *platformStyle, co
|
||||
windowTitle += tr("Node");
|
||||
}
|
||||
windowTitle += " " + networkStyle->getTitleAddText();
|
||||
#ifndef Q_OS_MAC
|
||||
QApplication::setWindowIcon(networkStyle->getTrayAndWindowIcon());
|
||||
setWindowIcon(networkStyle->getTrayAndWindowIcon());
|
||||
#else
|
||||
MacDockIconHandler::instance()->setIcon(networkStyle->getAppIcon());
|
||||
#endif
|
||||
setWindowTitle(windowTitle);
|
||||
|
||||
#if defined(Q_OS_MAC) && QT_VERSION < 0x050000
|
||||
// This property is not implemented in Qt 5. Setting it has no effect.
|
||||
// A replacement API (QtMacUnifiedToolBar) is available in QtMacExtras.
|
||||
setUnifiedTitleAndToolBarOnMac(true);
|
||||
#endif
|
||||
|
||||
rpcConsole = new RPCConsole(platformStyle, 0);
|
||||
helpMessageDialog = new HelpMessageDialog(this, false);
|
||||
#ifdef ENABLE_WALLET
|
||||
@@ -244,7 +228,7 @@ BitcoinGUI::BitcoinGUI(const Config *cfg, const PlatformStyle *platformStyle, co
|
||||
|
||||
// Override style sheet for progress bar for styles that have a segmented progress bar,
|
||||
// as they make the text unreadable (workaround for issue #1071)
|
||||
// See https://qt-project.org/doc/qt-4.8/gallery.html
|
||||
// See https://doc.qt.io/qt-5/gallery.html
|
||||
QString curStyle = QApplication::style()->metaObject()->className();
|
||||
if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
|
||||
{
|
||||
@@ -609,7 +593,7 @@ void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
|
||||
void BitcoinGUI::createTrayIconMenu()
|
||||
{
|
||||
#ifndef Q_OS_MAC
|
||||
// return if trayIcon is unset (only on non-Mac OSes)
|
||||
// return if trayIcon is unset (only on non-macOSes)
|
||||
if (!trayIcon)
|
||||
return;
|
||||
|
||||
@@ -619,10 +603,12 @@ void BitcoinGUI::createTrayIconMenu()
|
||||
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||
this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
|
||||
#else
|
||||
// Note: On Mac, the dock icon is used to provide the tray's functionality.
|
||||
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
|
||||
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
|
||||
dockIconHandler->setMainWindow((QMainWindow *)this);
|
||||
trayIconMenu = dockIconHandler->dockMenu();
|
||||
connect(dockIconHandler, &MacDockIconHandler::dockIconClicked, this, &BitcoinGUI::macosDockIconActivated);
|
||||
|
||||
trayIconMenu = new QMenu(this);
|
||||
trayIconMenu->setAsDockMenu();
|
||||
#endif
|
||||
|
||||
// Configuration of the tray icon (or dock icon) icon menu
|
||||
@@ -636,7 +622,7 @@ void BitcoinGUI::createTrayIconMenu()
|
||||
trayIconMenu->addSeparator();
|
||||
trayIconMenu->addAction(optionsAction);
|
||||
trayIconMenu->addAction(openRPCConsoleAction);
|
||||
#ifndef Q_OS_MAC // This is built-in on Mac
|
||||
#ifndef Q_OS_MAC // This is built-in on macOS
|
||||
trayIconMenu->addSeparator();
|
||||
trayIconMenu->addAction(quitAction);
|
||||
#endif
|
||||
@@ -651,6 +637,12 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
||||
toggleHidden();
|
||||
}
|
||||
}
|
||||
#else
|
||||
void BitcoinGUI::macosDockIconActivated()
|
||||
{
|
||||
show();
|
||||
activateWindow();
|
||||
}
|
||||
#endif
|
||||
|
||||
void BitcoinGUI::optionsClicked()
|
||||
|
||||
Reference in New Issue
Block a user