dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
configgadgetfactory.cpp
Go to the documentation of this file.
1 
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 #include "configgadgetfactory.h"
27 #include "configgadget.h"
30 #include <coreplugin/iuavgadget.h>
33 #include <coreplugin/icore.h>
34 #include <coreplugin/modemanager.h>
35 
37  : IUAVGadgetFactory(QString("ConfigGadget"), tr("Config Gadget"), parent)
38  , gadgetWidget(nullptr)
39 {
40 }
41 
43 {
44 }
45 
47 {
48  gadgetWidget = new ConfigGadgetWidget(parent);
49 
50  // Add Menu entry
53 
54  Core::Command *cmd = am->registerAction(new QAction(this), "ConfigPlugin.ShowInputWizard",
56  cmd->action()->setText(tr("Radio Setup Wizard"));
57 
59 
60  ac->appendGroup("Wizard");
61  ac->addAction(cmd, "Wizard");
62 
63  connect(cmd->action(), &QAction::triggered, this, &ConfigGadgetFactory::startInputWizard);
64 
65  return new ConfigGadget(QString("ConfigGadget"), gadgetWidget, parent);
66 }
67 
68 IUAVGadgetConfiguration *ConfigGadgetFactory::createConfiguration(QSettings *qSettings)
69 {
70  return new ConfigGadgetConfiguration(QString("ConfigGadget"), qSettings);
71 }
72 
73 IOptionsPage *ConfigGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
74 {
75  return new ConfigGadgetOptionsPage(qobject_cast<ConfigGadgetConfiguration *>(config));
76 }
77 
79 {
80  if (gadgetWidget) {
82  gadgetWidget->startInputWizard();
83  }
84 }
IUAVGadget * createGadget(QWidget *parent)
static ModeManager * instance()
Definition: modemanager.h:62
virtual QAction * action() const =0
virtual Command * registerAction(QAction *action, const QString &id, const QList< int > &context)=0
Makes an action known to the system under the specified string id.
const char *const M_TOOLS
Definition: coreconstants.h:83
virtual ActionContainer * actionContainer(const QString &id) const =0
Returns the IActionContainter object that is know to the system under the given string id...
virtual ActionManager * actionManager() const =0
Returns the application's action manager.
void addAction(Command *command, int priority, QMenu *menu=nullptr)
IUAVGadgetConfiguration * createConfiguration(QSettings *qSettings)
IOptionsPage * createOptionsPage(IUAVGadgetConfiguration *config)
const int C_GLOBAL_ID
Definition: coreconstants.h:90
void activateModeByWorkspaceName(const QString &id)
static ICore * instance()
Definition: coreimpl.cpp:46
virtual void appendGroup(const QString &group)=0
virtual void addAction(Core::Command *action, const QString &group=QString())=0
The action manager is responsible for registration of menus and menu items and keyboard shortcuts...
Definition: actionmanager.h:47
ConfigGadgetFactory(QObject *parent=nullptr)
The class Command represents an action like a menu item, tool button, or shortcut. You don't create Command objects directly, instead use {ActionManager::registerAction()} to register an action and retrieve a Command. The Command object represents the user visible action and its properties. If multiple actions are registered with the same ID (but different contexts) the returned Command is the shared one between these actions.
Definition: command.h:43