78 lines
2.1 KiB
C++
Executable File
78 lines
2.1 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* CustomView for Exercises
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Mike Wille, SLSE, 2016-04-08
|
|
*/
|
|
|
|
#include "ism_schedule.h"
|
|
#include "ui_ism_schedule.h"
|
|
#include "ism_plan_dialog_model.h"
|
|
|
|
#include <ngltools/ngltools_dtg.h>
|
|
#include <QDateTime>
|
|
|
|
namespace InfrastructureManagement
|
|
{
|
|
|
|
CustomViewSchedule::CustomViewSchedule(QWidget *parent)
|
|
: AbstractDisplayWidget(parent)
|
|
, m_ui(new Ui::CustomViewSchedule)
|
|
, m_logger(getLogger("CustomViewSchedule"))
|
|
{
|
|
m_ui->setupUi(this);
|
|
}
|
|
|
|
CustomViewSchedule::~CustomViewSchedule()
|
|
{
|
|
delete m_ui;
|
|
}
|
|
|
|
bool CustomViewSchedule::init(const QModelIndex &idx)
|
|
{
|
|
if (!idx.isValid())
|
|
return false;
|
|
|
|
const QString msName = rowData(idx, InfrastructureManagement::PlanDialogModel::NAME).toString();
|
|
m_ui->lblName->setText(msName);
|
|
|
|
int msId = rowData(idx, InfrastructureManagement::PlanDialogModel::ID).toInt();
|
|
if (msId == 0)
|
|
{
|
|
m_ui->lblName->setWordWrap(true);
|
|
m_ui->lbCreated->hide();
|
|
m_ui->lblCreated->hide();
|
|
m_ui->lbBegin->hide();
|
|
m_ui->lblBegin->hide();
|
|
m_ui->lbEnd->hide();
|
|
m_ui->lblEnd->hide();
|
|
m_ui->lblStatus->hide();
|
|
}
|
|
else
|
|
{
|
|
m_ui->lbCreated->hide();
|
|
m_ui->lblCreated->hide();
|
|
#ifndef LTS_DEBUG
|
|
// m_ui->lblCreated->setVisible(true); // Should not be visible in Release build, but it is
|
|
// m_ui->lbCreated->setVisible(true);
|
|
#endif
|
|
m_ui->lblCreated->setText(rowData(idx, InfrastructureManagement::PlanDialogModel::CREATED).toString());
|
|
m_ui->lblBegin->setText(rowData(idx, InfrastructureManagement::PlanDialogModel::START).toString());
|
|
m_ui->lblEnd->setText(rowData(idx, InfrastructureManagement::PlanDialogModel::END).toString());
|
|
|
|
m_ui->lblStatus->setText(rowData(idx, InfrastructureManagement::PlanDialogModel::STATUS).toString());
|
|
|
|
QPalette p = m_ui->lblStatus->palette();
|
|
QColor newCol = rowData(idx, PlanDialogModel::STATUS, Qt::TextColorRole).value<QColor>();
|
|
p.setColor(m_ui->lblStatus->backgroundRole(), newCol);
|
|
p.setColor(m_ui->lblStatus->foregroundRole(), newCol);
|
|
m_ui->lblStatus->setPalette(p);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
} // namespace InfrastructureManagement
|