1 /* 2 Actiona 3 Copyright (C) 2005 Jonathan Mercier-Ganady 4 5 Actiona is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 Actiona is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 Contact : jmgr@jmgr.info 19 */ 20 21 #pragma once 22 23 #include "actiondefinition.h" 24 #include "cursorpathinstance.h" 25 #include "pointlistparameterdefinition.h" 26 #include "listparameterdefinition.h" 27 #include "positionparameterdefinition.h" 28 29 namespace ActionTools 30 { 31 class ActionPack; 32 class ActionInstance; 33 } 34 35 namespace Actions 36 { 37 class CursorPathDefinition : public ActionTools::ActionDefinition 38 { 39 Q_OBJECT 40 41 public: CursorPathDefinition(ActionTools::ActionPack * pack)42 explicit CursorPathDefinition(ActionTools::ActionPack *pack) 43 : ActionDefinition(pack) 44 { 45 translateItems("CursorPathInstance::buttons", CursorPathInstance::buttons); 46 47 auto &path = addParameter<ActionTools::PointListParameterDefinition>({QStringLiteral("path"), tr("Path")}); 48 path.setTooltip(tr("The path to follow")); 49 50 auto &button = addParameter<ActionTools::ListParameterDefinition>({QStringLiteral("button"), tr("Button")}); 51 button.setTooltip(tr("The button to simulate")); 52 button.setItems(CursorPathInstance::buttons); 53 button.setDefaultValue(CursorPathInstance::buttons.second.at(CursorPathInstance::NoButton)); 54 55 auto &positionOffset = addParameter<ActionTools::PositionParameterDefinition>({QStringLiteral("positionOffset"), tr("Offset")}, 1); 56 positionOffset.setTooltip(tr("The offset to apply to the path")); 57 } 58 name()59 QString name() const override { return QObject::tr("Cursor path"); } id()60 QString id() const override { return QStringLiteral("ActionCursorPath"); } flags()61 ActionTools::Flag flags() const override { return ActionDefinition::flags() | ActionTools::Official; } description()62 QString description() const override { return QObject::tr("Move the mouse cursor on a path"); } newActionInstance()63 ActionTools::ActionInstance *newActionInstance() const override { return new CursorPathInstance(this); } category()64 ActionTools::ActionCategory category() const override { return ActionTools::Device; } icon()65 QPixmap icon() const override { return QPixmap(QStringLiteral(":/actions/icons/movecursor.png")); } requirementCheck(QStringList & missingRequirements)66 bool requirementCheck(QStringList &missingRequirements) const override { return requirementCheckXTest(missingRequirements); } tabs()67 QStringList tabs() const override { return ActionDefinition::StandardTabs; } 68 69 private: 70 Q_DISABLE_COPY(CursorPathDefinition) 71 }; 72 } 73 74