ImageProcessing-ElectronicPublications / photoquick

Light-weight image viewer with crop,resize,collage, photogrid and filters
GNU General Public License v3.0
4 stars 0 forks source link

Qt5 support? #35

Closed trufanov-nok closed 3 years ago

trufanov-nok commented 3 years ago

Hi, I was trying to build the app on Kubuntu 20.04 and faced with some problems as app requires Qt4. There is no Qt4 even as a legacy in repos for my system since last few releases. I've tried to build it with Qt 5.15 and it took only few changes to make code buildable for Qt5. The diff:

diff --git a/src/dialogs.cpp b/src/dialogs.cpp
index ef9f0b4..1d40fba 100644
--- a/src/dialogs.cpp
+++ b/src/dialogs.cpp
@@ -66,7 +66,7 @@ PaperSizeDialog:: PaperSizeDialog(QWidget *parent, bool landscapeMode) : QDialog
     vLayout = new QVBoxLayout(this);
     label = new QLabel("Select Paper Size :", this);
     combo = new QComboBox(this);
-    items = { "Automatic", "A4", "A5", "100 dpi", "300 dpi", "Other dpi" };
+    items << "Automatic" << "A4" << "A5" << "100 dpi" << "300 dpi" << "Other dpi";
     combo->addItems(items);
     landscape = new QCheckBox("Landscape", this);
     landscape->setChecked(landscapeMode);
@@ -95,7 +95,7 @@ ExpandBorderDialog:: ExpandBorderDialog(QWidget *parent, int border_w) : QDialog
     widthSpin->setValue(border_w);
     label2 = new QLabel("Set Border Type :", this);
     combo = new QComboBox(this);
-    items = {"Clone Edges", "White Color", "Black Color", "Other Color"};
+    items << "Clone Edges" << "White Color" << "Black Color" << "Other Color";
     combo->addItems(items);
     btnBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal, this);
     vLayout->addWidget(label);
diff --git a/src/main.cpp b/src/main.cpp
index cf76a2a..f31db1a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -186,7 +186,7 @@ Window:: loadPlugins()
     QString app_dir_path = qApp->applicationDirPath();
     QStringList dirs = { app_dir_path };
     if (app_dir_path.endsWith("/src"))
-        dirs = { app_dir_path, app_dir_path+"/.." };
+        dirs << app_dir_path << app_dir_path+"/..";
 #ifdef _WIN32
     QStringList filter = {"*.dll"};
 #else
diff --git a/src/photogrid.cpp b/src/photogrid.cpp
index 00a745b..a2c6f8c 100644
--- a/src/photogrid.cpp
+++ b/src/photogrid.cpp
@@ -1,6 +1,7 @@
 /* This file is a part of photoquick program, which is GPLv3 licensed */

 #include "photogrid.h"
+#include <QMimeData>

 GridDialog:: GridDialog(QImage img, QWidget *parent) : QDialog(parent)
 {
diff --git a/src/photoquick.pro b/src/photoquick.pro
index ff1fe8b..cc03ae6 100644
--- a/src/photoquick.pro
+++ b/src/photoquick.pro
@@ -8,6 +8,8 @@ LIBS += -lgomp

 CONFIG -= debug_and_release debug

+QT += widgets
+
 # build dir
 UI_DIR  =     ../build
 MOC_DIR =     ../build

So, perhaps it's feasible to add Qt5 support to the project?

ksharindam commented 3 years ago

If few line of changes can support both Qt4 and Qt5 then I will add Qt5 support. It seems most changes are about QList. Your diff file does not take account of the plugins. Does photoquick plugins work in Qt5.

zvezdochiot commented 3 years ago

Only if using #ifdef ... #else ... #endif. Qt5 doesn't suit me personally.

ℹ️ Create a fork. This will be enough.

ksharindam commented 3 years ago

I also dislike Qt5 because of slower startup, larger library size and no additional advantage. I thought I would never port it to Qt5 but it seems debian bulseye (which will be next stable version soon) does not have qt4 in the repo. Which is very annoying. Either I have to stick to debian buster two more years, or I have to port it to Qt5.

zvezdochiot commented 3 years ago

@ksharindam , try to be backward compatible.

❓ Why can't you install Qt4 from a previous release?

ksharindam commented 3 years ago

Because,

  1. I never needed to. I always used current stable debian version.
  2. Qt4 was available in all stable releases until now.
trufanov-nok commented 3 years ago

Your diff file does not take account of the plugins. Does photoquick plugins work in Qt5.

The diff for plugins is below. It's all about specifying widgets module and changing Qt plugin declarations from Q_EXPORT_PLUGIN2 to Q_PLUGIN_METADATA depending on Qt ver.

diff --git a/src/colors/grayscale-local/grayscale-local.pro b/src/colors/grayscale-local/grayscale-local.pro
index 6aa62b7..161fa3a 100644
--- a/src/colors/grayscale-local/grayscale-local.pro
+++ b/src/colors/grayscale-local/grayscale-local.pro
@@ -14,6 +14,8 @@ LIBS           +=
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/colors/grayscale-local/grayscale_local.cpp b/src/colors/grayscale-local/grayscale_local.cpp
index aeae05a..25dcd24 100644
--- a/src/colors/grayscale-local/grayscale_local.cpp
+++ b/src/colors/grayscale-local/grayscale_local.cpp
@@ -9,7 +9,9 @@
 #define PLUGIN_NAME "GrayScale (Local)"
 #define PLUGIN_VERSION "1.0"

-Q_EXPORT_PLUGIN2(grayscale-local, FilterPlugin);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    Q_EXPORT_PLUGIN2(grayscale-local, FilterPlugin);
+#endif

 QImage color2gray(QImage &image, int radius, int samples, int iterations, bool enhance_shadows);

diff --git a/src/colors/grayscale-local/grayscale_local.h b/src/colors/grayscale-local/grayscale_local.h
index 7406dc4..1bf37d2 100644
--- a/src/colors/grayscale-local/grayscale_local.h
+++ b/src/colors/grayscale-local/grayscale_local.h
@@ -13,6 +13,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "grayscale-local")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/colors/invert/invert.cpp b/src/colors/invert/invert.cpp
index 53eaf78..b67b90c 100644
--- a/src/colors/invert/invert.cpp
+++ b/src/colors/invert/invert.cpp
@@ -4,8 +4,10 @@
 #define PLUGIN_MENU "Filters/Color/Invert%Negative"
 #define PLUGIN_VERSION "4.3.3"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 // first parameter is name of plugin, usually same as the library file name
 Q_EXPORT_PLUGIN2(invert, FilterPlugin);
+#endif

 //********* ---------- Invert Colors or Negate --------- ********** //
 void invert(QImage &img)
diff --git a/src/colors/invert/invert.h b/src/colors/invert/invert.h
index c48a8a7..f8e15b3 100644
--- a/src/colors/invert/invert.h
+++ b/src/colors/invert/invert.h
@@ -6,6 +6,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "invert")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/colors/invert/invert.pro b/src/colors/invert/invert.pro
index 192b093..3354648 100644
--- a/src/colors/invert/invert.pro
+++ b/src/colors/invert/invert.pro
@@ -14,6 +14,8 @@ LIBS           +=
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/colors/stretch-histogram/stretch-histogram.pro b/src/colors/stretch-histogram/stretch-histogram.pro
index 23791e9..0184a07 100644
--- a/src/colors/stretch-histogram/stretch-histogram.pro
+++ b/src/colors/stretch-histogram/stretch-histogram.pro
@@ -14,6 +14,8 @@ LIBS           +=
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/colors/stretch-histogram/stretch_histogram.cpp b/src/colors/stretch-histogram/stretch_histogram.cpp
index d400067..f89bcaa 100644
--- a/src/colors/stretch-histogram/stretch_histogram.cpp
+++ b/src/colors/stretch-histogram/stretch_histogram.cpp
@@ -7,7 +7,9 @@
 #define PLUGIN_MENU "Filters/Color/Histogram Equalize"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 Q_EXPORT_PLUGIN2(stretch-histogram, FilterPlugin);
+#endif

 //*********** ------------ Stretch Histogram ----------- ************ //
 /* This filter gives same effect as GIMP Colors->Auto->Equalize
diff --git a/src/colors/stretch-histogram/stretch_histogram.h b/src/colors/stretch-histogram/stretch_histogram.h
index c48a8a7..67e3971 100644
--- a/src/colors/stretch-histogram/stretch_histogram.h
+++ b/src/colors/stretch-histogram/stretch_histogram.h
@@ -6,6 +6,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "stretch-histogram")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/colors/unalpha/unalpha.cpp b/src/colors/unalpha/unalpha.cpp
index 837d764..a251aa2 100644
--- a/src/colors/unalpha/unalpha.cpp
+++ b/src/colors/unalpha/unalpha.cpp
@@ -4,8 +4,10 @@
 #define PLUGIN_MENU "Filters/Color/UnAlpha"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 // first parameter is name of plugin, usually same as the library file name
 Q_EXPORT_PLUGIN2(unalpha, FilterPlugin);
+#endif

 // ********************** Unalpha *********************

diff --git a/src/colors/unalpha/unalpha.h b/src/colors/unalpha/unalpha.h
index c48a8a7..466fab2 100644
--- a/src/colors/unalpha/unalpha.h
+++ b/src/colors/unalpha/unalpha.h
@@ -6,6 +6,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "unalpha")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/colors/unalpha/unalpha.pro b/src/colors/unalpha/unalpha.pro
index f540cab..8a5711a 100644
--- a/src/colors/unalpha/unalpha.pro
+++ b/src/colors/unalpha/unalpha.pro
@@ -14,6 +14,8 @@ LIBS           +=
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/decorate/photo-frame/photo-frame.pro b/src/decorate/photo-frame/photo-frame.pro
index 1c07ab5..c711efc 100644
--- a/src/decorate/photo-frame/photo-frame.pro
+++ b/src/decorate/photo-frame/photo-frame.pro
@@ -16,6 +16,8 @@ UI_DIR  =     $$DESTDIR/build
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/decorate/photo-frame/photo_frame.cpp b/src/decorate/photo-frame/photo_frame.cpp
index 14922d2..aedd2d6 100644
--- a/src/decorate/photo-frame/photo_frame.cpp
+++ b/src/decorate/photo-frame/photo_frame.cpp
@@ -2,12 +2,15 @@
     Copyright (C) 2021 Arindam Chaudhuri <ksharindam@gmail.com>
 */
 #include "photo_frame.h"
+#include <QMimeData>

 #define PLUGIN_NAME "Photo Frame"
 #define PLUGIN_MENU "Decorate/Add Photo Frame"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 Q_EXPORT_PLUGIN2(photo-frame, ToolPlugin);
+#endif

 #define MIN(a,b) ((a)<(b) ? (a):(b))

diff --git a/src/decorate/photo-frame/photo_frame.h b/src/decorate/photo-frame/photo_frame.h
index 29d058d..495998a 100644
--- a/src/decorate/photo-frame/photo_frame.h
+++ b/src/decorate/photo-frame/photo_frame.h
@@ -16,6 +16,10 @@ class ToolPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "photo-frame")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/effects/kuwahara/kuwahara.cpp b/src/effects/kuwahara/kuwahara.cpp
index 07e7b20..f5fbcdb 100644
--- a/src/effects/kuwahara/kuwahara.cpp
+++ b/src/effects/kuwahara/kuwahara.cpp
@@ -4,7 +4,9 @@
 #define PLUGIN_MENU "Filters/Effects/Kuwahara Filter"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 Q_EXPORT_PLUGIN2(kuwahara, FilterPlugin);
+#endif

 // takes 4 pixels and a floating point coordinate, returns bilinear interpolated pixel
 QRgb interpolateBilinear(float x, float y, QRgb p00, QRgb p01, QRgb p10, QRgb p11)
diff --git a/src/effects/kuwahara/kuwahara.h b/src/effects/kuwahara/kuwahara.h
index c7b230d..fc0a18c 100644
--- a/src/effects/kuwahara/kuwahara.h
+++ b/src/effects/kuwahara/kuwahara.h
@@ -8,6 +8,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "kuwahara")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/effects/kuwahara/kuwahara.pro b/src/effects/kuwahara/kuwahara.pro
index 4e58278..ef0cf05 100644
--- a/src/effects/kuwahara/kuwahara.pro
+++ b/src/effects/kuwahara/kuwahara.pro
@@ -14,6 +14,8 @@ LIBS           += -lgomp
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/effects/tone-mapping/tone-mapping.pro b/src/effects/tone-mapping/tone-mapping.pro
index 099e2d0..8791d8c 100644
--- a/src/effects/tone-mapping/tone-mapping.pro
+++ b/src/effects/tone-mapping/tone-mapping.pro
@@ -14,6 +14,8 @@ LIBS           +=
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/effects/tone-mapping/tone_mapping.cpp b/src/effects/tone-mapping/tone_mapping.cpp
index 1c37fae..ab85264 100644
--- a/src/effects/tone-mapping/tone_mapping.cpp
+++ b/src/effects/tone-mapping/tone_mapping.cpp
@@ -6,7 +6,9 @@
 #define PLUGIN_NAME "Tone Mapping"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 Q_EXPORT_PLUGIN2(tone-mapping, FilterPlugin);
+#endif

 void toneMapping_mantiuk06(QImage &img, float contrast=0.1, float saturation=0.8);

diff --git a/src/effects/tone-mapping/tone_mapping.h b/src/effects/tone-mapping/tone_mapping.h
index 2cefbfa..066d28c 100644
--- a/src/effects/tone-mapping/tone_mapping.h
+++ b/src/effects/tone-mapping/tone_mapping.h
@@ -12,6 +12,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "tone-mapping")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/threshold/bimodal-adaptive/bimodal-adaptive.pro b/src/threshold/bimodal-adaptive/bimodal-adaptive.pro
index 6ead305..92113eb 100644
--- a/src/threshold/bimodal-adaptive/bimodal-adaptive.pro
+++ b/src/threshold/bimodal-adaptive/bimodal-adaptive.pro
@@ -14,6 +14,8 @@ LIBS           += -lgomp
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/threshold/bimodal-adaptive/bimodal_adaptive.cpp b/src/threshold/bimodal-adaptive/bimodal_adaptive.cpp
index 01fc3c9..d91ce7e 100644
--- a/src/threshold/bimodal-adaptive/bimodal_adaptive.cpp
+++ b/src/threshold/bimodal-adaptive/bimodal_adaptive.cpp
@@ -4,8 +4,10 @@
 #define PLUGIN_MENU "Filters/Threshold/Bimodal adaptive"
 #define PLUGIN_VERSION "4.4.3"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 // first parameter is name of plugin, usually same as the library file name
 Q_EXPORT_PLUGIN2(adaptive_bimodal, FilterPlugin);
+#endif

 int SelectChannelPixel(QRgb pix, int channel)
 {
diff --git a/src/threshold/bimodal-adaptive/bimodal_adaptive.h b/src/threshold/bimodal-adaptive/bimodal_adaptive.h
index 675440d..cabe3ba 100644
--- a/src/threshold/bimodal-adaptive/bimodal_adaptive.h
+++ b/src/threshold/bimodal-adaptive/bimodal_adaptive.h
@@ -20,6 +20,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "adaptive_bimodal")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/threshold/bimodal-threshold/bimodal-threshold.pro b/src/threshold/bimodal-threshold/bimodal-threshold.pro
index 538f734..a4e58e0 100644
--- a/src/threshold/bimodal-threshold/bimodal-threshold.pro
+++ b/src/threshold/bimodal-threshold/bimodal-threshold.pro
@@ -14,6 +14,8 @@ LIBS           += -lgomp
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/threshold/bimodal-threshold/bimodal_thresh.cpp b/src/threshold/bimodal-threshold/bimodal_thresh.cpp
index dbd8543..393d203 100644
--- a/src/threshold/bimodal-threshold/bimodal_thresh.cpp
+++ b/src/threshold/bimodal-threshold/bimodal_thresh.cpp
@@ -4,8 +4,10 @@
 #define PLUGIN_MENU "Filters/Threshold/Bimodal"
 #define PLUGIN_VERSION "1.1"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 // first parameter is name of plugin, usually same as the library file name
 Q_EXPORT_PLUGIN2(bimodal_thresh, FilterPlugin);
+#endif

 // ********************** Bimodal Threshold *********************
 int histogram_darkest(long long hist[])
diff --git a/src/threshold/bimodal-threshold/bimodal_thresh.h b/src/threshold/bimodal-threshold/bimodal_thresh.h
index 315d6b9..72e62bc 100644
--- a/src/threshold/bimodal-threshold/bimodal_thresh.h
+++ b/src/threshold/bimodal-threshold/bimodal_thresh.h
@@ -12,6 +12,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "bimodal_thresh")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/threshold/dalg/dalg.cpp b/src/threshold/dalg/dalg.cpp
index 559c577..d03828e 100644
--- a/src/threshold/dalg/dalg.cpp
+++ b/src/threshold/dalg/dalg.cpp
@@ -4,8 +4,10 @@
 #define PLUGIN_MENU "Filters/Threshold/Dalg"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 // first parameter is name of plugin, usually same as the library file name
 Q_EXPORT_PLUGIN2(dalg_thresh, FilterPlugin);
+#endif

 // **** D-algoritm dither ****
 void dalg(QImage &img, unsigned tcount, int tdelta)
diff --git a/src/threshold/dalg/dalg.h b/src/threshold/dalg/dalg.h
index 3b044bf..ff110d2 100644
--- a/src/threshold/dalg/dalg.h
+++ b/src/threshold/dalg/dalg.h
@@ -11,6 +11,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "dalg_thresh")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/threshold/dalg/dalg.pro b/src/threshold/dalg/dalg.pro
index 053045a..067ee3a 100644
--- a/src/threshold/dalg/dalg.pro
+++ b/src/threshold/dalg/dalg.pro
@@ -14,6 +14,8 @@ LIBS           += -lgomp
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/threshold/dither/dither.cpp b/src/threshold/dither/dither.cpp
index 97e9899..a0893a9 100644
--- a/src/threshold/dither/dither.cpp
+++ b/src/threshold/dither/dither.cpp
@@ -4,8 +4,10 @@
 #define PLUGIN_MENU "Filters/Threshold/Dither"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 // first parameter is name of plugin, usually same as the library file name
 Q_EXPORT_PLUGIN2(dither_thresh, FilterPlugin);
+#endif

 // **** Dither of D.E.Knuth "Computer Typesetting" ****
 void dither(QImage &img, unsigned tcount, int tdelta, int kpg)
diff --git a/src/threshold/dither/dither.h b/src/threshold/dither/dither.h
index b868981..7727f4b 100644
--- a/src/threshold/dither/dither.h
+++ b/src/threshold/dither/dither.h
@@ -11,6 +11,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "dither_thresh")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/threshold/dither/dither.pro b/src/threshold/dither/dither.pro
index 6fc4717..e8b28e2 100644
--- a/src/threshold/dither/dither.pro
+++ b/src/threshold/dither/dither.pro
@@ -14,6 +14,8 @@ LIBS           += -lgomp
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/threshold/quant/quant.cpp b/src/threshold/quant/quant.cpp
index 3fd5027..2268ae4 100644
--- a/src/threshold/quant/quant.cpp
+++ b/src/threshold/quant/quant.cpp
@@ -4,8 +4,10 @@
 #define PLUGIN_MENU "Filters/Threshold/Quant"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 // first parameter is name of plugin, usually same as the library file name
 Q_EXPORT_PLUGIN2(quant, FilterPlugin);
+#endif

 // ********************** Quant Simple *********************

diff --git a/src/threshold/quant/quant.h b/src/threshold/quant/quant.h
index abc7f6b..af82962 100644
--- a/src/threshold/quant/quant.h
+++ b/src/threshold/quant/quant.h
@@ -11,6 +11,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "quant")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/threshold/quant/quant.pro b/src/threshold/quant/quant.pro
index 82c3a0b..b1710fd 100644
--- a/src/threshold/quant/quant.pro
+++ b/src/threshold/quant/quant.pro
@@ -14,6 +14,8 @@ LIBS           += -lgomp
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/threshold/threshold-bg-scale/threshold-bg-scale.pro b/src/threshold/threshold-bg-scale/threshold-bg-scale.pro
index f837042..d84018d 100644
--- a/src/threshold/threshold-bg-scale/threshold-bg-scale.pro
+++ b/src/threshold/threshold-bg-scale/threshold-bg-scale.pro
@@ -14,6 +14,8 @@ LIBS           +=
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/threshold/threshold-bg-scale/threshold_bg_scale.cpp b/src/threshold/threshold-bg-scale/threshold_bg_scale.cpp
index 2706674..ab56edb 100644
--- a/src/threshold/threshold-bg-scale/threshold_bg_scale.cpp
+++ b/src/threshold/threshold-bg-scale/threshold_bg_scale.cpp
@@ -4,7 +4,9 @@
 #define PLUGIN_MENU "Filters/Threshold/BG Scale"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 Q_EXPORT_PLUGIN2(threshold-bg-scale, FilterPlugin);
+#endif

 //***** ------ Threshold by difference from Blurred Background ----- ***** //
 void thresholdBgScale(QImage &img, int thresh, int scaledW)
diff --git a/src/threshold/threshold-bg-scale/threshold_bg_scale.h b/src/threshold/threshold-bg-scale/threshold_bg_scale.h
index 6e88563..224132e 100644
--- a/src/threshold/threshold-bg-scale/threshold_bg_scale.h
+++ b/src/threshold/threshold-bg-scale/threshold_bg_scale.h
@@ -11,6 +11,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "threshold-bg-scale")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/tools/histogram-viewer/histogram-viewer.pro b/src/tools/histogram-viewer/histogram-viewer.pro
index 99eec2e..b933a6a 100644
--- a/src/tools/histogram-viewer/histogram-viewer.pro
+++ b/src/tools/histogram-viewer/histogram-viewer.pro
@@ -14,6 +14,8 @@ LIBS           +=
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/tools/histogram-viewer/histogram_viewer.cpp b/src/tools/histogram-viewer/histogram_viewer.cpp
index 1e36e4c..0a19dea 100644
--- a/src/tools/histogram-viewer/histogram_viewer.cpp
+++ b/src/tools/histogram-viewer/histogram_viewer.cpp
@@ -7,7 +7,9 @@
 #define PLUGIN_MENU "Info/Histogram Viewer"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 Q_EXPORT_PLUGIN2(histogram-viewer, ToolPlugin);
+#endif

 //********* ---------- Histogram Viewer --------- ********** //

diff --git a/src/tools/histogram-viewer/histogram_viewer.h b/src/tools/histogram-viewer/histogram_viewer.h
index d16f9cc..c9fe1af 100644
--- a/src/tools/histogram-viewer/histogram_viewer.h
+++ b/src/tools/histogram-viewer/histogram_viewer.h
@@ -13,6 +13,10 @@ class ToolPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "histogram-viewer")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/transform/deskew/deskew.cpp b/src/transform/deskew/deskew.cpp
index 595389b..756cdf2 100644
--- a/src/transform/deskew/deskew.cpp
+++ b/src/transform/deskew/deskew.cpp
@@ -4,8 +4,10 @@
 #define PLUGIN_MENU "Transform/Geometry/DeSkew"
 #define PLUGIN_VERSION "4.4.3"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 // first parameter is name of plugin, usually same as the library file name
 Q_EXPORT_PLUGIN2(deskew, FilterPlugin);
+#endif

 // ----------------------------------------------------------

diff --git a/src/transform/deskew/deskew.h b/src/transform/deskew/deskew.h
index 9c78f31..e164d14 100644
--- a/src/transform/deskew/deskew.h
+++ b/src/transform/deskew/deskew.h
@@ -13,6 +13,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "deskew")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/transform/deskew/deskew.pro b/src/transform/deskew/deskew.pro
index 91372ad..b5589d4 100644
--- a/src/transform/deskew/deskew.pro
+++ b/src/transform/deskew/deskew.pro
@@ -14,6 +14,8 @@ LIBS           += -lgomp
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/transform/geoconformal/geoconformal.cpp b/src/transform/geoconformal/geoconformal.cpp
index 260b877..519491e 100644
--- a/src/transform/geoconformal/geoconformal.cpp
+++ b/src/transform/geoconformal/geoconformal.cpp
@@ -6,7 +6,9 @@
 #define PLUGIN_VERSION "0.20210416"

 // first parameter is name of plugin, usually same as the library file name
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 Q_EXPORT_PLUGIN2(geoconformal, FilterPlugin);
+#endif

 // ********************** Geo Conformal *********************

diff --git a/src/transform/geoconformal/geoconformal.h b/src/transform/geoconformal/geoconformal.h
index 15c5aae..e134ab4 100644
--- a/src/transform/geoconformal/geoconformal.h
+++ b/src/transform/geoconformal/geoconformal.h
@@ -13,6 +13,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "geoconformal")
+#endif
+
 public:
     QString menuItem();

diff --git a/src/transform/geoconformal/geoconformal.pro b/src/transform/geoconformal/geoconformal.pro
index 2f38ec2..601683b 100644
--- a/src/transform/geoconformal/geoconformal.pro
+++ b/src/transform/geoconformal/geoconformal.pro
@@ -14,6 +14,8 @@ LIBS           += -lgomp
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/transform/pixart-scaler/pixart-scaler.pro b/src/transform/pixart-scaler/pixart-scaler.pro
index 2476d86..ac6b9de 100644
--- a/src/transform/pixart-scaler/pixart-scaler.pro
+++ b/src/transform/pixart-scaler/pixart-scaler.pro
@@ -14,6 +14,8 @@ LIBS           +=
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/transform/pixart-scaler/pixart_scaler.cpp b/src/transform/pixart-scaler/pixart_scaler.cpp
index 52638e8..9df8a35 100644
--- a/src/transform/pixart-scaler/pixart_scaler.cpp
+++ b/src/transform/pixart-scaler/pixart_scaler.cpp
@@ -7,7 +7,9 @@
 #define PLUGIN_MENU "Transform/Upscale Icon"
 #define PLUGIN_VERSION "1.2"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 Q_EXPORT_PLUGIN2(pixart-scaler, FilterPlugin);
+#endif

 void FilterPlugin:: UpcaleX(int method, int n/*factor*/)
 {
diff --git a/src/transform/pixart-scaler/pixart_scaler.h b/src/transform/pixart-scaler/pixart_scaler.h
index a763731..6b1b167 100644
--- a/src/transform/pixart-scaler/pixart_scaler.h
+++ b/src/transform/pixart-scaler/pixart_scaler.h
@@ -14,6 +14,10 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "pixart-scaler")
+#endif
+
 public:
     QString menuItem();
     void UpcaleX(int method, int n);
diff --git a/src/transform/ris-scaler/ris-scaler.pro b/src/transform/ris-scaler/ris-scaler.pro
index 5ad9b5d..fe67721 100644
--- a/src/transform/ris-scaler/ris-scaler.pro
+++ b/src/transform/ris-scaler/ris-scaler.pro
@@ -14,6 +14,8 @@ LIBS           +=
 MOC_DIR =     $$DESTDIR/build
 OBJECTS_DIR = $$DESTDIR/build

+QT += widgets
+
 unix {
     INSTALLS += target
     target.path = /usr/local/share/photoquick/plugins
diff --git a/src/transform/ris-scaler/ris_scaler.cpp b/src/transform/ris-scaler/ris_scaler.cpp
index 05177af..eb072a9 100644
--- a/src/transform/ris-scaler/ris_scaler.cpp
+++ b/src/transform/ris-scaler/ris_scaler.cpp
@@ -4,7 +4,9 @@
 #define PLUGIN_MENU "Transform/RIS"
 #define PLUGIN_VERSION "1.0"

+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 Q_EXPORT_PLUGIN2(ris-scaler, FilterPlugin);
+#endif

 void FilterPlugin:: filterHRISX(int n/*factor*/)
 {
diff --git a/src/transform/ris-scaler/ris_scaler.h b/src/transform/ris-scaler/ris_scaler.h
index 2f33814..cd9ea16 100644
--- a/src/transform/ris-scaler/ris_scaler.h
+++ b/src/transform/ris-scaler/ris_scaler.h
@@ -14,6 +14,11 @@ class FilterPlugin : public QObject, Plugin
     Q_OBJECT
     Q_INTERFACES(Plugin)

+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    Q_PLUGIN_METADATA(IID "ris-scaler")
+#endif
+
+
 public:
     QString menuItem();
     void filterHRISX(int n);
ksharindam commented 3 years ago

Checked in linux, your code is both Qt4 and Qt5 compatible.

ksharindam commented 3 years ago

Hi @zvezdochiot I have updated my ksharindam/photoquick repo. If possible, merge the changes.

zvezdochiot commented 3 years ago

Hi @ksharindam .

There are not many changes. Therefore, I will not fiddle with the patch, but just make it with pens. I will check on Qt4, but who will check on Qt5?

ksharindam commented 3 years ago

Then i will do it manually and test both Qt4 and Qt5

On Sat, 12 Jun, 2021, 9:40 PM звездочёт, @.***> wrote:

Hi @ksharindam https://github.com/ksharindam .

There are not many changes. Therefore, I will not fiddle with the patch, but just make it with pens. I will check on Qt4, but who will check on Qt5?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ImageProcessing-ElectronicPublications/photoquick/issues/35#issuecomment-860074317, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKWXPUHGPWFAS2744HP5OLTSOBHTANCNFSM46ORDVCQ .