From 98265580638f5d4248d734c13e3a39a96847ef63 Mon Sep 17 00:00:00 2001 From: Yuriy Puchkov Date: Thu, 24 Sep 2020 21:13:26 +0300 Subject: [PATCH] Fix issue of merge upstream repo to Namecheap one --- flameshot.pro | 327 ------------------ src/config/CMakeLists.txt | 6 +- src/config/geneneralconf.cpp | 3 +- src/config/geneneralconf.h | 1 - src/tools/CMakeLists.txt | 21 +- src/tools/capturetool.h | 3 +- src/tools/pixelate/pixelatetool.cpp | 5 +- src/tools/storage/imguploadertool.cpp | 10 + src/tools/storage/imguploadertool.h | 4 + src/tools/storage/imgur/imguruploadertool.cpp | 5 - src/tools/storage/imgur/imguruploadertool.h | 1 - src/tools/storage/s3/imgs3uploadertool.cpp | 10 - src/tools/storage/s3/imgs3uploadertool.h | 4 +- src/tools/storage/storagemanager.cpp | 2 +- src/tools/toolfactory.cpp | 4 +- src/utils/CMakeLists.txt | 10 +- src/utils/configshortcuts.cpp | 48 +-- src/utils/configshortcuts.h | 6 +- src/widgets/CMakeLists.txt | 8 +- src/widgets/capture/capturewidget.cpp | 26 +- src/widgets/capture/capturewidget.h | 5 +- 21 files changed, 103 insertions(+), 406 deletions(-) delete mode 100644 flameshot.pro diff --git a/flameshot.pro b/flameshot.pro deleted file mode 100644 index 5903ef13..00000000 --- a/flameshot.pro +++ /dev/null @@ -1,327 +0,0 @@ -#------------------------------------------------- -# -# Project created by Dharkael 2017-04-21T00:42:49 -# -#------------------------------------------------- - -win32:LIBS += -luser32 -lshell32 - -LIBS += -Llibeay32 -Lssleay32 - -BASE_VERSION = 0.7.12 -TAG_VERSION = "$$system(git --git-dir $$PWD/.git rev-parse --short HEAD)" -isEmpty(TAG_VERSION){ - DEFINES += APP_VERSION=\\\"$$BASE_VERSION\\\" -} -else { - DEFINES += APP_VERSION=\\\"$$BASE_VERSION-$$TAG_VERSION\\\" -} - -QT += core gui widgets network svg - -unix:!macx { - QT += dbus -} - -CONFIG += c++11 link_pkgconfig - -#CONFIG += packaging # Enables "make install" for packaging paths - -TARGET = flameshot -TEMPLATE = app - -win32:RC_ICONS += img/app/flameshot.ico -QMAKE_TARGET_COMPANY = "NameCheap" -QMAKE_TARGET_COPYRIGHT = "GNU General Public License v3.0" -QMAKE_TARGET_DESCRIPTION = "Flameshot - S3 bucket edition" -VERSION = $$BASE_VERSION - -#release: DESTDIR = build/release -#debug: DESTDIR = build/debug - -#OBJECTS_DIR = $$DESTDIR/.obj -#MOC_DIR = $$DESTDIR/.moc -#RCC_DIR = $$DESTDIR/.qrc -#UI_DIR = $$DESTDIR/.ui - -TRANSLATIONS = translations/Internationalization_es.ts \ - translations/Internationalization_ca.ts \ - translations/Internationalization_ru.ts \ - translations/Internationalization_zh_CN.ts \ - translations/Internationalization_zh_TW.ts \ - translations/Internationalization_tr.ts \ - translations/Internationalization_ka.ts \ - translations/Internationalization_fr.ts \ - translations/Internationalization_pl.ts \ - translations/Internationalization_ja.ts \ - translations/Internationalization_pt_br.ts \ - translations/Internationalization_sr.ts \ - translations/Internationalization_uk.ts \ - translations/Internationalization_de_DE.ts \ - translations/Internationalization_sk.ts \ - -# Generate translations in build -TRANSLATIONS_FILES = - -qtPrepareTool(LRELEASE, lrelease) -for(tsfile, TRANSLATIONS) { - qmfile = $$shadowed($$tsfile) - qmfile ~= s,.ts$,.qm, - qmdir = $$dirname(qmfile) - !exists($$qmdir) { - mkpath($$qmdir)|error("Aborting.") - } - command = $$LRELEASE -removeidentical $$tsfile -qm $$qmfile - system($$command)|error("Failed to run: $$command") - TRANSLATIONS_FILES += $$qmfile -} - -DEFINES += QT_DEPRECATED_WARNINGS - -include(src/third-party/singleapplication/singleapplication.pri) -include(src/third-party/Qt-Color-Widgets//color_widgets.pri) - -DEFINES += QAPPLICATION_CLASS=QApplication - -SOURCES += src/main.cpp \ - src/config/filepathconfiguration.cpp \ - src/config/setshortcutwidget.cpp \ - src/config/shortcutswidget.cpp \ - src/tools/storage/imguploadertool.cpp \ - src/tools/storage/storagemanager.cpp \ - src/utils/configshortcuts.cpp \ - src/widgets/historywidget.cpp \ - src/utils/configenterprise.cpp \ - src/utils/history.cpp \ - src/widgets/capture/buttonhandler.cpp \ - src/widgets/infowindow.cpp \ - src/config/configwindow.cpp \ - src/widgets/capture/capturewidget.cpp \ - src/widgets/capture/colorpicker.cpp \ - src/config/buttonlistview.cpp \ - src/config/uicoloreditor.cpp \ - src/config/geneneralconf.cpp \ - src/core/controller.cpp \ - src/config/clickablelabel.cpp \ - src/config/filenameeditor.cpp \ - src/config/strftimechooserwidget.cpp \ - src/widgets/capture/capturebutton.cpp \ - src/tools/pencil/penciltool.cpp \ - src/tools/undo/undotool.cpp \ - src/tools/redo/redotool.cpp \ - src/tools/arrow/arrowtool.cpp \ - src/tools/circle/circletool.cpp \ - src/tools/copy/copytool.cpp \ - src/tools/exit/exittool.cpp \ - src/tools/line/linetool.cpp \ - src/tools/marker/markertool.cpp \ - src/tools/move/movetool.cpp \ - src/tools/rectangle/rectangletool.cpp \ - src/tools/save/savetool.cpp \ - src/tools/selection/selectiontool.cpp \ - src/tools/sizeindicator/sizeindicatortool.cpp \ - src/tools/toolfactory.cpp \ - src/utils/filenamehandler.cpp \ - src/utils/screengrabber.cpp \ - src/utils/confighandler.cpp \ - src/utils/systemnotification.cpp \ - src/cli/commandlineparser.cpp \ - src/cli/commandoption.cpp \ - src/cli/commandargument.cpp \ - src/utils/screenshotsaver.cpp \ - src/tools/storage/imguploader.cpp \ - src/tools/storage/imgur/imguruploadertool.cpp \ - src/tools/storage/imgur/imguruploader.cpp \ - src/tools/storage/s3/imgs3uploadertool.cpp \ - src/tools/storage/s3/imgs3uploader.cpp \ - src/tools/storage/s3/imgs3settings.cpp \ - src/widgets/loadspinner.cpp \ - src/widgets/imagelabel.cpp \ - src/widgets/notificationwidget.cpp \ - src/widgets/capture/notifierbox.cpp \ - src/utils/desktopinfo.cpp \ - src/tools/launcher/applauncherwidget.cpp \ - src/utils/desktopfileparse.cpp \ - src/tools/launcher/launcheritemdelegate.cpp \ - src/tools/blur/blurtool.cpp \ - src/tools/pin/pintool.cpp \ - src/tools/launcher/terminallauncher.cpp \ - src/config/visualseditor.cpp \ - src/config/extendedslider.cpp \ - src/tools/launcher/openwithprogram.cpp \ - src/tools/launcher/applaunchertool.cpp \ - src/utils/pathinfo.cpp \ - src/utils/colorutils.cpp \ - src/tools/capturecontext.cpp \ - src/widgets/capture/modificationcommand.cpp \ - src/tools/abstractpathtool.cpp \ - src/tools/abstracttwopointtool.cpp \ - src/tools/abstractactiontool.cpp \ - src/utils/globalvalues.cpp \ - src/widgets/panel/utilitypanel.cpp \ - src/widgets/capture/hovereventfilter.cpp \ - src/widgets/capture/selectionwidget.cpp \ - src/tools/pin/pinwidget.cpp \ - src/widgets/capturelauncher.cpp \ - src/tools/text/texttool.cpp \ - src/tools/text/textwidget.cpp \ - src/core/capturerequest.cpp \ - src/tools/text/textconfig.cpp \ - src/widgets/panel/sidepanelwidget.cpp - -HEADERS += src/widgets/capture/buttonhandler.h \ - src/config/filepathconfiguration.h \ - src/config/setshortcutwidget.h \ - src/config/shortcutswidget.h \ - src/tools/storage/imgstorages.h \ - src/tools/storage/imguploadertool.h \ - src/tools/storage/storagemanager.h \ - src/utils/configshortcuts.h \ - src/widgets/historywidget.h \ - src/utils/configenterprise.h \ - src/utils/history.h \ - src/widgets/infowindow.h \ - src/config/configwindow.h \ - src/widgets/capture/capturewidget.h \ - src/widgets/capture/colorpicker.h \ - src/config/buttonlistview.h \ - src/config/uicoloreditor.h \ - src/config/geneneralconf.h \ - src/config/clickablelabel.h \ - src/config/filenameeditor.h \ - src/utils/filenamehandler.h \ - src/config/strftimechooserwidget.h \ - src/utils/screengrabber.h \ - src/tools/capturetool.h \ - src/widgets/capture/capturebutton.h \ - src/tools/pencil/penciltool.h \ - src/tools/undo/undotool.h \ - src/tools/redo/redotool.h \ - src/tools/arrow/arrowtool.h \ - src/tools/circle/circletool.h \ - src/tools/copy/copytool.h \ - src/tools/exit/exittool.h \ - src/tools/line/linetool.h \ - src/tools/marker/markertool.h \ - src/tools/move/movetool.h \ - src/tools/rectangle/rectangletool.h \ - src/tools/save/savetool.h \ - src/tools/selection/selectiontool.h \ - src/tools/sizeindicator/sizeindicatortool.h \ - src/tools/toolfactory.h \ - src/utils/confighandler.h \ - src/core/controller.h \ - src/utils/systemnotification.h \ - src/cli/commandlineparser.h \ - src/cli/commandoption.h \ - src/cli/commandargument.h \ - src/utils/screenshotsaver.h \ - src/tools/storage/imguploader.h \ - src/tools/storage/imgur/imguruploadertool.h \ - src/tools/storage/imgur/imguruploader.h \ - src/tools/storage/s3/imgs3uploader.h \ - src/tools/storage/s3/imgs3uploadertool.h \ - src/tools/storage/s3/imgs3settings.h \ - src/widgets/loadspinner.h \ - src/widgets/imagelabel.h \ - src/widgets/notificationwidget.h \ - src/widgets/capture/notifierbox.h \ - src/utils/desktopinfo.h \ - src/tools/launcher/applauncherwidget.h \ - src/utils/desktopfileparse.h \ - src/tools/launcher/launcheritemdelegate.h \ - src/tools/blur/blurtool.h \ - src/tools/pin/pintool.h \ - src/tools/launcher/terminallauncher.h \ - src/config/visualseditor.h \ - src/config/extendedslider.h \ - src/tools/launcher/openwithprogram.h \ - src/utils/pathinfo.h \ - src/tools/capturecontext.h \ - src/tools/launcher/applaunchertool.h \ - src/utils/globalvalues.h \ - src/utils/colorutils.h \ - src/widgets/capture/modificationcommand.h \ - src/tools/abstractpathtool.h \ - src/tools/abstracttwopointtool.h \ - src/tools/abstractactiontool.h \ - src/widgets/panel/utilitypanel.h \ - src/widgets/capture/hovereventfilter.h \ - src/widgets/capture/selectionwidget.h \ - src/tools/pin/pinwidget.h \ - src/widgets/capturelauncher.h \ - src/tools/text/texttool.h \ - src/tools/text/textwidget.h \ - src/core/capturerequest.h \ - src/tools/text/textconfig.h \ - src/widgets/panel/sidepanelwidget.h - -unix:!macx { - SOURCES += src/core/flameshotdbusadapter.cpp \ - src/utils/dbusutils.cpp - - HEADERS += src/core/flameshotdbusadapter.h \ - src/utils/dbusutils.h -} - -win32 { - SOURCES += src/core/globalshortcutfilter.cpp - - HEADERS += src/core/globalshortcutfilter.h -} - -RESOURCES += \ - graphics.qrc - -# installs -unix:!macx { - isEmpty(PREFIX) { - packaging { - PREFIX = /usr - } else { - PREFIX = /usr/local - } - } - - DEFINES += APP_PREFIX=\\\"$$PREFIX\\\" - - target.path = $${PREFIX}/bin/ - - qmfile.path = $${PREFIX}/share/flameshot/translations/ - qmfile.files = $${TRANSLATIONS_FILES} - - dbus.path = $${PREFIX}/share/dbus-1/interfaces/ - dbus.files = dbus/org.dharkael.Flameshot.xml - - icon.path = $${PREFIX}/share/icons/hicolor/ - icon.files = img/hicolor/* - - completion.path = $${PREFIX}/share/bash-completion/completions/ - completion.files = docs/bash-completion/flameshot - - appdata.path = $${PREFIX}/share/metainfo/ - appdata.files = docs/appdata/flameshot.appdata.xml - - desktopentry.path = $${PREFIX}/share/applications - desktopentry.files = docs/desktopEntry/package/flameshot.desktop - - servicedbus.path = $${PREFIX}/share/dbus-1/services/ - - packaging { - servicedbus.files = dbus/package/org.dharkael.Flameshot.service - } else { - servicedbus.files = dbus/make/org.dharkael.Flameshot.service - } - - INSTALLS += target \ - icon \ - desktopentry \ - qmfile \ - servicedbus \ - dbus \ - completion \ - appdata -} - -# Imgur API data -include(src/imgur.pri) diff --git a/src/config/CMakeLists.txt b/src/config/CMakeLists.txt index 72360542..c431d975 100644 --- a/src/config/CMakeLists.txt +++ b/src/config/CMakeLists.txt @@ -8,4 +8,8 @@ target_sources( geneneralconf.cpp strftimechooserwidget.cpp uicoloreditor.cpp - visualseditor.cpp) + visualseditor.cpp + filepathconfiguration.cpp + shortcutswidget.cpp + setshortcutwidget.cpp +) diff --git a/src/config/geneneralconf.cpp b/src/config/geneneralconf.cpp index f9d68483..8b02ae37 100644 --- a/src/config/geneneralconf.cpp +++ b/src/config/geneneralconf.cpp @@ -18,10 +18,9 @@ #include "geneneralconf.h" #include "filepathconfiguration.h" #include "src/core/controller.h" -#include "src/utils/confighandler.h" -#include "src/utils/filenamehandler.h" #include "src/tools/storage/imgstorages.h" #include "src/utils/confighandler.h" +#include "src/utils/filenamehandler.h" #include #include #include diff --git a/src/config/geneneralconf.h b/src/config/geneneralconf.h index ac3bab6d..7f2aceb9 100644 --- a/src/config/geneneralconf.h +++ b/src/config/geneneralconf.h @@ -26,7 +26,6 @@ class QLabel; class QLineEdit; class FilePathConfiguration; - class GeneneralConf : public QWidget { Q_OBJECT diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index dd892be2..87c473e0 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -6,10 +6,23 @@ target_sources(flameshot PRIVATE copy/copytool.h copy/copytool.cpp) target_sources(flameshot PRIVATE exit/exittool.h exit/exittool.cpp) target_sources( flameshot - PRIVATE imgur/imguruploader.h - imgur/imguruploadertool.h - imgur/imguruploader.cpp - imgur/imguruploadertool.cpp) + PRIVATE storage/storagemanager.h + storage/storagemanager.cpp + storage/imguploader.h + storage/imguploadertool.h + storage/imguploader.cpp + storage/imguploadertool.cpp + storage/imgur/imguruploader.h + storage/imgur/imguruploadertool.h + storage/imgur/imguruploader.cpp + storage/imgur/imguruploadertool.cpp + storage/s3/imgs3settings.h + storage/s3/imgs3settings.cpp + storage/s3/imgs3uploader.h + storage/s3/imgs3uploadertool.h + storage/s3/imgs3uploader.cpp + storage/s3/imgs3uploadertool.cpp +) target_sources( flameshot PRIVATE launcher/applaunchertool.h diff --git a/src/tools/capturetool.h b/src/tools/capturetool.h index 1f6250f5..efca8b7f 100644 --- a/src/tools/capturetool.h +++ b/src/tools/capturetool.h @@ -44,7 +44,8 @@ enum class ToolType SELECTION, SIZEINDICATOR, TEXT, - UNDO + UNDO, + UPLOAD }; class CaptureTool : public QObject diff --git a/src/tools/pixelate/pixelatetool.cpp b/src/tools/pixelate/pixelatetool.cpp index 6f742279..c7cf40a7 100644 --- a/src/tools/pixelate/pixelatetool.cpp +++ b/src/tools/pixelate/pixelatetool.cpp @@ -84,7 +84,10 @@ void PixelateTool::process(QPainter& painter, scene.render(&painter, selection, QRectF()); blur->setBlurRadius(12); - scene.render(&painter, selection, QRectF()); + // multiple repeat for make blur effect stronger + for (int cnt = 100; cnt > 0; cnt--) { + scene.render(&painter, selection, QRectF()); + } } else { int width = selection.width() * (0.5 / qMax(1, m_thickness)); diff --git a/src/tools/storage/imguploadertool.cpp b/src/tools/storage/imguploadertool.cpp index 95ae7b15..a3ab7bd5 100644 --- a/src/tools/storage/imguploadertool.cpp +++ b/src/tools/storage/imguploadertool.cpp @@ -16,6 +16,11 @@ void ImgUploaderTool::pressed(const CaptureContext& context) emit requestAction(REQ_ADD_EXTERNAL_WIDGETS); } +QString ImgUploaderTool::name() const +{ + return tr("Imgage uploader tool"); +} + const QPixmap& ImgUploaderTool::capture() { return m_capture; @@ -31,3 +36,8 @@ bool ImgUploaderTool::closeOnButtonPressed() const { return true; } + +ToolType ImgUploaderTool::nameID() const +{ + return ToolType::UPLOAD; +} \ No newline at end of file diff --git a/src/tools/storage/imguploadertool.h b/src/tools/storage/imguploadertool.h index 543e4d74..f0928e55 100644 --- a/src/tools/storage/imguploadertool.h +++ b/src/tools/storage/imguploadertool.h @@ -11,6 +11,7 @@ public: bool closeOnButtonPressed() const; + QString name() const override; QIcon icon(const QColor& background, bool inEditor) const override; void setCapture(const QPixmap& pixmap); @@ -19,6 +20,9 @@ public: public slots: void pressed(const CaptureContext& context) override; +protected: + ToolType nameID() const override; + private: QPixmap m_capture; }; diff --git a/src/tools/storage/imgur/imguruploadertool.cpp b/src/tools/storage/imgur/imguruploadertool.cpp index 6c534a57..410005cb 100644 --- a/src/tools/storage/imgur/imguruploadertool.cpp +++ b/src/tools/storage/imgur/imguruploadertool.cpp @@ -28,11 +28,6 @@ QString ImgurUploaderTool::name() const return tr("Image Uploader"); } -QString ImgurUploaderTool::nameID() -{ - return QLatin1String(""); -} - QString ImgurUploaderTool::description() const { return tr("Upload the selection to Imgur"); diff --git a/src/tools/storage/imgur/imguruploadertool.h b/src/tools/storage/imgur/imguruploadertool.h index d9bf74ed..0ff2daf6 100644 --- a/src/tools/storage/imgur/imguruploadertool.h +++ b/src/tools/storage/imgur/imguruploadertool.h @@ -26,7 +26,6 @@ public: explicit ImgurUploaderTool(QObject* parent = nullptr); QString name() const override; - static QString nameID(); QString description() const override; QWidget* widget() override; diff --git a/src/tools/storage/s3/imgs3uploadertool.cpp b/src/tools/storage/s3/imgs3uploadertool.cpp index 56ddaed4..bacb95bd 100644 --- a/src/tools/storage/s3/imgs3uploadertool.cpp +++ b/src/tools/storage/s3/imgs3uploadertool.cpp @@ -23,16 +23,6 @@ ImgS3UploaderTool::ImgS3UploaderTool(QObject* parent) : ImgUploaderTool(parent) {} -QString ImgS3UploaderTool::name() const -{ - return tr("Image Uploader"); -} - -QString ImgS3UploaderTool::nameID() -{ - return QLatin1String(""); -} - QString ImgS3UploaderTool::description() const { return tr("Upload the selection to S3 bucket"); diff --git a/src/tools/storage/s3/imgs3uploadertool.h b/src/tools/storage/s3/imgs3uploadertool.h index d1ee8afa..fddc5d5a 100644 --- a/src/tools/storage/s3/imgs3uploadertool.h +++ b/src/tools/storage/s3/imgs3uploadertool.h @@ -23,10 +23,8 @@ class ImgS3UploaderTool : public ImgUploaderTool { Q_OBJECT public: - explicit ImgS3UploaderTool(QObject* parent = nullptr); + ImgS3UploaderTool(QObject* parent = nullptr); - QString name() const override; - static QString nameID(); QString description() const override; QWidget* widget() override; diff --git a/src/tools/storage/storagemanager.cpp b/src/tools/storage/storagemanager.cpp index 5100805d..628cdc2d 100644 --- a/src/tools/storage/storagemanager.cpp +++ b/src/tools/storage/storagemanager.cpp @@ -2,10 +2,10 @@ #include "imguploader.h" #include "imgur/imguruploader.h" #include "imgur/imguruploadertool.h" +#include "s3/imgs3settings.h" #include "s3/imgs3uploader.h" #include "s3/imgs3uploadertool.h" #include "src/tools/capturetool.h" -#include "src/tools/storage/s3/imgs3settings.h" #include diff --git a/src/tools/toolfactory.cpp b/src/tools/toolfactory.cpp index 6281a1dc..65d48c9f 100644 --- a/src/tools/toolfactory.cpp +++ b/src/tools/toolfactory.cpp @@ -46,7 +46,7 @@ CaptureTool* ToolFactory::CreateTool(CaptureToolButton::ButtonType t, QObject* parent) { StorageManager storageManager; - CaptureTool *tool; + CaptureTool* tool; switch (t) { case CaptureToolButton::TYPE_ARROW: tool = new ArrowTool(parent); @@ -60,7 +60,7 @@ CaptureTool* ToolFactory::CreateTool(CaptureToolButton::ButtonType t, case CaptureToolButton::TYPE_EXIT: tool = new ExitTool(parent); break; - case CaptureButton::TYPE_IMAGEUPLOADER: + case CaptureToolButton::TYPE_IMAGEUPLOADER: tool = storageManager.imgUploaderTool( ConfigHandler().uploadStorage(), parent); break; diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 048d09ab..fee459ec 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -4,7 +4,9 @@ target_sources( PRIVATE dbusutils.h filenamehandler.h screengrabber.h - systemnotification.h) + systemnotification.h + configshortcuts.h +) target_sources( flameshot @@ -18,4 +20,8 @@ target_sources( desktopfileparse.cpp desktopinfo.cpp pathinfo.cpp - colorutils.cpp) + colorutils.cpp + history.cpp + configenterprise.cpp + configshortcuts.cpp +) diff --git a/src/utils/configshortcuts.cpp b/src/utils/configshortcuts.cpp index 6095c231..69e438b6 100644 --- a/src/utils/configshortcuts.cpp +++ b/src/utils/configshortcuts.cpp @@ -4,14 +4,14 @@ ConfigShortcuts::ConfigShortcuts() {} -// QVector getButtons() +// QVector getButtons() const QVector& ConfigShortcuts::captureShortcutsDefault( - const QVector& buttons) + const QVector& buttons) { // get shortcuts names from tools - for (const CaptureButton::ButtonType& t : buttons) { - CaptureButton* b = new CaptureButton(t, nullptr); + for (const CaptureToolButton::ButtonType& t : buttons) { + CaptureToolButton* b = new CaptureToolButton(t, nullptr); QString shortcutName = QVariant::fromValue(t).toString(); QKeySequence ks = captureShortcutDefault(t); m_shortcuts << (QStringList() @@ -70,61 +70,61 @@ const QVector& ConfigShortcuts::captureShortcutsDefault( } const QKeySequence& ConfigShortcuts::captureShortcutDefault( - const CaptureButton::ButtonType& buttonType) + const CaptureToolButton::ButtonType& buttonType) { m_ks = QKeySequence(); switch (buttonType) { - case CaptureButton::ButtonType::TYPE_PENCIL: + case CaptureToolButton::ButtonType::TYPE_PENCIL: m_ks = QKeySequence(Qt::Key_P); break; - case CaptureButton::ButtonType::TYPE_DRAWER: + case CaptureToolButton::ButtonType::TYPE_DRAWER: m_ks = QKeySequence(Qt::Key_D); break; - case CaptureButton::ButtonType::TYPE_ARROW: + case CaptureToolButton::ButtonType::TYPE_ARROW: m_ks = QKeySequence(Qt::Key_A); break; - case CaptureButton::ButtonType::TYPE_SELECTION: + case CaptureToolButton::ButtonType::TYPE_SELECTION: m_ks = QKeySequence(Qt::Key_S); break; - case CaptureButton::ButtonType::TYPE_RECTANGLE: + case CaptureToolButton::ButtonType::TYPE_RECTANGLE: m_ks = QKeySequence(Qt::Key_R); break; - case CaptureButton::ButtonType::TYPE_CIRCLE: + case CaptureToolButton::ButtonType::TYPE_CIRCLE: m_ks = QKeySequence(Qt::Key_C); break; - case CaptureButton::ButtonType::TYPE_MARKER: + case CaptureToolButton::ButtonType::TYPE_MARKER: m_ks = QKeySequence(Qt::Key_M); break; - // case CaptureButton::ButtonType::TYPE_SELECTIONINDICATOR: - case CaptureButton::ButtonType::TYPE_MOVESELECTION: + // case CaptureToolButton::ButtonType::TYPE_SELECTIONINDICATOR: + case CaptureToolButton::ButtonType::TYPE_MOVESELECTION: m_ks = QKeySequence(Qt::CTRL + Qt::Key_M); break; - case CaptureButton::ButtonType::TYPE_UNDO: + case CaptureToolButton::ButtonType::TYPE_UNDO: m_ks = QKeySequence(Qt::CTRL + Qt::Key_Z); break; - case CaptureButton::ButtonType::TYPE_COPY: + case CaptureToolButton::ButtonType::TYPE_COPY: m_ks = QKeySequence(Qt::CTRL + Qt::Key_C); break; - case CaptureButton::ButtonType::TYPE_SAVE: + case CaptureToolButton::ButtonType::TYPE_SAVE: m_ks = QKeySequence(Qt::CTRL + Qt::Key_S); break; - case CaptureButton::ButtonType::TYPE_EXIT: + case CaptureToolButton::ButtonType::TYPE_EXIT: m_ks = QKeySequence(Qt::CTRL + Qt::Key_Q); break; - case CaptureButton::ButtonType::TYPE_IMAGEUPLOADER: + case CaptureToolButton::ButtonType::TYPE_IMAGEUPLOADER: m_ks = QKeySequence(Qt::Key_Return); break; - case CaptureButton::ButtonType::TYPE_OPEN_APP: + case CaptureToolButton::ButtonType::TYPE_OPEN_APP: m_ks = QKeySequence(Qt::CTRL + Qt::Key_O); break; - case CaptureButton::ButtonType::TYPE_BLUR: + case CaptureToolButton::ButtonType::TYPE_PIXELATE: m_ks = QKeySequence(Qt::Key_B); break; - case CaptureButton::ButtonType::TYPE_REDO: + case CaptureToolButton::ButtonType::TYPE_REDO: m_ks = QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z); break; - // case CaptureButton::ButtonType::TYPE_PIN: - case CaptureButton::ButtonType::TYPE_TEXT: + // case CaptureToolButton::ButtonType::TYPE_PIN: + case CaptureToolButton::ButtonType::TYPE_TEXT: m_ks = QKeySequence(Qt::Key_T); break; default: diff --git a/src/utils/configshortcuts.h b/src/utils/configshortcuts.h index adb97c9f..e6377479 100644 --- a/src/utils/configshortcuts.h +++ b/src/utils/configshortcuts.h @@ -1,7 +1,7 @@ #ifndef CONFIGSHORTCUTS_H #define CONFIGSHORTCUTS_H -#include "src/widgets/capture/capturebutton.h" +#include "src/widgets/capture/capturetoolbutton.h" #include #include #include @@ -13,9 +13,9 @@ public: ConfigShortcuts(); const QVector& captureShortcutsDefault( - const QVector& buttons); + const QVector& buttons); const QKeySequence& captureShortcutDefault( - const CaptureButton::ButtonType& buttonType); + const CaptureToolButton::ButtonType& buttonType); private: QVector m_shortcuts; diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index 219b981a..55eee41a 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -10,7 +10,9 @@ target_sources( infowindow.h loadspinner.h notificationwidget.h - orientablepushbutton.h) + orientablepushbutton.h + historywidget.h +) target_sources( flameshot @@ -20,4 +22,6 @@ target_sources( infowindow.cpp loadspinner.cpp notificationwidget.cpp - orientablepushbutton.cpp) + orientablepushbutton.cpp + historywidget.cpp +) diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index 57dd68c3..41832a60 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -189,12 +189,12 @@ void CaptureWidget::updateButtons() makeChild(b); switch (t) { - case CaptureButton::ButtonType::TYPE_EXIT: - case CaptureButton::ButtonType::TYPE_SAVE: - case CaptureButton::ButtonType::TYPE_COPY: - case CaptureButton::ButtonType::TYPE_UNDO: - case CaptureButton::ButtonType::TYPE_REDO: - case CaptureButton::ButtonType::TYPE_IMAGEUPLOADER: + case CaptureToolButton::ButtonType::TYPE_EXIT: + case CaptureToolButton::ButtonType::TYPE_SAVE: + case CaptureToolButton::ButtonType::TYPE_COPY: + case CaptureToolButton::ButtonType::TYPE_UNDO: + case CaptureToolButton::ButtonType::TYPE_REDO: + case CaptureToolButton::ButtonType::TYPE_IMAGEUPLOADER: // nothing to do, just skip non-dynamic buttons with existing // hard coded slots break; @@ -214,7 +214,7 @@ void CaptureWidget::updateButtons() } connect( - b, &CaptureButton::pressedButton, this, &CaptureWidget::setState); + b, &CaptureToolButton::pressedButton, this, &CaptureWidget::setState); connect(b->tool(), &CaptureTool::requestAction, this, @@ -942,27 +942,27 @@ void CaptureWidget::downResize() void CaptureWidget::initShortcuts() { QString shortcut = ConfigHandler().shortcut( - QVariant::fromValue(CaptureButton::ButtonType::TYPE_EXIT).toString()); + QVariant::fromValue(CaptureToolButton::ButtonType::TYPE_EXIT).toString()); new QShortcut(QKeySequence(shortcut), this, SLOT(close())); shortcut = ConfigHandler().shortcut( - QVariant::fromValue(CaptureButton::ButtonType::TYPE_SAVE).toString()); + QVariant::fromValue(CaptureToolButton::ButtonType::TYPE_SAVE).toString()); new QShortcut(QKeySequence(shortcut), this, SLOT(saveScreenshot())); shortcut = ConfigHandler().shortcut( - QVariant::fromValue(CaptureButton::ButtonType::TYPE_COPY).toString()); + QVariant::fromValue(CaptureToolButton::ButtonType::TYPE_COPY).toString()); new QShortcut(QKeySequence(shortcut), this, SLOT(copyScreenshot())); shortcut = ConfigHandler().shortcut( - QVariant::fromValue(CaptureButton::ButtonType::TYPE_UNDO).toString()); + QVariant::fromValue(CaptureToolButton::ButtonType::TYPE_UNDO).toString()); new QShortcut(QKeySequence(shortcut), this, SLOT(undo())); shortcut = ConfigHandler().shortcut( - QVariant::fromValue(CaptureButton::ButtonType::TYPE_REDO).toString()); + QVariant::fromValue(CaptureToolButton::ButtonType::TYPE_REDO).toString()); new QShortcut(QKeySequence(shortcut), this, SLOT(redo())); shortcut = ConfigHandler().shortcut( - QVariant::fromValue(CaptureButton::ButtonType::TYPE_IMAGEUPLOADER) + QVariant::fromValue(CaptureToolButton::ButtonType::TYPE_IMAGEUPLOADER) .toString()); new QShortcut(shortcut, this, SLOT(uploadScreenshot())); diff --git a/src/widgets/capture/capturewidget.h b/src/widgets/capture/capturewidget.h index 33cdd73f..fe3ffdbf 100644 --- a/src/widgets/capture/capturewidget.h +++ b/src/widgets/capture/capturewidget.h @@ -95,12 +95,11 @@ private slots: void setState(CaptureToolButton* b); void processTool(CaptureTool* t); void handleButtonSignal(CaptureTool::Request r); - void setDrawColor(const QColor &c); - void setDrawThickness(const int &t); + void setDrawColor(const QColor& c); + void setDrawThickness(const int& t); void incrementCircleCount(); void decrementCircleCount(); - protected: void paintEvent(QPaintEvent*); void mousePressEvent(QMouseEvent*);