131 lines
2.7 KiB
C++
Executable File
131 lines
2.7 KiB
C++
Executable File
|
|
|
|
|
|
#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();
|
|
|
|
|
|
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:
|
|
{
|
|
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
|
statusText = tr("Invalid");
|
|
break;
|
|
}
|
|
case LOADED:
|
|
{
|
|
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(124, 189, 124);"));
|
|
statusText = tr("Loaded");
|
|
break;
|
|
}
|
|
case CONFLICT:
|
|
{
|
|
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
|
statusText = tr("CONFLICT!");
|
|
break;
|
|
}
|
|
case UNLOADED:
|
|
{
|
|
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(100, 100, 100);"));
|
|
statusText = tr("Unloaded");
|
|
break;
|
|
}
|
|
case INIT_FAILED:
|
|
{
|
|
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
|
statusText = tr("INIT FAILED!");
|
|
break;
|
|
}
|
|
case MISSING_SERVICE:
|
|
{
|
|
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
|
statusText = tr("MISSING SERVICE!");
|
|
break;
|
|
}
|
|
case OBLIBATORY_INTERFACES_MISSING:
|
|
{
|
|
m_ui->frStatus->setStyleSheet(QLatin1String("background-color: rgb(189, 106, 98);"));
|
|
statusText = tr("OBLIGATORY INTERFACES MISSING!");
|
|
break;
|
|
}
|
|
case INVALID_PLUGIN_VERSION:
|
|
{
|
|
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);
|
|
}
|
|
}
|