From ca08f6662838c96bb86ea6aa8d5d63504c39c4d4 Mon Sep 17 00:00:00 2001 From: manuel keglevic Date: Tue, 9 Oct 2018 17:23:07 +0200 Subject: [PATCH] fixed PatchMatchingPlugin compile errors --- .../src/DkPatchMatchingPlugin.cpp | 40 +++++++------------ .../src/DkPatchMatchingPlugin.h | 6 ++- .../src/DkPatchMatchingPlugin.json | 2 +- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/PatchMatchingPlugin/src/DkPatchMatchingPlugin.cpp b/PatchMatchingPlugin/src/DkPatchMatchingPlugin.cpp index 8b118e1..fbbde4a 100644 --- a/PatchMatchingPlugin/src/DkPatchMatchingPlugin.cpp +++ b/PatchMatchingPlugin/src/DkPatchMatchingPlugin.cpp @@ -73,18 +73,16 @@ namespace nmp { qDebug() << "Get viewport"; - if (!mViewport) { - mViewport = new DkPatchMatchingViewPort; - } + return mViewport; } - void DkPatchMatchingPlugin::deleteViewPort() { - - if (mViewport) { - mViewport->deleteLater(); - mViewport = nullptr; + bool DkPatchMatchingPlugin::createViewPort(QWidget * parent) + { + if (!mViewport) { + mViewport = new DkPatchMatchingViewPort; } + return mViewport != 0; } bool DkPatchMatchingPlugin::closesOnImageChange() const @@ -92,6 +90,11 @@ namespace nmp { return false; } + void DkPatchMatchingPlugin::setVisible(bool visible) + { + mViewport->setVisible(visible); + } + /*-----------------------------------DkPatchMatchingViewPort ---------------------------------------------*/ DkPatchMatchingViewPort::DkPatchMatchingViewPort(QWidget* parent, Qt::WindowFlags flags) @@ -220,7 +223,7 @@ namespace nmp { void DkPatchMatchingViewPort::saveSettings() const { - QSettings& settings = nmc::DkSettingsManager::instance().qSettings(); + nmc::DefaultSettings settings; settings.beginGroup(objectName()); settings.setValue("StepSize", mtoolbar->getStepSize()); @@ -241,7 +244,7 @@ namespace nmp { void DkPatchMatchingViewPort::loadSettings() { - QSettings& settings = nmc::DkSettingsManager::instance().qSettings(); + nmc::DefaultSettings settings; settings.beginGroup(objectName()); mtoolbar->setStepSize(settings.value("StepSize", 50).toInt()); @@ -559,7 +562,7 @@ namespace nmp { void DkPatchMatchingViewPort::setVisible(bool visible) { if (mtoolbar) - emit DkPluginViewPort::showToolbar(mtoolbar.data(), visible); + emit DkPluginViewPort::showToolBar(mtoolbar.data(), visible); DkPluginViewPort::setVisible(visible); } @@ -568,20 +571,7 @@ namespace nmp { createLayout(); - if (nmc::DkSettingsManager::param().display().toolbarGradient) { - - QColor hCol = nmc::DkSettingsManager::param().display().highlightColor; - hCol.setAlpha(80); - - setStyleSheet( - QString("QToolBar {border: none; background: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #edeff9, stop: 1 #bebfc7); spacing: 3px; padding: 3px;}") - + QString("QToolBar::separator {background: #656565; width: 1px; height: 1px; margin: 3px;}") - + QString("QToolButton:hover{border: none; background-color: rgba(255,255,255,80);} QToolButton:pressed{margin: 0px; border: none; background-color: " + nmc::DkUtils::colorToString(hCol) + ";}") - ); - } - else { - setStyleSheet("QToolBar{spacing: 3px; padding: 3px;}"); - } + setStyleSheet("QToolBar{spacing: 3px; padding: 3px;}"); qDebug() << "[PAINT TOOLBAR] created..."; } diff --git a/PatchMatchingPlugin/src/DkPatchMatchingPlugin.h b/PatchMatchingPlugin/src/DkPatchMatchingPlugin.h index ea96398..8515cd6 100644 --- a/PatchMatchingPlugin/src/DkPatchMatchingPlugin.h +++ b/PatchMatchingPlugin/src/DkPatchMatchingPlugin.h @@ -77,8 +77,9 @@ class DkPatchMatchingPlugin : public QObject, nmc::DkViewPortInterface { QSharedPointer runPlugin(const QString &runID = QString(), QSharedPointer image = QSharedPointer()) const override; nmc::DkPluginViewPort* getViewPort() override; - void deleteViewPort() override; + virtual bool createViewPort(QWidget* parent) override; bool closesOnImageChange() const override; + virtual void setVisible(bool visible) override; protected: DkPatchMatchingViewPort* mViewport; @@ -100,9 +101,10 @@ class DkPatchMatchingViewPort : public nmc::DkPluginViewPort { QByteArray createCurrentJson(); auto getNearestPolygon(QPointF point); + public slots: - void setVisible(bool visible) override; + virtual void setVisible(bool visible) override; void updateImageContainer(QSharedPointer imgC) override; void setPanning(bool checked); void discardChangesAndClose(); diff --git a/PatchMatchingPlugin/src/DkPatchMatchingPlugin.json b/PatchMatchingPlugin/src/DkPatchMatchingPlugin.json index 90ed807..da648f4 100644 --- a/PatchMatchingPlugin/src/DkPatchMatchingPlugin.json +++ b/PatchMatchingPlugin/src/DkPatchMatchingPlugin.json @@ -3,7 +3,7 @@ "AuthorName" : "Manuel", "Company" : "", "DateCreated" : "2014-05-01", - "DateModified" : "2018-06-05", + "DateModified" : "2018-10-09", "Description" : "Stuff", "Tagline" : "Stuff.", "PluginId" : "ccbf6ff1f8ab4da5a8c44269c81ebf8b",