Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / libs / extensionsystem / pluginerrorview.cpp
blobd23711a9da3fd498ce01afd289e995acca4ad9df
1 /**
2 ******************************************************************************
4 * @file pluginerrorview.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 * @brief
8 * @see The GNU Public License (GPL) Version 3
9 * @defgroup
10 * @{
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 "pluginerrorview.h"
30 #include "ui_pluginerrorview.h"
31 #include "pluginspec.h"
33 #include <QtCore/QString>
35 /*!
36 \class ExtensionSystem::PluginErrorView
37 \brief Widget that displays the state and error message of a PluginSpec.
39 Can be used for integration in the application that
40 uses the plugin manager.
42 \sa ExtensionSystem::PluginView
45 using namespace ExtensionSystem;
47 /*!
48 \fn PluginErrorView::PluginErrorView(QWidget *parent)
49 Constructs a new error view with given \a parent widget.
51 PluginErrorView::PluginErrorView(QWidget *parent)
52 : QWidget(parent),
53 m_ui(new Internal::Ui::PluginErrorView())
55 m_ui->setupUi(this);
58 /*!
59 \fn PluginErrorView::~PluginErrorView()
60 \internal
62 PluginErrorView::~PluginErrorView()
64 delete m_ui;
67 /*!
68 \fn void PluginErrorView::update(PluginSpec *spec)
69 Reads the given \a spec and displays its state and
70 error information in this PluginErrorView.
72 void PluginErrorView::update(PluginSpec *spec)
74 QString text;
75 QString tooltip;
77 switch (spec->state()) {
78 case PluginSpec::Invalid:
79 text = tr("Invalid");
80 tooltip = tr("Description file found, but error on read");
81 break;
82 case PluginSpec::Read:
83 text = tr("Read");
84 tooltip = tr("Description successfully read");
85 break;
86 case PluginSpec::Resolved:
87 text = tr("Resolved");
88 tooltip = tr("Dependencies are successfully resolved");
89 break;
90 case PluginSpec::Loaded:
91 text = tr("Loaded");
92 tooltip = tr("Library is loaded");
93 break;
94 case PluginSpec::Initialized:
95 text = tr("Initialized");
96 tooltip = tr("Plugin's initialization method succeeded");
97 break;
98 case PluginSpec::Running:
99 text = tr("Running");
100 tooltip = tr("Plugin successfully loaded and running");
101 break;
102 case PluginSpec::Stopped:
103 text = tr("Stopped");
104 tooltip = tr("Plugin was shut down");
105 break;
106 case PluginSpec::Deleted:
107 text = tr("Deleted");
108 tooltip = tr("Plugin ended its life cycle and was deleted");
109 break;
111 m_ui->state->setText(text);
112 m_ui->state->setToolTip(tooltip);
113 m_ui->errorString->setText(spec->errorString());