Code refactoring - remove Q_OS_MACX (is not required, is covered by Q_OS_DARWIN)

(cherry picked from commit 00b9aae5266aaffb9a01a6f689e1829ae8218bdc)
This commit is contained in:
Yuriy Puchkov
2021-02-17 14:50:34 +02:00
parent dd54d028a1
commit a5cd4cd1bc
4 changed files with 23 additions and 23 deletions

View File

@@ -49,7 +49,7 @@
#include "src/core/globalshortcutfilter.h"
#endif
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
#include <QOperatingSystemVersion>
#include <QScreen>
#endif
@@ -64,7 +64,7 @@ Controller::Controller()
, m_trayIconMenu(nullptr)
, m_networkCheckUpdates(nullptr)
, m_showCheckAppUpdateStatus(false)
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
, m_HotkeyScreenshotCapture(nullptr)
, m_HotkeyScreenshotHistory(nullptr)
#endif
@@ -93,7 +93,7 @@ Controller::Controller()
QString StyleSheet = CaptureButton::globalStyleSheet();
qApp->setStyleSheet(StyleSheet);
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
// 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
@@ -270,7 +270,7 @@ void Controller::requestCapture(const CaptureRequest& request)
void Controller::startVisualCapture(const uint id,
const QString& forcedSavePath)
{
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
// 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
@@ -315,7 +315,7 @@ void Controller::startVisualCapture(const uint id,
#ifdef Q_OS_WIN
m_captureWindow->show();
#elif (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#elif (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
// In "Emulate fullscreen mode"
m_captureWindow->showFullScreen();
m_captureWindow->activateWindow();
@@ -359,7 +359,7 @@ void Controller::openConfigWindow()
if (!m_configWindow) {
m_configWindow = new ConfigWindow();
m_configWindow->show();
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
m_configWindow->activateWindow();
m_configWindow->raise();
#endif
@@ -371,7 +371,7 @@ void Controller::openInfoWindow()
{
if (!m_infoWindow) {
m_infoWindow = new InfoWindow();
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
m_infoWindow->activateWindow();
m_infoWindow->raise();
#endif
@@ -384,7 +384,7 @@ void Controller::openLauncherWindow()
m_launcherWindow = new CaptureLauncher();
}
m_launcherWindow->show();
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
m_launcherWindow->activateWindow();
m_launcherWindow->raise();
#endif
@@ -403,7 +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_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
auto currentMacOsVersion = QOperatingSystemVersion::current();
if (currentMacOsVersion >= currentMacOsVersion.MacOSBigSur) {
startVisualCapture();
@@ -458,7 +458,7 @@ void Controller::enableTrayIcon()
Q_ASSERT(m_trayIcon);
}
m_trayIcon->setToolTip(QStringLiteral("Flameshot"));
#if defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)
#if defined(Q_OS_MAC64) || defined(Q_OS_MACOS)
// Because of the following issues on MacOS "Catalina":
// https://bugreports.qt.io/browse/QTBUG-86393
// https://developer.apple.com/forums/thread/126072
@@ -473,7 +473,7 @@ void Controller::enableTrayIcon()
QIcon::fromTheme("flameshot-tray", QIcon(":img/app/flameshot.png"));
m_trayIcon->setIcon(trayIcon);
#if defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX)
#if defined(Q_OS_MAC64) || defined(Q_OS_MACOS)
if (currentMacOsVersion < currentMacOsVersion.MacOSBigSur) {
// Because of the following issues on MacOS "Catalina":
// https://bugreports.qt.io/browse/QTBUG-86393
@@ -558,7 +558,7 @@ void Controller::showRecentScreenshots()
}
m_history->loadHistory();
m_history->show();
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
m_history->activateWindow();
m_history->raise();
#endif

View File

@@ -62,7 +62,7 @@ QVector<CaptureToolButton::ButtonType> ConfigHandler::getButtons()
<< CaptureToolButton::TYPE_COPY << CaptureToolButton::TYPE_SAVE
<< CaptureToolButton::TYPE_EXIT
<< CaptureToolButton::TYPE_IMAGEUPLOADER
#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if not(defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
<< CaptureToolButton::TYPE_OPEN_APP
#endif
<< CaptureToolButton::TYPE_PIN << CaptureToolButton::TYPE_TEXT
@@ -324,7 +324,7 @@ void ConfigHandler::setCheckForUpdates(const bool checkForUpdates)
bool ConfigHandler::startupLaunchValue()
{
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
bool res = false;
#else
bool res = true;
@@ -363,7 +363,7 @@ void ConfigHandler::setStartupLaunch(const bool start)
if (start == m_settings.value(QStringLiteral("startupLaunch")).toBool()) {
return;
}
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
/* 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

View File

@@ -27,7 +27,7 @@
#include <QImageWriter>
#include <QMessageBox>
#include <QMimeData>
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
#include "src/widgets/capture/capturewidget.h"
#endif
@@ -120,7 +120,7 @@ bool ScreenshotSaver::saveToFilesystemGUI(const QPixmap& capture)
while (!ok) {
ConfigHandler config;
QString savePath = FileNameHandler().absoluteSavePath();
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
for (QWidget* widget : qApp->topLevelWidgets()) {
QString className(widget->metaObject()->className());
if (0 == className.compare(

View File

@@ -120,7 +120,7 @@ CaptureWidget::CaptureWidget(const uint id,
}
move(topLeft);
resize(pixmap().size());
#elif (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#elif (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
// Emulate fullscreen mode
// setWindowFlags(Qt::WindowStaysOnTopHint |
// Qt::BypassWindowManagerHint |
@@ -147,7 +147,7 @@ CaptureWidget::CaptureWidget(const uint id,
topLeftOffset - topLeft;
#endif
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
// MacOS works just with one active display, so we need to append
// just one current display and keep multiple displays logic for
// other OS
@@ -334,7 +334,7 @@ void CaptureWidget::paintEvent(QPaintEvent*)
painter.setClipRect(rect());
if (m_showInitialMsg) {
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
QRect helpRect;
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
if (currentScreen) {
@@ -763,7 +763,7 @@ void CaptureWidget::initPanel()
m_panel = new UtilityPanel(this);
m_panel->hide();
makeChild(m_panel);
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
panelRect.moveTo(mapFromGlobal(panelRect.topLeft()));
m_panel->setFixedWidth(m_colorPicker->width() * 1.5);
@@ -810,7 +810,7 @@ void CaptureWidget::showAppUpdateNotification(const QString& appLatestVersion,
m_updateNotificationWidget =
new UpdateNotificationWidget(this, appLatestVersion, appLatestUrl);
}
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
int ax = (width() - m_updateNotificationWidget->width()) / 2;
#elif (defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
QRect helpRect = QGuiApplication::primaryScreen()->geometry();
@@ -1233,7 +1233,7 @@ void CaptureWidget::copyScreenshot()
void CaptureWidget::saveScreenshot()
{
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_MAC64) || defined(Q_OS_MACOS))
showNormal();
#endif
m_captureDone = true;