Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nomacs/nomacs-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
diemmarkus committed Oct 22, 2018
2 parents 1804149 + ca08f66 commit 204d9eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 28 deletions.
40 changes: 15 additions & 25 deletions PatchMatchingPlugin/src/DkPatchMatchingPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,28 @@ 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
{
return false;
}

void DkPatchMatchingPlugin::setVisible(bool visible)
{
mViewport->setVisible(visible);
}

/*-----------------------------------DkPatchMatchingViewPort ---------------------------------------------*/

DkPatchMatchingViewPort::DkPatchMatchingViewPort(QWidget* parent, Qt::WindowFlags flags)
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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);
}
Expand All @@ -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...";
}
Expand Down
6 changes: 4 additions & 2 deletions PatchMatchingPlugin/src/DkPatchMatchingPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ class DkPatchMatchingPlugin : public QObject, nmc::DkViewPortInterface {
QSharedPointer<nmc::DkImageContainer> runPlugin(const QString &runID = QString(),
QSharedPointer<nmc::DkImageContainer> image = QSharedPointer<nmc::DkImageContainer>()) 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;
Expand All @@ -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<nmc::DkImageContainerT> imgC) override;
void setPanning(bool checked);
void discardChangesAndClose();
Expand Down
2 changes: 1 addition & 1 deletion PatchMatchingPlugin/src/DkPatchMatchingPlugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 204d9eb

Please sign in to comment.