diff --git a/krita/krita4.xmlgui b/krita/krita4.xmlgui index e250ade684..1185578707 100644 --- a/krita/krita4.xmlgui +++ b/krita/krita4.xmlgui @@ -1,409 +1,409 @@ &File &Edit Fill Special &View &Canvas &Snap To &Image &Rotate &Layer New &Import/Export Import &Convert &Select &Group &Transform &Rotate Transform &All Layers &Rotate S&plit S&plit Alpha &Select Select &Opaque Filte&r &Tools Scripts Setti&ngs &Help File - + Brushes and Stuff diff --git a/plugins/extensions/CMakeLists.txt b/plugins/extensions/CMakeLists.txt index 26f5ced2f8..34cbf68c6f 100644 --- a/plugins/extensions/CMakeLists.txt +++ b/plugins/extensions/CMakeLists.txt @@ -1,20 +1,20 @@ add_subdirectory( imagesplit ) add_subdirectory( clonesarray ) add_subdirectory( colorrange ) add_subdirectory( colorspaceconversion ) add_subdirectory( imagesize ) add_subdirectory( metadataeditor ) add_subdirectory( modify_selection ) add_subdirectory( offsetimage ) add_subdirectory( rotateimage ) add_subdirectory( separate_channels ) add_subdirectory( shearimage ) add_subdirectory( layergroupswitcher ) add_subdirectory( resourcemanager ) add_subdirectory( layersplit ) add_subdirectory( animationrenderer ) add_subdirectory( waveletdecompose ) add_subdirectory( pykrita ) add_subdirectory( qmic ) add_subdirectory( buginfo ) -add_subdirectory( actionsearch ) +add_subdirectory( search ) diff --git a/plugins/extensions/actionsearch/CMakeLists.txt b/plugins/extensions/actionsearch/CMakeLists.txt deleted file mode 100644 index ab0540a2bb..0000000000 --- a/plugins/extensions/actionsearch/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -set(kritaactionsearch_SOURCES - ActionSearch.cpp - ActionSearchWidget.cpp - ActionModel.cpp - ActionFilterModel.cpp - ActionSearchLine.cpp -) - -ki18n_wrap_ui(kritaactionsearch_SOURCES WdgActionSearch.ui ) - -add_library(kritaactionsearch MODULE ${kritaactionsearch_SOURCES}) - -target_link_libraries(kritaactionsearch kritaui) - -install(TARGETS kritaactionsearch DESTINATION ${KRITA_PLUGIN_INSTALL_DIR}) - -install( FILES ActionSearch.action DESTINATION ${DATA_INSTALL_DIR}/krita/actions) diff --git a/plugins/extensions/search/CMakeLists.txt b/plugins/extensions/search/CMakeLists.txt new file mode 100644 index 0000000000..facc43d36e --- /dev/null +++ b/plugins/extensions/search/CMakeLists.txt @@ -0,0 +1,17 @@ +set(kritasearch_SOURCES + SearchWidget.cpp + SearchPopup.cpp + SearchModel.cpp + SearchFilterModel.cpp + SearchPlugin.cpp +) + +ki18n_wrap_ui(kritasearch_SOURCES WdgSearch.ui ) + +add_library(kritasearch MODULE ${kritasearch_SOURCES}) + +target_link_libraries(kritasearch kritaui) + +install(TARGETS kritasearch DESTINATION ${KRITA_PLUGIN_INSTALL_DIR}) + +install( FILES Search.action DESTINATION ${DATA_INSTALL_DIR}/krita/actions) diff --git a/plugins/extensions/actionsearch/ActionSearch.action b/plugins/extensions/search/Search.action similarity index 94% rename from plugins/extensions/actionsearch/ActionSearch.action rename to plugins/extensions/search/Search.action index 0c20eeeea0..7c6283141f 100644 --- a/plugins/extensions/actionsearch/ActionSearch.action +++ b/plugins/extensions/search/Search.action @@ -1,18 +1,18 @@ General - + Search in Krita 0 0 false diff --git a/plugins/extensions/actionsearch/ActionFilterModel.cpp b/plugins/extensions/search/SearchFilterModel.cpp similarity index 83% rename from plugins/extensions/actionsearch/ActionFilterModel.cpp rename to plugins/extensions/search/SearchFilterModel.cpp index 920eabeb41..671ae4709d 100644 --- a/plugins/extensions/actionsearch/ActionFilterModel.cpp +++ b/plugins/extensions/search/SearchFilterModel.cpp @@ -1,73 +1,71 @@ /* * Copyright (c) 2019 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * * You should have received a copy of the GNU 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 "ActionFilterModel.h" +#include "SearchFilterModel.h" #include #include #include #include #include #include #include #include -#include "ActionModel.h" - -ActionFilterModel::ActionFilterModel(QObject *parent) +SearchFilterModel::SearchFilterModel(QObject *parent) { } -void ActionFilterModel::setFilterText(const QString &filter) +void SearchFilterModel::setFilterText(const QString &filter) { m_filter = filter; } -bool ActionFilterModel::filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const +bool SearchFilterModel::filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const { return true; } -bool ActionFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const +bool SearchFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { const QModelIndex index = sourceModel()->index(source_row, 0, source_parent); if (!index.isValid()) return false; return true; QStringList tags = index.data(Qt::UserRole + 1).toStringList(); bool hit = false; Q_FOREACH(const QString &tag, tags) { if (true || tag.contains(m_filter)) { hit = true; break; } } return hit; } -bool ActionFilterModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const +bool SearchFilterModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const { QVariant leftData = sourceModel()->data(source_left, Qt::DisplayRole); QVariant rightData = sourceModel()->data(source_right, Qt::DisplayRole); QString leftName = leftData.toString(); QString rightName = rightData.toString(); return QString::localeAwareCompare(leftName, rightName) < 0; } diff --git a/plugins/extensions/actionsearch/ActionFilterModel.h b/plugins/extensions/search/SearchFilterModel.h similarity index 88% rename from plugins/extensions/actionsearch/ActionFilterModel.h rename to plugins/extensions/search/SearchFilterModel.h index 7c244d699c..59f46e7ce2 100644 --- a/plugins/extensions/actionsearch/ActionFilterModel.h +++ b/plugins/extensions/search/SearchFilterModel.h @@ -1,44 +1,44 @@ /* * Copyright (c) 2019 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * * You should have received a copy of the GNU 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 ACTIONFILTERMODEL_H -#define ACTIONFILTERMODEL_H +#ifndef SEARCHFILTERMODEL_H +#define SEARCHFILTERMODEL_H #include #include #include -class ActionFilterModel : public QSortFilterProxyModel +class SearchFilterModel : public QSortFilterProxyModel { Q_OBJECT public: - explicit ActionFilterModel(QObject *parent = 0); + explicit SearchFilterModel(QObject *parent = 0); void setFilterText(const QString &filter); protected: bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const override; bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; private: QString m_filter; }; #endif diff --git a/plugins/extensions/actionsearch/ActionModel.cpp b/plugins/extensions/search/SearchModel.cpp similarity index 86% rename from plugins/extensions/actionsearch/ActionModel.cpp rename to plugins/extensions/search/SearchModel.cpp index 515c17a28b..8435fe029f 100644 --- a/plugins/extensions/actionsearch/ActionModel.cpp +++ b/plugins/extensions/search/SearchModel.cpp @@ -1,68 +1,68 @@ /* * Copyright (c) 2019 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * * You should have received a copy of the GNU 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 "ActionModel.h" +#include "SearchModel.h" #include #include #include #include #include #include #include #include #include -ActionModel::ActionModel(KActionCollection *actionCollection, QObject *parent) +SearchModel::SearchModel(KActionCollection *actionCollection, QObject *parent) : QAbstractListModel(parent) , m_actionCollection(actionCollection) { } // reimp from QAbstractListModel -int ActionModel::rowCount(const QModelIndex &/*parent*/) const +int SearchModel::rowCount(const QModelIndex &/*parent*/) const { qDebug() << "Count" << m_actionCollection->count(); return m_actionCollection->count(); } -int ActionModel::columnCount(const QModelIndex &/*parent*/) const +int SearchModel::columnCount(const QModelIndex &/*parent*/) const { return 1; } -QVariant ActionModel::data(const QModelIndex &index, int role) const +QVariant SearchModel::data(const QModelIndex &index, int role) const { qDebug() << index.isValid() << index; QAction *action = m_actionCollection->action(index.row()); qDebug() << action; // switch (role) { // case Qt::DisplayRole: return action->text(); // case Qt::WhatsThisRole: // return action->whatsThis(); // case Qt::UserRole + 1: // return QStringList() << action->text() << action->property("tags").toStringList(); // default: // return action->objectName(); // }; } diff --git a/plugins/extensions/actionsearch/ActionModel.h b/plugins/extensions/search/SearchModel.h similarity index 89% rename from plugins/extensions/actionsearch/ActionModel.h rename to plugins/extensions/search/SearchModel.h index b5028e1ee2..e9bea94f65 100644 --- a/plugins/extensions/actionsearch/ActionModel.h +++ b/plugins/extensions/search/SearchModel.h @@ -1,41 +1,41 @@ /* * Copyright (c) 2019 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * * You should have received a copy of the GNU 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 ACTIONMODEL_H -#define ACTIONMODEL_H +#ifndef SEARCHMODEL_H +#define SEARCHMODEL_H #include #include class KActionCollection; -class ActionModel : public QAbstractListModel { +class SearchModel : public QAbstractListModel { Q_OBJECT public: - explicit ActionModel(KActionCollection *actionCollection, QObject *parent = 0); + explicit SearchModel(KActionCollection *actionCollection, QObject *parent = 0); // reimp from QAbstractListModel int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; private: KActionCollection *m_actionCollection {0}; }; #endif diff --git a/plugins/extensions/actionsearch/ActionSearch.cpp b/plugins/extensions/search/SearchPlugin.cpp similarity index 69% rename from plugins/extensions/actionsearch/ActionSearch.cpp rename to plugins/extensions/search/SearchPlugin.cpp index 2c2d2b0481..9a6f07c08c 100644 --- a/plugins/extensions/actionsearch/ActionSearch.cpp +++ b/plugins/extensions/search/SearchPlugin.cpp @@ -1,55 +1,50 @@ /* * actionsearch.cc -- Part of Krita * * Copyright (c) 2004 Michael Thaler * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * * You should have received a copy of the GNU 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 "ActionSearch.h" +#include "SearchPlugin.h" #include #include #include #include #include #include #include #include #include -#include "ActionSearchLine.h" +#include "SearchWidget.h" -K_PLUGIN_FACTORY_WITH_JSON(ActionSearchFactory, "kritaactionsearch.json", registerPlugin();) +K_PLUGIN_FACTORY_WITH_JSON(SearchPluginFactory, "kritasearch.json", registerPlugin();) -ActionSearch::ActionSearch(QObject *parent, const QVariantList &) +SearchPlugin::SearchPlugin(QObject *parent, const QVariantList &) : KisActionPlugin(parent) { - m_actionSearchLine = new ActionSearchLine(viewManager()->actionCollection(), 0); + m_actionSearchLine = new SearchWidget(viewManager()->actionCollection(), 0); m_searchAction = new QWidgetAction(this); - KisActionRegistry::instance()->propertizeAction("actionsearch", m_searchAction); - viewManager()->actionCollection()->addAction("actionsearch", m_searchAction); + KisActionRegistry::instance()->propertizeAction("searchaction", m_searchAction); + viewManager()->actionCollection()->addAction("searchaction", m_searchAction); m_searchAction->setDefaultWidget(m_actionSearchLine); } -ActionSearch::~ActionSearch() -{ - qDebug() << "We get deleted"; -} - -#include "ActionSearch.moc" +#include "SearchPlugin.moc" diff --git a/plugins/extensions/actionsearch/ActionSearch.h b/plugins/extensions/search/SearchPlugin.h similarity index 84% rename from plugins/extensions/actionsearch/ActionSearch.h rename to plugins/extensions/search/SearchPlugin.h index e99de8f6f6..3c337bcec9 100644 --- a/plugins/extensions/actionsearch/ActionSearch.h +++ b/plugins/extensions/search/SearchPlugin.h @@ -1,41 +1,41 @@ /* * actionsearch.h -- Part of Krita * * Copyright (c) 2004 Michael Thaler (michael.thaler@physik.tu-muenchen.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * * You should have received a copy of the GNU 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 ACTIONSEARCH_H #define ACTIONSEARCH_H #include #include class QWidgetAction; -class ActionSearchLine; +class SearchWidget; -class ActionSearch : public KisActionPlugin +class SearchPlugin : public KisActionPlugin { Q_OBJECT public: - ActionSearch(QObject *parent, const QVariantList &); - ~ActionSearch() override; + SearchPlugin(QObject *parent, const QVariantList &); + private: QWidgetAction *m_searchAction {0}; - ActionSearchLine *m_actionSearchLine {0}; + SearchWidget *m_actionSearchLine {0}; }; #endif // ACTIONSEARCH_H diff --git a/plugins/extensions/actionsearch/ActionSearchWidget.cpp b/plugins/extensions/search/SearchPopup.cpp similarity index 67% rename from plugins/extensions/actionsearch/ActionSearchWidget.cpp rename to plugins/extensions/search/SearchPopup.cpp index 9c0593914d..3323d8b5a9 100644 --- a/plugins/extensions/actionsearch/ActionSearchWidget.cpp +++ b/plugins/extensions/search/SearchPopup.cpp @@ -1,63 +1,63 @@ /* * Copyright (c) 2019 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * * You should have received a copy of the GNU 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 "ActionSearchWidget.h" +#include "SearchPopup.h" #include #include #include #include #include #include #include #include -#include "ActionModel.h" -#include "ActionFilterModel.h" +#include "SearchModel.h" +#include "SearchFilterModel.h" -class ActionSearchWidget::Private +class SearchPopup::Private { public: - ActionFilterModel *searchModel; + SearchFilterModel *searchModel; }; -ActionSearchWidget::ActionSearchWidget(KActionCollection *actionCollection, QWidget *parent) +SearchPopup::SearchPopup(KActionCollection *actionCollection, QWidget *parent) : QWidget(parent) - , Ui_WdgActionSearch() - , d(new ActionSearchWidget::Private()) + , Ui_WdgSearch() + , d(new SearchPopup::Private()) { setupUi(this); connect(bnTrigger, SIGNAL(pressed()), SIGNAL(actionTriggered())); connect(lstAction, SIGNAL(activated(QModelIndex)), SLOT(actionSelected(QModelIndex))); - ActionModel *actionModel = new ActionModel(actionCollection, this); - d->searchModel = new ActionFilterModel(this); - d->searchModel->setSourceModel(actionModel); - lstAction->setModel(actionModel); + SearchModel *searchModel = new SearchModel(actionCollection, this); + d->searchModel = new SearchFilterModel(this); + d->searchModel->setSourceModel(searchModel); + lstAction->setModel(searchModel); } -ActionSearchWidget::~ActionSearchWidget() +SearchPopup::~SearchPopup() { } -void ActionSearchWidget::actionSelected(const QModelIndex &idx) +void SearchPopup::actionSelected(const QModelIndex &idx) { lblWhatsThis->setText(idx.data(Qt::WhatsThisRole).toString()); } diff --git a/plugins/extensions/actionsearch/ActionSearchWidget.h b/plugins/extensions/search/SearchPopup.h similarity index 78% rename from plugins/extensions/actionsearch/ActionSearchWidget.h rename to plugins/extensions/search/SearchPopup.h index 35bf5c44c3..543fc669c6 100644 --- a/plugins/extensions/actionsearch/ActionSearchWidget.h +++ b/plugins/extensions/search/SearchPopup.h @@ -1,45 +1,46 @@ /* * Copyright (c) 2019 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * * You should have received a copy of the GNU 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 ACTIONSEARCHWIDGET_H -#define ACTIONSEARCHWIDGET_H +#ifndef SearchPopup_H +#define SearchPopup_H #include #include #include -#include "ui_WdgActionSearch.h" +#include "ui_WdgSearch.h" -class ActionSearchWidget : public QWidget, public Ui_WdgActionSearch +class SearchPopup : public QWidget, public Ui_WdgSearch { Q_OBJECT public: - explicit ActionSearchWidget(KActionCollection *actionCollection, QWidget *parent = 0); - virtual ~ActionSearchWidget() override; + explicit SearchPopup(KActionCollection *actionCollection, QWidget *parent = 0); + virtual ~SearchPopup() override; Q_SIGNALS: void actionTriggered(); private Q_SLOTS: void actionSelected(const QModelIndex &idx); + private: class Private; QScopedPointer d; }; #endif diff --git a/plugins/extensions/actionsearch/ActionSearchLine.cpp b/plugins/extensions/search/SearchWidget.cpp similarity index 81% rename from plugins/extensions/actionsearch/ActionSearchLine.cpp rename to plugins/extensions/search/SearchWidget.cpp index 9adb0d8fc6..d79f6428b2 100644 --- a/plugins/extensions/actionsearch/ActionSearchLine.cpp +++ b/plugins/extensions/search/SearchWidget.cpp @@ -1,100 +1,100 @@ /* * Copyright (c) 2019 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * * You should have received a copy of the GNU 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 "ActionSearchLine.h" +#include "SearchWidget.h" #include #include #include #include #include #include #include #include -#include "ActionSearchWidget.h" +#include "SearchPopup.h" -class ActionSearchLine::Private +class SearchWidget::Private { public: bool popupVisible {false}; QFrame *frame {0}; - ActionSearchWidget *searchWidget {0}; + SearchPopup *searchWidget {0}; QHBoxLayout *frameLayout {0}; }; -ActionSearchLine::ActionSearchLine(KActionCollection *actionCollection, QWidget *parent) +SearchWidget::SearchWidget(KActionCollection *actionCollection, QWidget *parent) : QLineEdit(parent) - , d(new ActionSearchLine::Private()) + , d(new SearchWidget::Private()) { d->frame = new QFrame(this); - d->searchWidget = new ActionSearchWidget(actionCollection, this); + d->searchWidget = new SearchPopup(actionCollection, this); connect(d->searchWidget, SIGNAL(actionTriggered()), SLOT(hidePopup())); d->frame->setFrameStyle(QFrame::Box | QFrame::Plain); d->frame->setWindowFlags(Qt::Popup); d->frameLayout = new QHBoxLayout(d->frame); d->frameLayout->setMargin(0); d->frameLayout->setSizeConstraint(QLayout::SetFixedSize); d->frame->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); d->searchWidget->setParent(d->frame); d->frameLayout->addWidget(d->searchWidget); d->frame->setFrameStyle(Qt::Popup); } -ActionSearchLine::~ActionSearchLine() +SearchWidget::~SearchWidget() { } -void ActionSearchLine::showPopup() +void SearchWidget::showPopup() { if (d->searchWidget && !d->searchWidget->isVisible()) { d->frame->raise(); d->frame->show(); adjustPosition(); } else { hidePopup(); } } -void ActionSearchLine::hidePopup() +void SearchWidget::hidePopup() { if (d->searchWidget) { d->frame->setVisible(false); } } -void ActionSearchLine::focusInEvent(QFocusEvent *ev) +void SearchWidget::focusInEvent(QFocusEvent *ev) { QLineEdit::focusInEvent(ev); showPopup(); } -void ActionSearchLine::adjustPosition() +void SearchWidget::adjustPosition() { QSize popSize = d->searchWidget->size(); QRect popupRect(this->mapToGlobal(QPoint(0, this->size().height())), popSize); // Get the available geometry of the screen which contains this KisPopupButton QDesktopWidget* desktopWidget = QApplication::desktop(); QRect screenRect = desktopWidget->availableGeometry(this); popupRect = kisEnsureInRect(popupRect, screenRect); d->frame->setGeometry(popupRect); } diff --git a/plugins/extensions/actionsearch/ActionSearchLine.h b/plugins/extensions/search/SearchWidget.h similarity index 84% rename from plugins/extensions/actionsearch/ActionSearchLine.h rename to plugins/extensions/search/SearchWidget.h index b54060257f..801a545cd8 100644 --- a/plugins/extensions/actionsearch/ActionSearchLine.h +++ b/plugins/extensions/search/SearchWidget.h @@ -1,53 +1,53 @@ /* * Copyright (c) 2019 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * * You should have received a copy of the GNU 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 ACTIONSEARCHLINE_H -#define ACTIONSEARCHLINE_H +#ifndef SearchWidget_H +#define SearchWidget_H #include #include #include #include #include #include #include #include "ui_WdgActionSearch.h" -class ActionSearchLine : public QLineEdit +class SearchWidget : public QLineEdit { Q_OBJECT public: - explicit ActionSearchLine(KActionCollection *actionCollection, QWidget *parent = 0); - virtual ~ActionSearchLine() override; + explicit SearchWidget(KActionCollection *actionCollection, QWidget *parent = 0); + virtual ~SearchWidget() override; private Q_SLOTS: void showPopup(); void hidePopup(); protected: void focusInEvent(QFocusEvent *) override; private: void adjustPosition(); class Private; QScopedPointer d; }; #endif diff --git a/plugins/extensions/actionsearch/WdgActionSearch.ui b/plugins/extensions/search/WdgSearch.ui similarity index 85% rename from plugins/extensions/actionsearch/WdgActionSearch.ui rename to plugins/extensions/search/WdgSearch.ui index b3d3003cde..16881da1bf 100644 --- a/plugins/extensions/actionsearch/WdgActionSearch.ui +++ b/plugins/extensions/search/WdgSearch.ui @@ -1,38 +1,38 @@ - WdgActionSearch - + WdgSearch + 0 0 400 300 Form - E&xecute Action + &Go diff --git a/plugins/extensions/actionsearch/kritaactionsearch.json b/plugins/extensions/search/kritasearch.json similarity index 61% rename from plugins/extensions/actionsearch/kritaactionsearch.json rename to plugins/extensions/search/kritasearch.json index aee2a48ddc..6b6c8777f3 100644 --- a/plugins/extensions/actionsearch/kritaactionsearch.json +++ b/plugins/extensions/search/kritasearch.json @@ -1,9 +1,9 @@ { - "Id": "Shear Image Plugin", + "Id": "Search Plugin", "Type": "Service", - "X-KDE-Library": "kritaactionsearch", + "X-KDE-Library": "kritasearch", "X-KDE-ServiceTypes": [ "Krita/ViewPlugin" ], "X-Krita-Version": "28" }