Skip to content

Commit

Permalink
Initial implementation of the plugin framework
Browse files Browse the repository at this point in the history
Plugin RFC #2529

Signed-off-by: Ouyang Chunhui <[email protected]>
  • Loading branch information
jack9603301 committed Jul 5, 2024
1 parent ccb5a27 commit 5286322
Show file tree
Hide file tree
Showing 27 changed files with 1,952 additions and 23 deletions.
1,195 changes: 1,195 additions & 0 deletions 0001-Initial-implementation-of-the-plugin-framework.patch

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ option(USE_EXTERNAL_SINGLEAPPLICATION "Use external QtSingleApplication library"
option(USE_LAUNCHER_ABSOLUTE_PATH "Use absolute path for the desktop launcher" ON)
option(USE_WAYLAND_CLIPBOARD "USE KF Gui Wayland Clipboard" OFF)
option(DISABLE_UPDATE_CHECKER "Disable check for updates" OFF)
option(USE_PLUGIN_MANAGER "Activate the Plugin Manager" ON)
option(USE_WAYLAND_GRIM "Activate the Wayland GRIM screenshot adapter" OFF)

if (USE_PLUGIN_MANAGER)
set(PLUGIN_DIRECTORY "app_plugins" CACHE PATH "Setting the Plugin Manager Plugin Directory")
endif()
if (DISABLE_UPDATE_CHECKER)
add_compile_definitions(DISABLE_UPDATE_CHECKER)
endif ()
Expand Down
4 changes: 4 additions & 0 deletions data/graphics.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,9 @@
<file>img/material/black/image.svg</file>
<file>img/material/white/apps.svg</file>
<file>img/material/white/image.svg</file>
<file>img/material/black/content-print.svg</file>
<file>img/material/black/save-to-pdf.svg</file>
<file>img/material/white/content-print.svg</file>
<file>img/material/white/save-to-pdf.svg</file>
</qresource>
</RCC>
41 changes: 41 additions & 0 deletions data/img/material/black/content-print.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions data/img/material/black/save-to-pdf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions data/img/material/white/content-print.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions data/img/material/white/save-to-pdf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ find_package(
Network
Svg
DBus
LinguistTools)
LinguistTools
PrintSupport)

if (USE_WAYLAND_CLIPBOARD)
find_package(KF5GuiAddons)
endif()

if (USE_PLUGIN_MANAGER)
find_package(yaml-cpp)
endif()

set(USE_PLUGIN_MANAGER ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
Expand Down Expand Up @@ -213,6 +219,7 @@ target_link_libraries(
Qt5::DBus
Qt5::Network
Qt5::Widgets
Qt5::PrintSupport
${QTSINGLEAPPLICATION_LIBRARY}
QtColorWidgets

Expand Down
3 changes: 3 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ target_sources(flameshot PRIVATE
flameshotdaemon.h
flameshotdbusadapter.h
qguiappcurrentscreen.h
pluginmanager.h
corepluginInterface.h
)

target_sources(flameshot PRIVATE
Expand All @@ -11,6 +13,7 @@ target_sources(flameshot PRIVATE
flameshotdaemon.cpp
flameshotdbusadapter.cpp
qguiappcurrentscreen.cpp
pluginmanager.cpp
)

IF (WIN32)
Expand Down
2 changes: 2 additions & 0 deletions src/core/capturerequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class CaptureRequest
PIN = 16,
UPLOAD = 32,
ACCEPT_ON_SELECT = 64,
PRINT_SYSTEM = 128,
SAVE_TO_PDF = 256
};

CaptureRequest(CaptureMode mode,
Expand Down
20 changes: 20 additions & 0 deletions src/core/corepluginInterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef COREPLUGININTERFACE_H
#define COREPLUGININTERFACE_H

#include <QtPlugin>

class CorePluginInterface {
public:
virtual ~CorePluginInterface() = 0;
virtual bool load(std::map<std::string, std::string> &PluginConfig) = 0;
virtual void unload() = 0;
virtual bool ImagePost(QPixmap &pixmap) = 0;
virtual bool ImageToPDFPost(QPixmap &pixmap) = 0;
virtual bool PrintPre(QPixmap &pixmap) = 0;
};

#define FlameshotPlugin_iid "FlameshotPlugin.CorePluginInterface"

Q_DECLARE_INTERFACE(CorePluginInterface, FlameshotPlugin_iid)

#endif // COREPLUGININTERFACE_H
Loading

0 comments on commit 5286322

Please sign in to comment.