mirror of
https://github.com/fergalmoran/flameshot.git
synced 2025-12-30 13:49:48 +00:00
Port to QT6 on MacOs (#3977)
This commit is contained in:
@@ -21,8 +21,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void initInfoTable();
|
void initInfoTable();
|
||||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
|
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
|
||||||
defined(Q_OS_MACX))
|
|
||||||
const QString& nativeOSHotKeyText(const QString& text);
|
const QString& nativeOSHotKeyText(const QString& text);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -31,8 +30,7 @@ private slots:
|
|||||||
void onShortcutCellClicked(int, int);
|
void onShortcutCellClicked(int, int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
|
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
|
||||||
defined(Q_OS_MACX))
|
|
||||||
QString m_res;
|
QString m_res;
|
||||||
#endif
|
#endif
|
||||||
ConfigHandler m_config;
|
ConfigHandler m_config;
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ class ConfigWindow;
|
|||||||
class InfoWindow;
|
class InfoWindow;
|
||||||
class CaptureLauncher;
|
class CaptureLauncher;
|
||||||
class UploadHistory;
|
class UploadHistory;
|
||||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
|
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
|
||||||
defined(Q_OS_MACX))
|
|
||||||
class QHotkey;
|
class QHotkey;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -75,8 +74,7 @@ private:
|
|||||||
QPointer<CaptureLauncher> m_launcherWindow;
|
QPointer<CaptureLauncher> m_launcherWindow;
|
||||||
QPointer<ConfigWindow> m_configWindow;
|
QPointer<ConfigWindow> m_configWindow;
|
||||||
|
|
||||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
|
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
|
||||||
defined(Q_OS_MACX))
|
|
||||||
QHotkey* m_HotkeyScreenshotCapture;
|
QHotkey* m_HotkeyScreenshotCapture;
|
||||||
QHotkey* m_HotkeyScreenshotHistory;
|
QHotkey* m_HotkeyScreenshotHistory;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ void CaptureWidget::showxywh()
|
|||||||
void CaptureWidget::initHelpMessage()
|
void CaptureWidget::initHelpMessage()
|
||||||
{
|
{
|
||||||
QList<QPair<QString, QString>> keyMap;
|
QList<QPair<QString, QString>> keyMap;
|
||||||
keyMap << QPair(tr("Mouse"), tr("Select screenshot area"));
|
keyMap << std::pair(tr("Mouse"), tr("Select screenshot area"));
|
||||||
using CT = CaptureTool;
|
using CT = CaptureTool;
|
||||||
for (auto toolType : { CT::TYPE_ACCEPT, CT::TYPE_SAVE, CT::TYPE_COPY }) {
|
for (auto toolType : { CT::TYPE_ACCEPT, CT::TYPE_SAVE, CT::TYPE_COPY }) {
|
||||||
if (!m_tools.contains(toolType)) {
|
if (!m_tools.contains(toolType)) {
|
||||||
@@ -432,14 +432,14 @@ void CaptureWidget::initHelpMessage()
|
|||||||
ConfigHandler().shortcut(QVariant::fromValue(toolType).toString());
|
ConfigHandler().shortcut(QVariant::fromValue(toolType).toString());
|
||||||
shortcut.replace("Return", "Enter");
|
shortcut.replace("Return", "Enter");
|
||||||
if (!shortcut.isEmpty()) {
|
if (!shortcut.isEmpty()) {
|
||||||
keyMap << QPair(shortcut, tool->description());
|
keyMap << std::pair(shortcut, tool->description());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyMap << QPair(tr("Mouse Wheel"), tr("Change tool size"));
|
keyMap << std::pair(tr("Mouse Wheel"), tr("Change tool size"));
|
||||||
keyMap << QPair(tr("Right Click"), tr("Show color picker"));
|
keyMap << std::pair(tr("Right Click"), tr("Show color picker"));
|
||||||
keyMap << QPair(ConfigHandler().shortcut("TYPE_TOGGLE_PANEL"),
|
keyMap << std::pair(ConfigHandler().shortcut("TYPE_TOGGLE_PANEL"),
|
||||||
tr("Open side panel"));
|
tr("Open side panel"));
|
||||||
keyMap << QPair(tr("Esc"), tr("Exit"));
|
keyMap << std::pair(tr("Esc"), tr("Exit"));
|
||||||
|
|
||||||
m_helpMessage = OverlayMessage::compileFromKeyMap(keyMap);
|
m_helpMessage = OverlayMessage::compileFromKeyMap(keyMap);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ TrayIcon::TrayIcon(QObject* parent)
|
|||||||
// https://bugreports.qt.io/browse/QTBUG-86393
|
// https://bugreports.qt.io/browse/QTBUG-86393
|
||||||
// https://developer.apple.com/forums/thread/126072
|
// https://developer.apple.com/forums/thread/126072
|
||||||
auto currentMacOsVersion = QOperatingSystemVersion::current();
|
auto currentMacOsVersion = QOperatingSystemVersion::current();
|
||||||
if (currentMacOsVersion >= currentMacOsVersion.MacOSBigSur) {
|
if (currentMacOsVersion >= QOperatingSystemVersion::MacOSBigSur) {
|
||||||
setContextMenu(m_menu);
|
setContextMenu(m_menu);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -37,7 +37,7 @@ TrayIcon::TrayIcon(QObject* parent)
|
|||||||
setIcon(icon);
|
setIcon(icon);
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
if (currentMacOsVersion < currentMacOsVersion.MacOSBigSur) {
|
if (currentMacOsVersion < QOperatingSystemVersion::MacOSBigSur) {
|
||||||
// Because of the following issues on MacOS "Catalina":
|
// Because of the following issues on MacOS "Catalina":
|
||||||
// https://bugreports.qt.io/browse/QTBUG-86393
|
// https://bugreports.qt.io/browse/QTBUG-86393
|
||||||
// https://developer.apple.com/forums/thread/126072
|
// https://developer.apple.com/forums/thread/126072
|
||||||
@@ -101,7 +101,7 @@ void TrayIcon::initMenu()
|
|||||||
connect(captureAction, &QAction::triggered, this, [this]() {
|
connect(captureAction, &QAction::triggered, this, [this]() {
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
auto currentMacOsVersion = QOperatingSystemVersion::current();
|
auto currentMacOsVersion = QOperatingSystemVersion::current();
|
||||||
if (currentMacOsVersion >= currentMacOsVersion.MacOSBigSur) {
|
if (currentMacOsVersion >= QOperatingSystemVersion::MacOSBigSur) {
|
||||||
startGuiCapture();
|
startGuiCapture();
|
||||||
} else {
|
} else {
|
||||||
// It seems it is not relevant for MacOS BigSur (Wait 400 ms to hide
|
// It seems it is not relevant for MacOS BigSur (Wait 400 ms to hide
|
||||||
|
|||||||
Reference in New Issue
Block a user