Commit ecd5cec0 authored by Laurent Montel's avatar Laurent Montel
Browse files

Allow to build without kImageAnnotator lib

(there is not qt6 support for it yet)
parent d94ef56d
......@@ -141,12 +141,15 @@ if(X11_FOUND)
set(HAVE_X11 1)
endif()
find_package(kImageAnnotator)
set_package_properties(kImageAnnotator PROPERTIES URL "https://github.com/ksnip/kImageAnnotator" DESCRIPTION "The kImageAnnotator library provides tools to annotate" TYPE REQUIRED)
if(kImageAnnotator_FOUND)
find_package(kColorPicker REQUIRED)
if(NOT kImageAnnotator_VERSION VERSION_LESS 0.5.0)
set(KIMAGEANNOTATOR_CAN_LOAD_TRANSLATIONS 1)
if (QT_MAJOR_VERSION STREQUAL "5")
find_package(kImageAnnotator)
set_package_properties(kImageAnnotator PROPERTIES URL "https://github.com/ksnip/kImageAnnotator" DESCRIPTION "The kImageAnnotator library provides tools to annotate" TYPE REQUIRED)
if(kImageAnnotator_FOUND)
set(KIMAGEANNOTATOR_FOUND 1)
find_package(kColorPicker REQUIRED)
if(NOT kImageAnnotator_VERSION VERSION_LESS 0.5.0)
set(KIMAGEANNOTATOR_CAN_LOAD_TRANSLATIONS 1)
endif()
endif()
endif()
......
......@@ -132,4 +132,6 @@ target_link_libraries(slideshowfileitemaction
KF5::KIOWidgets
KF5::Notifications)
target_link_libraries(gwenview kImageAnnotator::kImageAnnotator)
if(kImageAnnotator_FOUND)
target_link_libraries(gwenview kImageAnnotator::kImageAnnotator)
endif()
......@@ -38,8 +38,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mainwindow.h"
#include "sidebar.h"
#include "viewmainpage.h"
#ifdef KIMAGEANNOTATOR_FOUND
#include <lib/annotate/annotatedialog.h>
#include <lib/annotate/annotateoperation.h>
#endif
#include <lib/contextmanager.h>
#include <lib/crop/croptool.h>
#include <lib/document/documentfactory.h>
......@@ -75,7 +77,9 @@ struct ImageOpsContextManagerItem::Private {
QAction *mResizeAction = nullptr;
QAction *mCropAction = nullptr;
QAction *mRedEyeReductionAction = nullptr;
#ifdef KIMAGEANNOTATOR_FOUND
QAction *mAnnotateAction = nullptr;
#endif
QList<QAction *> mActionList;
void setupActions()
......@@ -117,7 +121,7 @@ struct ImageOpsContextManagerItem::Private {
mRedEyeReductionAction->setText(i18n("Reduce Red Eye"));
mRedEyeReductionAction->setIcon(QIcon::fromTheme(QStringLiteral("redeyes")));
actionCollection->setDefaultShortcut(mRedEyeReductionAction, Qt::SHIFT | Qt::Key_E);
#ifdef KIMAGEANNOTATOR_FOUND
mAnnotateAction = edit->addAction(QStringLiteral("annotate"));
mAnnotateAction->setText(i18nc("@action:intoolbar", "Annotate"));
mAnnotateAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-image"), QIcon::fromTheme(QStringLiteral("draw-brush"))));
......@@ -133,9 +137,11 @@ struct ImageOpsContextManagerItem::Private {
q->applyImageOperation(new AnnotateOperation(dialog.getImage()));
}
});
mActionList << mRotateLeftAction << mRotateRightAction << mMirrorAction << mFlipAction << mResizeAction << mCropAction << mRedEyeReductionAction
<< mAnnotateAction;
#endif
mActionList << mRotateLeftAction << mRotateRightAction << mMirrorAction << mFlipAction << mResizeAction << mCropAction << mRedEyeReductionAction;
#ifdef KIMAGEANNOTATOR_FOUND
mActionList << mAnnotateAction;
#endif
}
bool ensureEditable()
......@@ -209,8 +215,9 @@ void ImageOpsContextManagerItem::updateActions()
d->mResizeAction->setEnabled(canModify);
d->mCropAction->setEnabled(canModify && viewMainPageIsVisible);
d->mRedEyeReductionAction->setEnabled(canModify && viewMainPageIsVisible);
#ifdef KIMAGEANNOTATOR_FOUND
d->mAnnotateAction->setEnabled(canModify);
#endif
updateSideBarContent();
}
......
......@@ -152,9 +152,13 @@ set(gwenviewlib_SRCS
touch/twofingertap.cpp
touch/touch_helper.cpp
${GV_JPEG_DIR}/transupp.c
annotate/annotatedialog.cpp
annotate/annotateoperation.cpp
)
if (kImageAnnotator_FOUND)
set(gwenviewlib_SRCS ${gwenviewlib_SRCS}
annotate/annotatedialog.cpp
annotate/annotateoperation.cpp
)
endif()
set_source_files_properties(${GV_JPEG_DIR}/transupp.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
......@@ -298,6 +302,7 @@ if (GWENVIEW_SEMANTICINFO_BACKEND_BALOO)
)
endif()
target_link_libraries(gwenviewlib kImageAnnotator::kImageAnnotator)
if(kImageAnnotator_FOUND)
target_link_libraries(gwenviewlib kImageAnnotator::kImageAnnotator)
endif()
install(TARGETS gwenviewlib ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment