Added: #1206 Added plugin view dialog. And if there are errors while loading plugin displays a diagnostic message.
parent
1c69bb9409
commit
5fbb37d106
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
Object Viewer Qt
|
||||||
|
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PLUGIN_VIEW_H
|
||||||
|
#define PLUGIN_VIEW_H
|
||||||
|
|
||||||
|
#include "ui_plugin_view.h"
|
||||||
|
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
|
||||||
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
|
class IPluginManager;
|
||||||
|
|
||||||
|
class CPluginView: public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CPluginView(IPluginManager *pluginManager, QWidget *parent = 0);
|
||||||
|
~CPluginView();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void updateList();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
IPluginManager *_pluginManager;
|
||||||
|
Ui::CPluginView _ui;
|
||||||
|
}; /* class CPluginView */
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
||||||
|
|
||||||
|
#endif // PLUGIN_VIEW_H
|
@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
Object Viewer Qt
|
||||||
|
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "plugin_view.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
#include <QtGui/QIcon>
|
||||||
|
#include <QtGui/QStyle>
|
||||||
|
#include <QtGui/QTreeWidgetItem>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "plugin_spec.h"
|
||||||
|
#include "iplugin_manager.h"
|
||||||
|
|
||||||
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
|
CPluginView::CPluginView(IPluginManager *pluginManager, QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
_ui.setupUi(this);
|
||||||
|
_pluginManager = pluginManager;
|
||||||
|
|
||||||
|
connect(_pluginManager, SIGNAL(pluginsChanged()), this, SLOT(updateList()));
|
||||||
|
|
||||||
|
updateList();
|
||||||
|
}
|
||||||
|
|
||||||
|
CPluginView::~CPluginView()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPluginView::updateList()
|
||||||
|
{
|
||||||
|
static QIcon okIcon = QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton);
|
||||||
|
static QIcon errorIcon = QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton);
|
||||||
|
|
||||||
|
QList<QTreeWidgetItem *> items;
|
||||||
|
Q_FOREACH (CPluginSpec *spec, _pluginManager->plugins())
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = new QTreeWidgetItem(QStringList()
|
||||||
|
<< ""
|
||||||
|
<< spec->name()
|
||||||
|
<< QString("%1").arg(spec->version())
|
||||||
|
<< spec->vendor()
|
||||||
|
<< QDir::toNativeSeparators(spec->filePath()));
|
||||||
|
item->setIcon(0, spec->hasError() ? errorIcon : okIcon);
|
||||||
|
items.append(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
_ui.pluginTreeWidget->clear();
|
||||||
|
if (!items.isEmpty())
|
||||||
|
_ui.pluginTreeWidget->addTopLevelItems(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
Loading…
Reference in New Issue