Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <qt/walletview.h>
#endif // ENABLE_WALLET

#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
#include <qt/macdockiconhandler.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is macOS specific, so Q_OS_MACOS makes sense.

#endif

Expand Down Expand Up @@ -69,7 +69,7 @@


const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
#if defined(Q_OS_MAC)
#if defined(Q_OS_MACOS)
"macosx"
#elif defined(Q_OS_WIN)
"windows"
Expand Down Expand Up @@ -219,7 +219,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay);
connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay);

#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
m_app_nap_inhibitor = new CAppNapInhibitor;
#endif

Expand All @@ -235,7 +235,7 @@ BitcoinGUI::~BitcoinGUI()
settings.setValue("MainWindowGeometry", saveGeometry());
if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
trayIcon->hide();
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
delete m_app_nap_inhibitor;
delete appMenuBar;
MacDockIconHandler::cleanup();
Expand Down Expand Up @@ -433,7 +433,7 @@ void BitcoinGUI::createActions()

void BitcoinGUI::createMenuBar()
{
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
// Create a decoupled menu bar on Mac which stays even if the window is closed
appMenuBar = new QMenuBar();
#else
Expand Down Expand Up @@ -482,7 +482,7 @@ void BitcoinGUI::createMenuBar()
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
});

#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
QAction* zoom_action = window_menu->addAction(tr("Zoom"));
connect(zoom_action, &QAction::triggered, [] {
QWindow* window = qApp->focusWindow();
Expand All @@ -499,7 +499,7 @@ void BitcoinGUI::createMenuBar()
#endif

if (walletFrame) {
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
window_menu->addSeparator();
QAction* main_window_action = window_menu->addAction(tr("Main Window"));
connect(main_window_action, &QAction::triggered, [this] {
Expand Down Expand Up @@ -755,7 +755,7 @@ void BitcoinGUI::createTrayIcon()
{
assert(QSystemTrayIcon::isSystemTrayAvailable());

#ifndef Q_OS_MAC
#ifndef Q_OS_MACOS
if (QSystemTrayIcon::isSystemTrayAvailable()) {
trayIcon = new QSystemTrayIcon(m_network_style->getTrayAndWindowIcon(), this);
QString toolTip = tr("%1 client").arg(PACKAGE_NAME) + " " + m_network_style->getTitleAddText();
Expand All @@ -766,17 +766,17 @@ void BitcoinGUI::createTrayIcon()

void BitcoinGUI::createTrayIconMenu()
{
#ifndef Q_OS_MAC
#ifndef Q_OS_MACOS
if (!trayIcon) return;
#endif // Q_OS_MAC
#endif // Q_OS_MACOS

// Configuration of the tray icon (or Dock icon) menu.
QAction* show_hide_action{nullptr};
#ifndef Q_OS_MAC
#ifndef Q_OS_MACOS
// Note: On macOS, the Dock icon's menu already has Show / Hide action.
show_hide_action = trayIconMenu->addAction(QString(), this, &BitcoinGUI::toggleHidden);
trayIconMenu->addSeparator();
#endif // Q_OS_MAC
#endif // Q_OS_MACOS

QAction* send_action{nullptr};
QAction* receive_action{nullptr};
Expand All @@ -794,7 +794,7 @@ void BitcoinGUI::createTrayIconMenu()
options_action->setMenuRole(QAction::PreferencesRole);
QAction* node_window_action = trayIconMenu->addAction(openRPCConsoleAction->text(), openRPCConsoleAction, &QAction::trigger);
QAction* quit_action{nullptr};
#ifndef Q_OS_MAC
#ifndef Q_OS_MACOS
// Note: On macOS, the Dock icon's menu already has Quit action.
trayIconMenu->addSeparator();
quit_action = trayIconMenu->addAction(quitAction->text(), quitAction, &QAction::trigger);
Expand All @@ -814,7 +814,7 @@ void BitcoinGUI::createTrayIconMenu()
activateWindow();
});
trayIconMenu->setAsDockMenu();
#endif // Q_OS_MAC
#endif // Q_OS_MACOS

connect(
// Using QSystemTrayIcon::Context is not reliable.
Expand Down Expand Up @@ -1006,7 +1006,7 @@ void BitcoinGUI::openOptionsDialogWithTab(OptionsDialog::Tab tab)
void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header, SynchronizationState sync_state)
{
// Disabling macOS App Nap on initial sync, disk and reindex operations.
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
if (sync_state == SynchronizationState::POST_INIT) {
m_app_nap_inhibitor->enableAppNap();
} else {
Expand Down Expand Up @@ -1192,7 +1192,7 @@ void BitcoinGUI::changeEvent(QEvent *e)

QMainWindow::changeEvent(e);

#ifndef Q_OS_MAC // Ignored on Mac
#ifndef Q_OS_MACOS // Ignored on Mac
if(e->type() == QEvent::WindowStateChange)
{
if(clientModel && clientModel->getOptionsModel() && clientModel->getOptionsModel()->getMinimizeToTray())
Expand All @@ -1215,7 +1215,7 @@ void BitcoinGUI::changeEvent(QEvent *e)

void BitcoinGUI::closeEvent(QCloseEvent *event)
{
#ifndef Q_OS_MAC // Ignored on Mac
#ifndef Q_OS_MACOS // Ignored on Mac
if(clientModel && clientModel->getOptionsModel())
{
if(!clientModel->getOptionsModel()->getMinimizeOnClose())
Expand Down
4 changes: 2 additions & 2 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <QPoint>
#include <QSystemTrayIcon>

#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
#include <qt/macos_appnap.h>
#endif

Expand Down Expand Up @@ -175,7 +175,7 @@ class BitcoinGUI : public QMainWindow

QMenu* m_network_context_menu = new QMenu(this);

#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
CAppNapInhibitor* m_app_nap_inhibitor = nullptr;
#endif

Expand Down
8 changes: 4 additions & 4 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#include <string>
#include <vector>

#if defined(Q_OS_MAC)
#if defined(Q_OS_MACOS)

#include <QProcess>

Expand Down Expand Up @@ -399,7 +399,7 @@ bool isObscured(QWidget *w)

void bringToFront(QWidget* w)
{
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
ForceActivation();
#endif

Expand Down Expand Up @@ -443,7 +443,7 @@ bool openBitcoinConf()

/* Open bitcoin.conf with the associated application */
bool res = QDesktopServices::openUrl(QUrl::fromLocalFile(PathToQString(pathConfig)));
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
// Workaround for macOS-specific behavior; see #15409.
if (!res) {
res = QProcess::startDetached("/usr/bin/open", QStringList{"-t", PathToQString(pathConfig)});
Expand Down Expand Up @@ -882,7 +882,7 @@ bool ItemDelegate::eventFilter(QObject *object, QEvent *event)

void PolishProgressDialog(QProgressDialog* dialog)
{
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
// Workaround for macOS-only Qt bug; see: QTBUG-65750, QTBUG-70357.
const int margin = TextWidth(dialog->fontMetrics(), ("X"));
dialog->resize(dialog->width() + 2 * margin, dialog->height());
Expand Down
8 changes: 4 additions & 4 deletions src/qt/notificator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <QtDBus>
#include <stdint.h>
#endif
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
#include <qt/macnotificationhandler.h>
#endif

Expand Down Expand Up @@ -50,7 +50,7 @@ Notificator::Notificator(const QString &_programName, QSystemTrayIcon *_trayIcon
mode = Freedesktop;
}
#endif
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
// check if users OS has support for NSUserNotification
if( MacNotificationHandler::instance()->hasUserNotificationCenterSupport()) {
mode = UserNotificationCenter;
Expand Down Expand Up @@ -210,7 +210,7 @@ void Notificator::notifySystray(Class cls, const QString &title, const QString &
trayIcon->showMessage(title, text, sicon, millisTimeout);
}

#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
void Notificator::notifyMacUserNotificationCenter(const QString &title, const QString &text)
{
// icon is not supported by the user notification center yet. OSX will use the app icon.
Expand All @@ -230,7 +230,7 @@ void Notificator::notify(Class cls, const QString &title, const QString &text, c
case QSystemTray:
notifySystray(cls, title, text, millisTimeout);
break;
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
case UserNotificationCenter:
notifyMacUserNotificationCenter(title, text);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/qt/notificator.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Q_SLOTS:
void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
#endif
void notifySystray(Class cls, const QString &title, const QString &text, int millisTimeout);
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
void notifyMacUserNotificationCenter(const QString &title, const QString &text);
#endif
};
Expand Down
4 changes: 2 additions & 2 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
connect(ui->connectSocksTor, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState);

/* Window elements init */
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
/* remove Window tab on Mac */
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow));
/* hide launch at startup option on macOS */
Expand Down Expand Up @@ -261,7 +261,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->proxyPortTor, OptionsModel::ProxyPortTor);

/* Window */
#ifndef Q_OS_MAC
#ifndef Q_OS_MACOS
if (QSystemTrayIcon::isSystemTrayAvailable()) {
mapper->addMapping(ui->showTrayIcon, OptionsModel::ShowTrayIcon);
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ void RPCConsole::clear(bool keep_prompt)
}

// Set default style sheet
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont(/*use_embedded_font=*/true));
#else
QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont());
Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/addressbooktests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)

void AddressBookTests::addressBookTests()
{
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
if (QApplication::platformName() == "minimal") {
// Disable for mac on "minimal" platform to avoid crashes inside the Qt
// framework when it tries to look up unimplemented cocoa functions,
Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/apptests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void TestRpcCommand(RPCConsole* console)
//! Entry point for BitcoinApplication tests.
void AppTests::appTests()
{
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
if (QApplication::platformName() == "minimal") {
// Disable for mac on "minimal" platform to avoid crashes inside the Qt
// framework when it tries to look up unimplemented cocoa functions,
Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/wallettests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void TestGUI(interfaces::Node& node)

void WalletTests::walletTests()
{
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
if (QApplication::platformName() == "minimal") {
// Disable for mac on "minimal" platform to avoid crashes inside the Qt
// framework when it tries to look up unimplemented cocoa functions,
Expand Down