0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

scripted-diff: replace deprecated Q_OS_MAC with Q_OS_MACOS

-BEGIN VERIFY SCRIPT-
sed -i 's/Q_OS_MAC/Q_OS_MACOS/' $(git grep -l "Q_OS_MAC" src/qt)
-END VERIFY SCRIPT-
This commit is contained in:
João Barbosa 2022-04-26 01:13:29 +01:00
parent 1e7db37e76
commit e3daecae03
10 changed files with 34 additions and 34 deletions

View file

@ -26,7 +26,7 @@
#include <qt/walletview.h> #include <qt/walletview.h>
#endif // ENABLE_WALLET #endif // ENABLE_WALLET
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
#include <qt/macdockiconhandler.h> #include <qt/macdockiconhandler.h>
#endif #endif
@ -69,7 +69,7 @@
const std::string BitcoinGUI::DEFAULT_UIPLATFORM = const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
#if defined(Q_OS_MAC) #if defined(Q_OS_MACOS)
"macosx" "macosx"
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
"windows" "windows"
@ -219,7 +219,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay); connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay);
connect(progressBar, &GUIUtil::ClickableProgressBar::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; m_app_nap_inhibitor = new CAppNapInhibitor;
#endif #endif
@ -235,7 +235,7 @@ BitcoinGUI::~BitcoinGUI()
settings.setValue("MainWindowGeometry", saveGeometry()); settings.setValue("MainWindowGeometry", saveGeometry());
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_OS_MAC #ifdef Q_OS_MACOS
delete m_app_nap_inhibitor; delete m_app_nap_inhibitor;
delete appMenuBar; delete appMenuBar;
MacDockIconHandler::cleanup(); MacDockIconHandler::cleanup();
@ -433,7 +433,7 @@ void BitcoinGUI::createActions()
void BitcoinGUI::createMenuBar() 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 // Create a decoupled menu bar on Mac which stays even if the window is closed
appMenuBar = new QMenuBar(); appMenuBar = new QMenuBar();
#else #else
@ -482,7 +482,7 @@ void BitcoinGUI::createMenuBar()
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized); 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")); QAction* zoom_action = window_menu->addAction(tr("Zoom"));
connect(zoom_action, &QAction::triggered, [] { connect(zoom_action, &QAction::triggered, [] {
QWindow* window = qApp->focusWindow(); QWindow* window = qApp->focusWindow();
@ -499,7 +499,7 @@ void BitcoinGUI::createMenuBar()
#endif #endif
if (walletFrame) { if (walletFrame) {
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
window_menu->addSeparator(); window_menu->addSeparator();
QAction* main_window_action = window_menu->addAction(tr("Main Window")); QAction* main_window_action = window_menu->addAction(tr("Main Window"));
connect(main_window_action, &QAction::triggered, [this] { connect(main_window_action, &QAction::triggered, [this] {
@ -755,7 +755,7 @@ void BitcoinGUI::createTrayIcon()
{ {
assert(QSystemTrayIcon::isSystemTrayAvailable()); assert(QSystemTrayIcon::isSystemTrayAvailable());
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
if (QSystemTrayIcon::isSystemTrayAvailable()) { if (QSystemTrayIcon::isSystemTrayAvailable()) {
trayIcon = new QSystemTrayIcon(m_network_style->getTrayAndWindowIcon(), this); trayIcon = new QSystemTrayIcon(m_network_style->getTrayAndWindowIcon(), this);
QString toolTip = tr("%1 client").arg(PACKAGE_NAME) + " " + m_network_style->getTitleAddText(); QString toolTip = tr("%1 client").arg(PACKAGE_NAME) + " " + m_network_style->getTitleAddText();
@ -766,17 +766,17 @@ void BitcoinGUI::createTrayIcon()
void BitcoinGUI::createTrayIconMenu() void BitcoinGUI::createTrayIconMenu()
{ {
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
if (!trayIcon) return; if (!trayIcon) return;
#endif // Q_OS_MAC #endif // Q_OS_MACOS
// Configuration of the tray icon (or Dock icon) menu. // Configuration of the tray icon (or Dock icon) menu.
QAction* show_hide_action{nullptr}; 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. // Note: On macOS, the Dock icon's menu already has Show / Hide action.
show_hide_action = trayIconMenu->addAction(QString(), this, &BitcoinGUI::toggleHidden); show_hide_action = trayIconMenu->addAction(QString(), this, &BitcoinGUI::toggleHidden);
trayIconMenu->addSeparator(); trayIconMenu->addSeparator();
#endif // Q_OS_MAC #endif // Q_OS_MACOS
QAction* send_action{nullptr}; QAction* send_action{nullptr};
QAction* receive_action{nullptr}; QAction* receive_action{nullptr};
@ -794,7 +794,7 @@ void BitcoinGUI::createTrayIconMenu()
options_action->setMenuRole(QAction::PreferencesRole); options_action->setMenuRole(QAction::PreferencesRole);
QAction* node_window_action = trayIconMenu->addAction(openRPCConsoleAction->text(), openRPCConsoleAction, &QAction::trigger); QAction* node_window_action = trayIconMenu->addAction(openRPCConsoleAction->text(), openRPCConsoleAction, &QAction::trigger);
QAction* quit_action{nullptr}; QAction* quit_action{nullptr};
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
// Note: On macOS, the Dock icon's menu already has Quit action. // Note: On macOS, the Dock icon's menu already has Quit action.
trayIconMenu->addSeparator(); trayIconMenu->addSeparator();
quit_action = trayIconMenu->addAction(quitAction->text(), quitAction, &QAction::trigger); quit_action = trayIconMenu->addAction(quitAction->text(), quitAction, &QAction::trigger);
@ -814,7 +814,7 @@ void BitcoinGUI::createTrayIconMenu()
activateWindow(); activateWindow();
}); });
trayIconMenu->setAsDockMenu(); trayIconMenu->setAsDockMenu();
#endif // Q_OS_MAC #endif // Q_OS_MACOS
connect( connect(
// Using QSystemTrayIcon::Context is not reliable. // Using QSystemTrayIcon::Context is not reliable.
@ -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) 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. // 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) { if (sync_state == SynchronizationState::POST_INIT) {
m_app_nap_inhibitor->enableAppNap(); m_app_nap_inhibitor->enableAppNap();
} else { } else {
@ -1192,7 +1192,7 @@ void BitcoinGUI::changeEvent(QEvent *e)
QMainWindow::changeEvent(e); QMainWindow::changeEvent(e);
#ifndef Q_OS_MAC // Ignored on Mac #ifndef Q_OS_MACOS // Ignored on Mac
if(e->type() == QEvent::WindowStateChange) if(e->type() == QEvent::WindowStateChange)
{ {
if(clientModel && clientModel->getOptionsModel() && clientModel->getOptionsModel()->getMinimizeToTray()) if(clientModel && clientModel->getOptionsModel() && clientModel->getOptionsModel()->getMinimizeToTray())
@ -1215,7 +1215,7 @@ void BitcoinGUI::changeEvent(QEvent *e)
void BitcoinGUI::closeEvent(QCloseEvent *event) 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 && clientModel->getOptionsModel())
{ {
if(!clientModel->getOptionsModel()->getMinimizeOnClose()) if(!clientModel->getOptionsModel()->getMinimizeOnClose())

View file

@ -22,7 +22,7 @@
#include <QPoint> #include <QPoint>
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
#include <qt/macos_appnap.h> #include <qt/macos_appnap.h>
#endif #endif
@ -175,7 +175,7 @@ private:
QMenu* m_network_context_menu = new QMenu(this); QMenu* m_network_context_menu = new QMenu(this);
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
CAppNapInhibitor* m_app_nap_inhibitor = nullptr; CAppNapInhibitor* m_app_nap_inhibitor = nullptr;
#endif #endif

View file

@ -74,7 +74,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#if defined(Q_OS_MAC) #if defined(Q_OS_MACOS)
#include <QProcess> #include <QProcess>
@ -399,7 +399,7 @@ bool isObscured(QWidget *w)
void bringToFront(QWidget* w) void bringToFront(QWidget* w)
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
ForceActivation(); ForceActivation();
#endif #endif
@ -443,7 +443,7 @@ bool openBitcoinConf()
/* Open bitcoin.conf with the associated application */ /* Open bitcoin.conf with the associated application */
bool res = QDesktopServices::openUrl(QUrl::fromLocalFile(PathToQString(pathConfig))); bool res = QDesktopServices::openUrl(QUrl::fromLocalFile(PathToQString(pathConfig)));
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
// Workaround for macOS-specific behavior; see #15409. // Workaround for macOS-specific behavior; see #15409.
if (!res) { if (!res) {
res = QProcess::startDetached("/usr/bin/open", QStringList{"-t", PathToQString(pathConfig)}); res = QProcess::startDetached("/usr/bin/open", QStringList{"-t", PathToQString(pathConfig)});
@ -882,7 +882,7 @@ bool ItemDelegate::eventFilter(QObject *object, QEvent *event)
void PolishProgressDialog(QProgressDialog* dialog) void PolishProgressDialog(QProgressDialog* dialog)
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
// Workaround for macOS-only Qt bug; see: QTBUG-65750, QTBUG-70357. // Workaround for macOS-only Qt bug; see: QTBUG-65750, QTBUG-70357.
const int margin = TextWidth(dialog->fontMetrics(), ("X")); const int margin = TextWidth(dialog->fontMetrics(), ("X"));
dialog->resize(dialog->width() + 2 * margin, dialog->height()); dialog->resize(dialog->width() + 2 * margin, dialog->height());

View file

@ -18,7 +18,7 @@
#include <QtDBus> #include <QtDBus>
#include <stdint.h> #include <stdint.h>
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
#include <qt/macnotificationhandler.h> #include <qt/macnotificationhandler.h>
#endif #endif
@ -50,7 +50,7 @@ Notificator::Notificator(const QString &_programName, QSystemTrayIcon *_trayIcon
mode = Freedesktop; mode = Freedesktop;
} }
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
// check if users OS has support for NSUserNotification // check if users OS has support for NSUserNotification
if( MacNotificationHandler::instance()->hasUserNotificationCenterSupport()) { if( MacNotificationHandler::instance()->hasUserNotificationCenterSupport()) {
mode = UserNotificationCenter; mode = UserNotificationCenter;
@ -210,7 +210,7 @@ void Notificator::notifySystray(Class cls, const QString &title, const QString &
trayIcon->showMessage(title, text, sicon, millisTimeout); trayIcon->showMessage(title, text, sicon, millisTimeout);
} }
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
void Notificator::notifyMacUserNotificationCenter(const QString &title, const QString &text) 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. // 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
case QSystemTray: case QSystemTray:
notifySystray(cls, title, text, millisTimeout); notifySystray(cls, title, text, millisTimeout);
break; break;
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
case UserNotificationCenter: case UserNotificationCenter:
notifyMacUserNotificationCenter(title, text); notifyMacUserNotificationCenter(title, text);
break; break;

View file

@ -69,7 +69,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, int millisTimeout); 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); void notifyMacUserNotificationCenter(const QString &title, const QString &text);
#endif #endif
}; };

View file

@ -78,7 +78,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
connect(ui->connectSocksTor, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState); connect(ui->connectSocksTor, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState);
/* Window elements init */ /* Window elements init */
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
/* remove Window tab on Mac */ /* remove Window tab on Mac */
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow)); ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow));
/* hide launch at startup option on macOS */ /* hide launch at startup option on macOS */
@ -261,7 +261,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->proxyPortTor, OptionsModel::ProxyPortTor); mapper->addMapping(ui->proxyPortTor, OptionsModel::ProxyPortTor);
/* Window */ /* Window */
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
if (QSystemTrayIcon::isSystemTrayAvailable()) { if (QSystemTrayIcon::isSystemTrayAvailable()) {
mapper->addMapping(ui->showTrayIcon, OptionsModel::ShowTrayIcon); mapper->addMapping(ui->showTrayIcon, OptionsModel::ShowTrayIcon);
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray); mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);

View file

@ -871,7 +871,7 @@ void RPCConsole::clear(bool keep_prompt)
} }
// Set default style sheet // Set default style sheet
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont(/*use_embedded_font=*/true)); QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont(/*use_embedded_font=*/true));
#else #else
QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont()); QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont());

View file

@ -161,7 +161,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
void AddressBookTests::addressBookTests() void AddressBookTests::addressBookTests()
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
if (QApplication::platformName() == "minimal") { if (QApplication::platformName() == "minimal") {
// Disable for mac on "minimal" platform to avoid crashes inside the Qt // Disable for mac on "minimal" platform to avoid crashes inside the Qt
// framework when it tries to look up unimplemented cocoa functions, // framework when it tries to look up unimplemented cocoa functions,

View file

@ -58,7 +58,7 @@ void TestRpcCommand(RPCConsole* console)
//! Entry point for BitcoinApplication tests. //! Entry point for BitcoinApplication tests.
void AppTests::appTests() void AppTests::appTests()
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
if (QApplication::platformName() == "minimal") { if (QApplication::platformName() == "minimal") {
// Disable for mac on "minimal" platform to avoid crashes inside the Qt // Disable for mac on "minimal" platform to avoid crashes inside the Qt
// framework when it tries to look up unimplemented cocoa functions, // framework when it tries to look up unimplemented cocoa functions,

View file

@ -315,7 +315,7 @@ void TestGUI(interfaces::Node& node)
void WalletTests::walletTests() void WalletTests::walletTests()
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
if (QApplication::platformName() == "minimal") { if (QApplication::platformName() == "minimal") {
// Disable for mac on "minimal" platform to avoid crashes inside the Qt // Disable for mac on "minimal" platform to avoid crashes inside the Qt
// framework when it tries to look up unimplemented cocoa functions, // framework when it tries to look up unimplemented cocoa functions,