dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
importexportplugin.cpp
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  */
28 
29 #include "importexportplugin.h"
30 #include "importexportdialog.h"
31 #include <QDebug>
32 #include <QtPlugin>
33 #include <QStringList>
35 
38 #include <coreplugin/icore.h>
39 #include <QKeySequence>
40 
41 ImportExportPlugin::ImportExportPlugin()
42 {
43  // Do nothing
44 }
45 
46 ImportExportPlugin::~ImportExportPlugin()
47 {
48  // Do nothing
49 }
50 
51 bool ImportExportPlugin::initialize(const QStringList &args, QString *errMsg)
52 {
53  Q_UNUSED(args);
54  Q_UNUSED(errMsg);
55 
56  // Add Menu entry
59 
60  Core::Command *cmd = am->registerAction(new QAction(this), "ImportExportPlugin.ImportExport",
62  cmd->setDefaultKeySequence(QKeySequence("Ctrl+S"));
63  cmd->action()->setText(tr("GCS Settings Import/Export..."));
64 
65  // ac->menu()->addSeparator();
66  // ac->appendGroup("ImportExport");
67  // ac->addAction(cmd, "ImportExport");
69 
70  connect(cmd->action(), &QAction::triggered, this, &ImportExportPlugin::importExport);
71 
72  return true;
73 }
74 
75 void ImportExportPlugin::importExport()
76 {
77  ImportExportDialog().exec();
78 }
79 
80 void ImportExportPlugin::extensionsInitialized()
81 {
82  // Do nothing
83 }
84 
85 void ImportExportPlugin::shutdown()
86 {
87  // Do nothing
88 }
89 
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.
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.
const char *const G_FILE_SAVE
const int C_GLOBAL_ID
Definition: coreconstants.h:90
const char *const M_FILE
Definition: coreconstants.h:77
static ICore * instance()
Definition: coreimpl.cpp:46
virtual void addAction(Core::Command *action, const QString &group=QString())=0
virtual void setDefaultKeySequence(const QKeySequence &key)=0
The action manager is responsible for registration of menus and menu items and keyboard shortcuts...
Definition: actionmanager.h:47
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