Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

@@ -0,0 +1,68 @@
/**
* @RDE_HEADER@
* PlanChooser - New Plan Dialog - Asks for Plan name
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2017-04-20
*/
#include "new_plan_dialog.h"
#include "ui_new_plan_dialog.h"
#include <LtsSession/lts_session.h>
#include <QDateTime>
namespace InfrastructureManagement
{
NewPlanDialog::NewPlanDialog(LtsSession::LtsSession *session, QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::NewPlanDialog)
, m_session(session)
, m_logger(getLogger("NewPlanDialog"))
{
setWindowTitle(tr("Create New Plan"));
m_ui->setupUi(this);
connect(m_ui->pbCreate, &QPushButton::clicked, this, &NewPlanDialog::accept);
connect(m_ui->pbCancel, &QPushButton::clicked, this, &NewPlanDialog::reject);
Qt::WindowFlags wf = Qt::FramelessWindowHint; // make frameless, shadow replaces the border / frame
//setModal(true);
wf |= Qt::Dialog;
wf |= Qt::WindowStaysOnTopHint;
setWindowFlags(wf);
m_ui->dteBegin->setRetrieveCurrentTimeCallback([this]() { return m_session->partitionTime(); });
m_ui->dteEnd->setRetrieveCurrentTimeCallback([this]() { return m_session->partitionTime(); });
//m_ui->dteBegin->setMsecsSinceEpoch(QDateTime::currentMSecsSinceEpoch());
//m_ui->dteEnd->setMsecsSinceEpoch(QDateTime::currentMSecsSinceEpoch());
}
NewPlanDialog::~NewPlanDialog()
{
delete m_ui;
}
void NewPlanDialog::init(const std::shared_ptr<ForeignGuiComboboxInterface> &ismCbx)
{
ismCbx->fillScheduleStatusComboBox(m_ui->cbStatus);
m_ui->cbStatus->setCurrentIndex(m_ui->cbStatus->findData(ScheduleStatus::Inactive));
}
bool NewPlanDialog::getData(QString &name, qint64 &begin, qint64 &end, int &status)
{
if (exec() != QDialog::Accepted)
return false;
name = m_ui->lePlanName->text();
begin = m_ui->dteBegin->msecsSinceEpoch();
end = m_ui->dteEnd->msecsSinceEpoch();
status = static_cast<ScheduleStatus::type>(m_ui->cbStatus->currentData().toInt());
return true;
}
} // namespace InfrastructureManagement
@@ -0,0 +1,45 @@
/**
* @RDE_HEADER@
* PlanChooser - New Plan Dialog - Asks for Plan name
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2017-04-20
*/
#pragma once
#include <InfrastructureManagement/logger.h>
#include <InfrastructureManagement/ism_combobox_gui_plugin_interface.h>
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <QDialog>
namespace Ui
{
class NewPlanDialog;
}
namespace LtsSession
{
class LtsSession;
}
namespace InfrastructureManagement
{
class NewPlanDialog : public QDialog
{
Q_OBJECT
public:
explicit NewPlanDialog(LtsSession::LtsSession *session, QWidget *parent = nullptr);
~NewPlanDialog();
void init( const std::shared_ptr<ForeignGuiComboboxInterface> &ismCbx);
bool getData(QString &name, qint64 &begin, qint64 &end, int &status);
private:
Ui::NewPlanDialog* m_ui;
std::shared_ptr<ForeignGuiComboboxInterface> m_ismGuiCbx{nullptr};
LtsSession::LtsSession *m_session{nullptr};
LOGGER_T m_logger;
};
}
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NewPlanDialog</class>
<widget class="QDialog" name="NewPlanDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>304</width>
<height>238</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>RME EXCON - Exercise Chooser</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0,0,0,0">
<item>
<widget class="QLabel" name="lblName">
<property name="text">
<string>Name for new Plan:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lePlanName"/>
</item>
<item>
<widget class="QLabel" name="lblStatus">
<property name="text">
<string>Status:</string>
</property>
</widget>
</item>
<item>
<widget class="LtsWidgets::LtsComboBox" name="cbStatus"/>
</item>
<item>
<widget class="QLabel" name="lblBegin">
<property name="text">
<string>Begin</string>
</property>
</widget>
</item>
<item>
<widget class="LtsWidgets::LtsDateTimeEdit" name="dteBegin" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblEnd">
<property name="text">
<string>End</string>
</property>
</widget>
</item>
<item>
<widget class="LtsWidgets::LtsDateTimeEdit" name="dteEnd" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pbCreate">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsWidgets::LtsComboBox</class>
<extends>QComboBox</extends>
<header>LtsWidgets/lts_combo_box.h</header>
</customwidget>
<customwidget>
<class>LtsWidgets::LtsDateTimeEdit</class>
<extends>QWidget</extends>
<header>LtsWidgets/lts_date_time_edit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,143 @@
/**
* @RDE_HEADER@
* PlanChooser Payload UI
* $Id$
* $HeadURL$
* $Author$
* Created by Mike Wille, SLSE, 2016-08-12
*/
#include "plan_chooser.h"
#include "ui_plan_chooser.h"
#include "ism_plan_dialog_model.h"
#include "CustomViews/ism_schedule.h"
#include <LtsSession/lts_session_manager.h>
#include <LtsSession/lts_session.h>
#include <ConnectDialog/connect_dialog_nt.h>
#include <LtsWidgets/lts_global_wait_dialog.h>
#include <QCloseEvent>
#include <QPushButton>
#define DEVEL
namespace InfrastructureManagement
{
PlanChooser::PlanChooser(const std::shared_ptr<Interface::Dtc> &dtc, QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::PlanChooser)
, m_model(nullptr)
, m_dtc(dtc)
, m_selected(false)
, m_logger(getLogger("PlanChooser"))
{
LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(false);
m_ui->setupUi(this);
setWindowTitle(tr("Select Instrumentation Plan"));
setWindowFlags(windowFlags() | /*Qt::WindowStaysOnTopHint | */Qt::FramelessWindowHint); // hints..
m_ui->widget->seamless();
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
this, &PlanChooser::enaDisa, Qt::QueuedConnection);
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked,
this, &PlanChooser::slotPlanSelected, Qt::QueuedConnection);
connect(m_ui->pbNewPlan, &QPushButton::clicked,
this, &PlanChooser::signalNewPlan); //[this]() { emit signalNewPlan(); });
connect(m_ui->pbSelect, &QPushButton::clicked,
this, &PlanChooser::slotPlanSelected, Qt::QueuedConnection);
connect(m_ui->pbCancel, &QPushButton::clicked,
this, &PlanChooser::signalQuit, Qt::QueuedConnection);
connect(m_ui->pbCancel, &QPushButton::clicked,
this, [this]()
{
LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(true);
m_close = true;
close();
});
new LtsUtils::ConnectingDialogNT([this](int timeWait) { return m_dtc->waitForHistoricalDataMainSchedule(timeWait); }, tr("Infrastructure Management"), tr("Global"), parent);
}
bool PlanChooser::init(LtsSession::LtsSession *session)
{
m_session = session;
delete m_model;
m_model = new PlanDialogModel(this);
m_model->initModel(m_dtc);
m_ui->widget->selectCustomView();
m_ui->widget->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection);
m_ui->widget->setModel(m_model, [this]() { return new CustomViewSchedule(this); });
for (int i = 0; i < m_model->columnCount(); ++i)
m_ui->widget->hideColumn(i);
m_ui->widget->showColumn(PlanDialogModel::NAME);
return true;
}
PlanChooser::~PlanChooser()
{
LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(true);
delete m_ui;
}
void PlanChooser::reject()
{
if (!m_selected)
emit signalQuit();
QDialog::reject();
}
void PlanChooser::enaDisa()
{
//const QModelIndex idx = m_ui->widget->currentIndex();
//const MainSchedule ms = m_model->getRowData(idx.row());
m_ui->pbSelect->setEnabled(m_ui->widget->selectedRows().size() == 1);
}
void PlanChooser::closeEvent(QCloseEvent *event) // TODO: override reject()
{
if (!m_close)
event->ignore();
}
void PlanChooser::slotPlanSelected()
{
const QModelIndex idx = m_ui->widget->currentIndex();
const MainSchedule ms = m_model->getRowData(idx.row());
int id = ms.id();
if (id <= 0)
return;
m_selected = true;
emit signalSelectPlan(id);
m_close = true;
close();
}
void PlanChooser::selectPlan(int planId)
{
m_selected = true;
emit signalSelectPlan(planId);
m_close = true;
close();
}
} // namespace InfrastructureManagement
@@ -0,0 +1,65 @@
/**
* @RDE_HEADER@
* PlanChooser Payload UI
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2016-11-02
*/
#pragma once
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/logger.h>
#include <QDialog>
namespace Ui
{
class PlanChooser;
}
namespace LtsSession
{
class LtsSession;
}
namespace InfrastructureManagement
{
class PlanDialogModel;
class PlanChooser : public QDialog // TODO: move me directly to Gui ?
{
Q_OBJECT
public:
explicit PlanChooser(const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &dtc, QWidget *parent = nullptr);
~PlanChooser();
bool init(LtsSession::LtsSession *session);
void selectPlan(int planId);
private:
Ui::PlanChooser *m_ui{nullptr};
PlanDialogModel *m_model{nullptr};
LtsSession::LtsSession *m_session{nullptr};
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_dtc{nullptr};
bool m_close{false};
bool m_selected{false};
LOGGER_T m_logger;
protected:
void closeEvent(QCloseEvent *event) override;
private Q_SLOTS:
void slotPlanSelected();
void enaDisa();
void reject() override;
Q_SIGNALS:
void signalNewPlan();
void signalSelectPlan(int planId);
void signalQuit();
};
}
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PlanChooser</class>
<widget class="QDialog" name="PlanChooser">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>521</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>RME EXCON - Plan Chooser</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Login to Plan:</string>
</property>
</widget>
</item>
<item>
<widget class="LtsDataView::LtsDataView" name="widget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>300</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pbCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbNewPlan">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Add new Plan</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSelect">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsDataView::LtsDataView</class>
<extends>QWidget</extends>
<header>LtsDataView/lts_data_view.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>