Skip to content

Commit

Permalink
added : Qt5 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ksharindam committed Jun 12, 2021
1 parent a706797 commit a2e6610
Show file tree
Hide file tree
Showing 57 changed files with 150 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Auto-genereated files
Makefile
moc_*.cpp
.qmake.stash
build/

TODO
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ A set of plugins for the viewer [photoquick](https://github.com/ImageProcessing-
* libgomp1

### Build

It can be built with either Qt4 or Qt5
#### Linux
Install dependencies...
**Build dependencies ...**
* libqt4-dev
* libqt4-dev or qtbase5-dev

To build this program, extract the source code zip.
Open terminal and change directory to src/
Expand Down
2 changes: 2 additions & 0 deletions src/colors/grayscale-local/grayscale-local.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ QMAKE_CXXFLAGS = -std=c++11
QMAKE_LFLAGS += -s
LIBS +=

QT += widgets

MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build

Expand Down
4 changes: 3 additions & 1 deletion src/colors/grayscale-local/grayscale_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions src/colors/grayscale-local/grayscale_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
5 changes: 3 additions & 2 deletions src/colors/invert/invert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#define PLUGIN_MENU "Filters/Color/Invert%Negative"
#define PLUGIN_VERSION "4.3.3"

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

//********* ---------- Invert Colors or Negate --------- ********** //
void invert(QImage &img)
Expand Down
3 changes: 3 additions & 0 deletions src/colors/invert/invert.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
2 changes: 2 additions & 0 deletions src/colors/invert/invert.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ QMAKE_CXXFLAGS = -std=c++11
QMAKE_LFLAGS += -s
LIBS +=

QT += widgets

MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build

Expand Down
2 changes: 2 additions & 0 deletions src/colors/stretch-histogram/stretch-histogram.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ QMAKE_CXXFLAGS = -std=c++11
QMAKE_LFLAGS += -s
LIBS +=

QT += widgets

MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build

Expand Down
4 changes: 3 additions & 1 deletion src/colors/stretch-histogram/stretch_histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#define PLUGIN_MENU "Filters/Color/Histogram Equalize"
#define PLUGIN_VERSION "1.0"

Q_EXPORT_PLUGIN2(stretch-histogram, FilterPlugin);
#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
Expand Down
3 changes: 3 additions & 0 deletions src/colors/stretch-histogram/stretch_histogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
5 changes: 3 additions & 2 deletions src/colors/unalpha/unalpha.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#define PLUGIN_MENU "Filters/Color/UnAlpha"
#define PLUGIN_VERSION "1.0"

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

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

Expand Down
3 changes: 3 additions & 0 deletions src/colors/unalpha/unalpha.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
2 changes: 2 additions & 0 deletions src/colors/unalpha/unalpha.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ QMAKE_CXXFLAGS = -std=c++11
QMAKE_LFLAGS += -s
LIBS +=

QT += widgets

MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build

Expand Down
2 changes: 2 additions & 0 deletions src/decorate/photo-frame/photo-frame.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ QMAKE_CXXFLAGS = -std=c++11
QMAKE_LFLAGS += -s
LIBS +=

QT += widgets

UI_DIR = $$DESTDIR/build
MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build
Expand Down
5 changes: 4 additions & 1 deletion src/decorate/photo-frame/photo_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

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

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

Expand Down
3 changes: 3 additions & 0 deletions src/decorate/photo-frame/photo_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class ToolPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
4 changes: 3 additions & 1 deletion src/effects/kuwahara/kuwahara.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#define PLUGIN_MENU "Filters/Effects/Kuwahara Filter"
#define PLUGIN_VERSION "1.0"

Q_EXPORT_PLUGIN2(kuwahara, FilterPlugin);
#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)
Expand Down
3 changes: 3 additions & 0 deletions src/effects/kuwahara/kuwahara.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
2 changes: 2 additions & 0 deletions src/effects/kuwahara/kuwahara.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ QMAKE_CXXFLAGS = -std=c++11 -fopenmp
QMAKE_LFLAGS += -s
LIBS += -lgomp

QT += widgets

MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build

Expand Down
2 changes: 2 additions & 0 deletions src/effects/tone-mapping/tone-mapping.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ QMAKE_CXXFLAGS = -std=c++11 -fopenmp
QMAKE_LFLAGS += -s -lgomp
LIBS +=

QT += widgets

MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build

Expand Down
4 changes: 3 additions & 1 deletion src/effects/tone-mapping/tone_mapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#define PLUGIN_NAME "Tone Mapping"
#define PLUGIN_VERSION "1.0"

Q_EXPORT_PLUGIN2(tone-mapping, FilterPlugin);
#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);

Expand Down
3 changes: 3 additions & 0 deletions src/effects/tone-mapping/tone_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
3 changes: 2 additions & 1 deletion src/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class Plugin
virtual void sendNotification(QString title, QString message) = 0;
};

#define Plugin_iid "photoquick.Plugin/1.0"

Q_DECLARE_INTERFACE(Plugin, "photoquick.Plugin");
Q_DECLARE_INTERFACE(Plugin, Plugin_iid);

#endif /* __PHOTOQUIK_PLUGIN */
2 changes: 2 additions & 0 deletions src/threshold/bimodal-adaptive/bimodal-adaptive.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ QMAKE_CXXFLAGS = -std=c++11 -fopenmp
QMAKE_LFLAGS += -s
LIBS += -lgomp

QT += widgets

MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build

Expand Down
5 changes: 3 additions & 2 deletions src/threshold/bimodal-adaptive/bimodal_adaptive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#define PLUGIN_MENU "Filters/Threshold/Bimodal adaptive"
#define PLUGIN_VERSION "4.4.3"

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

int SelectChannelPixel(QRgb pix, int channel)
{
Expand Down
3 changes: 3 additions & 0 deletions src/threshold/bimodal-adaptive/bimodal_adaptive.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
2 changes: 2 additions & 0 deletions src/threshold/bimodal-threshold/bimodal-threshold.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ QMAKE_CXXFLAGS = -std=c++11 -fopenmp
QMAKE_LFLAGS += -s
LIBS += -lgomp

QT += widgets

MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build

Expand Down
5 changes: 3 additions & 2 deletions src/threshold/bimodal-threshold/bimodal_thresh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#define PLUGIN_MENU "Filters/Threshold/Bimodal"
#define PLUGIN_VERSION "1.1"

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

// ********************** Bimodal Threshold *********************
int histogram_darkest(long long hist[])
Expand Down
3 changes: 3 additions & 0 deletions src/threshold/bimodal-threshold/bimodal_thresh.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
5 changes: 3 additions & 2 deletions src/threshold/dalg/dalg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#define PLUGIN_MENU "Filters/Threshold/Dalg"
#define PLUGIN_VERSION "1.0"

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

// **** D-algoritm dither ****
void dalg(QImage &img, unsigned tcount, int tdelta)
Expand Down
3 changes: 3 additions & 0 deletions src/threshold/dalg/dalg.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
2 changes: 2 additions & 0 deletions src/threshold/dalg/dalg.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ QMAKE_CXXFLAGS = -std=c++11 -fopenmp
QMAKE_LFLAGS += -s
LIBS += -lgomp

QT += widgets

MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build

Expand Down
5 changes: 3 additions & 2 deletions src/threshold/dither/dither.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#define PLUGIN_MENU "Filters/Threshold/Dither"
#define PLUGIN_VERSION "1.0"

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

// **** Dither of D.E.Knuth "Computer Typesetting" ****
void dither(QImage &img, unsigned tcount, int tdelta, int kpg)
Expand Down
3 changes: 3 additions & 0 deletions src/threshold/dither/dither.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
2 changes: 2 additions & 0 deletions src/threshold/dither/dither.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ QMAKE_CXXFLAGS = -std=c++11 -fopenmp
QMAKE_LFLAGS += -s
LIBS += -lgomp

QT += widgets

MOC_DIR = $$DESTDIR/build
OBJECTS_DIR = $$DESTDIR/build

Expand Down
5 changes: 3 additions & 2 deletions src/threshold/quant/quant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#define PLUGIN_MENU "Filters/Threshold/Quant"
#define PLUGIN_VERSION "1.0"

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

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

Expand Down
3 changes: 3 additions & 0 deletions src/threshold/quant/quant.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class FilterPlugin : public QObject, Plugin
{
Q_OBJECT
Q_INTERFACES(Plugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID Plugin_iid)
#endif

public:
QString menuItem();
Expand Down
Loading

1 comment on commit a2e6610

@zvezdochiot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.