Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* plugin manager widget
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2016-07-07
|
||||
*/
|
||||
|
||||
#include "lts_plugin_manager_widget.h"
|
||||
#include "ui_lts_plugin_manager_widget.h"
|
||||
|
||||
using namespace LtsPluginManager;
|
||||
|
||||
LtsPluginWidget::LtsPluginWidget(const QString &filename, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::LtsPluginWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->leFilename->setText(filename);
|
||||
setStatus(UNKNOWN);
|
||||
setType();
|
||||
setIdent();
|
||||
|
||||
// not impl yet
|
||||
m_ui->lbGuiPlugins->hide();
|
||||
|
||||
m_ui->lbDtc->hide();
|
||||
m_ui->lwDtcs->hide();
|
||||
|
||||
m_ui->lbFtc->hide();
|
||||
m_ui->lwFtcs->hide();
|
||||
}
|
||||
|
||||
LtsPluginWidget::~LtsPluginWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void LtsPluginWidget::setStatus(Status status)
|
||||
{
|
||||
QString statusText;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case INVALID: // not a DataPlugin: not a GuiPlugin
|
||||
{
|
||||
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
||||
statusText = tr("Invalid");
|
||||
break;
|
||||
}
|
||||
case LOADED: // valid and loaded and probably used
|
||||
{
|
||||
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(124, 189, 124);"));
|
||||
statusText = tr("Loaded");
|
||||
break;
|
||||
}
|
||||
case CONFLICT: // conflicting with other plugin(s), was unloaded for safety
|
||||
{
|
||||
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
||||
statusText = tr("CONFLICT!");
|
||||
break;
|
||||
}
|
||||
case UNLOADED: // unloaded by user
|
||||
{
|
||||
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(100, 100, 100);"));
|
||||
statusText = tr("Unloaded");
|
||||
break;
|
||||
}
|
||||
case INIT_FAILED: // init() has failed on the plugin
|
||||
{
|
||||
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
||||
statusText = tr("INIT FAILED!");
|
||||
break;
|
||||
}
|
||||
case MISSING_SERVICE: // service is requiered that is not available
|
||||
{
|
||||
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
||||
statusText = tr("MISSING SERVICE!");
|
||||
break;
|
||||
}
|
||||
case OBLIBATORY_INTERFACES_MISSING: // some plugins did not pronounce their interfaces
|
||||
{
|
||||
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
||||
statusText = tr("OBLIGATORY INTERFACES MISSING!");
|
||||
break;
|
||||
}
|
||||
case INVALID_PLUGIN_VERSION: // plugin manager not compatible
|
||||
{
|
||||
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
||||
statusText = tr("INVALID PLUGIN VERSION!");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(100, 100, 100);"));
|
||||
statusText = tr("Unknown (%1)").arg(status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_ui->leStatus->setText(statusText);
|
||||
}
|
||||
|
||||
|
||||
void LtsPluginWidget::setType(const QString &type)
|
||||
{
|
||||
if (type.isEmpty())
|
||||
{
|
||||
m_ui->leType->hide();
|
||||
m_ui->lbType->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->leType->show();
|
||||
m_ui->lbType->show();
|
||||
m_ui->leType->setText(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LtsPluginWidget::setIdent(const QString &ident)
|
||||
{
|
||||
if (ident.isEmpty())
|
||||
{
|
||||
m_ui->leIdent->hide();
|
||||
m_ui->lbIdent->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->leIdent->show();
|
||||
m_ui->lbIdent->show();
|
||||
m_ui->leIdent->setText(ident);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user