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

Merge bitcoin-core/gui#594: scripted-diff: replace deprecated Q_OS_MAC with Q_OS_MACOS

e3daecae03 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 e3daecae03
  hebasto:
    ACK e3daecae03.

Tree-SHA512: 17b4b891c70f027f6a420be830e61bd87fde5297a4473a5b122e4e34bdf83141635bd5cf5143efe95a0dd6f8cf50bc67a2de6cbfed7956952369587c74ece225
This commit is contained in:
Hennadii Stepanov 2022-05-20 11:31:36 +02:00
commit 8118970c86
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
10 changed files with 34 additions and 34 deletions

View file

@ -26,7 +26,7 @@
#include <qt/walletview.h>
#endif // ENABLE_WALLET
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
#include <qt/macdockiconhandler.h>
#endif
@ -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"
@ -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
@ -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();
@ -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
@ -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();
@ -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] {
@ -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();
@ -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};
@ -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);
@ -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.
@ -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 {
@ -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())
@ -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())

View file

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

View file

@ -74,7 +74,7 @@
#include <string>
#include <vector>
#if defined(Q_OS_MAC)
#if defined(Q_OS_MACOS)
#include <QProcess>
@ -399,7 +399,7 @@ bool isObscured(QWidget *w)
void bringToFront(QWidget* w)
{
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
ForceActivation();
#endif
@ -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)});
@ -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());

View file

@ -18,7 +18,7 @@
#include <QtDBus>
#include <stdint.h>
#endif
#ifdef Q_OS_MAC
#ifdef Q_OS_MACOS
#include <qt/macnotificationhandler.h>
#endif
@ -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;
@ -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.
@ -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;

View file

@ -69,7 +69,7 @@ private:
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
};

View file

@ -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 */
@ -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);

View file

@ -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());

View file

@ -168,7 +168,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,

View file

@ -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,

View file

@ -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,