Browse Source

Revert "working on wayland clipboard (#2284)" (#2301)

This reverts commit 9005a14b3a4f401f5499fbca1c1bf54c44d3bb4b.
borgmanJeremy 3 years ago
parent
commit
24509e69d8

+ 0 - 1
.github/workflows/Linux-pack.yml

@@ -484,7 +484,6 @@ jobs:
             fcitx-frontend-qt5 \
             openssl \
             ca-certificates
-
       - name: Get go-appimage tool
       # Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution,
       # which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340.

+ 0 - 2
CMakeLists.txt

@@ -67,7 +67,6 @@ option(USE_MONOCHROME_ICON "Build using monochrome icon as default" OFF)
 option(GENERATE_TS "Regenerate translation source files" 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_WAYLAND_CLIPBOARD "USE KF Gui Wayland Clipboard" OFF)
 
 include(cmake/StandardProjectSettings.cmake)
 
@@ -109,7 +108,6 @@ option(BUILD_STATIC_LIBS ON)
 option(BUILD_SHARED_LIBS OFF)
 add_subdirectory(external/Qt-Color-Widgets EXCLUDE_FROM_ALL) 
 
-
 if (APPLE)
   add_subdirectory(external/QHotkey)
 endif()

+ 2 - 3
packaging/flatpak/org.flameshot.Flameshot.yml

@@ -26,9 +26,8 @@ modules:
   - name: flameshot
     buildsystem: cmake-ninja
     config-opts:
-      - -DCMAKE_BUILD_TYPE=Release 
-      - -DUSE_WAYLAND_CLIPBOARD=1
+      - -DCMAKE_BUILD_TYPE=Release
     sources:
       - type: git
         url: https://github.com/flameshot-org/flameshot.git
-        branch: master
+        branch: master

+ 0 - 2
snapcraft.yaml

@@ -46,8 +46,6 @@ parts:
       - kde-frameworks-5-qt-5-15-core20
     source: https://github.com/flameshot-org/flameshot.git
     plugin: cmake
-    cmake-parameters:
-      - -DUSE_WAYLAND_CLIPBOARD=1
     source-type: git
     override-pull: |
       snapcraftctl pull

+ 0 - 10
src/CMakeLists.txt

@@ -10,10 +10,6 @@ find_package(
         DBus
         LinguistTools)
 
-if (USE_WAYLAND_CLIPBOARD)
-    find_package(KF5GuiAddons)
-endif()
-
 set(CMAKE_AUTOMOC ON)
 set(CMAKE_AUTORCC ON)
 set(CMAKE_AUTOUIC ON)
@@ -194,14 +190,8 @@ target_link_libraries(
         Qt5::Widgets
         ${QTSINGLEAPPLICATION_LIBRARY}
         QtColorWidgets
-
 )
 
-if (USE_WAYLAND_CLIPBOARD)
-  target_compile_definitions(flameshot PRIVATE USE_WAYLAND_CLIPBOARD=1)
-  target_link_libraries(flameshot KF5::GuiAddons)
-endif()
-
 if (APPLE)
     set(MACOSX_BUNDLE_IDENTIFIER "org.flameshot")
     set_target_properties(

+ 5 - 21
src/utils/screenshotsaver.cpp

@@ -9,11 +9,6 @@
 #include "src/utils/filenamehandler.h"
 #include "src/utils/globalvalues.h"
 #include "utils/desktopinfo.h"
-
-#if USE_WAYLAND_CLIPBOARD
-#include <KSystemClipboard>
-#endif
-
 #include <QApplication>
 #include <QBuffer>
 #include <QClipboard>
@@ -38,26 +33,15 @@ void ScreenshotSaver::saveToClipboardMime(const QPixmap& capture,
     QImageWriter imageWriter{ &buffer, imageType.toUpper().toUtf8() };
     imageWriter.write(capture.toImage());
 
-    QPixmap formattedPixmap;
+    QPixmap pngPixmap;
     bool isLoaded =
-      formattedPixmap.loadFromData(reinterpret_cast<uchar*>(array.data()),
-                                   array.size(),
-                                   imageType.toUpper().toUtf8());
+      pngPixmap.loadFromData(reinterpret_cast<uchar*>(array.data()),
+                             array.size(),
+                             imageType.toUpper().toUtf8());
     if (isLoaded) {
-
-        auto mimeData = new QMimeData();
-
-#ifdef USE_WAYLAND_CLIPBOARD
-        mimeData->setImageData(formattedPixmap.toImage());
-        mimeData->setData(QStringLiteral("x-kde-force-image-copy"),
-                          QByteArray());
-        KSystemClipboard::instance()->setMimeData(mimeData,
-                                                  QClipboard::Clipboard);
-#else
+        QMimeData* mimeData = new QMimeData;
         mimeData->setData("image/" + imageType, array);
         QApplication::clipboard()->setMimeData(mimeData);
-#endif
-
     } else {
         AbstractLogger::error()
           << QObject::tr("Error while saving to clipboard");