Code refactoring - remove Q_OS_MAC (deprecated synonym for Q_OS_DARWIN)
(cherry picked from commit aff1649670aa5ba64f2927933a29c62b06fee21f)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 <QOperatingSystemVersion>
|
||||
#include <QScreen>
|
||||
#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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 |
|
||||
* ------------*/
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 +
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
#include "savetool.h"
|
||||
#include "src/utils/screenshotsaver.h"
|
||||
#include <QPainter>
|
||||
#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 <QApplication>
|
||||
#include <QWidget>
|
||||
@@ -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 ==
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -62,8 +62,7 @@ QVector<CaptureToolButton::ButtonType> 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
|
||||
|
||||
@@ -62,8 +62,7 @@ const QVector<QStringList>& 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;
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include <QApplication>
|
||||
#include <QUrl>
|
||||
|
||||
#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 <QDBusConnection>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusMessage>
|
||||
@@ -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<QVariant> args;
|
||||
|
||||
@@ -134,8 +134,7 @@ static std::map<CaptureToolButton::ButtonType, int> 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::ButtonType>
|
||||
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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QSlider>
|
||||
#include <QVBoxLayout>
|
||||
#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 <QScreen>
|
||||
#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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user