From a893fdfc75a7dab6dcc68fe870744ee8b1d831a4 Mon Sep 17 00:00:00 2001 From: Yuriy Puchkov Date: Wed, 10 Feb 2021 19:44:08 +0200 Subject: [PATCH] Code refactoring - remove Q_OS_MAC (deprecated synonym for Q_OS_DARWIN) (cherry picked from commit aff1649670aa5ba64f2927933a29c62b06fee21f) --- src/config/shortcutswidget.cpp | 9 ++-- src/core/controller.cpp | 63 +++++++++++++---------- src/core/qguiappcurrentscreen.cpp | 3 +- src/main.cpp | 8 +-- src/tools/abstractpathtool.cpp | 6 +-- src/tools/abstracttwopointtool.cpp | 6 +-- src/tools/pin/pintool.cpp | 6 +-- src/tools/save/savetool.cpp | 6 +-- src/tools/text/texttool.cpp | 6 +-- src/tools/toolfactory.cpp | 3 +- src/utils/confighandler.cpp | 9 ++-- src/utils/configshortcuts.cpp | 6 +-- src/utils/screengrabber.cpp | 3 +- src/utils/systemnotification.cpp | 12 ++--- src/widgets/capture/capturetoolbutton.cpp | 6 +-- src/widgets/capturelauncher.cpp | 3 +- src/widgets/panel/sidepanelwidget.cpp | 6 +-- src/widgets/panel/utilitypanel.cpp | 8 +-- 18 files changed, 76 insertions(+), 93 deletions(-) diff --git a/src/config/shortcutswidget.cpp b/src/config/shortcutswidget.cpp index 5951c2d0..bc6b6057 100644 --- a/src/config/shortcutswidget.cpp +++ b/src/config/shortcutswidget.cpp @@ -90,8 +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_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) QTableWidgetItem* item = new QTableWidgetItem(nativeOSHotKeyText(m_shortcuts.at(i).at(2))); #else @@ -146,8 +145,7 @@ void ShortcutsWidget::slotShortcutCellClicked(int row, int col) } if (m_config.setShortcut(shortcutName, shortcutValue.toString())) { -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) QTableWidgetItem* item = new QTableWidgetItem( nativeOSHotKeyText(shortcutValue.toString())); #else @@ -163,8 +161,7 @@ void ShortcutsWidget::slotShortcutCellClicked(int row, int col) } } -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) const QString& ShortcutsWidget::nativeOSHotKeyText(const QString& text) { m_res = text; diff --git a/src/core/controller.cpp b/src/core/controller.cpp index bfecc515..d4ad1976 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -49,8 +49,7 @@ #include "src/core/globalshortcutfilter.h" #endif -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) #include #include #endif @@ -65,8 +64,7 @@ Controller::Controller() , m_trayIconMenu(nullptr) , m_networkCheckUpdates(nullptr) , m_showCheckAppUpdateStatus(false) -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) , m_HotkeyScreenshotCapture(nullptr) , m_HotkeyScreenshotHistory(nullptr) #endif @@ -95,8 +93,7 @@ Controller::Controller() QString StyleSheet = CaptureButton::globalStyleSheet(); qApp->setStyleSheet(StyleSheet); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) // Try to take a test screenshot, MacOS will request a "Screen Recording" // permissions on the first run. Otherwise it will be hidden under the // CaptureWidget @@ -178,9 +175,30 @@ void Controller::handleReplyCheckUpdates(QNetworkReply* reply) QJsonDocument response = QJsonDocument::fromJson(reply->readAll()); QJsonObject json = response.object(); m_appLatestVersion = json["tag_name"].toString().replace("v", ""); - if (QStringLiteral(APP_VERSION) - .replace("v", "") - .compare(m_appLatestVersion) < 0) { + + // Transform strings version for correct comparison + QStringList appLatestVersion = + m_appLatestVersion.replace("v", "").split("."); + QStringList currentVersion = + QStringLiteral(APP_VERSION).replace("v", "").split("."); + // transform versions to the string which can be compared correctly, + // example: versions "0.8.5.9" and "0.8.5.10" are transformed into: + // "0000.0008.0005.0009" and "0000.0008.0005.0010" + // For string comparison you'll get: + // "0.8.5.9" < "0.8.5.10" INCORRECT (lower version is bigger) + // "0000.0008.0005.0009" > "0000.0008.0005.0010" CORRECT + std::transform( + appLatestVersion.begin(), + appLatestVersion.end(), + appLatestVersion.begin(), + [](QString c) -> QString { return c = ("0000" + c).right(4); }); + std::transform( + currentVersion.begin(), + currentVersion.end(), + currentVersion.begin(), + [](QString c) -> QString { return c = ("0000" + c).right(4); }); + + if (currentVersion.join(".").compare(appLatestVersion.join(".")) < 0) { m_appLatestUrl = json["html_url"].toString(); QString newVersion = tr("New version %1 is available").arg(m_appLatestVersion); @@ -252,8 +270,7 @@ void Controller::requestCapture(const CaptureRequest& request) void Controller::startVisualCapture(const uint id, const QString& forcedSavePath) { -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) // This is required on MacOS because of Mission Control. If you'll switch to // another Desktop you cannot take a new screenshot from the tray, you have // to switch back to the Flameshot Desktop manually. It is not obvious and a @@ -298,8 +315,7 @@ void Controller::startVisualCapture(const uint id, #ifdef Q_OS_WIN m_captureWindow->show(); -#elif (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#elif (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) // In "Emulate fullscreen mode" m_captureWindow->showFullScreen(); m_captureWindow->activateWindow(); @@ -343,8 +359,7 @@ void Controller::openConfigWindow() if (!m_configWindow) { m_configWindow = new ConfigWindow(); m_configWindow->show(); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) m_configWindow->activateWindow(); m_configWindow->raise(); #endif @@ -356,8 +371,7 @@ void Controller::openInfoWindow() { if (!m_infoWindow) { m_infoWindow = new InfoWindow(); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) m_infoWindow->activateWindow(); m_infoWindow->raise(); #endif @@ -370,8 +384,7 @@ void Controller::openLauncherWindow() m_launcherWindow = new CaptureLauncher(); } m_launcherWindow->show(); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) m_launcherWindow->activateWindow(); m_launcherWindow->raise(); #endif @@ -390,8 +403,7 @@ void Controller::enableTrayIcon() ConfigHandler().setDisabledTrayIcon(false); QAction* captureAction = new QAction(tr("&Take Screenshot"), this); connect(captureAction, &QAction::triggered, this, [this]() { -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) auto currentMacOsVersion = QOperatingSystemVersion::current(); if (currentMacOsVersion >= currentMacOsVersion.MacOSBigSur) { startVisualCapture(); @@ -446,8 +458,7 @@ void Controller::enableTrayIcon() Q_ASSERT(m_trayIcon); } m_trayIcon->setToolTip(QStringLiteral("Flameshot")); -#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX) +#if defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX) // Because of the following issues on MacOS "Catalina": // https://bugreports.qt.io/browse/QTBUG-86393 // https://developer.apple.com/forums/thread/126072 @@ -462,8 +473,7 @@ void Controller::enableTrayIcon() QIcon::fromTheme("flameshot-tray", QIcon(":img/app/flameshot.png")); m_trayIcon->setIcon(trayIcon); -#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX) +#if defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX) if (currentMacOsVersion < currentMacOsVersion.MacOSBigSur) { // Because of the following issues on MacOS "Catalina": // https://bugreports.qt.io/browse/QTBUG-86393 @@ -548,8 +558,7 @@ void Controller::showRecentScreenshots() } m_history->loadHistory(); m_history->show(); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) m_history->activateWindow(); m_history->raise(); #endif diff --git a/src/core/qguiappcurrentscreen.cpp b/src/core/qguiappcurrentscreen.cpp index a69effac..1cb592f9 100644 --- a/src/core/qguiappcurrentscreen.cpp +++ b/src/core/qguiappcurrentscreen.cpp @@ -22,8 +22,7 @@ QScreen* QGuiAppCurrentScreen::currentScreen() QScreen* QGuiAppCurrentScreen::currentScreen(const QPoint& pos) { m_currentScreen = screenAt(pos); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) // 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 9d775c59..fee7690e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -108,8 +108,8 @@ int main(int argc, char* argv[]) app.setOrganizationName(QStringLiteral("flameshot")); auto c = Controller::getInstance(); -#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX) || defined(Q_OS_WIN)) +#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX) || \ + defined(Q_OS_WIN)) new FlameshotDBusAdapter(c); QDBusConnection dbus = QDBusConnection::sessionBus(); if (!dbus.isConnected()) { @@ -125,8 +125,8 @@ int main(int argc, char* argv[]) return app.exec(); } -#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX) || defined(Q_OS_WIN)) +#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX) || \ + defined(Q_OS_WIN)) /*--------------| * CLI parsing | * ------------*/ diff --git a/src/tools/abstractpathtool.cpp b/src/tools/abstractpathtool.cpp index c4a771b9..65557805 100644 --- a/src/tools/abstractpathtool.cpp +++ b/src/tools/abstractpathtool.cpp @@ -46,8 +46,7 @@ bool AbstractPathTool::showMousePreview() const void AbstractPathTool::undo(QPixmap& pixmap) { QPainter p(&pixmap); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) // 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. @@ -86,8 +85,7 @@ void AbstractPathTool::updateBackup(const QPixmap& pixmap) QRect AbstractPathTool::backupRect(const QPixmap& pixmap) const { const QRect& limits = pixmap.rect(); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) // 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 728fd399..fe8c7975 100644 --- a/src/tools/abstracttwopointtool.cpp +++ b/src/tools/abstracttwopointtool.cpp @@ -73,8 +73,7 @@ bool AbstractTwoPointTool::showMousePreview() const void AbstractTwoPointTool::undo(QPixmap& pixmap) { QPainter p(&pixmap); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) // 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. @@ -122,8 +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_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) // 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 6ef8bb5e..9708738d 100644 --- a/src/tools/pin/pintool.cpp +++ b/src/tools/pin/pintool.cpp @@ -52,8 +52,7 @@ QString PinTool::description() const QWidget* PinTool::widget() { qreal devicePixelRatio = 1; -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen(); if (currentScreen) { devicePixelRatio = currentScreen->devicePixelRatio(); @@ -63,8 +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_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) 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 28debb4c..6230076b 100644 --- a/src/tools/save/savetool.cpp +++ b/src/tools/save/savetool.cpp @@ -18,8 +18,7 @@ #include "savetool.h" #include "src/utils/screenshotsaver.h" #include -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) #include "src/widgets/capture/capturewidget.h" #include #include @@ -61,8 +60,7 @@ CaptureTool* SaveTool::copy(QObject* parent) void SaveTool::pressed(const CaptureContext& context) { -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) 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 7fea1bdf..05603398 100644 --- a/src/tools/text/texttool.cpp +++ b/src/tools/text/texttool.cpp @@ -130,8 +130,7 @@ CaptureTool* TextTool::copy(QObject* parent) void TextTool::undo(QPixmap& pixmap) { QPainter p(&pixmap); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) // 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. @@ -166,8 +165,7 @@ QRect TextTool::backupRect(const QPixmap& pixmap) const { const QRect& limits = pixmap.rect(); QRect r = m_backupArea.normalized(); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) 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 8f3e4fb1..2754353a 100644 --- a/src/tools/toolfactory.cpp +++ b/src/tools/toolfactory.cpp @@ -92,8 +92,7 @@ CaptureTool* ToolFactory::CreateTool(CaptureToolButton::ButtonType t, case CaptureToolButton::TYPE_REDO: tool = new RedoTool(parent); break; -#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) case CaptureToolButton::TYPE_OPEN_APP: tool = new AppLauncher(parent); break; diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp index 4ec30b30..1fc68f4b 100644 --- a/src/utils/confighandler.cpp +++ b/src/utils/confighandler.cpp @@ -62,8 +62,7 @@ QVector ConfigHandler::getButtons() << CaptureToolButton::TYPE_COPY << CaptureToolButton::TYPE_SAVE << CaptureToolButton::TYPE_EXIT << CaptureToolButton::TYPE_IMAGEUPLOADER -#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) << CaptureToolButton::TYPE_OPEN_APP #endif << CaptureToolButton::TYPE_PIN << CaptureToolButton::TYPE_TEXT @@ -325,8 +324,7 @@ void ConfigHandler::setCheckForUpdates(const bool checkForUpdates) bool ConfigHandler::startupLaunchValue() { -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) bool res = false; #else bool res = true; @@ -365,8 +363,7 @@ void ConfigHandler::setStartupLaunch(const bool start) if (start == m_settings.value(QStringLiteral("startupLaunch")).toBool()) { return; } -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) /* TODO - there should be more correct way via API, but didn't find it without extra dependencies, there should be something like that: https://stackoverflow.com/questions/3358410/programmatically-run-at-startup-on-mac-os-x diff --git a/src/utils/configshortcuts.cpp b/src/utils/configshortcuts.cpp index 247f2504..b6ec4504 100644 --- a/src/utils/configshortcuts.cpp +++ b/src/utils/configshortcuts.cpp @@ -62,8 +62,7 @@ const QVector& ConfigShortcuts::captureShortcutsDefault( m_shortcuts << (QStringList() << "" << QObject::tr("Quit capture") << QKeySequence(Qt::Key_Escape).toString()); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) m_shortcuts << (QStringList() << "" << QObject::tr("Screenshot history") << "⇧⌘⌥H"); m_shortcuts << (QStringList() @@ -132,8 +131,7 @@ const QKeySequence& ConfigShortcuts::captureShortcutDefault( case CaptureToolButton::ButtonType::TYPE_IMAGEUPLOADER: m_ks = QKeySequence(Qt::Key_Return); break; -#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) 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 e66154e8..1d19bb54 100644 --- a/src/utils/screengrabber.cpp +++ b/src/utils/screengrabber.cpp @@ -39,8 +39,7 @@ ScreenGrabber::ScreenGrabber(QObject* parent) QPixmap ScreenGrabber::grabEntireDesktop(bool& ok) { ok = true; -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen(); QPixmap screenPixmap( currentScreen->grabWindow(QApplication::desktop()->winId(), diff --git a/src/utils/systemnotification.cpp b/src/utils/systemnotification.cpp index 2e3e62c5..79fad371 100644 --- a/src/utils/systemnotification.cpp +++ b/src/utils/systemnotification.cpp @@ -4,8 +4,8 @@ #include #include -#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX) || defined(Q_OS_WIN)) +#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX) || \ + defined(Q_OS_WIN)) #include #include #include @@ -15,8 +15,8 @@ SystemNotification::SystemNotification(QObject* parent) : QObject(parent) , m_interface(nullptr) { -#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX) || defined(Q_OS_WIN)) +#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX) || \ + defined(Q_OS_WIN)) m_interface = new QDBusInterface(QStringLiteral("org.freedesktop.Notifications"), QStringLiteral("/org/freedesktop/Notifications"), @@ -41,8 +41,8 @@ void SystemNotification::sendMessage(const QString& text, return; } -#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX) || defined(Q_OS_WIN) +#if defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX) || \ + 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 637a969b..7f81d76f 100644 --- a/src/widgets/capture/capturetoolbutton.cpp +++ b/src/widgets/capture/capturetoolbutton.cpp @@ -134,8 +134,7 @@ static std::map buttonTypeOrder { CaptureToolButton::TYPE_COPY, 14 }, { CaptureToolButton::TYPE_SAVE, 15 }, { CaptureToolButton::TYPE_IMAGEUPLOADER, 16 }, -#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) { CaptureToolButton::TYPE_OPEN_APP, 17 }, { CaptureToolButton::TYPE_EXIT, 18 }, { CaptureToolButton::TYPE_PIN, 19 }, #else @@ -169,8 +168,7 @@ QVector CaptureToolButton::TYPE_SAVE, CaptureToolButton::TYPE_EXIT, CaptureToolButton::TYPE_IMAGEUPLOADER, -#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) CaptureToolButton::TYPE_OPEN_APP, #endif CaptureToolButton::TYPE_PIN, diff --git a/src/widgets/capturelauncher.cpp b/src/widgets/capturelauncher.cpp index cb8e722a..6fd1be02 100644 --- a/src/widgets/capturelauncher.cpp +++ b/src/widgets/capturelauncher.cpp @@ -60,8 +60,7 @@ CaptureLauncher::CaptureLauncher(QDialog* parent) m_captureType->insertItem( 1, tr("Rectangular Region"), CaptureRequest::GRAPHICAL_MODE); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) // 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 00ffc152..527795d6 100644 --- a/src/widgets/panel/sidepanelwidget.cpp +++ b/src/widgets/panel/sidepanelwidget.cpp @@ -25,8 +25,7 @@ #include #include #include -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) #include #endif @@ -166,8 +165,7 @@ QColor SidePanelWidget::grabPixmapColor(const QPoint& p) { QColor c; if (m_pixmap) { -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ - defined(Q_OS_MACX)) +#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)) QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen(); QPoint point = p; if (currentScreen) { diff --git a/src/widgets/panel/utilitypanel.cpp b/src/widgets/panel/utilitypanel.cpp index 1068f906..74ea2409 100644 --- a/src/widgets/panel/utilitypanel.cpp +++ b/src/widgets/panel/utilitypanel.cpp @@ -43,8 +43,8 @@ UtilityPanel::UtilityPanel(QWidget* parent) m_internalPanel, &QWidget::hide); -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_MAC64) || \ - defined(Q_OS_MACOS) || defined(Q_OS_MACX)) +#if (defined(Q_OS_WIN) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ + defined(Q_OS_MACX)) move(0, 0); #endif } @@ -86,8 +86,8 @@ 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_MAC) || defined(Q_OS_MAC64) || \ - defined(Q_OS_MACOS) || defined(Q_OS_MACX)) +#if (defined(Q_OS_WIN) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ + defined(Q_OS_MACX)) move(0, 0); #endif QWidget::show();