diff --git a/src/config/shortcutswidget.cpp b/src/config/shortcutswidget.cpp index 21d5fa3b..c45e5751 100644 --- a/src/config/shortcutswidget.cpp +++ b/src/config/shortcutswidget.cpp @@ -90,7 +90,7 @@ void ShortcutsWidget::initInfoTable() const auto default_key_sequence = current_shortcut.at(2); m_table->setItem(i, 0, new QTableWidgetItem(description)); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) QTableWidgetItem* item = new QTableWidgetItem(nativeOSHotKeyText(m_shortcuts.at(i).at(2))); #else @@ -145,7 +145,7 @@ void ShortcutsWidget::slotShortcutCellClicked(int row, int col) } if (m_config.setShortcut(shortcutName, shortcutValue.toString())) { -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) QTableWidgetItem* item = new QTableWidgetItem( nativeOSHotKeyText(shortcutValue.toString())); #else @@ -161,7 +161,7 @@ void ShortcutsWidget::slotShortcutCellClicked(int row, int col) } } -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) const QString& ShortcutsWidget::nativeOSHotKeyText(const QString& text) { m_res = text; diff --git a/src/core/qguiappcurrentscreen.cpp b/src/core/qguiappcurrentscreen.cpp index fface54b..64e37af8 100644 --- a/src/core/qguiappcurrentscreen.cpp +++ b/src/core/qguiappcurrentscreen.cpp @@ -22,7 +22,7 @@ QScreen* QGuiAppCurrentScreen::currentScreen() QScreen* QGuiAppCurrentScreen::currentScreen(const QPoint& pos) { m_currentScreen = screenAt(pos); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) // On the MacOS if mouse position is at the edge of bottom or right sides // qGuiApp->screenAt will return nullptr, so we need to try to find current // screen by moving 1 pixel inside to the current desktop area diff --git a/src/main.cpp b/src/main.cpp index 2b6c2234..b0ca10b7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -108,7 +108,7 @@ int main(int argc, char* argv[]) app.setOrganizationName(QStringLiteral("flameshot")); auto c = Controller::getInstance(); -#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_WIN)) +#if not(defined(Q_OS_MACOS) || defined(Q_OS_WIN)) new FlameshotDBusAdapter(c); QDBusConnection dbus = QDBusConnection::sessionBus(); if (!dbus.isConnected()) { @@ -124,7 +124,7 @@ int main(int argc, char* argv[]) return app.exec(); } -#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_WIN)) +#if not(defined(Q_OS_MACOS) || defined(Q_OS_WIN)) /*--------------| * CLI parsing | * ------------*/ diff --git a/src/tools/abstractpathtool.cpp b/src/tools/abstractpathtool.cpp index fbbd7e4c..60900011 100644 --- a/src/tools/abstractpathtool.cpp +++ b/src/tools/abstractpathtool.cpp @@ -46,7 +46,7 @@ bool AbstractPathTool::showMousePreview() const void AbstractPathTool::undo(QPixmap& pixmap) { QPainter p(&pixmap); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) // Not sure how will it work on 4k and fullHd on Linux or Windows with a // capture of different displays with different DPI, so let it be MacOS // specific only. @@ -85,7 +85,7 @@ void AbstractPathTool::updateBackup(const QPixmap& pixmap) QRect AbstractPathTool::backupRect(const QPixmap& pixmap) const { const QRect& limits = pixmap.rect(); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) // Not sure how will it work on 4k and fullHd on Linux or Windows with a // capture of different displays with different DPI, so let it be MacOS // specific only. diff --git a/src/tools/abstracttwopointtool.cpp b/src/tools/abstracttwopointtool.cpp index f4653164..91cb2292 100644 --- a/src/tools/abstracttwopointtool.cpp +++ b/src/tools/abstracttwopointtool.cpp @@ -73,7 +73,7 @@ bool AbstractTwoPointTool::showMousePreview() const void AbstractTwoPointTool::undo(QPixmap& pixmap) { QPainter p(&pixmap); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) // Not sure how will it work on 4k and fullHd on Linux or Windows with a // capture of different displays with different DPI, so let it be MacOS // specific only. @@ -121,7 +121,7 @@ QRect AbstractTwoPointTool::backupRect(const QPixmap& pixmap) const { const QRect& limits = pixmap.rect(); QRect r = QRect(m_points.first, m_points.second).normalized(); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) // Not sure how will it work on 4k and fullHd on Linux or Windows with a // capture of different displays with different DPI, so let it be MacOS // specific only. diff --git a/src/tools/pin/pintool.cpp b/src/tools/pin/pintool.cpp index 934667cd..3118e073 100644 --- a/src/tools/pin/pintool.cpp +++ b/src/tools/pin/pintool.cpp @@ -52,7 +52,7 @@ QString PinTool::description() const QWidget* PinTool::widget() { qreal devicePixelRatio = 1; -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen(); if (currentScreen) { devicePixelRatio = currentScreen->devicePixelRatio(); @@ -62,7 +62,7 @@ QWidget* PinTool::widget() const int m = w->margin() * devicePixelRatio; QRect adjusted_pos = m_geometry + QMargins(m, m, m, m); w->setGeometry(adjusted_pos); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) if (currentScreen) { QPoint topLeft = currentScreen->geometry().topLeft(); adjusted_pos.setX((adjusted_pos.x() - topLeft.x()) / devicePixelRatio + diff --git a/src/tools/save/savetool.cpp b/src/tools/save/savetool.cpp index 272c39ea..fea6f53e 100644 --- a/src/tools/save/savetool.cpp +++ b/src/tools/save/savetool.cpp @@ -18,7 +18,7 @@ #include "savetool.h" #include "src/utils/screenshotsaver.h" #include -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) #include "src/widgets/capture/capturewidget.h" #include #include @@ -60,7 +60,7 @@ CaptureTool* SaveTool::copy(QObject* parent) void SaveTool::pressed(const CaptureContext& context) { -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) for (QWidget* widget : qApp->topLevelWidgets()) { QString className(widget->metaObject()->className()); if (0 == diff --git a/src/tools/text/texttool.cpp b/src/tools/text/texttool.cpp index c475316e..b3f6ccfe 100644 --- a/src/tools/text/texttool.cpp +++ b/src/tools/text/texttool.cpp @@ -130,7 +130,7 @@ CaptureTool* TextTool::copy(QObject* parent) void TextTool::undo(QPixmap& pixmap) { QPainter p(&pixmap); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) // Not sure how will it work on 4k and fullHd on Linux or Windows with a // capture of different displays with different DPI, so let it be MacOS // specific only. @@ -165,7 +165,7 @@ QRect TextTool::backupRect(const QPixmap& pixmap) const { const QRect& limits = pixmap.rect(); QRect r = m_backupArea.normalized(); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) const qreal pixelRatio = pixmap.devicePixelRatio(); const int val = 5 * pixelRatio; if (1 != pixelRatio) { diff --git a/src/tools/toolfactory.cpp b/src/tools/toolfactory.cpp index 3d4d3ebe..b52e17af 100644 --- a/src/tools/toolfactory.cpp +++ b/src/tools/toolfactory.cpp @@ -92,7 +92,7 @@ CaptureTool* ToolFactory::CreateTool(CaptureToolButton::ButtonType t, case CaptureToolButton::TYPE_REDO: tool = new RedoTool(parent); break; -#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if not defined(Q_OS_MACOS) case CaptureToolButton::TYPE_OPEN_APP: tool = new AppLauncher(parent); break; diff --git a/src/utils/configshortcuts.cpp b/src/utils/configshortcuts.cpp index 07fae504..7561e05e 100644 --- a/src/utils/configshortcuts.cpp +++ b/src/utils/configshortcuts.cpp @@ -62,7 +62,7 @@ const QVector& ConfigShortcuts::captureShortcutsDefault( m_shortcuts << (QStringList() << "" << QObject::tr("Quit capture") << QKeySequence(Qt::Key_Escape).toString()); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) m_shortcuts << (QStringList() << "" << QObject::tr("Screenshot history") << "⇧⌘⌥H"); m_shortcuts << (QStringList() @@ -131,7 +131,7 @@ const QKeySequence& ConfigShortcuts::captureShortcutDefault( case CaptureToolButton::ButtonType::TYPE_IMAGEUPLOADER: m_ks = QKeySequence(Qt::Key_Return); break; -#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if not defined(Q_OS_MACOS) case CaptureToolButton::ButtonType::TYPE_OPEN_APP: m_ks = QKeySequence(Qt::CTRL + Qt::Key_O); break; diff --git a/src/utils/screengrabber.cpp b/src/utils/screengrabber.cpp index 3aac0dc2..bc50fb6b 100644 --- a/src/utils/screengrabber.cpp +++ b/src/utils/screengrabber.cpp @@ -39,7 +39,7 @@ ScreenGrabber::ScreenGrabber(QObject* parent) QPixmap ScreenGrabber::grabEntireDesktop(bool& ok) { ok = true; -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen(); QPixmap screenPixmap( currentScreen->grabWindow(QApplication::desktop()->winId(), diff --git a/src/utils/systemnotification.cpp b/src/utils/systemnotification.cpp index bd417097..6dabfc24 100644 --- a/src/utils/systemnotification.cpp +++ b/src/utils/systemnotification.cpp @@ -4,7 +4,7 @@ #include #include -#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_WIN)) +#if not(defined(Q_OS_MACOS) || defined(Q_OS_WIN)) #include #include #include @@ -14,7 +14,7 @@ SystemNotification::SystemNotification(QObject* parent) : QObject(parent) , m_interface(nullptr) { -#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_WIN)) +#if not(defined(Q_OS_MACOS) || defined(Q_OS_WIN)) m_interface = new QDBusInterface(QStringLiteral("org.freedesktop.Notifications"), QStringLiteral("/org/freedesktop/Notifications"), @@ -39,7 +39,7 @@ void SystemNotification::sendMessage(const QString& text, return; } -#if defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_WIN) +#if defined(Q_OS_MACOS) || defined(Q_OS_WIN) Controller::getInstance()->sendTrayNotification(text, title, timeout); #else QList args; diff --git a/src/widgets/capture/capturetoolbutton.cpp b/src/widgets/capture/capturetoolbutton.cpp index 6159e781..d56686dd 100644 --- a/src/widgets/capture/capturetoolbutton.cpp +++ b/src/widgets/capture/capturetoolbutton.cpp @@ -134,7 +134,7 @@ static std::map buttonTypeOrder { CaptureToolButton::TYPE_COPY, 14 }, { CaptureToolButton::TYPE_SAVE, 15 }, { CaptureToolButton::TYPE_IMAGEUPLOADER, 16 }, -#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if not defined(Q_OS_MACOS) { CaptureToolButton::TYPE_OPEN_APP, 17 }, { CaptureToolButton::TYPE_EXIT, 18 }, { CaptureToolButton::TYPE_PIN, 19 }, #else @@ -168,7 +168,7 @@ QVector CaptureToolButton::TYPE_SAVE, CaptureToolButton::TYPE_EXIT, CaptureToolButton::TYPE_IMAGEUPLOADER, -#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if not defined(Q_OS_MACOS) CaptureToolButton::TYPE_OPEN_APP, #endif CaptureToolButton::TYPE_PIN, diff --git a/src/widgets/capturelauncher.cpp b/src/widgets/capturelauncher.cpp index 19e9c6ad..a540b310 100644 --- a/src/widgets/capturelauncher.cpp +++ b/src/widgets/capturelauncher.cpp @@ -60,7 +60,7 @@ CaptureLauncher::CaptureLauncher(QDialog* parent) m_captureType->insertItem( 1, tr("Rectangular Region"), CaptureRequest::GRAPHICAL_MODE); -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) // Following to MacOS philosophy (one application cannot be displayed on // more than one display) m_captureType->insertItem( diff --git a/src/widgets/panel/sidepanelwidget.cpp b/src/widgets/panel/sidepanelwidget.cpp index d78c9cf8..2327cef4 100644 --- a/src/widgets/panel/sidepanelwidget.cpp +++ b/src/widgets/panel/sidepanelwidget.cpp @@ -25,7 +25,7 @@ #include #include #include -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) #include #endif @@ -165,7 +165,7 @@ QColor SidePanelWidget::grabPixmapColor(const QPoint& p) { QColor c; if (m_pixmap) { -#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS)) +#if defined(Q_OS_MACOS) QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen(); QPoint point = p; if (currentScreen) { diff --git a/src/widgets/panel/utilitypanel.cpp b/src/widgets/panel/utilitypanel.cpp index 74ea2409..ced9231e 100644 --- a/src/widgets/panel/utilitypanel.cpp +++ b/src/widgets/panel/utilitypanel.cpp @@ -43,8 +43,7 @@ UtilityPanel::UtilityPanel(QWidget* parent) m_internalPanel, &QWidget::hide); -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS)) move(0, 0); #endif } @@ -86,8 +85,7 @@ void UtilityPanel::show() m_showAnimation->setEndValue(QRect(0, 0, width(), height())); m_internalPanel->show(); m_showAnimation->start(); -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS)) move(0, 0); #endif QWidget::show();