diff --git a/src/imageprovider.h b/qmlUiKirigami/EditorView.qml similarity index 54% rename from src/imageprovider.h rename to qmlUiKirigami/EditorView.qml index a5c4eda..60fcd2d 100644 --- a/src/imageprovider.h +++ b/qmlUiKirigami/EditorView.qml @@ -1,33 +1,50 @@ /* * Copyright 2017 by Atul Sharma * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef IMAGE_PROVIDER_H -#define IMAGE_PROVIDER_H +import QtQuick 2.7 +import QtQuick.Controls 2.1 as Controls +import org.kde.kirigami 2.0 as Kirigami +import org.kde.kquickcontrolsaddons 2.0 as KQA +import org.kde.koko 0.1 as Koko -#include - -class ImageProvider: public QQuickImageProvider -{ -public: - explicit ImageProvider(); +Kirigami.Page { + id: rootEditorView + title: i18n("Edit") + leftPadding: 0 + rightPadding: 0 - virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize); -}; - -#endif + property string imagePath + + Koko.ImageDocument { + id: imageDoc + path: imagePath + } + + contentItem: Flickable { + width: rootEditorView.width + height: rootEditorView.height + KQA.QImageItem { + id: editImage + width: rootEditorView.width + height: rootEditorView.height + image: imageDoc.visualImage + } + } + +} diff --git a/qmlUiKirigami/ImageViewer.qml b/qmlUiKirigami/ImageViewer.qml index 15464c7..d607e25 100644 --- a/qmlUiKirigami/ImageViewer.qml +++ b/qmlUiKirigami/ImageViewer.qml @@ -1,396 +1,332 @@ /* * Copyright (C) 2017 Marco Martin * Copyright (C) 2017 Atul Sharma * Copyright (C) 2015 Vishesh Handa * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * */ import QtQuick 2.7 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 as Controls import QtGraphicalEffects 1.0 as Effects import QtQuick.Layouts 1.3 import org.kde.kirigami 2.0 as Kirigami import org.kde.koko 0.1 as Koko import org.kde.kquickcontrolsaddons 2.0 as KQA Kirigami.Page { id: root title: i18n("Details") property alias sourceModel: imagesListModel.sourceModel property int indexValue property int imageWidth property int imageHeight leftPadding: 0 rightPadding: 0 KQA.MimeDatabase { id: mimeDB } - Koko.ImageDocument { - id: imageDoc - path: listView.currentItem.currentImageSource - onResetHandle: { - brightnessSlider.value = 0.5 - listView.forceActiveFocus(); - } - } - Kirigami.ContextDrawer { id: contextDrawer title: i18n("Edit image") handleVisible: true } - + actions { left: Kirigami.Action { id: backAction iconName: "view-close" tooltip: i18n("Close Image") onTriggered: root.close(); } main: Kirigami.Action { id: shareAction iconName: "document-share" tooltip: i18n("Share Image") onTriggered: { shareDialog.open(); shareDialog.inputData = { "urls": [ listView.currentItem.currentImageSource.toString() ], "mimeType": mimeDB.mimeTypeForUrl( listView.currentItem.currentImageSource).name } } } - contextualActions: [ - Kirigami.Action { - iconName: "image-rotate-left-symbolic" - text: i18n("Rotate left") - tooltip: i18n("Rotate the image to the left") - onTriggered: { - imageDoc.rotate(270) - } - }, - Kirigami.Action { - iconName: "image-rotate-right-symbolic" - text: i18n("Rotate right") - tooltip: i18n("Rotate the image to the right") - onTriggered: { - imageDoc.rotate(90) - } - } - ] - } - - ColumnLayout { - anchors.top: root.top - width: root.width - z: listView.z + 1 - - Controls.Slider { - id: brightnessSlider - property real previousValue: 0.5 - Layout.fillWidth: true - visible: applicationWindow().controlsVisible - from: 0 - to: 1.0 - value: 0.5 - stepSize: 0.1 - z: listView.z + 1 - snapMode: Controls.Slider.SnapAlways - hoverEnabled: true - Controls.ToolTip { - parent: brightnessSlider - visible: brightnessSlider.hovered - text: i18n("Brightness Controller") - } - onValueChanged: { - imageDoc.edited = true - } - } - - RowLayout { - Layout.fillWidth: true - visible: imageDoc.edited - Controls.Button { - Layout.fillWidth: true - text: i18n("Save") - onClicked: { - listView.currentItem.image.modifiedImage.grabToImage( function( result) { imageDoc.save( result.image)}) - } - } - Controls.Button { - Layout.fillWidth: true - text: i18n("Cancel") - onClicked: imageDoc.cancel() + right: Kirigami.Action { + id: editingAction + iconName: "edit-entry" + tooltip: i18n("Edit Image") + onTriggered: { + applicationWindow().pageStack.layers.push(editorComponent) } } } //FIXME: HACK property bool wasDrawerOpen Component.onCompleted: { applicationWindow().controlsVisible = false; listView.forceActiveFocus(); applicationWindow().header.visible = false; applicationWindow().footer.visible = false; wasDrawerOpen = applicationWindow().globalDrawer.visible; applicationWindow().globalDrawer.visible = false; applicationWindow().globalDrawer.enabled = false; } function close() { applicationWindow().controlsVisible = true; applicationWindow().header.visible = true; if (applicationWindow().footer) { applicationWindow().footer.visible = true; } applicationWindow().globalDrawer.visible = wasDrawerOpen; applicationWindow().globalDrawer.enabled = true; applicationWindow().visibility = Window.Windowed; applicationWindow().pageStack.layers.pop(); } background: Rectangle { color: "black" } Keys.onPressed: { switch(event.key) { case Qt.Key_Escape: root.close(); break; case Qt.Key_F: applicationWindow().visibility = applicationWindow().visibility == Window.FullScreen ? Window.Windowed : Window.FullScreen break; default: break; } } ListView { id: listView anchors.fill: parent orientation: Qt.Horizontal snapMode: ListView.SnapOneItem onMovementEnded: currentImage.index = model.sourceIndex(indexAt(contentX+1, 1)) model: Koko.SortModel { id: imagesListModel filterRole: Koko.Roles.MimeTypeRole filterRegExp: /image\// } currentIndex: model.proxyIndex( indexValue) onCurrentIndexChanged: { currentImage.index = model.sourceIndex( currentIndex) listView.positionViewAtIndex(currentIndex, ListView.Beginning) shareDialog.close(); } delegate: Flickable { id: flick property string currentImageSource: model.imageurl property alias image: image width: imageWidth height: imageHeight contentWidth: imageWidth contentHeight: imageHeight interactive: contentWidth > width || contentHeight > height onInteractiveChanged: listView.interactive = !interactive; clip: true z: index == listView.currentIndex ? 1000 : 0 Controls.ScrollBar.vertical: Controls.ScrollBar {} Controls.ScrollBar.horizontal: Controls.ScrollBar {} PinchArea { width: Math.max(flick.contentWidth, flick.width) height: Math.max(flick.contentHeight, flick.height) property real initialWidth property real initialHeight onPinchStarted: { initialWidth = flick.contentWidth initialHeight = flick.contentHeight } onPinchUpdated: { // adjust content pos due to drag flick.contentX += pinch.previousCenter.x - pinch.center.x flick.contentY += pinch.previousCenter.y - pinch.center.y // resize content flick.resizeContent(Math.max(imageWidth*0.7, initialWidth * pinch.scale), Math.max(imageHeight*0.7, initialHeight * pinch.scale), pinch.center) } onPinchFinished: { // Move its content within bounds. if (flick.contentWidth < root.imageWidth || flick.contentHeight < root.imageHeight) { zoomAnim.x = 0; zoomAnim.y = 0; zoomAnim.width = root.imageWidth; zoomAnim.height = root.imageHeight; zoomAnim.running = true; } else { flick.returnToBounds(); } } ParallelAnimation { id: zoomAnim property real x: 0 property real y: 0 property real width: root.imageWidth property real height: root.imageHeight NumberAnimation { target: flick property: "contentWidth" from: flick.contentWidth to: zoomAnim.width duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: flick property: "contentHeight" from: flick.contentHeight to: zoomAnim.height duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: flick property: "contentY" from: flick.contentY to: zoomAnim.y duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: flick property: "contentX" from: flick.contentX to: zoomAnim.x duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } } Image { id: image - property alias modifiedImage: brightnessContrast - property string imageObject: "image://imageprovider/"+ (model.imageurl).slice(7) width: flick.contentWidth height: flick.contentHeight fillMode: Image.PreserveAspectFit - source: imageObject + source: currentImageSource Timer { id: doubleClickTimer interval: 150 onTriggered: applicationWindow().controlsVisible = !applicationWindow().controlsVisible } MouseArea { anchors.fill: parent onClicked: { contextDrawer.drawerOpen = false doubleClickTimer.restart(); } onDoubleClicked: { doubleClickTimer.running = false; applicationWindow().controlsVisible = false; if (flick.interactive) { zoomAnim.x = 0; zoomAnim.y = 0; zoomAnim.width = root.imageWidth; zoomAnim.height = root.imageHeight; zoomAnim.running = true; } else { zoomAnim.x = mouse.x * 2; zoomAnim.y = mouse.y *2; zoomAnim.width = root.imageWidth * 3; zoomAnim.height = root.imageHeight * 3; zoomAnim.running = true; } } onWheel: { if (wheel.modifiers & Qt.ControlModifier) { if (wheel.angleDelta.y != 0) { var factor = 1 + wheel.angleDelta.y / 600; zoomAnim.running = false; zoomAnim.width = Math.min(Math.max(root.imageWidth, zoomAnim.width * factor), root.imageWidth * 4); zoomAnim.height = Math.min(Math.max(root.imageHeight, zoomAnim.height * factor), root.imageHeight * 4); //actual factors, may be less than factor var xFactor = zoomAnim.width / flick.contentWidth; var yFactor = zoomAnim.height / flick.contentHeight; zoomAnim.x = flick.contentX * xFactor + (((wheel.x - flick.contentX) * xFactor) - (wheel.x - flick.contentX)) zoomAnim.y = flick.contentY * yFactor + (((wheel.y - flick.contentY) * yFactor) - (wheel.y - flick.contentY)) zoomAnim.running = true; } else if (wheel.pixelDelta.y != 0) { flick.resizeContent(Math.min(Math.max(root.imageWidth, flick.contentWidth + wheel.pixelDelta.y), root.imageWidth * 4), Math.min(Math.max(root.imageHeight, flick.contentHeight + wheel.pixelDelta.y), root.imageHeight * 4), wheel); } } } } - - Effects.GammaAdjust { - id: brightnessContrast - source: image - anchors.fill: image - gamma: brightnessSlider.value + 0.5 - } - } } } } ShareDialog { id: shareDialog x: (root.width - width) / 2 y: root.height - height - Kirigami.Units.gridUnit * 3 inputData: { "urls": [], "mimeType": ["image/"] } onFinished: { if (error==0 && output.url !== "") { console.assert(output.url !== undefined); var resultUrl = output.url; console.log("Received", resultUrl) notificationManager.showNotification( true, resultUrl); clipboard.content = resultUrl; } else { notificationManager.showNotification( false); } } } + + Component { + id: editorComponent + EditorView { + width: root.imageWidth + height: root.imageHeight + imagePath: listView.currentItem.currentImageSource + } + } + } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 91abd05..54ba121 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,137 +1,135 @@ # # Common Library # set(LIB_SRCS imagestorage.cpp filesystemimagefetcher.cpp ${LIB_SRCS} ) add_library(kokocommon SHARED ${LIB_SRCS}) target_link_libraries(kokocommon Qt5::Core Qt5::Positioning Qt5::Sql KF5::CoreAddons ) generate_export_header(kokocommon BASE_NAME KOKO EXPORT_FILE_NAME koko_export.h) install(TARGETS kokocommon EXPORT KokoLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}) # # Application # add_executable(koko main.cpp reversegeocoder.cpp filesystemtracker.cpp processor.cpp committimer.cpp imageprocessorrunnable.cpp exiv2extractor.cpp kokoconfig.cpp kdtree.c ) target_link_libraries(koko Qt5::Quick Qt5::Widgets Qt5::Qml Qt5::Positioning KF5::ConfigCore KF5::DBusAddons KF5::I18n KF5::CoreAddons KF5::KIOCore kokocommon ${EXIV2_LIBRARIES} ) install(TARGETS koko ${INSTALL_TARGETS_DEFAULT_ARGS}) # # QML Plugin # set (qml_plugin_SRCS qmlplugins.cpp tagmodel.cpp imagelocationmodel.cpp imagetimemodel.cpp imagefoldermodel.cpp sortmodel.cpp allimagesmodel.cpp imagelistmodel.cpp notificationmanager.cpp types.cpp roles.cpp imagedocument.cpp - imageprovider.cpp ) add_library (kokoqmlplugin SHARED ${qml_plugin_SRCS}) target_link_libraries (kokoqmlplugin Qt5::Qml - Qt5::Quick KF5::KIOCore KF5::KIOFileWidgets KF5::KIOWidgets KF5::GuiAddons KF5::I18n KF5::Notifications kokocommon ) install (TARGETS kokoqmlplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/koko) install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/koko) install (FILES org.kde.koko.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) # # Reverse GeoLookup Data # # Packagers can download the file and put it in the tarball if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cities1000.zip) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/cities1000.zip DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) endif() if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/cities1000.zip) file (DOWNLOAD "http://download.geonames.org/export/dump/cities1000.zip" ${CMAKE_CURRENT_BINARY_DIR}/cities1000.zip SHOW_PROGRESS ) endif() execute_process( COMMAND ${CMAKE_COMMAND} -E tar -xzf ${CMAKE_CURRENT_BINARY_DIR}/cities1000.zip WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/admin1CodesASCII.txt) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/admin1CodesASCII.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) endif() if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/admin1CodesASCII.txt) file (DOWNLOAD "http://download.geonames.org/export/dump/admin1CodesASCII.txt" ${CMAKE_CURRENT_BINARY_DIR}/admin1CodesASCII.txt SHOW_PROGRESS ) endif() file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/admin1CodesASCII.txt ${CMAKE_CURRENT_BINARY_DIR}/admin1Codes.txt) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/admin2Codes.txt) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/admin2Codes.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) endif() if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/admin2Codes.txt) file (DOWNLOAD "http://download.geonames.org/export/dump/admin2Codes.txt" ${CMAKE_CURRENT_BINARY_DIR}/admin2Codes.txt SHOW_PROGRESS ) endif() install (FILES ${CMAKE_CURRENT_BINARY_DIR}/cities1000.txt DESTINATION ${DATA_INSTALL_DIR}/koko) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/admin1Codes.txt DESTINATION ${DATA_INSTALL_DIR}/koko) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/admin2Codes.txt DESTINATION ${DATA_INSTALL_DIR}/koko) install (FILES countries.csv DESTINATION ${DATA_INSTALL_DIR}/koko) install (FILES koko.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR}) diff --git a/src/imagedocument.cpp b/src/imagedocument.cpp index 2e50290..b4a1357 100644 --- a/src/imagedocument.cpp +++ b/src/imagedocument.cpp @@ -1,110 +1,104 @@ /* * Copyright 2017 by Atul Sharma * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "imagedocument.h" #include #include #include ImageDocument::ImageDocument() { m_image = new QImage(); connect( this, &ImageDocument::pathChanged, this, [this] (const QString &url) { emit resetHandle(); /** Since the url passed by the model in the ImageViewer.qml contains 'file://' prefix */ QString location = QUrl( url).path(); m_image->load( location); m_edited = false; emit editedChanged(); emit visualImageChanged(); }); } ImageDocument::~ImageDocument() { } QString ImageDocument::path() { return m_path; } void ImageDocument::setPath(QString& url) { m_path = url; emit pathChanged( url); } QImage ImageDocument::visualImage() { return *m_image; } -void ImageDocument::setVisualImage(QImage& image) -{ - m_image = ℑ - emit visualImageChanged(); -} - bool ImageDocument::edited() { return m_edited; } void ImageDocument::setEdited(bool value) { m_edited = value; emit editedChanged(); } void ImageDocument::rotate(int angle) { QMatrix matrix; matrix.rotate( angle); *m_image = m_image->transformed( matrix); QString location = QUrl( m_path).path(); if (QFileInfo( location).isWritable()) { m_image->save( location); } emit visualImageChanged(); } void ImageDocument::save( QImage image) { QString location = QUrl( m_path).path(); *m_image = image; if( QFileInfo( location).isWritable()) { m_image->save( location); emit resetHandle(); m_edited = false; emit editedChanged(); } m_image->load( location); emit visualImageChanged(); } void ImageDocument::cancel() { emit resetHandle(); m_edited = false; emit editedChanged(); } #include "moc_imagedocument.cpp" diff --git a/src/imagedocument.h b/src/imagedocument.h index 1edcc1b..c5a4c44 100644 --- a/src/imagedocument.h +++ b/src/imagedocument.h @@ -1,60 +1,59 @@ /* * Copyright 2017 by Atul Sharma * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef IMAGEDOCUMENT_H #define IMAGEDOCUMENT_H #include class ImageDocument : public QObject { Q_OBJECT Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) - Q_PROPERTY(QImage visualImage READ visualImage WRITE setVisualImage NOTIFY visualImageChanged) + Q_PROPERTY(QImage visualImage READ visualImage NOTIFY visualImageChanged) Q_PROPERTY(bool edited READ edited WRITE setEdited NOTIFY editedChanged) public: ImageDocument(); ~ImageDocument(); QString path(); void setPath( QString &url); QImage visualImage(); - void setVisualImage( QImage& image); bool edited(); void setEdited( bool value); Q_INVOKABLE void rotate( int angle); Q_INVOKABLE void save( QImage image); Q_INVOKABLE void cancel(); signals: void pathChanged(const QString &url); void visualImageChanged(); void editedChanged(); void resetHandle(); private: QString m_path; QImage *m_image; bool m_edited; }; #endif diff --git a/src/imageprovider.cpp b/src/imageprovider.cpp deleted file mode 100644 index 2dde34f..0000000 --- a/src/imageprovider.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017 by Atul Sharma - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "imageprovider.h" - -ImageProvider::ImageProvider() - : QQuickImageProvider(QQuickImageProvider::Image) -{ -} - -QImage ImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) -{ - Q_UNUSED(size) - Q_UNUSED(requestedSize) - return QImage(id); -} - -#include "moc_imageprovider.cpp" diff --git a/src/qmlplugins.cpp b/src/qmlplugins.cpp index 05e7d75..56a8e3b 100644 --- a/src/qmlplugins.cpp +++ b/src/qmlplugins.cpp @@ -1,58 +1,56 @@ /* * Copyright (C) 2014 Vishesh Handa * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * */ #include "qmlplugins.h" #include "tagmodel.h" #include "imagelocationmodel.h" #include "imagetimemodel.h" #include "imagefoldermodel.h" #include "sortmodel.h" #include "allimagesmodel.h" #include "imagelistmodel.h" #include "notificationmanager.h" #include "types.h" #include "roles.h" #include "imagedocument.h" -#include "imageprovider.h" #include -void QmlPlugins::initializeEngine(QQmlEngine *engine, const char *) +void QmlPlugins::initializeEngine(QQmlEngine *, const char *) { - engine->addImageProvider("imageprovider", new ImageProvider()); } void QmlPlugins::registerTypes(const char *uri) { qmlRegisterType (); qmlRegisterType (uri, 0, 1, "TagModel"); qmlRegisterType (uri, 0, 1, "ImageLocationModel"); qmlRegisterType (uri, 0, 1, "ImageTimeModel"); qmlRegisterType (uri, 0, 1, "ImageFolderModel"); qmlRegisterType (uri, 0, 1, "AllImagesModel"); qmlRegisterType (uri, 0, 1, "SortModel"); qmlRegisterType (uri, 0, 1, "ImageListModel"); qmlRegisterType (uri, 0, 1, "ImageDocument"); qmlRegisterType (uri, 0, 1, "NotificationManager"); qmlRegisterUncreatableType(uri, 0, 1, "Types", "Cannot instantiate the Types class"); qmlRegisterUncreatableType(uri, 0, 1, "Roles", "Cannot instantiate the Roles class"); } diff --git a/src/qmlplugins.h b/src/qmlplugins.h index af80c84..173bc92 100644 --- a/src/qmlplugins.h +++ b/src/qmlplugins.h @@ -1,38 +1,37 @@ /* * Copyright (C) 2013 Vishesh Handa * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * */ #ifndef _QML_PLUGINS_H #define _QML_PLUGINS_H #include -#include class QmlPlugins : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: virtual void initializeEngine(QQmlEngine *engine, const char *uri); virtual void registerTypes(const char *uri); }; #endif