Skip to content

Commit 8118970

Browse files
committed
Merge bitcoin-core/gui#594: scripted-diff: replace deprecated Q_OS_MAC with Q_OS_MACOS
e3daeca scripted-diff: replace deprecated Q_OS_MAC with Q_OS_MACOS (João Barbosa) Pull request description: `Q_OS_MAC` is deprecated but it is also defined when Qt is configured with `-xplatform macx-ios-clang`, and currently it guards some features not available on iOS, like `QProcess`. ACKs for top commit: jarolrod: tACK e3daeca hebasto: ACK e3daeca. Tree-SHA512: 17b4b891c70f027f6a420be830e61bd87fde5297a4473a5b122e4e34bdf83141635bd5cf5143efe95a0dd6f8cf50bc67a2de6cbfed7956952369587c74ece225
2 parents 0cd1a2e + e3daeca commit 8118970

File tree

10 files changed

+34
-34
lines changed

10 files changed

+34
-34
lines changed

src/qt/bitcoingui.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <qt/walletview.h>
2727
#endif // ENABLE_WALLET
2828

29-
#ifdef Q_OS_MAC
29+
#ifdef Q_OS_MACOS
3030
#include <qt/macdockiconhandler.h>
3131
#endif
3232

@@ -69,7 +69,7 @@
6969

7070

7171
const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
72-
#if defined(Q_OS_MAC)
72+
#if defined(Q_OS_MACOS)
7373
"macosx"
7474
#elif defined(Q_OS_WIN)
7575
"windows"
@@ -219,7 +219,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
219219
connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay);
220220
connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay);
221221

222-
#ifdef Q_OS_MAC
222+
#ifdef Q_OS_MACOS
223223
m_app_nap_inhibitor = new CAppNapInhibitor;
224224
#endif
225225

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

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

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

501501
if (walletFrame) {
502-
#ifdef Q_OS_MAC
502+
#ifdef Q_OS_MACOS
503503
window_menu->addSeparator();
504504
QAction* main_window_action = window_menu->addAction(tr("Main Window"));
505505
connect(main_window_action, &QAction::triggered, [this] {
@@ -755,7 +755,7 @@ void BitcoinGUI::createTrayIcon()
755755
{
756756
assert(QSystemTrayIcon::isSystemTrayAvailable());
757757

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

767767
void BitcoinGUI::createTrayIconMenu()
768768
{
769-
#ifndef Q_OS_MAC
769+
#ifndef Q_OS_MACOS
770770
if (!trayIcon) return;
771-
#endif // Q_OS_MAC
771+
#endif // Q_OS_MACOS
772772

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

781781
QAction* send_action{nullptr};
782782
QAction* receive_action{nullptr};
@@ -794,7 +794,7 @@ void BitcoinGUI::createTrayIconMenu()
794794
options_action->setMenuRole(QAction::PreferencesRole);
795795
QAction* node_window_action = trayIconMenu->addAction(openRPCConsoleAction->text(), openRPCConsoleAction, &QAction::trigger);
796796
QAction* quit_action{nullptr};
797-
#ifndef Q_OS_MAC
797+
#ifndef Q_OS_MACOS
798798
// Note: On macOS, the Dock icon's menu already has Quit action.
799799
trayIconMenu->addSeparator();
800800
quit_action = trayIconMenu->addAction(quitAction->text(), quitAction, &QAction::trigger);
@@ -814,7 +814,7 @@ void BitcoinGUI::createTrayIconMenu()
814814
activateWindow();
815815
});
816816
trayIconMenu->setAsDockMenu();
817-
#endif // Q_OS_MAC
817+
#endif // Q_OS_MACOS
818818

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

11931193
QMainWindow::changeEvent(e);
11941194

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

12161216
void BitcoinGUI::closeEvent(QCloseEvent *event)
12171217
{
1218-
#ifndef Q_OS_MAC // Ignored on Mac
1218+
#ifndef Q_OS_MACOS // Ignored on Mac
12191219
if(clientModel && clientModel->getOptionsModel())
12201220
{
12211221
if(!clientModel->getOptionsModel()->getMinimizeOnClose())

src/qt/bitcoingui.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <QPoint>
2323
#include <QSystemTrayIcon>
2424

25-
#ifdef Q_OS_MAC
25+
#ifdef Q_OS_MACOS
2626
#include <qt/macos_appnap.h>
2727
#endif
2828

@@ -175,7 +175,7 @@ class BitcoinGUI : public QMainWindow
175175

176176
QMenu* m_network_context_menu = new QMenu(this);
177177

178-
#ifdef Q_OS_MAC
178+
#ifdef Q_OS_MACOS
179179
CAppNapInhibitor* m_app_nap_inhibitor = nullptr;
180180
#endif
181181

src/qt/guiutil.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
#include <string>
7575
#include <vector>
7676

77-
#if defined(Q_OS_MAC)
77+
#if defined(Q_OS_MACOS)
7878

7979
#include <QProcess>
8080

@@ -399,7 +399,7 @@ bool isObscured(QWidget *w)
399399

400400
void bringToFront(QWidget* w)
401401
{
402-
#ifdef Q_OS_MAC
402+
#ifdef Q_OS_MACOS
403403
ForceActivation();
404404
#endif
405405

@@ -443,7 +443,7 @@ bool openBitcoinConf()
443443

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

883883
void PolishProgressDialog(QProgressDialog* dialog)
884884
{
885-
#ifdef Q_OS_MAC
885+
#ifdef Q_OS_MACOS
886886
// Workaround for macOS-only Qt bug; see: QTBUG-65750, QTBUG-70357.
887887
const int margin = TextWidth(dialog->fontMetrics(), ("X"));
888888
dialog->resize(dialog->width() + 2 * margin, dialog->height());

src/qt/notificator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <QtDBus>
1919
#include <stdint.h>
2020
#endif
21-
#ifdef Q_OS_MAC
21+
#ifdef Q_OS_MACOS
2222
#include <qt/macnotificationhandler.h>
2323
#endif
2424

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

213-
#ifdef Q_OS_MAC
213+
#ifdef Q_OS_MACOS
214214
void Notificator::notifyMacUserNotificationCenter(const QString &title, const QString &text)
215215
{
216216
// icon is not supported by the user notification center yet. OSX will use the app icon.
@@ -230,7 +230,7 @@ void Notificator::notify(Class cls, const QString &title, const QString &text, c
230230
case QSystemTray:
231231
notifySystray(cls, title, text, millisTimeout);
232232
break;
233-
#ifdef Q_OS_MAC
233+
#ifdef Q_OS_MACOS
234234
case UserNotificationCenter:
235235
notifyMacUserNotificationCenter(title, text);
236236
break;

src/qt/notificator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Q_SLOTS:
6969
void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
7070
#endif
7171
void notifySystray(Class cls, const QString &title, const QString &text, int millisTimeout);
72-
#ifdef Q_OS_MAC
72+
#ifdef Q_OS_MACOS
7373
void notifyMacUserNotificationCenter(const QString &title, const QString &text);
7474
#endif
7575
};

src/qt/optionsdialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
7878
connect(ui->connectSocksTor, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState);
7979

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

263263
/* Window */
264-
#ifndef Q_OS_MAC
264+
#ifndef Q_OS_MACOS
265265
if (QSystemTrayIcon::isSystemTrayAvailable()) {
266266
mapper->addMapping(ui->showTrayIcon, OptionsModel::ShowTrayIcon);
267267
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);

src/qt/rpcconsole.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ void RPCConsole::clear(bool keep_prompt)
871871
}
872872

873873
// Set default style sheet
874-
#ifdef Q_OS_MAC
874+
#ifdef Q_OS_MACOS
875875
QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont(/*use_embedded_font=*/true));
876876
#else
877877
QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont());

src/qt/test/addressbooktests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
168168

169169
void AddressBookTests::addressBookTests()
170170
{
171-
#ifdef Q_OS_MAC
171+
#ifdef Q_OS_MACOS
172172
if (QApplication::platformName() == "minimal") {
173173
// Disable for mac on "minimal" platform to avoid crashes inside the Qt
174174
// framework when it tries to look up unimplemented cocoa functions,

src/qt/test/apptests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void TestRpcCommand(RPCConsole* console)
5858
//! Entry point for BitcoinApplication tests.
5959
void AppTests::appTests()
6060
{
61-
#ifdef Q_OS_MAC
61+
#ifdef Q_OS_MACOS
6262
if (QApplication::platformName() == "minimal") {
6363
// Disable for mac on "minimal" platform to avoid crashes inside the Qt
6464
// framework when it tries to look up unimplemented cocoa functions,

src/qt/test/wallettests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ void TestGUI(interfaces::Node& node)
315315

316316
void WalletTests::walletTests()
317317
{
318-
#ifdef Q_OS_MAC
318+
#ifdef Q_OS_MACOS
319319
if (QApplication::platformName() == "minimal") {
320320
// Disable for mac on "minimal" platform to avoid crashes inside the Qt
321321
// framework when it tries to look up unimplemented cocoa functions,

0 commit comments

Comments
 (0)