LP-56 - Better txpid option namings, fix tabs-spaces, tooltips. headers, variable...
[librepilot.git] / ground / openpilotgcs / src / plugins / coreplugin / coreimpl.cpp
bloba6e3ab31df6b503db01f6fa9c82ea35f2a11dda0
1 /**
2 ******************************************************************************
4 * @file coreimpl.cpp
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 * @addtogroup GCSPlugins GCS Plugins
8 * @{
9 * @addtogroup CorePlugin Core Plugin
10 * @{
11 * @brief The Core GCS plugin
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include "coreimpl.h"
31 #include <QtCore/QDir>
32 #include <QtCore/QCoreApplication>
34 #include "utils/pathutils.h"
36 namespace Core {
37 namespace Internal {
38 // The Core Singleton
39 static CoreImpl *m_instance = 0;
40 } // namespace Internal
41 } // namespace Core
44 using namespace Core;
45 using namespace Core::Internal;
48 ICore *ICore::instance()
50 return m_instance;
53 CoreImpl::CoreImpl(MainWindow *mainwindow)
55 m_instance = this;
56 m_mainwindow = mainwindow;
59 bool CoreImpl::showOptionsDialog(const QString &group, const QString &page, QWidget *parent)
61 return m_mainwindow->showOptionsDialog(group, page, parent);
64 bool CoreImpl::showWarningWithOptions(const QString &title, const QString &text,
65 const QString &details,
66 const QString &settingsCategory,
67 const QString &settingsId,
68 QWidget *parent)
70 return m_mainwindow->showWarningWithOptions(title, text,
71 details, settingsCategory,
72 settingsId, parent);
75 ActionManager *CoreImpl::actionManager() const
77 return m_mainwindow->actionManager();
80 UniqueIDManager *CoreImpl::uniqueIDManager() const
82 return m_mainwindow->uniqueIDManager();
85 MessageManager *CoreImpl::messageManager() const
87 return m_mainwindow->messageManager();
90 ConnectionManager *CoreImpl::connectionManager() const
92 return m_mainwindow->connectionManager();
95 UAVGadgetInstanceManager *CoreImpl::uavGadgetInstanceManager() const
97 return m_mainwindow->uavGadgetInstanceManager();
100 VariableManager *CoreImpl::variableManager() const
102 return m_mainwindow->variableManager();
105 ThreadManager *CoreImpl::threadManager() const
107 return m_mainwindow->threadManager();
110 ModeManager *CoreImpl::modeManager() const
112 return m_mainwindow->modeManager();
115 MimeDatabase *CoreImpl::mimeDatabase() const
117 return m_mainwindow->mimeDatabase();
120 QSettings *CoreImpl::settings(QSettings::Scope scope) const
122 return m_mainwindow->settings(scope);
125 SettingsDatabase *CoreImpl::settingsDatabase() const
127 return m_mainwindow->settingsDatabase();
130 QString CoreImpl::resourcePath() const
132 return QDir::cleanPath(Utils::GetDataPath());
135 IContext *CoreImpl::currentContextObject() const
137 return m_mainwindow->currentContextObject();
141 QMainWindow *CoreImpl::mainWindow() const
143 return m_mainwindow;
146 // adds and removes additional active contexts, this context is appended to the
147 // currently active contexts. call updateContext after changing
148 void CoreImpl::addAdditionalContext(int context)
150 m_mainwindow->addAdditionalContext(context);
153 void CoreImpl::removeAdditionalContext(int context)
155 m_mainwindow->removeAdditionalContext(context);
158 bool CoreImpl::hasContext(int context) const
160 return m_mainwindow->hasContext(context);
163 void CoreImpl::addContextObject(IContext *context)
165 m_mainwindow->addContextObject(context);
168 void CoreImpl::removeContextObject(IContext *context)
170 m_mainwindow->removeContextObject(context);
173 void CoreImpl::updateContext()
175 return m_mainwindow->updateContext();
178 void CoreImpl::openFiles(const QStringList &arguments)
180 Q_UNUSED(arguments)
181 // m_mainwindow->openFiles(arguments);
184 void CoreImpl::readMainSettings(QSettings *qs, bool workspaceDiffOnly)
186 m_mainwindow->readSettings(qs, workspaceDiffOnly);
189 void CoreImpl::saveMainSettings(QSettings *qs)
191 m_mainwindow->saveSettings(qs);
194 void CoreImpl::readSettings(IConfigurablePlugin *plugin, QSettings *qs)
196 m_mainwindow->readSettings(plugin, qs);
198 void CoreImpl::saveSettings(IConfigurablePlugin *plugin, QSettings *qs)
200 m_mainwindow->saveSettings(plugin, qs);
202 void CoreImpl::deleteSettings()
204 m_mainwindow->deleteSettings();