dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
coreimpl.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 "coreimpl.h"
30 
31 #include <QtCore/QDir>
32 #include <QtCore/QCoreApplication>
33 
34 namespace Core {
35 namespace Internal {
36 
37  // The Core Singleton
38  static CoreImpl *m_instance = nullptr;
39 
40 } // namespace Internal
41 } // namespace Core
42 
43 using namespace Core;
44 using namespace Core::Internal;
45 
47 {
48  return m_instance;
49 }
50 
52 {
53  m_instance = this;
54  m_mainwindow = mainwindow;
55 }
56 
57 bool CoreImpl::showOptionsDialog(const QString &group, const QString &page, QWidget *parent)
58 {
59  return m_mainwindow->showOptionsDialog(group, page, parent);
60 }
61 
63 {
64  return m_mainwindow->actionManager();
65 }
66 
68 {
69  return m_mainwindow->uniqueIDManager();
70 }
71 
73 {
74  return m_mainwindow->connectionManager();
75 }
76 
78 {
79  return m_mainwindow->boardManager();
80 }
81 
83 {
84  return m_mainwindow->globalMessaging();
85 }
86 
88 {
89  return m_mainwindow->uavGadgetInstanceManager();
90 }
91 
93 {
94  return m_mainwindow->modeManager();
95 }
96 
97 QSettings *CoreImpl::settings(QSettings::Scope scope) const
98 {
99  return m_mainwindow->settings(scope);
100 }
101 
102 #ifdef Q_OS_MAC
103 #define SHARE_PATH "/../Resources"
104 #else
105 #define SHARE_PATH "/../share"
106 #endif
107 
108 QString CoreImpl::resourcePath() const
109 {
110  return QDir::cleanPath(QCoreApplication::applicationDirPath() + QLatin1String(SHARE_PATH));
111 }
112 
114 {
115  return m_mainwindow->currentContextObject();
116 }
117 
118 QMainWindow *CoreImpl::mainWindow() const
119 {
120  return m_mainwindow;
121 }
122 
123 // adds and removes additional active contexts, this context is appended to the
124 // currently active contexts. call updateContext after changing
126 {
127  m_mainwindow->addAdditionalContext(context);
128 }
129 
131 {
132  m_mainwindow->removeAdditionalContext(context);
133 }
134 
135 bool CoreImpl::hasContext(int context) const
136 {
137  return m_mainwindow->hasContext(context);
138 }
139 
141 {
142  m_mainwindow->addContextObject(context);
143 }
144 
146 {
147  m_mainwindow->removeContextObject(context);
148 }
149 
151 {
152  return m_mainwindow->updateContext();
153 }
154 
155 void CoreImpl::openFiles(const QStringList &arguments)
156 {
157  Q_UNUSED(arguments)
158  // m_mainwindow->openFiles(arguments);
159 }
160 
161 void CoreImpl::readMainSettings(QSettings *qs, bool workspaceDiffOnly)
162 {
163  m_mainwindow->readSettings(qs, workspaceDiffOnly);
164 }
165 
166 void CoreImpl::saveMainSettings(QSettings *qs)
167 {
168  m_mainwindow->saveSettings(qs);
169 }
170 
171 void CoreImpl::readSettings(IConfigurablePlugin *plugin, QSettings *qs)
172 {
173  m_mainwindow->readSettings(plugin, qs);
174 }
175 void CoreImpl::saveSettings(IConfigurablePlugin *plugin, QSettings *qs)
176 {
177  m_mainwindow->saveSettings(plugin, qs);
178 }
180 {
181  m_mainwindow->deleteSettings();
182 }
GlobalMessaging * globalMessaging() const
Definition: coreimpl.cpp:82
void addContextObject(IContext *contex)
Registers an additional context object.
Definition: coreimpl.cpp:140
ModeManager * modeManager() const
Returns the application's mode manager.
Definition: coreimpl.cpp:92
void openFiles(const QStringList &fileNames)
Open all files from a list of fileNames like it would be done if they were given to the GCS on the co...
Definition: coreimpl.cpp:155
void removeAdditionalContext(int context)
Removes the given context from the list of currently active contexts.
Definition: coreimpl.cpp:130
bool hasContext(int context) const
Returns if the given context is currently one of the active contexts.
Definition: coreimpl.cpp:135
UniqueIDManager * uniqueIDManager() const
Returns the application's id manager.
Definition: coreimpl.cpp:67
Core::GlobalMessaging * globalMessaging() const
Definition: mainwindow.cpp:937
void addAdditionalContext(int context)
Register additional context to be currently active.
Definition: coreimpl.cpp:125
UAVGadgetInstanceManager * uavGadgetInstanceManager() const
Definition: coreimpl.cpp:87
The ICore class allows access to the different part that make up the basic functionality of the GCS...
Definition: icore.h:58
void removeContextObject(IContext *contex)
Unregisters a context object from the list of know contexts.
Definition: coreimpl.cpp:145
void addAdditionalContext(int context)
bool hasContext(int context) const
void saveMainSettings(QSettings *qs)
Definition: coreimpl.cpp:166
IContext * currentContextObject() const
Definition: mainwindow.cpp:526
QMainWindow * mainWindow() const
Returns the main application window.
Definition: coreimpl.cpp:118
void saveSettings(QSettings *qs=nullptr)
ActionManager * actionManager() const
Returns the application's action manager.
Definition: coreimpl.cpp:62
Core::ModeManager * modeManager() const
Definition: mainwindow.cpp:970
UAVGadgetInstanceManager * uavGadgetInstanceManager() const
Definition: mainwindow.cpp:965
void saveSettings(IConfigurablePlugin *plugin, QSettings *qs=nullptr)
Definition: coreimpl.cpp:175
static ICore * instance()
Definition: coreimpl.cpp:46
Core::BoardManager * boardManager() const
Definition: mainwindow.cpp:955
QSettings * settings(QSettings::Scope scope=QSettings::UserScope) const
Returns the application's main settings object.
Definition: coreimpl.cpp:97
void readSettings(IConfigurablePlugin *plugin, QSettings *qs=nullptr)
Definition: coreimpl.cpp:171
bool showOptionsDialog(const QString &group=QString(), const QString &page=QString(), QWidget *parent=nullptr)
Opens the application options/preferences dialog with preselected page in a specified group...
Definition: coreimpl.cpp:57
bool showOptionsDialog(const QString &category=QString(), const QString &page=QString(), QWidget *parent=nullptr)
Definition: mainwindow.cpp:883
Core::ConnectionManager * connectionManager() const
Definition: mainwindow.cpp:950
void readSettings(QSettings *qs=nullptr, bool workspaceDiffOnly=false)
The action manager is responsible for registration of menus and menu items and keyboard shortcuts...
Definition: actionmanager.h:47
CoreImpl(MainWindow *mainwindow)
Definition: coreimpl.cpp:51
BoardManager * boardManager() const
Definition: coreimpl.cpp:77
void updateContext()
Update the list of active contexts after adding or removing additional ones.
Definition: coreimpl.cpp:150
QSettings * settings(QSettings::Scope scope) const
Definition: mainwindow.cpp:942
void readMainSettings(QSettings *qs, bool workspaceDiffOnly)
Definition: coreimpl.cpp:161
Core::UniqueIDManager * uniqueIDManager() const
Definition: mainwindow.cpp:932
void addContextObject(IContext *contex)
Definition: mainwindow.cpp:985
void removeContextObject(IContext *contex)
Definition: mainwindow.cpp:996
ConnectionManager * connectionManager() const
Definition: coreimpl.cpp:72
void removeAdditionalContext(int context)
Core::ActionManager * actionManager() const
Definition: mainwindow.cpp:927
IContext * currentContextObject() const
Returns the context object of the current main context.
Definition: coreimpl.cpp:113
QString resourcePath() const
Returns the absolute path that is used for resources like project templates and the debugger macros...
Definition: coreimpl.cpp:108