Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of the plugin framework #3661

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" OFF)
option(USE_PRINTER_SUPPORT "Enable printer and PDF output support" 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.
17 changes: 17 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@
DBus
LinguistTools)

if (USE_PRINTER_SUPPORT)
find_package(PrintSupport)
endif()

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 @@ -218,6 +227,10 @@

)

if (USE_PRINTER_SUPPORT)
target_link_libraries(flameshot Qt5::PrintSupport)
endif()

if (USE_WAYLAND_CLIPBOARD)
if(!USE_WAYLAND_GRIM)
message(WARNING "You activated the USE_WAYLAND_CLIPBOARD option, but did not activate the USE_WAYLAND_GRIM option. Flameshot will use the dbus protocol to support wayland. If you use wlroots-based wayland, it is recommended to enable USE_WAYLAND_GRIM")
Expand All @@ -230,6 +243,10 @@
target_compile_definitions(flameshot PRIVATE USE_WAYLAND_GRIM=1)
endif()

if (USE_PRINTER_SUPPORT)
target_compile_definitions(flameshot PRIVATE USE_PRINTER_SUPPORT=1)
endif()

if (APPLE)
set(MACOSX_BUNDLE_IDENTIFIER "org.flameshot")
set_target_properties(
Expand Down Expand Up @@ -265,7 +282,7 @@
endif ()

if (NOT USE_OPENSSL)
message(WARNING "OpenSSL is required to upload screenshots")

Check warning on line 285 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2019 x86-portable

OpenSSL is required to upload screenshots

Check warning on line 285 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2019 x64-portable

OpenSSL is required to upload screenshots

Check warning on line 285 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2019 x64-installer

OpenSSL is required to upload screenshots

Check warning on line 285 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2019 x86-installer

OpenSSL is required to upload screenshots
endif ()
endif ()

Expand Down Expand Up @@ -418,7 +435,7 @@
FILES_MATCHING
PATTERN "*.dll")
else ()
message(WARNING "Unable to find OpenSSL dlls.")

Check warning on line 438 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2019 x86-portable

Unable to find OpenSSL dlls.

Check warning on line 438 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2019 x64-portable

Unable to find OpenSSL dlls.

Check warning on line 438 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2019 x64-installer

Unable to find OpenSSL dlls.

Check warning on line 438 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2019 x86-installer

Unable to find OpenSSL dlls.
endif ()
endif ()

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
21 changes: 21 additions & 0 deletions src/core/corepluginInterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#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
Loading