mirror of
https://github.com/fergalmoran/flameshot.git
synced 2025-12-22 09:51:06 +00:00
add cmake option DISABLE_UPDATE_CHECKER (#2793)
* add cmake option DISABLE_UPDATE_CHECKER * add cmake option DISABLE_UPDATE_CHECKER to compile out updatechecker * format code use `clang-format -i $(git ls-files "*.cpp" "*.h")` * fallback wrong code format * replace `add_definitions` with `add_compile_definitions`
This commit is contained in:
@@ -68,6 +68,10 @@ option(GENERATE_TS "Regenerate translation source files" OFF)
|
|||||||
option(USE_EXTERNAL_SINGLEAPPLICATION "Use external QtSingleApplication library" OFF)
|
option(USE_EXTERNAL_SINGLEAPPLICATION "Use external QtSingleApplication library" OFF)
|
||||||
option(USE_LAUNCHER_ABSOLUTE_PATH "Use absolute path for the desktop launcher" ON)
|
option(USE_LAUNCHER_ABSOLUTE_PATH "Use absolute path for the desktop launcher" ON)
|
||||||
option(USE_WAYLAND_CLIPBOARD "USE KF Gui Wayland Clipboard" OFF)
|
option(USE_WAYLAND_CLIPBOARD "USE KF Gui Wayland Clipboard" OFF)
|
||||||
|
option(DISABLE_UPDATE_CHECKER "Disable check for updates" OFF)
|
||||||
|
if (DISABLE_UPDATE_CHECKER)
|
||||||
|
add_compile_definitions(DISABLE_UPDATE_CHECKER)
|
||||||
|
endif ()
|
||||||
|
|
||||||
include(cmake/StandardProjectSettings.cmake)
|
include(cmake/StandardProjectSettings.cmake)
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ GeneralConf::GeneralConf(QWidget* parent)
|
|||||||
#endif
|
#endif
|
||||||
initShowTrayIcon();
|
initShowTrayIcon();
|
||||||
initShowDesktopNotification();
|
initShowDesktopNotification();
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
initCheckForUpdates();
|
initCheckForUpdates();
|
||||||
|
#endif
|
||||||
initShowStartupLaunchMessage();
|
initShowStartupLaunchMessage();
|
||||||
initAllowMultipleGuiInstances();
|
initAllowMultipleGuiInstances();
|
||||||
initSaveLastRegion();
|
initSaveLastRegion();
|
||||||
@@ -82,7 +84,9 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath)
|
|||||||
m_uploadWithoutConfirmation->setChecked(config.uploadWithoutConfirmation());
|
m_uploadWithoutConfirmation->setChecked(config.uploadWithoutConfirmation());
|
||||||
m_historyConfirmationToDelete->setChecked(
|
m_historyConfirmationToDelete->setChecked(
|
||||||
config.historyConfirmationToDelete());
|
config.historyConfirmationToDelete());
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
m_checkForUpdates->setChecked(config.checkForUpdates());
|
m_checkForUpdates->setChecked(config.checkForUpdates());
|
||||||
|
#endif
|
||||||
m_allowMultipleGuiInstances->setChecked(config.allowMultipleGuiInstances());
|
m_allowMultipleGuiInstances->setChecked(config.allowMultipleGuiInstances());
|
||||||
m_showMagnifier->setChecked(config.showMagnifier());
|
m_showMagnifier->setChecked(config.showMagnifier());
|
||||||
m_squareMagnifier->setChecked(config.squareMagnifier());
|
m_squareMagnifier->setChecked(config.squareMagnifier());
|
||||||
@@ -132,10 +136,12 @@ void GeneralConf::showDesktopNotificationChanged(bool checked)
|
|||||||
ConfigHandler().setShowDesktopNotification(checked);
|
ConfigHandler().setShowDesktopNotification(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void GeneralConf::checkForUpdatesChanged(bool checked)
|
void GeneralConf::checkForUpdatesChanged(bool checked)
|
||||||
{
|
{
|
||||||
ConfigHandler().setCheckForUpdates(checked);
|
ConfigHandler().setCheckForUpdates(checked);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void GeneralConf::allowMultipleGuiInstancesChanged(bool checked)
|
void GeneralConf::allowMultipleGuiInstancesChanged(bool checked)
|
||||||
{
|
{
|
||||||
@@ -339,6 +345,7 @@ void GeneralConf::initConfigButtons()
|
|||||||
&GeneralConf::resetConfiguration);
|
&GeneralConf::resetConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void GeneralConf::initCheckForUpdates()
|
void GeneralConf::initCheckForUpdates()
|
||||||
{
|
{
|
||||||
m_checkForUpdates = new QCheckBox(tr("Automatic check for updates"), this);
|
m_checkForUpdates = new QCheckBox(tr("Automatic check for updates"), this);
|
||||||
@@ -350,6 +357,7 @@ void GeneralConf::initCheckForUpdates()
|
|||||||
this,
|
this,
|
||||||
&GeneralConf::checkForUpdatesChanged);
|
&GeneralConf::checkForUpdatesChanged);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void GeneralConf::initAllowMultipleGuiInstances()
|
void GeneralConf::initAllowMultipleGuiInstances()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ private slots:
|
|||||||
void saveLastRegion(bool checked);
|
void saveLastRegion(bool checked);
|
||||||
void showSidePanelButtonChanged(bool checked);
|
void showSidePanelButtonChanged(bool checked);
|
||||||
void showDesktopNotificationChanged(bool checked);
|
void showDesktopNotificationChanged(bool checked);
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void checkForUpdatesChanged(bool checked);
|
void checkForUpdatesChanged(bool checked);
|
||||||
|
#endif
|
||||||
void allowMultipleGuiInstancesChanged(bool checked);
|
void allowMultipleGuiInstancesChanged(bool checked);
|
||||||
void autoCloseIdleDaemonChanged(bool checked);
|
void autoCloseIdleDaemonChanged(bool checked);
|
||||||
void autostartChanged(bool checked);
|
void autostartChanged(bool checked);
|
||||||
@@ -63,7 +65,9 @@ private:
|
|||||||
void initAntialiasingPinZoom();
|
void initAntialiasingPinZoom();
|
||||||
void initAutoCloseIdleDaemon();
|
void initAutoCloseIdleDaemon();
|
||||||
void initAutostart();
|
void initAutostart();
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void initCheckForUpdates();
|
void initCheckForUpdates();
|
||||||
|
#endif
|
||||||
void initConfigButtons();
|
void initConfigButtons();
|
||||||
void initCopyAndCloseAfterUpload();
|
void initCopyAndCloseAfterUpload();
|
||||||
void initCopyOnDoubleClick();
|
void initCopyOnDoubleClick();
|
||||||
@@ -97,7 +101,9 @@ private:
|
|||||||
QCheckBox* m_showTray;
|
QCheckBox* m_showTray;
|
||||||
QCheckBox* m_helpMessage;
|
QCheckBox* m_helpMessage;
|
||||||
QCheckBox* m_sidePanelButton;
|
QCheckBox* m_sidePanelButton;
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
QCheckBox* m_checkForUpdates;
|
QCheckBox* m_checkForUpdates;
|
||||||
|
#endif
|
||||||
QCheckBox* m_allowMultipleGuiInstances;
|
QCheckBox* m_allowMultipleGuiInstances;
|
||||||
QCheckBox* m_autoCloseIdleDaemon;
|
QCheckBox* m_autoCloseIdleDaemon;
|
||||||
QCheckBox* m_autostart;
|
QCheckBox* m_autostart;
|
||||||
|
|||||||
@@ -12,15 +12,18 @@
|
|||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QDBusMessage>
|
#include <QDBusMessage>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QRect>
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QPixmap>
|
|
||||||
#include <QRect>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include "src/core/globalshortcutfilter.h"
|
#include "src/core/globalshortcutfilter.h"
|
||||||
@@ -57,9 +60,11 @@ FlameshotDaemon::FlameshotDaemon()
|
|||||||
, m_hostingClipboard(false)
|
, m_hostingClipboard(false)
|
||||||
, m_clipboardSignalBlocked(false)
|
, m_clipboardSignalBlocked(false)
|
||||||
, m_trayIcon(nullptr)
|
, m_trayIcon(nullptr)
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
, m_networkCheckUpdates(nullptr)
|
, m_networkCheckUpdates(nullptr)
|
||||||
, m_showCheckAppUpdateStatus(false)
|
, m_showCheckAppUpdateStatus(false)
|
||||||
, m_appLatestVersion(QStringLiteral(APP_VERSION).replace("v", ""))
|
, m_appLatestVersion(QStringLiteral(APP_VERSION).replace("v", ""))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
connect(
|
connect(
|
||||||
QApplication::clipboard(), &QClipboard::dataChanged, this, [this]() {
|
QApplication::clipboard(), &QClipboard::dataChanged, this, [this]() {
|
||||||
@@ -87,9 +92,12 @@ FlameshotDaemon::FlameshotDaemon()
|
|||||||
m_persist = !config.autoCloseIdleDaemon();
|
m_persist = !config.autoCloseIdleDaemon();
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
if (ConfigHandler().checkForUpdates()) {
|
if (ConfigHandler().checkForUpdates()) {
|
||||||
getLatestAvailableVersion();
|
getLatestAvailableVersion();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlameshotDaemon::start()
|
void FlameshotDaemon::start()
|
||||||
@@ -169,6 +177,7 @@ void FlameshotDaemon::sendTrayNotification(const QString& text,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void FlameshotDaemon::showUpdateNotificationIfAvailable(CaptureWidget* widget)
|
void FlameshotDaemon::showUpdateNotificationIfAvailable(CaptureWidget* widget)
|
||||||
{
|
{
|
||||||
if (!m_appLatestUrl.isEmpty() &&
|
if (!m_appLatestUrl.isEmpty() &&
|
||||||
@@ -207,6 +216,7 @@ void FlameshotDaemon::checkForUpdates()
|
|||||||
QDesktopServices::openUrl(QUrl(m_appLatestUrl));
|
QDesktopServices::openUrl(QUrl(m_appLatestUrl));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the daemon instance.
|
* @brief Return the daemon instance.
|
||||||
@@ -344,6 +354,7 @@ void FlameshotDaemon::enableTrayIcon(bool enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void FlameshotDaemon::handleReplyCheckUpdates(QNetworkReply* reply)
|
void FlameshotDaemon::handleReplyCheckUpdates(QNetworkReply* reply)
|
||||||
{
|
{
|
||||||
if (!ConfigHandler().checkForUpdates()) {
|
if (!ConfigHandler().checkForUpdates()) {
|
||||||
@@ -382,6 +393,7 @@ void FlameshotDaemon::handleReplyCheckUpdates(QNetworkReply* reply)
|
|||||||
}
|
}
|
||||||
m_showCheckAppUpdateStatus = false;
|
m_showCheckAppUpdateStatus = false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QDBusMessage FlameshotDaemon::createMethodCall(QString method)
|
QDBusMessage FlameshotDaemon::createMethodCall(QString method)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,10 +9,13 @@ class QRect;
|
|||||||
class QDBusMessage;
|
class QDBusMessage;
|
||||||
class QDBusConnection;
|
class QDBusConnection;
|
||||||
class TrayIcon;
|
class TrayIcon;
|
||||||
|
class CaptureWidget;
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
class QVersionNumber;
|
class QVersionNumber;
|
||||||
class CaptureWidget;
|
#endif
|
||||||
|
|
||||||
class FlameshotDaemon : public QObject
|
class FlameshotDaemon : public QObject
|
||||||
{
|
{
|
||||||
@@ -30,14 +33,19 @@ public:
|
|||||||
const QString& title = QStringLiteral("Flameshot Info"),
|
const QString& title = QStringLiteral("Flameshot Info"),
|
||||||
const int timeout = 5000);
|
const int timeout = 5000);
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void showUpdateNotificationIfAvailable(CaptureWidget* widget);
|
void showUpdateNotificationIfAvailable(CaptureWidget* widget);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void checkForUpdates();
|
void checkForUpdates();
|
||||||
void getLatestAvailableVersion();
|
void getLatestAvailableVersion();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleReplyCheckUpdates(QNetworkReply* reply);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newVersionAvailable(QVersionNumber version);
|
void newVersionAvailable(QVersionNumber version);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FlameshotDaemon();
|
FlameshotDaemon();
|
||||||
@@ -52,10 +60,6 @@ private:
|
|||||||
void initTrayIcon();
|
void initTrayIcon();
|
||||||
void enableTrayIcon(bool enable);
|
void enableTrayIcon(bool enable);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void handleReplyCheckUpdates(QNetworkReply* reply);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static QDBusMessage createMethodCall(QString method);
|
static QDBusMessage createMethodCall(QString method);
|
||||||
static void checkDBusConnection(const QDBusConnection& connection);
|
static void checkDBusConnection(const QDBusConnection& connection);
|
||||||
static void call(const QDBusMessage& m);
|
static void call(const QDBusMessage& m);
|
||||||
@@ -66,10 +70,12 @@ private:
|
|||||||
QList<QWidget*> m_widgets;
|
QList<QWidget*> m_widgets;
|
||||||
TrayIcon* m_trayIcon;
|
TrayIcon* m_trayIcon;
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
QString m_appLatestUrl;
|
QString m_appLatestUrl;
|
||||||
QString m_appLatestVersion;
|
QString m_appLatestVersion;
|
||||||
bool m_showCheckAppUpdateStatus;
|
bool m_showCheckAppUpdateStatus;
|
||||||
QNetworkAccessManager* m_networkCheckUpdates;
|
QNetworkAccessManager* m_networkCheckUpdates;
|
||||||
|
#endif
|
||||||
|
|
||||||
static FlameshotDaemon* m_instance;
|
static FlameshotDaemon* m_instance;
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,9 @@ static QMap<class QString, QSharedPointer<ValueHandler>>
|
|||||||
OPTION("showDesktopNotification" ,Bool ( true )),
|
OPTION("showDesktopNotification" ,Bool ( true )),
|
||||||
OPTION("disabledTrayIcon" ,Bool ( false )),
|
OPTION("disabledTrayIcon" ,Bool ( false )),
|
||||||
OPTION("historyConfirmationToDelete" ,Bool ( true )),
|
OPTION("historyConfirmationToDelete" ,Bool ( true )),
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
OPTION("checkForUpdates" ,Bool ( true )),
|
OPTION("checkForUpdates" ,Bool ( true )),
|
||||||
|
#endif
|
||||||
OPTION("allowMultipleGuiInstances" ,Bool ( false )),
|
OPTION("allowMultipleGuiInstances" ,Bool ( false )),
|
||||||
OPTION("showMagnifier" ,Bool ( false )),
|
OPTION("showMagnifier" ,Bool ( false )),
|
||||||
OPTION("squareMagnifier" ,Bool ( false )),
|
OPTION("squareMagnifier" ,Bool ( false )),
|
||||||
|
|||||||
@@ -86,7 +86,9 @@ public:
|
|||||||
CONFIG_GETTER_SETTER(drawThickness, setDrawThickness, int)
|
CONFIG_GETTER_SETTER(drawThickness, setDrawThickness, int)
|
||||||
CONFIG_GETTER_SETTER(drawFontSize, setDrawFontSize, int)
|
CONFIG_GETTER_SETTER(drawFontSize, setDrawFontSize, int)
|
||||||
CONFIG_GETTER_SETTER(keepOpenAppLauncher, setKeepOpenAppLauncher, bool)
|
CONFIG_GETTER_SETTER(keepOpenAppLauncher, setKeepOpenAppLauncher, bool)
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
CONFIG_GETTER_SETTER(checkForUpdates, setCheckForUpdates, bool)
|
CONFIG_GETTER_SETTER(checkForUpdates, setCheckForUpdates, bool)
|
||||||
|
#endif
|
||||||
CONFIG_GETTER_SETTER(allowMultipleGuiInstances,
|
CONFIG_GETTER_SETTER(allowMultipleGuiInstances,
|
||||||
setAllowMultipleGuiInstances,
|
setAllowMultipleGuiInstances,
|
||||||
bool)
|
bool)
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ target_sources(
|
|||||||
orientablepushbutton.h
|
orientablepushbutton.h
|
||||||
uploadhistory.h
|
uploadhistory.h
|
||||||
uploadlineitem.h
|
uploadlineitem.h
|
||||||
updatenotificationwidget.h
|
|
||||||
colorpickerwidget.h
|
colorpickerwidget.h
|
||||||
imguploaddialog.h
|
imguploaddialog.h
|
||||||
capture/capturetoolobjects.h
|
capture/capturetoolobjects.h
|
||||||
@@ -28,7 +27,8 @@ target_sources(
|
|||||||
|
|
||||||
target_sources(
|
target_sources(
|
||||||
flameshot
|
flameshot
|
||||||
PRIVATE capturelauncher.cpp
|
PRIVATE
|
||||||
|
capturelauncher.cpp
|
||||||
draggablewidgetmaker.cpp
|
draggablewidgetmaker.cpp
|
||||||
imagelabel.cpp
|
imagelabel.cpp
|
||||||
trayicon.cpp
|
trayicon.cpp
|
||||||
@@ -38,8 +38,16 @@ target_sources(
|
|||||||
orientablepushbutton.cpp
|
orientablepushbutton.cpp
|
||||||
uploadhistory.cpp
|
uploadhistory.cpp
|
||||||
uploadlineitem.cpp
|
uploadlineitem.cpp
|
||||||
updatenotificationwidget.cpp
|
|
||||||
colorpickerwidget.cpp
|
colorpickerwidget.cpp
|
||||||
imguploaddialog.cpp
|
imguploaddialog.cpp
|
||||||
capture/capturetoolobjects.cpp
|
capture/capturetoolobjects.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (NOT DISABLE_UPDATE_CHECKER)
|
||||||
|
target_sources(
|
||||||
|
flameshot
|
||||||
|
PRIVATE
|
||||||
|
updatenotificationwidget.h
|
||||||
|
updatenotificationwidget.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
@@ -29,7 +29,6 @@
|
|||||||
#include "src/widgets/orientablepushbutton.h"
|
#include "src/widgets/orientablepushbutton.h"
|
||||||
#include "src/widgets/panel/sidepanelwidget.h"
|
#include "src/widgets/panel/sidepanelwidget.h"
|
||||||
#include "src/widgets/panel/utilitypanel.h"
|
#include "src/widgets/panel/utilitypanel.h"
|
||||||
#include "src/widgets/updatenotificationwidget.h"
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -42,6 +41,10 @@
|
|||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <draggablewidgetmaker.h>
|
#include <draggablewidgetmaker.h>
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
|
#include "src/widgets/updatenotificationwidget.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MOUSE_DISTANCE_TO_START_MOVING 3
|
#define MOUSE_DISTANCE_TO_START_MOVING 3
|
||||||
|
|
||||||
// CaptureWidget is the main component used to capture the screen. It contains
|
// CaptureWidget is the main component used to capture the screen. It contains
|
||||||
@@ -64,7 +67,9 @@ CaptureWidget::CaptureWidget(const CaptureRequest& req,
|
|||||||
, m_toolWidget(nullptr)
|
, m_toolWidget(nullptr)
|
||||||
, m_colorPicker(nullptr)
|
, m_colorPicker(nullptr)
|
||||||
, m_lastMouseWheel(0)
|
, m_lastMouseWheel(0)
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
, m_updateNotificationWidget(nullptr)
|
, m_updateNotificationWidget(nullptr)
|
||||||
|
#endif
|
||||||
, m_activeToolIsMoved(false)
|
, m_activeToolIsMoved(false)
|
||||||
, m_panel(nullptr)
|
, m_panel(nullptr)
|
||||||
, m_sidePanel(nullptr)
|
, m_sidePanel(nullptr)
|
||||||
@@ -1127,6 +1132,7 @@ void CaptureWidget::initPanel()
|
|||||||
m_panel->fillCaptureTools(m_captureToolObjects.captureToolObjects());
|
m_panel->fillCaptureTools(m_captureToolObjects.captureToolObjects());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void CaptureWidget::showAppUpdateNotification(const QString& appLatestVersion,
|
void CaptureWidget::showAppUpdateNotification(const QString& appLatestVersion,
|
||||||
const QString& appLatestUrl)
|
const QString& appLatestUrl)
|
||||||
{
|
{
|
||||||
@@ -1159,6 +1165,7 @@ void CaptureWidget::showAppUpdateNotification(const QString& appLatestVersion,
|
|||||||
makeChild(m_updateNotificationWidget);
|
makeChild(m_updateNotificationWidget);
|
||||||
m_updateNotificationWidget->show();
|
m_updateNotificationWidget->show();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void CaptureWidget::initSelection()
|
void CaptureWidget::initSelection()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ class QNetworkReply;
|
|||||||
class ColorPicker;
|
class ColorPicker;
|
||||||
class NotifierBox;
|
class NotifierBox;
|
||||||
class HoverEventFilter;
|
class HoverEventFilter;
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
class UpdateNotificationWidget;
|
class UpdateNotificationWidget;
|
||||||
|
#endif
|
||||||
class UtilityPanel;
|
class UtilityPanel;
|
||||||
class SidePanelWidget;
|
class SidePanelWidget;
|
||||||
|
|
||||||
@@ -50,9 +52,11 @@ public:
|
|||||||
~CaptureWidget();
|
~CaptureWidget();
|
||||||
|
|
||||||
QPixmap pixmap();
|
QPixmap pixmap();
|
||||||
|
void setCaptureToolObjects(const CaptureToolObjects& captureToolObjects);
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void showAppUpdateNotification(const QString& appLatestVersion,
|
void showAppUpdateNotification(const QString& appLatestVersion,
|
||||||
const QString& appLatestUrl);
|
const QString& appLatestUrl);
|
||||||
void setCaptureToolObjects(const CaptureToolObjects& captureToolObjects);
|
#endif
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool commitCurrentTool();
|
bool commitCurrentTool();
|
||||||
@@ -168,7 +172,9 @@ private:
|
|||||||
bool m_configError;
|
bool m_configError;
|
||||||
bool m_configErrorResolved;
|
bool m_configErrorResolved;
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
UpdateNotificationWidget* m_updateNotificationWidget;
|
UpdateNotificationWidget* m_updateNotificationWidget;
|
||||||
|
#endif
|
||||||
quint64 m_lastMouseWheel;
|
quint64 m_lastMouseWheel;
|
||||||
QPointer<CaptureToolButton> m_sizeIndButton;
|
QPointer<CaptureToolButton> m_sizeIndButton;
|
||||||
// Last pressed button
|
// Last pressed button
|
||||||
|
|||||||
@@ -86,10 +86,12 @@ TrayIcon::~TrayIcon()
|
|||||||
delete m_menu;
|
delete m_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
QAction* TrayIcon::appUpdates()
|
QAction* TrayIcon::appUpdates()
|
||||||
{
|
{
|
||||||
return m_appUpdates;
|
return m_appUpdates;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void TrayIcon::initMenu()
|
void TrayIcon::initMenu()
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,7 @@ void TrayIcon::initMenu()
|
|||||||
connect(
|
connect(
|
||||||
infoAction, &QAction::triggered, Flameshot::instance(), &Flameshot::info);
|
infoAction, &QAction::triggered, Flameshot::instance(), &Flameshot::info);
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
m_appUpdates = new QAction(tr("Check for updates"), this);
|
m_appUpdates = new QAction(tr("Check for updates"), this);
|
||||||
connect(m_appUpdates,
|
connect(m_appUpdates,
|
||||||
&QAction::triggered,
|
&QAction::triggered,
|
||||||
@@ -141,6 +144,7 @@ void TrayIcon::initMenu()
|
|||||||
tr("New version %1 is available").arg(version.toString());
|
tr("New version %1 is available").arg(version.toString());
|
||||||
m_appUpdates->setText(newVersion);
|
m_appUpdates->setText(newVersion);
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
QAction* quitAction = new QAction(tr("&Quit"), this);
|
QAction* quitAction = new QAction(tr("&Quit"), this);
|
||||||
connect(quitAction, &QAction::triggered, qApp, &QCoreApplication::quit);
|
connect(quitAction, &QAction::triggered, qApp, &QCoreApplication::quit);
|
||||||
@@ -159,12 +163,15 @@ void TrayIcon::initMenu()
|
|||||||
m_menu->addSeparator();
|
m_menu->addSeparator();
|
||||||
m_menu->addAction(configAction);
|
m_menu->addAction(configAction);
|
||||||
m_menu->addSeparator();
|
m_menu->addSeparator();
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
m_menu->addAction(m_appUpdates);
|
m_menu->addAction(m_appUpdates);
|
||||||
|
#endif
|
||||||
m_menu->addAction(infoAction);
|
m_menu->addAction(infoAction);
|
||||||
m_menu->addSeparator();
|
m_menu->addSeparator();
|
||||||
m_menu->addAction(quitAction);
|
m_menu->addAction(quitAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void TrayIcon::enableCheckUpdatesAction(bool enable)
|
void TrayIcon::enableCheckUpdatesAction(bool enable)
|
||||||
{
|
{
|
||||||
if (m_appUpdates != nullptr) {
|
if (m_appUpdates != nullptr) {
|
||||||
@@ -175,9 +182,12 @@ void TrayIcon::enableCheckUpdatesAction(bool enable)
|
|||||||
FlameshotDaemon::instance()->getLatestAvailableVersion();
|
FlameshotDaemon::instance()->getLatestAvailableVersion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void TrayIcon::startGuiCapture()
|
void TrayIcon::startGuiCapture()
|
||||||
{
|
{
|
||||||
auto* widget = Flameshot::instance()->gui();
|
auto* widget = Flameshot::instance()->gui();
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
FlameshotDaemon::instance()->showUpdateNotificationIfAvailable(widget);
|
FlameshotDaemon::instance()->showUpdateNotificationIfAvailable(widget);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,15 +11,21 @@ public:
|
|||||||
TrayIcon(QObject* parent = nullptr);
|
TrayIcon(QObject* parent = nullptr);
|
||||||
virtual ~TrayIcon();
|
virtual ~TrayIcon();
|
||||||
|
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
QAction* appUpdates();
|
QAction* appUpdates();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initTrayIcon();
|
void initTrayIcon();
|
||||||
void initMenu();
|
void initMenu();
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
void enableCheckUpdatesAction(bool enable);
|
void enableCheckUpdatesAction(bool enable);
|
||||||
|
#endif
|
||||||
|
|
||||||
void startGuiCapture();
|
void startGuiCapture();
|
||||||
|
|
||||||
QMenu* m_menu;
|
QMenu* m_menu;
|
||||||
|
#if !defined(DISABLE_UPDATE_CHECKER)
|
||||||
QAction* m_appUpdates;
|
QAction* m_appUpdates;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user