uncrustification
[librepilot.git] / ground / openpilotgcs / src / plugins / welcome / welcomeplugin.cpp
blob0dfbf91bd0112ce85c0b64abddfb83d6a9ead414
1 /**
2 ******************************************************************************
4 * @file welcomeplugin.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 WelcomePlugin Welcome Plugin
10 * @{
11 * @brief The GCS Welcome 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 "welcomeplugin.h"
31 #include "welcomemode.h"
33 #include <coreplugin/actionmanager/actionmanager.h>
34 #include <coreplugin/basemode.h>
35 #include <coreplugin/coreconstants.h>
36 #include <coreplugin/icore.h>
37 #include <coreplugin/modemanager.h>
38 #include <coreplugin/uniqueidmanager.h>
40 #include <QtCore/QDebug>
41 #include <QtCore/QtPlugin>
42 #include <QAction>
43 #include <QMenu>
44 #include <QMessageBox>
45 #include <QPushButton>
47 using namespace Welcome::Internal;
49 WelcomePlugin::WelcomePlugin()
50 : m_welcomeMode(0)
53 WelcomePlugin::~WelcomePlugin()
55 // The below code is commented out to avoid having the application
56 // crash when it is terminated. TODO: Fix a real solution.
58 if (m_welcomeMode) {
59 removeObject(m_welcomeMode);
60 delete m_welcomeMode;
65 /*! Initializes the plugin. Returns true on success.
66 Plugins want to register objects with the plugin manager here.
68 \a error_message can be used to pass an error message to the plugin system,
69 if there was any.
71 bool WelcomePlugin::initialize(const QStringList &arguments, QString *error_message)
73 Q_UNUSED(arguments)
74 Q_UNUSED(error_message)
76 m_welcomeMode = new WelcomeMode;
77 addObject(m_welcomeMode);
79 return true;
82 /*! Notification that all extensions that this plugin depends on have been
83 initialized. The dependencies are defined in the plugins .qwp file.
85 Normally this method is used for things that rely on other plugins to have
86 added objects to the plugin manager, that implement interfaces that we're
87 interested in. These objects can now be requested through the
88 PluginManagerInterface.
90 The WelcomePlugin doesn't need things from other plugins, so it does
91 nothing here.
93 void WelcomePlugin::extensionsInitialized()
95 Core::ModeManager::instance()->activateMode(m_welcomeMode->uniqueModeName());