[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [krita/kazakov/async-animation-rendering] /: Load the sketch home page in the docker...
From: Boudewijn Rempt <null () kde ! org>
Date: 2017-08-31 13:58:41
Message-ID: E1dnPzV-0002jD-SN () code ! kde ! org
[Download RAW message or body]
Git commit 0f98cdec85f01a4cb57fd4d6abda9af7433a32a6 by Boudewijn Rempt.
Committed on 31/08/2017 at 13:57.
Pushed by rempt into branch 'kazakov/async-animation-rendering'.
Load the sketch home page in the docker...
It's very crashy and not yet what we want, but it _is_ progress! The
components and the two plugins can be accessed, we can load the qml
from a shared qrc file, which means that it's possible for other
krita plugins to also use the shared qml.
M +2 -1 libs/libqml/CMakeLists.txt
A +684 -0 libs/libqml/KisSketchView.cpp [License: LGPL (v2+)]
A +114 -0 libs/libqml/KisSketchView.h [License: LGPL (v2+)]
M +1 -0 libs/libqml/plugins/CMakeLists.txt
R +0 -0 libs/libqml/plugins/components/BusyIndicator.qml [from: \
libs/libqml/qml/components/BusyIndicator.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/Button.qml [from: \
libs/libqml/qml/components/Button.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/CategorySwitcher.qml [from: \
libs/libqml/qml/components/CategorySwitcher.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/CheckBox.qml [from: \
libs/libqml/qml/components/CheckBox.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/ColorSwatch.qml [from: \
libs/libqml/qml/components/ColorSwatch.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/Dialog.qml [from: \
libs/libqml/qml/components/Dialog.qml - 100% similarity] C +0 -0 \
libs/libqml/plugins/components/Divider.qml [from: \
libs/libqml/qml/components/Divider.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/DropShadow.qml [from: \
libs/libqml/qml/components/DropShadow.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/ExpandingListView.qml [from: \
libs/libqml/qml/components/ExpandingListView.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/Header.qml [from: \
libs/libqml/qml/components/Header.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/Label.qml [from: libs/libqml/qml/components/Label.qml \
- 100% similarity] R +0 -0 libs/libqml/plugins/components/ListItem.qml [from: \
libs/libqml/qml/components/ListItem.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/MessageStack.qml [from: \
libs/libqml/qml/components/MessageStack.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/NewImageList.qml [from: \
libs/libqml/qml/components/NewImageList.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/NewsList.qml [from: \
libs/libqml/qml/components/NewsList.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/Page.qml [from: libs/libqml/qml/components/Page.qml - \
100% similarity] R +0 -0 libs/libqml/plugins/components/PageStack.js [from: \
libs/libqml/qml/components/PageStack.js - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/PageStack.qml [from: \
libs/libqml/qml/components/PageStack.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/PanelTextField.qml [from: \
libs/libqml/qml/components/PanelTextField.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/RangeCombo.qml [from: \
libs/libqml/qml/components/RangeCombo.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/RangeInput.qml [from: \
libs/libqml/qml/components/RangeInput.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/RecentFilesList.qml [from: \
libs/libqml/qml/components/RecentFilesList.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/ScrollDecorator.qml [from: \
libs/libqml/qml/components/ScrollDecorator.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/Shadow.qml [from: \
libs/libqml/qml/components/Shadow.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/Slider.qml [from: \
libs/libqml/qml/components/Slider.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/TextField.qml [from: \
libs/libqml/qml/components/TextField.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/TextFieldMultiline.qml [from: \
libs/libqml/qml/components/TextFieldMultiline.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/Tooltip.qml [from: \
libs/libqml/qml/components/Tooltip.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/VirtualKeyboard.qml [from: \
libs/libqml/qml/components/VirtualKeyboard.qml - 100% similarity] R +0 -0 \
libs/libqml/plugins/components/qmldir [from: libs/libqml/qml/components/qmldir - 100% \
similarity] M +6 -6 libs/libqml/plugins/kritasketchplugin/Constants.cpp
M +5 -0 libs/libqml/plugins/kritasketchplugin/kritasketchplugin.cpp
M +1 -1 libs/libqml/plugins/kritasketchplugin/kritasketchplugin.h
D +0 -216 libs/libqml/qml.qrc
A +186 -0 libs/libqml/qml/qml.qrc
M +6 -1 libs/ui/KisApplication.cpp
M +18 -4 libs/widgetutils/KoResourcePaths.cpp
M +78 -3 plugins/dockers/touchdocker/TouchDockerDock.cpp
M +26 -0 plugins/dockers/touchdocker/TouchDockerDock.h
R +9 -3 plugins/dockers/touchdocker/qml/kritasketch.qml [from: \
libs/libqml/qml/components/Divider.qml - 065% similarity] M +1 -1 \
plugins/dockers/touchdocker/touchdocker.qrc
https://commits.kde.org/krita/0f98cdec85f01a4cb57fd4d6abda9af7433a32a6
diff --git a/libs/libqml/CMakeLists.txt b/libs/libqml/CMakeLists.txt
index b81860f66e7..e9b7d486377 100644
--- a/libs/libqml/CMakeLists.txt
+++ b/libs/libqml/CMakeLists.txt
@@ -21,9 +21,10 @@ set(kritaqml_SRCS
VirtualKeyboardController.cpp
Theme.cpp
QmlGlobalEngine.cpp
+ KisSketchView.cpp
)
-qt5_add_resources(kritaqml_SRCS qml.qrc)
+qt5_add_resources(kritaqml_SRCS qml/qml.qrc)
add_library(kritaqml SHARED ${kritaqml_SRCS})
generate_export_header(kritaqml BASE_NAME krita_sketch)
diff --git a/libs/libqml/KisSketchView.cpp b/libs/libqml/KisSketchView.cpp
new file mode 100644
index 00000000000..b74792128a2
--- /dev/null
+++ b/libs/libqml/KisSketchView.cpp
@@ -0,0 +1,684 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2012 Boudewijn Rempt <boud@kogmbh.com>
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#include "KisSketchView.h"
+
+#include <QApplication>
+#include <QScrollBar>
+#include <QFileInfo>
+
+#include <kactioncollection.h>
+
+#include <KoZoomController.h>
+#include <KoToolManager.h>
+
+#include "KisDocument.h"
+#include "kis_canvas2.h"
+#include <kis_canvas_controller.h>
+#include "KisViewManager.h"
+#include <kis_image_signal_router.h>
+#include <input/kis_input_manager.h>
+#include <input/kis_tablet_event.h>
+#include <kis_canvas_resource_provider.h>
+#include <kis_selection_manager.h>
+#include <KisPart.h>
+#include <kis_tool_freehand.h>
+#include <kis_paintop_box.h>
+#include "KisSelectionExtras.h"
+
+#include "ProgressProxy.h"
+#include "DocumentManager.h"
+
+class KisSketchView::Private
+{
+public:
+ Private( KisSketchView* qq)
+ : q(qq)
+ , actionCollection(0)
+ , doc(0)
+ , viewManager(0)
+ , view(0)
+ , canvas(0)
+ , canvasWidget(0)
+ , selectionExtras(0)
+ , undoAction(0)
+ , redoAction(0)
+ , tabletEventCount(0)
+ { }
+ ~Private() {
+ delete selectionExtras;
+ }
+
+ void imageUpdated(const QRect &updated);
+ void documentOffsetMoved();
+ void zoomChanged();
+ void resetDocumentPosition();
+ void removeNodeAsync(KisNodeSP removedNode);
+
+ KisSketchView* q;
+
+ KActionCollection *actionCollection;
+
+ QPointer<KisDocument> doc;
+ QPointer<KisViewManager> viewManager;
+ QPointer<KisView> view;
+
+ QPointer<KisCanvas2> canvas;
+ KUndo2Stack* undoStack;
+
+ QWidget *canvasWidget;
+
+ QString file;
+
+ KisSelectionExtras *selectionExtras;
+
+ QTimer *timer;
+
+ QTimer *loadedTimer;
+ QTimer *savedTimer;
+ QAction* undoAction;
+ QAction* redoAction;
+
+ unsigned char tabletEventCount;
+};
+
+KisSketchView::KisSketchView(QQuickItem* parent)
+ : QQuickItem(parent)
+ , d(new Private(this))
+{
+ // this is just an interaction overlay, the contents are painted on the \
sceneview background + setFlag(QQuickItem::ItemHasContents, false);
+ // QT5TODO
+// setAcceptTouchEvents(true);
+ setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton);
+ setAcceptHoverEvents(true);
+
+ d->actionCollection = new KActionCollection(this, "krita");
+ d->viewManager = new KisViewManager(qApp->activeWindow(), d->actionCollection);
+
+ // QT5TODO
+// grabGesture(Qt::PanGesture);
+ //grabGesture(Qt::PinchGesture);
+
+ KoZoomMode::setMinimumZoom(0.1);
+ KoZoomMode::setMaximumZoom(16.0);
+
+ d->timer = new QTimer(this);
+ d->timer->setSingleShot(true);
+ connect(d->timer, SIGNAL(timeout()), this, SLOT(resetDocumentPosition()));
+
+ d->loadedTimer = new QTimer(this);
+ d->loadedTimer->setSingleShot(true);
+ d->loadedTimer->setInterval(100);
+ connect(d->loadedTimer, SIGNAL(timeout()), SIGNAL(loadingFinished()));
+
+ d->savedTimer = new QTimer(this);
+ d->savedTimer->setSingleShot(true);
+ d->savedTimer->setInterval(100);
+ connect(d->savedTimer, SIGNAL(timeout()), SIGNAL(savingFinished()));
+
+ connect(DocumentManager::instance(), SIGNAL(aboutToDeleteDocument()), \
SLOT(documentAboutToBeDeleted())); + connect(DocumentManager::instance(), \
SIGNAL(documentChanged()), SLOT(documentChanged())); + \
connect(DocumentManager::instance()->progressProxy(), SIGNAL(valueChanged(int)), \
SIGNAL(progress(int))); + connect(DocumentManager::instance(), \
SIGNAL(documentSaved()), d->savedTimer, SLOT(start())); +
+ if (DocumentManager::instance()->document()) {
+ documentChanged();
+ }
+}
+
+KisSketchView::~KisSketchView()
+{
+ if (d->doc) {
+ DocumentManager::instance()->closeDocument();
+ }
+ if (d->canvasWidget) {
+ // QT5TODO
+// SketchDeclarativeView *v = \
qobject_cast<SketchDeclarativeView*>(scene()->views().at(0)); +// if (v) {
+// v->setCanvasWidget(0);
+// v->setDrawCanvas(false);
+// }
+ }
+
+ delete d;
+}
+
+QObject* KisSketchView::selectionManager() const
+{
+ if (!d->viewManager)
+ return 0;
+ return d->viewManager->selectionManager();
+}
+
+QObject* KisSketchView::selectionExtras() const
+{
+ if (!d->selectionExtras) {
+ d->selectionExtras = new KisSelectionExtras(d->viewManager);
+ }
+ return d->selectionExtras;
+}
+
+QObject* KisSketchView::doc() const
+{
+ return d->doc;
+}
+
+QObject* KisSketchView::view() const
+{
+ return d->viewManager;
+}
+
+QString KisSketchView::file() const
+{
+ return d->file;
+}
+
+QString KisSketchView::fileTitle() const
+{
+ QFileInfo file(d->file);
+ return file.fileName();
+}
+
+bool KisSketchView::isModified() const
+{
+ if(d->doc)
+ return d->doc->isModified();
+
+ return false;
+}
+
+void KisSketchView::setFile(const QString& file)
+{
+ if (!file.isEmpty() && file != d->file) {
+ d->file = file;
+ emit fileChanged();
+
+ if (!file.startsWith("temp://")) {
+ DocumentManager::instance()->openDocument(file);
+ }
+ }
+}
+
+void KisSketchView::componentComplete()
+{
+}
+
+bool KisSketchView::canUndo() const
+{
+ if (d->undoAction)
+ return d->undoAction->isEnabled();
+ return false;
+}
+
+bool KisSketchView::canRedo() const
+{
+ if (d->redoAction)
+ return d->redoAction->isEnabled();
+ return false;
+}
+
+int KisSketchView::imageHeight() const
+{
+ if (d->doc)
+ return d->doc->image()->height();
+ return 0;
+}
+
+int KisSketchView::imageWidth() const
+{
+ if (d->doc)
+ return d->doc->image()->width();
+ return 0;
+}
+
+void KisSketchView::undo()
+{
+ d->undoAction->trigger();
+}
+
+void KisSketchView::redo()
+{
+ d->redoAction->trigger();
+}
+
+void KisSketchView::zoomIn()
+{
+ d->viewManager->actionCollection()->action("zoom_in")->trigger();
+}
+
+void KisSketchView::zoomOut()
+{
+ d->viewManager->actionCollection()->action("zoom_out")->trigger();
+}
+
+void KisSketchView::save()
+{
+ DocumentManager::instance()->save();
+}
+
+void KisSketchView::saveAs(const QString& fileName, const QString& mimeType)
+{
+ DocumentManager::instance()->saveAs(fileName, mimeType);
+}
+
+void KisSketchView::documentAboutToBeDeleted()
+{
+ if (d->undoAction)
+ d->undoAction->disconnect(this);
+
+ if (d->redoAction)
+ d->redoAction->disconnect(this);
+
+ delete d->view;
+ d->view = 0;
+
+ emit viewChanged();
+
+ d->canvas = 0;
+ d->canvasWidget = 0;
+}
+
+void KisSketchView::documentChanged()
+{
+ d->doc = DocumentManager::instance()->document();
+ if (!d->doc) return;
+ if (!d->viewManager) return;
+
+ connect(d->doc, SIGNAL(modified(bool)), SIGNAL(modifiedChanged()));
+
+ QPointer<KisView> view = \
qobject_cast<KisView*>(KisPart::instance()->createView(d->doc, + \
d->viewManager->resourceProvider()->resourceManager(), + \
d->viewManager->actionCollection(), + \
QApplication::activeWindow())); + view->setViewManager(d->viewManager);
+ view->canvasBase()->setFavoriteResourceManager(d->viewManager->paintOpBox()->favoriteResourcesManager());
+ view->slotLoadingFinished();
+
+ d->view = view;
+ d->canvas = d->view->canvasBase();
+ d->view->setShowFloatingMessage(false);
+ d->viewManager->setCurrentView(view);
+ KisCanvasController *controller = \
static_cast<KisCanvasController*>(d->canvas->canvasController()); +
+ connect(d->viewManager, SIGNAL(floatingMessageRequested(QString,QString)), this, \
SIGNAL(floatingMessageRequested(QString,QString))); +
+ controller->setGeometry(x(), y(), width(), height());
+ d->view->hide();
+
+ d->undoStack = d->doc->undoStack();
+ d->undoAction = d->viewManager->actionCollection()->action("edit_undo");
+ connect(d->undoAction, SIGNAL(changed()), this, SIGNAL(canUndoChanged()));
+
+ d->redoAction = d->viewManager->actionCollection()->action("edit_redo");
+ connect(d->redoAction, SIGNAL(changed()), this, SIGNAL(canRedoChanged()));
+
+ KoToolManager::instance()->switchToolRequested( "KritaShape/KisToolBrush" );
+
+ d->canvasWidget = d->canvas->canvasWidget();
+
+
+
+ connect(d->doc->image(), SIGNAL(sigImageUpdated(QRect)), \
SLOT(imageUpdated(QRect))); + connect(controller->proxyObject, \
SIGNAL(moveDocumentOffset(QPoint)), SLOT(documentOffsetMoved())); + \
connect(d->view->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), \
SLOT(zoomChanged())); + connect(d->canvas, SIGNAL(updateCanvasRequested(QRect)), \
SLOT(imageUpdated(QRect))); + connect(d->doc->image()->signalRouter(), \
SIGNAL(sigRemoveNodeAsync(KisNodeSP)), SLOT(removeNodeAsync(KisNodeSP))); + \
connect(d->doc->image()->signalRouter(), SIGNAL(sigSizeChanged(QPointF,QPointF)), \
SIGNAL(imageSizeChanged())); +
+ // QT5TODO
+// if(scene()) {
+// SketchDeclarativeView *v = \
qobject_cast<SketchDeclarativeView*>(scene()->views().at(0)); +// if (v) {
+// v->setCanvasWidget(d->canvasWidget);
+// v->setDrawCanvas(true);
+// }
+// }
+
+ d->imageUpdated(d->canvas->image()->bounds());
+
+ static_cast<KoZoomHandler*>(d->canvas->viewConverter())->setResolution(d->doc->image()->xRes(), \
d->doc->image()->yRes()); + \
d->view->zoomController()->setZoomMode(KoZoomMode::ZOOM_PAGE); + \
controller->setScrollBarValue(QPoint(0, 0)); + \
controller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + \
controller->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +
+ geometryChanged(QRectF(x(), y(), width(), height()), QRectF());
+
+ d->loadedTimer->start(100);
+
+ d->viewManager->actionCollection()->action("zoom_to_100pct")->trigger();
+ d->resetDocumentPosition();
+
+ emit viewChanged();
+
+}
+
+bool KisSketchView::event( QEvent* event )
+{
+ if (!d->viewManager) return false;
+ if (!d->viewManager->canvasBase()) return false;
+
+ KisCanvasController *controller = \
dynamic_cast<KisCanvasController*>(d->viewManager->canvasBase()->canvasController()); \
+ if (!controller) return false; +
+// switch(static_cast<int>(event->type())) {
+// case ViewModeSwitchEvent::AboutToSwitchViewModeEvent: {
+// ViewModeSynchronisationObject* syncObject = \
static_cast<ViewModeSwitchEvent*>(event)->synchronisationObject(); +
+// if (d->view && d->viewManager && d->viewManager->canvasBase()) {
+
+// controller->setFocus();
+// qApp->processEvents();
+
+// KisCanvasResourceProvider* provider = d->view->resourceProvider();
+// syncObject->backgroundColor = provider->bgColor();
+// syncObject->foregroundColor = provider->fgColor();
+// syncObject->exposure = provider->HDRExposure();
+// syncObject->gamma = provider->HDRGamma();
+// syncObject->compositeOp = provider->currentCompositeOp();
+// syncObject->pattern = provider->currentPattern();
+// syncObject->gradient = provider->currentGradient();
+// syncObject->node = provider->currentNode();
+// syncObject->paintOp = provider->currentPreset();
+// syncObject->opacity = provider->opacity();
+// syncObject->globalAlphaLock = provider->globalAlphaLock();
+
+// syncObject->documentOffset = controller->scrollBarValue();
+// syncObject->zoomLevel = \
d->view->zoomController()->zoomAction()->effectiveZoom(); +// \
syncObject->rotationAngle = d->view->canvasBase()->rotationAngle(); +
+// syncObject->activeToolId = \
KoToolManager::instance()->activeToolId(); +
+// syncObject->gridConfig = d->view->document()->gridConfig();
+
+// syncObject->mirrorHorizontal = provider->mirrorHorizontal();
+// syncObject->mirrorVertical = provider->mirrorVertical();
+// //syncObject->mirrorAxesCenter = \
provider->resourceManager()->resource(KisCanvasResourceProvider::MirrorAxesCenter).toPointF();
+
+// KisToolFreehand* tool = \
qobject_cast<KisToolFreehand*>(KoToolManager::instance()->toolById(d->view->canvasBase(), \
syncObject->activeToolId)); +// if(tool) {
+// syncObject->smoothingOptions = tool->smoothingOptions();
+// }
+
+// syncObject->initialized = true;
+// }
+
+// return true;
+// }
+// case ViewModeSwitchEvent::SwitchedToSketchModeEvent: {
+// ViewModeSynchronisationObject* syncObject = \
static_cast<ViewModeSwitchEvent*>(event)->synchronisationObject(); +
+// if (d->view && syncObject->initialized) {
+// controller->setFocus();
+// qApp->processEvents();
+
+// KisToolFreehand* tool = \
qobject_cast<KisToolFreehand*>(KoToolManager::instance()->toolById(d->view->canvasBase(), \
syncObject->activeToolId)); +// if(tool && \
syncObject->smoothingOptions) { +// \
tool->smoothingOptions()->setSmoothingType(syncObject->smoothingOptions->smoothingType());
+// \
tool->smoothingOptions()->setSmoothPressure(syncObject->smoothingOptions->smoothPressure());
+// \
tool->smoothingOptions()->setTailAggressiveness(syncObject->smoothingOptions->tailAggressiveness());
+// \
tool->smoothingOptions()->setUseScalableDistance(syncObject->smoothingOptions->useScalableDistance());
+// \
tool->smoothingOptions()->setSmoothnessDistance(syncObject->smoothingOptions->smoothnessDistance());
+// \
tool->smoothingOptions()->setUseDelayDistance(syncObject->smoothingOptions->useDelayDistance());
+// \
tool->smoothingOptions()->setDelayDistance(syncObject->smoothingOptions->delayDistance());
+// \
tool->smoothingOptions()->setFinishStabilizedCurve(syncObject->smoothingOptions->finishStabilizedCurve());
+// \
tool->smoothingOptions()->setStabilizeSensors(syncObject->smoothingOptions->stabilizeSensors());
+// tool->updateSettingsViews();
+// }
+
+// KisCanvasResourceProvider* provider = d->view->resourceProvider();
+
+// provider->setMirrorHorizontal(syncObject->mirrorHorizontal);
+// provider->setMirrorVertical(syncObject->mirrorVertical);
+// //provider->resourceManager()->setResource(KisCanvasResourceProvider::MirrorAxesCenter, \
syncObject->mirrorAxesCenter); +
+// provider->setPaintOpPreset(syncObject->paintOp);
+// qApp->processEvents();
+
+// KoToolManager::instance()->switchToolRequested("InteractionTool");
+// qApp->processEvents();
+// KoToolManager::instance()->switchToolRequested(syncObject->activeToolId);
+// qApp->processEvents();
+
+// provider->setBGColor(syncObject->backgroundColor);
+// provider->setFGColor(syncObject->foregroundColor);
+// provider->setHDRExposure(syncObject->exposure);
+// provider->setHDRGamma(syncObject->gamma);
+// provider->slotPatternActivated(syncObject->pattern);
+// provider->slotGradientActivated(syncObject->gradient);
+// provider->slotNodeActivated(syncObject->node);
+// provider->setOpacity(syncObject->opacity);
+// provider->setGlobalAlphaLock(syncObject->globalAlphaLock);
+// provider->setCurrentCompositeOp(syncObject->compositeOp);
+
+// d->view->document()->setGridConfig(syncObject->gridConfig);
+
+// zoomIn();
+// qApp->processEvents();
+
+// d->view->zoomController()->setZoom(KoZoomMode::ZOOM_CONSTANT, \
syncObject->zoomLevel); +// \
controller->rotateCanvas(syncObject->rotationAngle - \
d->view->canvasBase()->rotationAngle()); +
+// qApp->processEvents();
+// QPoint newOffset = syncObject->documentOffset;
+// controller->setScrollBarValue(newOffset);
+// }
+
+// return true;
+// }
+// case KisTabletEvent::TabletPressEx:
+// case KisTabletEvent::TabletReleaseEx:
+// emit interactionStarted();
+// d->canvas->globalInputManager()->eventFilter(this, event);
+// return true;
+// case KisTabletEvent::TabletMoveEx:
+// d->tabletEventCount++; //Note that this will wraparound at some point; \
This is intentional. +//#ifdef Q_OS_X11
+// if(d->tabletEventCount % 2 == 0)
+//#endif
+// d->canvas->globalInputManager()->eventFilter(this, event);
+// return true;
+// case QEvent::KeyPress:
+// case QEvent::KeyRelease:
+// emit interactionStarted();
+// QApplication::sendEvent(d->view, event);
+// break;
+// default:
+// break;
+// }
+
+ return QQuickItem::event( event );
+}
+
+ // QT5TODO
+#if 0
+bool KisSketchView::sceneEvent(QEvent* event)
+{
+ if (d->canvas && d->canvasWidget) {
+ switch(event->type()) {
+ case QEvent::GraphicsSceneMousePress: {
+ QGraphicsSceneMouseEvent *gsmevent = \
static_cast<QGraphicsSceneMouseEvent*>(event); + QMouseEvent \
mevent(QMouseEvent::MouseButtonPress, gsmevent->pos().toPoint(), gsmevent->button(), \
gsmevent->buttons(), gsmevent->modifiers()); + \
QApplication::sendEvent(d->canvasWidget, &mevent); + emit \
interactionStarted(); + return true;
+ }
+ case QEvent::GraphicsSceneMouseMove: {
+ QGraphicsSceneMouseEvent *gsmevent = \
static_cast<QGraphicsSceneMouseEvent*>(event); + QMouseEvent \
mevent(QMouseEvent::MouseMove, gsmevent->pos().toPoint(), gsmevent->button(), \
gsmevent->buttons(), gsmevent->modifiers()); + \
QApplication::sendEvent(d->canvasWidget, &mevent); + update();
+ emit interactionStarted();
+ return true;
+ }
+ case QEvent::GraphicsSceneMouseRelease: {
+ QGraphicsSceneMouseEvent *gsmevent = \
static_cast<QGraphicsSceneMouseEvent*>(event); + QMouseEvent \
mevent(QMouseEvent::MouseButtonRelease, gsmevent->pos().toPoint(), \
gsmevent->button(), gsmevent->buttons(), gsmevent->modifiers()); + \
QApplication::sendEvent(d->canvasWidget, &mevent); + emit \
interactionStarted(); + return true;
+ }
+ case QEvent::GraphicsSceneWheel: {
+ QGraphicsSceneWheelEvent *gswevent = \
static_cast<QGraphicsSceneWheelEvent*>(event); + QWheelEvent \
wevent(gswevent->pos().toPoint(), gswevent->delta(), gswevent->buttons(), \
gswevent->modifiers(), gswevent->orientation()); + \
QApplication::sendEvent(d->canvasWidget, &wevent); + emit \
interactionStarted(); + return true;
+ }
+ case QEvent::GraphicsSceneHoverEnter: {
+ QGraphicsSceneHoverEvent *hevent = \
static_cast<QGraphicsSceneHoverEvent*>(event); + QHoverEvent \
e(QEvent::Enter, hevent->screenPos(), hevent->lastScreenPos()); + \
QApplication::sendEvent(d->canvasWidget, &e); + return true;
+ }
+ case QEvent::GraphicsSceneHoverLeave: {
+ QGraphicsSceneHoverEvent *hevent = \
static_cast<QGraphicsSceneHoverEvent*>(event); + QHoverEvent \
e(QEvent::Leave, hevent->screenPos(), hevent->lastScreenPos()); + \
QApplication::sendEvent(d->canvasWidget, &e); + return true;
+ }
+ case QEvent::TouchBegin: {
+ QApplication::sendEvent(d->canvasWidget, event);
+ event->accept();
+ emit interactionStarted();
+ return true;
+ }
+ case QEvent::TabletPress:
+ case QEvent::TabletMove:
+ case QEvent::TabletRelease:
+ d->canvas->globalInputManager()->stopIgnoringEvents();
+ QApplication::sendEvent(d->canvasWidget, event);
+ return true;
+ default:
+ if (QApplication::sendEvent(d->canvasWidget, event)) {
+ emit interactionStarted();
+ return true;
+ }
+ }
+ }
+ return QQuickItem::sceneEvent(event);
+}
+#endif
+void KisSketchView::geometryChanged(const QRectF& newGeometry, const QRectF& \
oldGeometry) +{
+ if (d->canvasWidget && !newGeometry.isEmpty()) {
+ d->view->resize(newGeometry.toRect().size());
+ // If we don't ask for this event to be sent, the view does not actually \
handle + // the resize, and we're stuck with a very oddly sized viewport
+ QResizeEvent *event = new QResizeEvent(newGeometry.toRect().size(), \
d->view->size()); + QApplication::sendEvent(d->view, event);
+ // This is a touch on the hackish side - i'm sure there's a better way of \
doing it + // but it's taking a long time to work it out. Problem: When \
switching orientation, + // the canvas is rendered wrong, in what looks like \
an off-by-one ish kind of fashion. + if (oldGeometry.height() == \
oldGeometry.width() && oldGeometry.height() == newGeometry.width()) { + // \
in this case, we've just rotated the display... do something useful! + // \
Turns out we get /two/ resize events per rotation, one one per setting each height \
and width. + // So we can't just check it normally. Annoying, but there \
you go. + QTimer::singleShot(100, this, SLOT(centerDoc()));
+ QTimer::singleShot(150, this, SLOT(zoomOut()));
+ }
+ if (oldGeometry.height() == oldGeometry.width() && oldGeometry.width() == \
newGeometry.height()) { + // in this case, we've just rotated the \
display... do something useful! + // Turns out we get /two/ resize events \
per rotation, one one per setting each height and width. + // So we can't \
just check it normally. Annoying, but there you go. + \
QTimer::singleShot(100, this, SLOT(centerDoc())); + \
QTimer::singleShot(150, this, SLOT(zoomOut())); + }
+ }
+}
+
+void KisSketchView::centerDoc()
+{
+ d->viewManager->zoomController()->setZoom(KoZoomMode::ZOOM_PAGE, 1.0);
+}
+
+void KisSketchView::Private::imageUpdated(const QRect &/*updated*/)
+{
+ // QT5TODO
+// if (q->scene()) {
+// q->scene()->views().at(0)->update(updated);
+// q->scene()->invalidate( 0, 0, q->width(), q->height() );
+// }
+}
+
+void KisSketchView::Private::documentOffsetMoved()
+{
+ // QT5TODO
+// if (q->scene()) {
+// q->scene()->views().at(0)->update();
+// q->scene()->invalidate( 0, 0, q->width(), q->height() );
+// }
+}
+
+void KisSketchView::Private::resetDocumentPosition()
+{
+ viewManager->zoomController()->setZoomMode(KoZoomMode::ZOOM_PAGE);
+
+ QPoint pos;
+ KisCanvasController *controller = \
dynamic_cast<KisCanvasController*>(viewManager->canvasBase()->canvasController()); +
+ if (!controller) return;
+
+ QScrollBar *sb = controller->horizontalScrollBar();
+ pos.rx() = sb->minimum() + (sb->maximum() - sb->minimum()) / 2;
+
+ sb = controller->verticalScrollBar();
+ pos.ry() = sb->minimum() + (sb->maximum() - sb->minimum()) / 2;
+
+ controller->setScrollBarValue(pos);
+
+}
+
+
+void KisSketchView::Private::removeNodeAsync(KisNodeSP removedNode)
+{
+ if (removedNode) {
+ imageUpdated(removedNode->extent());
+ }
+}
+
+void KisSketchView::Private::zoomChanged()
+{
+ // QT5TODO
+// if (q->scene()) {
+// q->scene()->views().at(0)->update();
+// q->scene()->invalidate( 0, 0, q->width(), q->height() );
+// }
+}
+
+void KisSketchView::activate()
+{
+ if (d->canvasWidget != d->canvas->canvasWidget()) {
+ d->canvasWidget = d->canvas->canvasWidget();
+ // QT5TODO
+// SketchDeclarativeView *v = \
qobject_cast<SketchDeclarativeView*>(scene()->views().at(0)); +// if (v) {
+// v->setCanvasWidget(d->canvasWidget);
+// v->setDrawCanvas(true);
+// }
+ }
+ d->canvasWidget->setFocus();
+ Q_ASSERT(d->viewManager);
+ KisCanvasController *controller = \
dynamic_cast<KisCanvasController*>(d->viewManager->canvasBase()->canvasController()); \
+ Q_ASSERT(controller); + controller->activate();
+}
+
+// for private slots
+#include "moc_KisSketchView.cpp"
diff --git a/libs/libqml/KisSketchView.h b/libs/libqml/KisSketchView.h
new file mode 100644
index 00000000000..4dda85b56ed
--- /dev/null
+++ b/libs/libqml/KisSketchView.h
@@ -0,0 +1,114 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2012 Boudewijn Rempt <boud@kogmbh.com>
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef KRITA_SKETCH_VIEW_H
+#define KRITA_SKETCH_VIEW_H
+
+#include <QQuickItem>
+
+#include "krita_sketch_export.h"
+
+class KRITA_SKETCH_EXPORT KisSketchView : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject *selectionManager READ selectionManager NOTIFY viewChanged)
+ Q_PROPERTY(QObject *selectionExtras READ selectionExtras NOTIFY viewChanged)
+ Q_PROPERTY(QObject *view READ view NOTIFY viewChanged)
+ Q_PROPERTY(QString file READ file WRITE setFile NOTIFY fileChanged)
+ Q_PROPERTY(QString fileTitle READ fileTitle NOTIFY fileChanged);
+ Q_PROPERTY(bool modified READ isModified NOTIFY modifiedChanged)
+
+ Q_PROPERTY(bool canUndo READ canUndo NOTIFY canUndoChanged);
+ Q_PROPERTY(bool canRedo READ canRedo NOTIFY canRedoChanged);
+
+ Q_PROPERTY(int imageHeight READ imageHeight NOTIFY imageSizeChanged)
+ Q_PROPERTY(int imageWidth READ imageWidth NOTIFY imageSizeChanged)
+
+public:
+ explicit KisSketchView(QQuickItem* parent = 0);
+ virtual ~KisSketchView();
+
+ QObject* selectionManager() const;
+ QObject* selectionExtras() const;
+ QObject* doc() const;
+ QObject* view() const;
+ QString file() const;
+ QString fileTitle() const;
+ bool isModified() const;
+
+ virtual void componentComplete();
+ virtual void geometryChanged(const QRectF& newGeometry, const QRectF& \
oldGeometry); +
+ void setFile(const QString &file);
+
+ void showFloatingMessage(const QString message, const QIcon& icon);
+
+ bool canUndo() const;
+ bool canRedo() const;
+
+ int imageHeight() const;
+ int imageWidth() const;
+public Q_SLOTS:
+ void undo();
+ void redo();
+
+ void zoomIn();
+ void zoomOut();
+
+ void save();
+ void saveAs(const QString& fileName, const QString& mimeType);
+
+ void documentAboutToBeDeleted();
+ void documentChanged();
+ void centerDoc();
+
+ void activate();
+
+Q_SIGNALS:
+ // This is directly forwarded from the document, which means that
+ // value 0-100 means in progress
+ // value -1 means completed
+ void progress(int value);
+ void viewChanged();
+ void fileChanged();
+ void modifiedChanged();
+ void floatingMessageRequested(const QString &message, const QString &iconName);
+ void interactionStarted();
+ void loadingFinished();
+ void savingFinished();
+ void canUndoChanged();
+ void canRedoChanged();
+ void imageSizeChanged();
+
+protected:
+ virtual bool event(QEvent* event);
+ // QT5TODO
+// virtual bool sceneEvent(QEvent* event);
+
+private:
+ class Private;
+ Private * const d;
+
+ Q_PRIVATE_SLOT(d, void imageUpdated(const QRect &updated))
+ Q_PRIVATE_SLOT(d, void documentOffsetMoved())
+ Q_PRIVATE_SLOT(d, void zoomChanged())
+ Q_PRIVATE_SLOT(d, void resetDocumentPosition())
+ Q_PRIVATE_SLOT(d, void removeNodeAsync(KisNodeSP removedNode))
+};
+
+#endif // KRITA_SKETCH_CANVAS_H
diff --git a/libs/libqml/plugins/CMakeLists.txt b/libs/libqml/plugins/CMakeLists.txt
index 5cb3f2262a9..b249361d6e4 100644
--- a/libs/libqml/plugins/CMakeLists.txt
+++ b/libs/libqml/plugins/CMakeLists.txt
@@ -1,2 +1,3 @@
add_subdirectory(draganddrop)
add_subdirectory(kritasketchplugin)
+install(DIRECTORY components DESTINATION ${QML_INSTALL_DIR}/org/krita/sketch \
PATTERN "*~" EXCLUDE)
diff --git a/libs/libqml/qml/components/BusyIndicator.qml \
b/libs/libqml/plugins/components/BusyIndicator.qml similarity index 100%
rename from libs/libqml/qml/components/BusyIndicator.qml
rename to libs/libqml/plugins/components/BusyIndicator.qml
diff --git a/libs/libqml/qml/components/Button.qml \
b/libs/libqml/plugins/components/Button.qml similarity index 100%
rename from libs/libqml/qml/components/Button.qml
rename to libs/libqml/plugins/components/Button.qml
diff --git a/libs/libqml/qml/components/CategorySwitcher.qml \
b/libs/libqml/plugins/components/CategorySwitcher.qml similarity index 100%
rename from libs/libqml/qml/components/CategorySwitcher.qml
rename to libs/libqml/plugins/components/CategorySwitcher.qml
diff --git a/libs/libqml/qml/components/CheckBox.qml \
b/libs/libqml/plugins/components/CheckBox.qml similarity index 100%
rename from libs/libqml/qml/components/CheckBox.qml
rename to libs/libqml/plugins/components/CheckBox.qml
diff --git a/libs/libqml/qml/components/ColorSwatch.qml \
b/libs/libqml/plugins/components/ColorSwatch.qml similarity index 100%
rename from libs/libqml/qml/components/ColorSwatch.qml
rename to libs/libqml/plugins/components/ColorSwatch.qml
diff --git a/libs/libqml/qml/components/Dialog.qml \
b/libs/libqml/plugins/components/Dialog.qml similarity index 100%
rename from libs/libqml/qml/components/Dialog.qml
rename to libs/libqml/plugins/components/Dialog.qml
diff --git a/libs/libqml/qml/components/Divider.qml \
b/libs/libqml/plugins/components/Divider.qml similarity index 100%
copy from libs/libqml/qml/components/Divider.qml
copy to libs/libqml/plugins/components/Divider.qml
diff --git a/libs/libqml/qml/components/DropShadow.qml \
b/libs/libqml/plugins/components/DropShadow.qml similarity index 100%
rename from libs/libqml/qml/components/DropShadow.qml
rename to libs/libqml/plugins/components/DropShadow.qml
diff --git a/libs/libqml/qml/components/ExpandingListView.qml \
b/libs/libqml/plugins/components/ExpandingListView.qml similarity index 100%
rename from libs/libqml/qml/components/ExpandingListView.qml
rename to libs/libqml/plugins/components/ExpandingListView.qml
diff --git a/libs/libqml/qml/components/Header.qml \
b/libs/libqml/plugins/components/Header.qml similarity index 100%
rename from libs/libqml/qml/components/Header.qml
rename to libs/libqml/plugins/components/Header.qml
diff --git a/libs/libqml/qml/components/Label.qml \
b/libs/libqml/plugins/components/Label.qml similarity index 100%
rename from libs/libqml/qml/components/Label.qml
rename to libs/libqml/plugins/components/Label.qml
diff --git a/libs/libqml/qml/components/ListItem.qml \
b/libs/libqml/plugins/components/ListItem.qml similarity index 100%
rename from libs/libqml/qml/components/ListItem.qml
rename to libs/libqml/plugins/components/ListItem.qml
diff --git a/libs/libqml/qml/components/MessageStack.qml \
b/libs/libqml/plugins/components/MessageStack.qml similarity index 100%
rename from libs/libqml/qml/components/MessageStack.qml
rename to libs/libqml/plugins/components/MessageStack.qml
diff --git a/libs/libqml/qml/components/NewImageList.qml \
b/libs/libqml/plugins/components/NewImageList.qml similarity index 100%
rename from libs/libqml/qml/components/NewImageList.qml
rename to libs/libqml/plugins/components/NewImageList.qml
diff --git a/libs/libqml/qml/components/NewsList.qml \
b/libs/libqml/plugins/components/NewsList.qml similarity index 100%
rename from libs/libqml/qml/components/NewsList.qml
rename to libs/libqml/plugins/components/NewsList.qml
diff --git a/libs/libqml/qml/components/Page.qml \
b/libs/libqml/plugins/components/Page.qml similarity index 100%
rename from libs/libqml/qml/components/Page.qml
rename to libs/libqml/plugins/components/Page.qml
diff --git a/libs/libqml/qml/components/PageStack.js \
b/libs/libqml/plugins/components/PageStack.js similarity index 100%
rename from libs/libqml/qml/components/PageStack.js
rename to libs/libqml/plugins/components/PageStack.js
diff --git a/libs/libqml/qml/components/PageStack.qml \
b/libs/libqml/plugins/components/PageStack.qml similarity index 100%
rename from libs/libqml/qml/components/PageStack.qml
rename to libs/libqml/plugins/components/PageStack.qml
diff --git a/libs/libqml/qml/components/PanelTextField.qml \
b/libs/libqml/plugins/components/PanelTextField.qml similarity index 100%
rename from libs/libqml/qml/components/PanelTextField.qml
rename to libs/libqml/plugins/components/PanelTextField.qml
diff --git a/libs/libqml/qml/components/RangeCombo.qml \
b/libs/libqml/plugins/components/RangeCombo.qml similarity index 100%
rename from libs/libqml/qml/components/RangeCombo.qml
rename to libs/libqml/plugins/components/RangeCombo.qml
diff --git a/libs/libqml/qml/components/RangeInput.qml \
b/libs/libqml/plugins/components/RangeInput.qml similarity index 100%
rename from libs/libqml/qml/components/RangeInput.qml
rename to libs/libqml/plugins/components/RangeInput.qml
diff --git a/libs/libqml/qml/components/RecentFilesList.qml \
b/libs/libqml/plugins/components/RecentFilesList.qml similarity index 100%
rename from libs/libqml/qml/components/RecentFilesList.qml
rename to libs/libqml/plugins/components/RecentFilesList.qml
diff --git a/libs/libqml/qml/components/ScrollDecorator.qml \
b/libs/libqml/plugins/components/ScrollDecorator.qml similarity index 100%
rename from libs/libqml/qml/components/ScrollDecorator.qml
rename to libs/libqml/plugins/components/ScrollDecorator.qml
diff --git a/libs/libqml/qml/components/Shadow.qml \
b/libs/libqml/plugins/components/Shadow.qml similarity index 100%
rename from libs/libqml/qml/components/Shadow.qml
rename to libs/libqml/plugins/components/Shadow.qml
diff --git a/libs/libqml/qml/components/Slider.qml \
b/libs/libqml/plugins/components/Slider.qml similarity index 100%
rename from libs/libqml/qml/components/Slider.qml
rename to libs/libqml/plugins/components/Slider.qml
diff --git a/libs/libqml/qml/components/TextField.qml \
b/libs/libqml/plugins/components/TextField.qml similarity index 100%
rename from libs/libqml/qml/components/TextField.qml
rename to libs/libqml/plugins/components/TextField.qml
diff --git a/libs/libqml/qml/components/TextFieldMultiline.qml \
b/libs/libqml/plugins/components/TextFieldMultiline.qml similarity index 100%
rename from libs/libqml/qml/components/TextFieldMultiline.qml
rename to libs/libqml/plugins/components/TextFieldMultiline.qml
diff --git a/libs/libqml/qml/components/Tooltip.qml \
b/libs/libqml/plugins/components/Tooltip.qml similarity index 100%
rename from libs/libqml/qml/components/Tooltip.qml
rename to libs/libqml/plugins/components/Tooltip.qml
diff --git a/libs/libqml/qml/components/VirtualKeyboard.qml \
b/libs/libqml/plugins/components/VirtualKeyboard.qml similarity index 100%
rename from libs/libqml/qml/components/VirtualKeyboard.qml
rename to libs/libqml/plugins/components/VirtualKeyboard.qml
diff --git a/libs/libqml/qml/components/qmldir \
b/libs/libqml/plugins/components/qmldir similarity index 100%
rename from libs/libqml/qml/components/qmldir
rename to libs/libqml/plugins/components/qmldir
diff --git a/libs/libqml/plugins/kritasketchplugin/Constants.cpp \
b/libs/libqml/plugins/kritasketchplugin/Constants.cpp index 111e4c79659..ada8529d99d \
100644
--- a/libs/libqml/plugins/kritasketchplugin/Constants.cpp
+++ b/libs/libqml/plugins/kritasketchplugin/Constants.cpp
@@ -25,8 +25,8 @@
Constants::Constants(QObject* parent)
: QObject(parent)
{
- m_gridWidth = qApp->activeWindow()->width() / gridColumns();
- m_gridHeight = qApp->activeWindow()->height() / gridHeight();
+// m_gridWidth = qApp->activeWindow()->width() / gridColumns();
+// m_gridHeight = qApp->activeWindow()->height() / gridHeight();
m_toolbarButtonSize = m_gridHeight;
}
@@ -103,9 +103,9 @@ qreal Constants::hugeFontSize() const
bool Constants::isLandscape() const
{
- // If user switches certain settings in windows, activeWindow can become null.
- if(qApp->activeWindow())
- return qApp->activeWindow()->height() > qApp->activeWindow()->width();
- return true;
+ // If user switches certain settings in windows, activeWindow can become null.
+ if(qApp->activeWindow())
+ return qApp->activeWindow()->height() > qApp->activeWindow()->width();
+ return true;
}
diff --git a/libs/libqml/plugins/kritasketchplugin/kritasketchplugin.cpp \
b/libs/libqml/plugins/kritasketchplugin/kritasketchplugin.cpp index \
eaeb736eb18..64e6ded3101 100644
--- a/libs/libqml/plugins/kritasketchplugin/kritasketchplugin.cpp
+++ b/libs/libqml/plugins/kritasketchplugin/kritasketchplugin.cpp
@@ -54,6 +54,7 @@
#include "PanelConfiguration.h"
#include "DocumentManager.h"
#include "kis_clipboard.h"
+#include "KisSketchView.h"
#include <QQmlEngine>
#include <QQmlContext>
@@ -89,6 +90,7 @@ static QObject *provideKritaRssModelObject(QQmlEngine *engine, \
QJSEngine *script
void KritaSketchPlugin::registerTypes(const char* uri)
{
+ qDebug() << "registerTypes();" << uri;
Q_UNUSED(uri)
Q_ASSERT(uri == QLatin1String("org.krita.sketch"));
qmlRegisterType<SimpleTouchArea>("org.krita.sketch", 1, 0, "SimpleTouchArea");
@@ -98,6 +100,7 @@ void KritaSketchPlugin::registerTypes(const char* uri)
qmlRegisterType<PaletteModel>("org.krita.sketch", 1, 0, "PaletteModel");
qmlRegisterType<PaletteColorsModel>("org.krita.sketch", 1, 0, \
"PaletteColorsModel");
qmlRegisterType<PresetModel>("org.krita.sketch", 1, 0, "PresetModel");
+ qmlRegisterType<KisSketchView>("org.krita.sketch", 1, 0, "SketchView");
qmlRegisterType<LayerModel>("org.krita.sketch", 1, 0, "LayerModel");
qmlRegisterType<FiltersCategoryModel>("org.krita.sketch", 1, 0, \
"FiltersCategoryModel");
qmlRegisterType<RecentImagesModel>("org.krita.sketch", 1, 0, \
"RecentImagesModel"); @@ -121,6 +124,8 @@ void KritaSketchPlugin::registerTypes(const \
char* uri)
void KritaSketchPlugin::initializeEngine(QQmlEngine* engine, const char* uri)
{
+ qDebug() << "initializeEngine();" << uri;
+
Q_UNUSED(uri)
Q_ASSERT(uri == QLatin1String("org.krita.sketch"));
// QT5TODO: seems to be run in thread other than the one of KritaSketchPlugin, \
so parenting directly not possible
diff --git a/libs/libqml/plugins/kritasketchplugin/kritasketchplugin.h \
b/libs/libqml/plugins/kritasketchplugin/kritasketchplugin.h index \
14bb0aa418c..0d748e6f8c2 100644
--- a/libs/libqml/plugins/kritasketchplugin/kritasketchplugin.h
+++ b/libs/libqml/plugins/kritasketchplugin/kritasketchplugin.h
@@ -28,7 +28,7 @@
class KritaSketchPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+ Q_PLUGIN_METADATA(IID "QQmlExtensionInterface_iid")
public:
virtual void registerTypes(const char* uri);
diff --git a/libs/libqml/qml.qrc b/libs/libqml/qml.qrc
deleted file mode 100644
index b50175cb57b..00000000000
--- a/libs/libqml/qml.qrc
+++ /dev/null
@@ -1,216 +0,0 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
-<qresource prefix="/">
-<file>qml/images/camera-web.png</file>
-<file>qml/images/red.png</file>
-<file>qml/images/edit-redo.png</file>
-<file>qml/images/help-about.png</file>
-<file>qml/images/document-share.png</file>
-<file>qml/images/document-open.png</file>
-<file>qml/images/busyindicator.png</file>
-<file>qml/images/header_krita_sketch_light.png</file>
-<file>qml/images/kritasketch.png</file>
-<file>qml/images/header_krita_sketch.png</file>
-<file>qml/images/document-save.png</file>
-<file>qml/images/edit-paste.png</file>
-<file>qml/images/shadow-bc.png</file>
-<file>qml/images/shadow-smooth.png</file>
-<file>qml/images/shadow-tr.png</file>
-<file>qml/images/divider.png</file>
-<file>qml/images/shadow-br.png</file>
-<file>qml/images/handle-menu.png</file>
-<file>qml/images/blue.png</file>
-<file>qml/images/svg/icon-filenew-black.svg</file>
-<file>qml/images/svg/icon-camera-black.svg</file>
-<file>qml/images/svg/icon-up.svg</file>
-<file>qml/images/svg/icon-erase.svg</file>
-<file>qml/images/svg/icon-filenew.svg</file>
-<file>qml/images/svg/icon-minimize.svg</file>
-<file>qml/images/svg/icon-transform.svg</file>
-<file>qml/images/svg/icon-select-replace.svg</file>
-<file>qml/images/svg/checker-small.svg</file>
-<file>qml/images/svg/icon-filesaveas.svg</file>
-<file>qml/images/svg/icon-move-black.svg</file>
-<file>qml/images/svg/icon-paint.svg</file>
-<file>qml/images/svg/icon-fill.svg</file>
-<file>qml/images/svg/icon-select-polygon.svg</file>
-<file>qml/images/svg/icon-paint-black.svg</file>
-<file>qml/images/svg/icon-filter_save-black.svg</file>
-<file>qml/images/svg/icon-select-show.svg</file>
-<file>qml/images/svg/icon-fileopen.svg</file>
-<file>qml/images/svg/icon-locked_on-black.svg</file>
-<file>qml/images/svg/icon-delete-black.svg</file>
-<file>qml/images/svg/icon-redo.svg</file>
-<file>qml/images/svg/icon-palette-add-black.svg</file>
-<file>qml/images/svg/icon-add-black.svg</file>
-<file>qml/images/svg/icon-mirror_c-black.svg</file>
-<file>qml/images/svg/icon-palette-black.svg</file>
-<file>qml/images/svg/icon-A4portrait-black.svg</file>
-<file>qml/images/svg/icon-gradient-black.svg</file>
-<file>qml/images/svg/icon-locked_off-black.svg</file>
-<file>qml/images/svg/icon-mirror_v-black.svg</file>
-<file>qml/images/svg/icon-visible_on.svg</file>
-<file>qml/images/svg/icon-fill-black.svg</file>
-<file>qml/images/svg/icon-select-add.svg</file>
-<file>qml/images/svg/icon-visible_off-black.svg</file>
-<file>qml/images/svg/combo-arrows-white.svg</file>
-<file>qml/images/svg/icon-filter_load-black.svg</file>
-<file>qml/images/svg/icon-delete.svg</file>
-<file>qml/images/svg/icon-crop.svg</file>
-<file>qml/images/svg/icon-undo.svg</file>
-<file>qml/images/svg/icon-apply.svg</file>
-<file>qml/images/svg/icon-move.svg</file>
-<file>qml/images/svg/icon-color_wheel.svg</file>
-<file>qml/images/svg/icon-select-area.svg</file>
-<file>qml/images/svg/icon-palette-delete-black.svg</file>
-<file>qml/images/svg/icon-fileclip-black.svg</file>
-<file>qml/images/svg/icon-filesave.svg</file>
-<file>qml/images/svg/icon-palette.svg</file>
-<file>qml/images/svg/icon-mirror_h-black.svg</file>
-<file>qml/images/svg/icon-down.svg</file>
-<file>qml/images/svg/icon-layer_filter-black.svg</file>
-<file>qml/images/svg/icon-select-apply.svg</file>
-<file>qml/images/svg/icon-krita_sketch.svg</file>
-<file>qml/images/svg/icon-apply-black.svg</file>
-<file>qml/images/svg/icon-select-hide.svg</file>
-<file>qml/images/svg/icon-select-color.svg</file>
-<file>qml/images/svg/icon-back.svg</file>
-<file>qml/images/svg/icon-layer_paint-black.svg</file>
-<file>qml/images/svg/icon-add.svg</file>
-<file>qml/images/svg/icon-select-reselect.svg</file>
-<file>qml/images/svg/icon-select-intersect.svg</file>
-<file>qml/images/svg/icon-edit.svg</file>
-<file>qml/images/svg/icon-visible_off.svg</file>
-<file>qml/images/svg/icon-cancel-black.svg</file>
-<file>qml/images/svg/icon-select-sub.svg</file>
-<file>qml/images/svg/icon-colorpicker.svg</file>
-<file>qml/images/svg/icon-forward.svg</file>
-<file>qml/images/svg/icon-A4landscape-black.svg</file>
-<file>qml/images/svg/icon-layer_group-black.svg</file>
-<file>qml/images/svg/icon-close.svg</file>
-<file>qml/images/svg/icon-select-deselect.svg</file>
-<file>qml/images/svg/icon-settings.svg</file>
-<file>qml/images/svg/icon-fileshare.svg</file>
-<file>qml/images/svg/icon-select-rectangle.svg</file>
-<file>qml/images/svg/icon-gradient.svg</file>
-<file>qml/images/svg/icon-filter_delete-black.svg</file>
-<file>qml/images/svg/icon-visible_on-black.svg</file>
-<file>qml/images/svg/icon-crop-black.svg</file>
-<file>qml/images/svg/icon-fileopen-black.svg</file>
-<file>qml/images/svg/icon-web.svg</file>
-<file>qml/images/svg/icon-help.svg</file>
-<file>qml/images/svg/icon-switch.svg</file>
-<file>qml/images/svg/icon-transform-black.svg</file>
-<file>qml/images/green.png</file>
-<file>qml/images/krita.png</file>
-<file>qml/images/image-x-generic.png</file>
-<file>qml/images/divider2.png</file>
-<file>qml/images/edit-copy.png</file>
-<file>qml/images/document-new.png</file>
-<file>qml/images/configure.png</file>
-<file>qml/images/edit-select.png</file>
-<file>qml/images/header_red.png</file>
-<file>qml/images/edit-undo.png</file>
-<file>qml/images/shadow-rc.png</file>
-<file>qml/images/document-save-as.png</file>
-<file>qml/images/shadow-tc.png</file>
-<file>qml/images/shadow-lc.png</file>
-<file>qml/images/shadow-bl.png</file>
-<file>qml/images/edit-cut.png</file>
-<file>qml/images/shadow-tl.png</file>
-<file>qml/KritaSketchBase.qml</file>
-<file>qml/CustomImagePage.qml</file>
-<file>qml/components/CheckBox.qml</file>
-<file>qml/components/PageStack.js</file>
-<file>qml/components/NewsList.qml</file>
-<file>qml/components/DropShadow.qml</file>
-<file>qml/components/ListItem.qml</file>
-<file>qml/components/TextField.qml</file>
-<file>qml/components/BusyIndicator.qml</file>
-<file>qml/components/ScrollDecorator.qml</file>
-<file>qml/components/ColorSwatch.qml</file>
-<file>qml/components/TextFieldMultiline.qml</file>
-<file>qml/components/ExpandingListView.qml</file>
-<file>qml/components/VirtualKeyboard.qml</file>
-<file>qml/components/Header.qml</file>
-<file>qml/components/RangeInput.qml</file>
-<file>qml/components/qmldir</file>
-<file>qml/components/Page.qml</file>
-<file>qml/components/Label.qml</file>
-<file>qml/components/Shadow.qml</file>
-<file>qml/components/CategorySwitcher.qml</file>
-<file>qml/components/MessageStack.qml</file>
-<file>qml/components/NewImageList.qml</file>
-<file>qml/components/PanelTextField.qml</file>
-<file>qml/components/Dialog.qml</file>
-<file>qml/components/Button.qml</file>
-<file>qml/components/Slider.qml</file>
-<file>qml/components/PageStack.qml</file>
-<file>qml/components/Tooltip.qml</file>
-<file>qml/components/RecentFilesList.qml</file>
-<file>qml/components/Divider.qml</file>
-<file>qml/components/RangeCombo.qml</file>
-<file>qml/HelpPage.qml</file>
-<file>qml/SettingsPage.qml</file>
-<file>qml/SaveImagePage.qml</file>
-<file>qml/WelcomePage.qml</file>
-<file>qml/panels/EditLayerPage.qml</file>
-<file>qml/panels/toolconfigpages</file>
-<file>qml/panels/toolconfigpages/paint.qml</file>
-<file>qml/panels/toolconfigpages/fill.qml</file>
-<file>qml/panels/toolconfigpages/transform.qml</file>
-<file>qml/panels/toolconfigpages/move.qml</file>
-<file>qml/panels/toolconfigpages/gradient.qml</file>
-<file>qml/panels/toolconfigpages/crop.qml</file>
-<file>qml/panels/tooloverlays</file>
-<file>qml/panels/tooloverlays/select.qml</file>
-<file>qml/panels/tooloverlays/transform.qml</file>
-<file>qml/panels/tooloverlays/none.qml</file>
-<file>qml/panels/tooloverlays/move.qml</file>
-<file>qml/panels/FilterPanel.qml</file>
-<file>qml/panels/NewImagePanel.qml</file>
-<file>qml/panels/SelectPanel.qml</file>
-<file>qml/panels/MenuPanel.qml</file>
-<file>qml/panels/EditPresetPage.qml</file>
-<file>qml/panels/PanelDropArea.qml</file>
-<file>qml/panels/ToolOverlayPanel.qml</file>
-<file>qml/panels/Panel.qml</file>
-<file>qml/panels/LayersPanel.qml</file>
-<file>qml/panels/PresetsPanel.qml</file>
-<file>qml/panels/filterconfigpages</file>
-<file>qml/panels/filterconfigpages/wave.qml</file>
-<file>qml/panels/filterconfigpages/motion blur.qml</file>
-<file>qml/panels/filterconfigpages/emboss.qml</file>
-<file>qml/panels/filterconfigpages/gaussian blur.qml</file>
-<file>qml/panels/filterconfigpages/nothing-to-configure.qml</file>
-<file>qml/panels/filterconfigpages/blur.qml</file>
-<file>qml/panels/filterconfigpages/phongbumpmap.qml</file>
-<file>qml/panels/filterconfigpages/perchannel.qml</file>
-<file>qml/panels/filterconfigpages/waveletnoisereducer.qml</file>
-<file>qml/panels/filterconfigpages/pixelize.qml</file>
-<file>qml/panels/filterconfigpages/colortransfer.qml</file>
-<file>qml/panels/filterconfigpages/gaussiannoisereducer.qml</file>
-<file>qml/panels/filterconfigpages/randompick.qml</file>
-<file>qml/panels/filterconfigpages/roundcorners.qml</file>
-<file>qml/panels/filterconfigpages/levels.qml</file>
-<file>qml/panels/filterconfigpages/noise.qml</file>
-<file>qml/panels/filterconfigpages/unsharp.qml</file>
-<file>qml/panels/filterconfigpages/hsvadjustment.qml</file>
-<file>qml/panels/filterconfigpages/lens blur.qml</file>
-<file>qml/panels/filterconfigpages/colortoalpha.qml</file>
-<file>qml/panels/filterconfigpages/sobel.qml</file>
-<file>qml/panels/filterconfigpages/oilpaint.qml</file>
-<file>qml/panels/filterconfigpages/raindrops.qml</file>
-<file>qml/panels/filterconfigpages/brightnesscontrast.qml</file>
-<file>qml/panels/filterconfigpages/NoConfigNeeded.qml</file>
-<file>qml/panels/filterconfigpages/smalltiles.qml</file>
-<file>qml/panels/filterconfigpages/burn.qml</file>
-<file>qml/panels/filterconfigpages/dodge.qml</file>
-<file>qml/panels/OpenImagePanel.qml</file>
-<file>qml/panels/ColorPanel.qml</file>
-<file>qml/panels/PanelBar.qml</file>
-<file>qml/panels/ToolPanel.qml</file>
-<file>qml/OpenImagePage.qml</file>
-<file>qml/MainPage.qml</file>
-</qresource>
-</RCC>
diff --git a/libs/libqml/qml/qml.qrc b/libs/libqml/qml/qml.qrc
new file mode 100644
index 00000000000..fbc76f3c884
--- /dev/null
+++ b/libs/libqml/qml/qml.qrc
@@ -0,0 +1,186 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+<qresource prefix="/">
+<file>images/camera-web.png</file>
+<file>images/red.png</file>
+<file>images/edit-redo.png</file>
+<file>images/help-about.png</file>
+<file>images/document-share.png</file>
+<file>images/document-open.png</file>
+<file>images/busyindicator.png</file>
+<file>images/header_krita_sketch_light.png</file>
+<file>images/kritasketch.png</file>
+<file>images/header_krita_sketch.png</file>
+<file>images/document-save.png</file>
+<file>images/edit-paste.png</file>
+<file>images/shadow-bc.png</file>
+<file>images/shadow-smooth.png</file>
+<file>images/shadow-tr.png</file>
+<file>images/divider.png</file>
+<file>images/shadow-br.png</file>
+<file>images/handle-menu.png</file>
+<file>images/blue.png</file>
+<file>images/svg/icon-filenew-black.svg</file>
+<file>images/svg/icon-camera-black.svg</file>
+<file>images/svg/icon-up.svg</file>
+<file>images/svg/icon-erase.svg</file>
+<file>images/svg/icon-filenew.svg</file>
+<file>images/svg/icon-minimize.svg</file>
+<file>images/svg/icon-transform.svg</file>
+<file>images/svg/icon-select-replace.svg</file>
+<file>images/svg/checker-small.svg</file>
+<file>images/svg/icon-filesaveas.svg</file>
+<file>images/svg/icon-move-black.svg</file>
+<file>images/svg/icon-paint.svg</file>
+<file>images/svg/icon-fill.svg</file>
+<file>images/svg/icon-select-polygon.svg</file>
+<file>images/svg/icon-paint-black.svg</file>
+<file>images/svg/icon-filter_save-black.svg</file>
+<file>images/svg/icon-select-show.svg</file>
+<file>images/svg/icon-fileopen.svg</file>
+<file>images/svg/icon-locked_on-black.svg</file>
+<file>images/svg/icon-delete-black.svg</file>
+<file>images/svg/icon-redo.svg</file>
+<file>images/svg/icon-palette-add-black.svg</file>
+<file>images/svg/icon-add-black.svg</file>
+<file>images/svg/icon-mirror_c-black.svg</file>
+<file>images/svg/icon-palette-black.svg</file>
+<file>images/svg/icon-A4portrait-black.svg</file>
+<file>images/svg/icon-gradient-black.svg</file>
+<file>images/svg/icon-locked_off-black.svg</file>
+<file>images/svg/icon-mirror_v-black.svg</file>
+<file>images/svg/icon-visible_on.svg</file>
+<file>images/svg/icon-fill-black.svg</file>
+<file>images/svg/icon-select-add.svg</file>
+<file>images/svg/icon-visible_off-black.svg</file>
+<file>images/svg/combo-arrows-white.svg</file>
+<file>images/svg/icon-filter_load-black.svg</file>
+<file>images/svg/icon-delete.svg</file>
+<file>images/svg/icon-crop.svg</file>
+<file>images/svg/icon-undo.svg</file>
+<file>images/svg/icon-apply.svg</file>
+<file>images/svg/icon-move.svg</file>
+<file>images/svg/icon-color_wheel.svg</file>
+<file>images/svg/icon-select-area.svg</file>
+<file>images/svg/icon-palette-delete-black.svg</file>
+<file>images/svg/icon-fileclip-black.svg</file>
+<file>images/svg/icon-filesave.svg</file>
+<file>images/svg/icon-palette.svg</file>
+<file>images/svg/icon-mirror_h-black.svg</file>
+<file>images/svg/icon-down.svg</file>
+<file>images/svg/icon-layer_filter-black.svg</file>
+<file>images/svg/icon-select-apply.svg</file>
+<file>images/svg/icon-krita_sketch.svg</file>
+<file>images/svg/icon-apply-black.svg</file>
+<file>images/svg/icon-select-hide.svg</file>
+<file>images/svg/icon-select-color.svg</file>
+<file>images/svg/icon-back.svg</file>
+<file>images/svg/icon-layer_paint-black.svg</file>
+<file>images/svg/icon-add.svg</file>
+<file>images/svg/icon-select-reselect.svg</file>
+<file>images/svg/icon-select-intersect.svg</file>
+<file>images/svg/icon-edit.svg</file>
+<file>images/svg/icon-visible_off.svg</file>
+<file>images/svg/icon-cancel-black.svg</file>
+<file>images/svg/icon-select-sub.svg</file>
+<file>images/svg/icon-colorpicker.svg</file>
+<file>images/svg/icon-forward.svg</file>
+<file>images/svg/icon-A4landscape-black.svg</file>
+<file>images/svg/icon-layer_group-black.svg</file>
+<file>images/svg/icon-close.svg</file>
+<file>images/svg/icon-select-deselect.svg</file>
+<file>images/svg/icon-settings.svg</file>
+<file>images/svg/icon-fileshare.svg</file>
+<file>images/svg/icon-select-rectangle.svg</file>
+<file>images/svg/icon-gradient.svg</file>
+<file>images/svg/icon-filter_delete-black.svg</file>
+<file>images/svg/icon-visible_on-black.svg</file>
+<file>images/svg/icon-crop-black.svg</file>
+<file>images/svg/icon-fileopen-black.svg</file>
+<file>images/svg/icon-web.svg</file>
+<file>images/svg/icon-help.svg</file>
+<file>images/svg/icon-switch.svg</file>
+<file>images/svg/icon-transform-black.svg</file>
+<file>images/green.png</file>
+<file>images/krita.png</file>
+<file>images/image-x-generic.png</file>
+<file>images/divider2.png</file>
+<file>images/edit-copy.png</file>
+<file>images/document-new.png</file>
+<file>images/configure.png</file>
+<file>images/edit-select.png</file>
+<file>images/header_red.png</file>
+<file>images/edit-undo.png</file>
+<file>images/shadow-rc.png</file>
+<file>images/document-save-as.png</file>
+<file>images/shadow-tc.png</file>
+<file>images/shadow-lc.png</file>
+<file>images/shadow-bl.png</file>
+<file>images/edit-cut.png</file>
+<file>images/shadow-tl.png</file>
+<file>KritaSketchBase.qml</file>
+<file>CustomImagePage.qml</file>
+<file>HelpPage.qml</file>
+<file>SettingsPage.qml</file>
+<file>SaveImagePage.qml</file>
+<file>WelcomePage.qml</file>
+<file>panels/EditLayerPage.qml</file>
+<file>panels/toolconfigpages</file>
+<file>panels/toolconfigpages/paint.qml</file>
+<file>panels/toolconfigpages/fill.qml</file>
+<file>panels/toolconfigpages/transform.qml</file>
+<file>panels/toolconfigpages/move.qml</file>
+<file>panels/toolconfigpages/gradient.qml</file>
+<file>panels/toolconfigpages/crop.qml</file>
+<file>panels/tooloverlays</file>
+<file>panels/tooloverlays/select.qml</file>
+<file>panels/tooloverlays/transform.qml</file>
+<file>panels/tooloverlays/none.qml</file>
+<file>panels/tooloverlays/move.qml</file>
+<file>panels/FilterPanel.qml</file>
+<file>panels/NewImagePanel.qml</file>
+<file>panels/SelectPanel.qml</file>
+<file>panels/MenuPanel.qml</file>
+<file>panels/EditPresetPage.qml</file>
+<file>panels/PanelDropArea.qml</file>
+<file>panels/ToolOverlayPanel.qml</file>
+<file>panels/Panel.qml</file>
+<file>panels/LayersPanel.qml</file>
+<file>panels/PresetsPanel.qml</file>
+<file>panels/filterconfigpages</file>
+<file>panels/filterconfigpages/wave.qml</file>
+<file>panels/filterconfigpages/motion blur.qml</file>
+<file>panels/filterconfigpages/emboss.qml</file>
+<file>panels/filterconfigpages/gaussian blur.qml</file>
+<file>panels/filterconfigpages/nothing-to-configure.qml</file>
+<file>panels/filterconfigpages/blur.qml</file>
+<file>panels/filterconfigpages/phongbumpmap.qml</file>
+<file>panels/filterconfigpages/perchannel.qml</file>
+<file>panels/filterconfigpages/waveletnoisereducer.qml</file>
+<file>panels/filterconfigpages/pixelize.qml</file>
+<file>panels/filterconfigpages/colortransfer.qml</file>
+<file>panels/filterconfigpages/gaussiannoisereducer.qml</file>
+<file>panels/filterconfigpages/randompick.qml</file>
+<file>panels/filterconfigpages/roundcorners.qml</file>
+<file>panels/filterconfigpages/levels.qml</file>
+<file>panels/filterconfigpages/noise.qml</file>
+<file>panels/filterconfigpages/unsharp.qml</file>
+<file>panels/filterconfigpages/hsvadjustment.qml</file>
+<file>panels/filterconfigpages/lens blur.qml</file>
+<file>panels/filterconfigpages/colortoalpha.qml</file>
+<file>panels/filterconfigpages/sobel.qml</file>
+<file>panels/filterconfigpages/oilpaint.qml</file>
+<file>panels/filterconfigpages/raindrops.qml</file>
+<file>panels/filterconfigpages/brightnesscontrast.qml</file>
+<file>panels/filterconfigpages/NoConfigNeeded.qml</file>
+<file>panels/filterconfigpages/smalltiles.qml</file>
+<file>panels/filterconfigpages/burn.qml</file>
+<file>panels/filterconfigpages/dodge.qml</file>
+<file>panels/OpenImagePanel.qml</file>
+<file>panels/ColorPanel.qml</file>
+<file>panels/PanelBar.qml</file>
+<file>panels/ToolPanel.qml</file>
+<file>OpenImagePage.qml</file>
+<file>MainPage.qml</file>
+</qresource>
+</RCC>
diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp
index fc743809ae5..469b947ecbf 100644
--- a/libs/ui/KisApplication.cpp
+++ b/libs/ui/KisApplication.cpp
@@ -437,7 +437,12 @@ bool KisApplication::start(const KisApplicationArguments &args)
m_mainWindow->viewManager()->switchCanvasOnly(true);
}
- m_mainWindow->show();
+ if (args.fullScreen()) {
+ m_mainWindow->showFullScreen();
+ }
+ else {
+ m_mainWindow->show();
+ }
}
}
short int numberOfOpenDocuments = 0; // number of documents open
diff --git a/libs/widgetutils/KoResourcePaths.cpp \
b/libs/widgetutils/KoResourcePaths.cpp index f57b9428a5a..a028c5a559f 100644
--- a/libs/widgetutils/KoResourcePaths.cpp
+++ b/libs/widgetutils/KoResourcePaths.cpp
@@ -114,9 +114,23 @@ QString getInstallationPrefix() {
debugWidgetUtils << ">>>>>>>>>>>" << bundlePath;
return bundlePath;
- #else
- return qApp->applicationDirPath() + "/../";
- #endif
+#else
+ #ifdef Q_OS_QWIN
+ QDir appdir(qApp->applicationDirPath());
+
+ // Corrects for mismatched case errors in path (qtdeclarative fails to load)
+ wchar_t buffer[1024];
+ QString absolute = appdir.absolutePath();
+ DWORD rv = ::GetShortPathName((wchar_t*)absolute.utf16(), buffer, 1024);
+ rv = ::GetLongPathName(buffer, buffer, 1024);
+ QString correctedPath((QChar *)buffer);
+ appdir.setPath(correctedPath);
+ appdir.cdUp();
+ return appdir.canonicalPath();
+ #else
+ return qApp->applicationDirPath() + "/../";
+ #endif
+#endif
}
class Q_DECL_HIDDEN KoResourcePaths::Private {
@@ -312,7 +326,7 @@ QString KoResourcePaths::findResourceInternal(const QString \
&type, const QString }
}
}
- if (resource.isEmpty() || !QFile::exists(resource)) {
+ if (resource.isEmpty() || !QFile::exists(resource)) {
QString approot = getApplicationRoot();
Q_FOREACH (const QString &alias, aliases) {
resource = approot + "/share/krita/" + alias + '/' + fileName;
diff --git a/plugins/dockers/touchdocker/TouchDockerDock.cpp \
b/plugins/dockers/touchdocker/TouchDockerDock.cpp index 03df5e2cd94..c5363fc48f5 \
100644
--- a/plugins/dockers/touchdocker/TouchDockerDock.cpp
+++ b/plugins/dockers/touchdocker/TouchDockerDock.cpp
@@ -18,28 +18,103 @@
#include "TouchDockerDock.h"
#include <QtQuickWidgets/QQuickWidget>
+#include <QQmlEngine>
+#include <QQmlContext>
#include <QAction>
+
#include <klocalizedstring.h>
#include <kactioncollection.h>
+
+#include <KoResourcePaths.h>
#include <kis_icon.h>
#include <KoCanvasBase.h>
#include <KisViewManager.h>
#include <kis_canvas2.h>
#include <KisMainWindow.h>
+#include <KisViewManager.h>
+
+class TouchDockerDock::Private
+{
+public:
+ Private()
+ {
+ }
+
+ TouchDockerDock *q;
+ bool allowClose {true};
+ KisViewManager *viewManager {0};
+ QString currentSketchPage;
+};
+
TouchDockerDock::TouchDockerDock( )
: QDockWidget(i18n("Touch Docker"))
+ , d(new Private())
{
- QQuickWidget *widget = new QQuickWidget(this);
- setWidget(widget);
+ m_quickWidget = new QQuickWidget(this);
+ setWidget(m_quickWidget);
setEnabled(true);
- widget->setSource(QUrl("qrc:/hello.qml"));
+ m_quickWidget->engine()->rootContext()->setContextProperty("mainWindow", this);
+
+ m_quickWidget->engine()->addImportPath(KoResourcePaths::getApplicationRoot() + \
"/lib/qml/"); + m_quickWidget->engine()->addImportPath(KoResourcePaths::getApplicationRoot() \
+ "/lib64/qml/"); +
+ m_quickWidget->setSource(QUrl("qrc:/kritasketch.qml"));
+ m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
+
}
TouchDockerDock::~TouchDockerDock()
{
}
+bool TouchDockerDock::allowClose() const
+{
+ return d->allowClose;
+}
+
+void TouchDockerDock::setAllowClose(bool allow)
+{
+ d->allowClose = allow;
+}
+
+QString TouchDockerDock::currentSketchPage() const
+{
+ return d->currentSketchPage;
+}
+
+void TouchDockerDock::setCurrentSketchPage(QString newPage)
+{
+ d->currentSketchPage = newPage;
+ emit currentSketchPageChanged();
+}
+
+void TouchDockerDock::closeEvent(QCloseEvent* event)
+{
+ if (!d->allowClose) {
+ event->ignore();
+ emit closeRequested();
+ } else {
+ event->accept();
+ }
+}
+
+QObject *TouchDockerDock::sketchKisView() const
+{
+ return d->viewManager;
+}
+
+void TouchDockerDock::setSketchKisView(QObject* newView)
+{
+ if (d->viewManager) {
+ d->viewManager->disconnect(this);
+ }
+
+ if (d->viewManager != newView) {
+ d->viewManager = qobject_cast<KisViewManager*>(newView);
+ emit sketchKisViewChanged(); }
+}
+
void TouchDockerDock::setCanvas(KoCanvasBase *canvas)
{
setEnabled(true);
diff --git a/plugins/dockers/touchdocker/TouchDockerDock.h \
b/plugins/dockers/touchdocker/TouchDockerDock.h index 9170c18170b..c8515a4a012 100644
--- a/plugins/dockers/touchdocker/TouchDockerDock.h
+++ b/plugins/dockers/touchdocker/TouchDockerDock.h
@@ -22,9 +22,14 @@
#include <KoCanvasObserverBase.h>
class KisCanvas2;
+class QQuickWidget;
class TouchDockerDock : public QDockWidget, public KoCanvasObserverBase {
Q_OBJECT
+ Q_PROPERTY(bool allowClose READ allowClose WRITE setAllowClose)
+ Q_PROPERTY(QString currentSketchPage READ currentSketchPage WRITE \
setCurrentSketchPage NOTIFY currentSketchPageChanged) + Q_PROPERTY(QObject* \
sketchKisView READ sketchKisView WRITE setSketchKisView NOTIFY sketchKisViewChanged) \
+ public:
TouchDockerDock();
~TouchDockerDock() override;
@@ -32,8 +37,29 @@ public:
void setCanvas(KoCanvasBase *canvas) override;
void unsetCanvas() override;
+ bool allowClose() const;
+ void setAllowClose(bool allow);
+
+ QString currentSketchPage() const;
+ void setCurrentSketchPage(QString newPage);
+
+ QObject *sketchKisView() const;
+ void setSketchKisView(QObject *newView);
+
+ virtual void closeEvent(QCloseEvent *event);
+
+Q_SIGNALS:
+ void closeRequested();
+ void currentSketchPageChanged();
+ void sketchKisViewChanged();
+
private:
KisCanvas2 *m_canvas {0};
+ QQuickWidget *m_quickWidget {0};
+
+ class Private;
+ const QScopedPointer<Private> d;
+
};
diff --git a/libs/libqml/qml/components/Divider.qml \
b/plugins/dockers/touchdocker/qml/kritasketch.qml similarity index 65%
rename from libs/libqml/qml/components/Divider.qml
rename to plugins/dockers/touchdocker/qml/kritasketch.qml
index 40af81e3609..a47dfb1774f 100644
--- a/libs/libqml/qml/components/Divider.qml
+++ b/plugins/dockers/touchdocker/qml/kritasketch.qml
@@ -17,8 +17,14 @@
*/
import QtQuick 2.3
+import org.krita.sketch 1.0
-Image {
- width: 8;
- source: Settings.theme.image("divider.png");
+KritaSketchBase {
+// TODO: presetting size with certain values somehow sometimes results in bad values
+// for grid width/height values and thus a sometimes broken welcome screen, this \
calculation seems fragile +// width: 1280;
+// height: 768;
+ onWidthChanged: Constants.setGridWidth( width / Constants.GridColumns );
+ onHeightChanged: Constants.setGridHeight( height / Constants.GridRows );
+ window: mainWindow;
}
diff --git a/plugins/dockers/touchdocker/touchdocker.qrc \
b/plugins/dockers/touchdocker/touchdocker.qrc index bf306498f47..466e58e3774 100644
--- a/plugins/dockers/touchdocker/touchdocker.qrc
+++ b/plugins/dockers/touchdocker/touchdocker.qrc
@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/">
- <file alias="hello.qml">qml/hello.qml</file>
+ <file alias="kritasketch.qml">qml/kritasketch.qml</file>
</qresource>
</RCC>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic