Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE, 2017-11-15
|
||||
#
|
||||
|
||||
#IF (NOT BUILD_RPM) <= Build always, even on release, started via hashed phrase
|
||||
ADD_SUBDIRECTORY(Gui)
|
||||
#ENDIF()
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(DevGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dev_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
GuiPluginInterface
|
||||
)
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Mike Wille, SLSE, 2017-11-15
|
||||
#
|
||||
|
||||
SET(dev_gui_SRCS
|
||||
dev_gui_plugin.cpp
|
||||
dev_gui_plugin.h
|
||||
dev_dialog.h
|
||||
dev_dialog.cpp
|
||||
dev_debug_flags_dialog.h
|
||||
dev_debug_flags_dialog.cpp
|
||||
dev_debug_flags_edit_dialog.h
|
||||
dev_debug_flags_edit_dialog.cpp
|
||||
dev_debug_flags_dialog_model.h
|
||||
dev_debug_flags_dialog_model.cpp
|
||||
dev_permissions_dialog.h
|
||||
dev_permissions_dialog.cpp
|
||||
dev_ftcmock.h
|
||||
dev_ftcmock.cpp
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(dev_gui_SRCS
|
||||
dev_dialog.ui
|
||||
dev_permissions_dialog.ui
|
||||
dev_debug_flags_dialog.ui
|
||||
dev_debug_flags_edit_dialog.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS NO_TRANSLATION DevGuiPlugin SHARED ${dev_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(DevGuiPlugin
|
||||
Qt5::Widgets
|
||||
Qt5::Network
|
||||
ngltranslator
|
||||
LtsWidgets
|
||||
LtsUtilsGuiDds
|
||||
LtsSessionData
|
||||
ProjectConfig
|
||||
LtsUtilsGuiConnectDialog
|
||||
LtsAppManager
|
||||
LtsPluginManager
|
||||
LtsSession
|
||||
LtsLogin
|
||||
LtsNotification
|
||||
LtsDataView
|
||||
LtsMultiMonitor
|
||||
LtsUtilsSettings
|
||||
|
||||
# ftcmock:
|
||||
#ExmDataPluginInterface
|
||||
svcExmClient
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(DevGuiPlugin)
|
||||
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ExerciseManangement - Exercise Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, NLSE, 2018-02-09
|
||||
*/
|
||||
|
||||
#include "dev_debug_flags_dialog.h"
|
||||
#include "ui_dev_debug_flags_dialog.h"
|
||||
#include "dev_debug_flags_dialog_model.h"
|
||||
#include "dev_debug_flags_edit_dialog.h"
|
||||
|
||||
#include <Viewer/LtsDataView/lts_data_view.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
DebugFlagsDialog::DebugFlagsDialog(const QString &menuGroup, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_model(new DebugFlagsDialogModel(this))
|
||||
, m_ui(new Ui::DebugFlagsDialog)
|
||||
, m_menuGroup(menuGroup)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this, &DebugFlagsDialog::onAddFlag);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &DebugFlagsDialog::onEditFlag);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &DebugFlagsDialog::onRemoveFlag);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Load, this, &DebugFlagsDialog::slotRefresh);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked,
|
||||
this, &DebugFlagsDialog::onEditFlag);
|
||||
|
||||
m_ui->widget->setModel(m_model);
|
||||
}
|
||||
|
||||
|
||||
DebugFlagsDialog::~DebugFlagsDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void DebugFlagsDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Debug Flags"));
|
||||
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Load)->setText(tr("Refresh"));
|
||||
}
|
||||
|
||||
|
||||
void DebugFlagsDialog::slotRefresh()
|
||||
{
|
||||
m_model->refresh();
|
||||
}
|
||||
|
||||
|
||||
void DebugFlagsDialog::enaDisa()
|
||||
{
|
||||
QModelIndexList selectedRows = m_ui->widget->selectedRows();
|
||||
const int cntSelectedRows = selectedRows.size();
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, cntSelectedRows == 1);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, cntSelectedRows == 1); // TODO: rm multiple
|
||||
}
|
||||
|
||||
|
||||
void DebugFlagsDialog::onAddFlag()
|
||||
{
|
||||
DebugFlagsEditDialog *d = new DebugFlagsEditDialog();
|
||||
connect(d, &DebugFlagsEditDialog::destroyed,
|
||||
this, &DebugFlagsDialog::slotRefresh);
|
||||
|
||||
addDialog(LtsWidgets::initDialog(d, QString() /* new flag */), m_menuGroup, QStringLiteral("NewFlag"));
|
||||
}
|
||||
|
||||
|
||||
void DebugFlagsDialog::onRemoveFlag()
|
||||
{
|
||||
QString flagName = m_model->getRowData(m_ui->widget->currentIndex().row()).name;
|
||||
LtsSessionData::LtsSessionData::getInstance()->removeDebugFlag(flagName);
|
||||
slotRefresh();
|
||||
}
|
||||
|
||||
|
||||
void DebugFlagsDialog::onEditFlag()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
QString flagName = m_model->getRowData(idx.row()).name;
|
||||
|
||||
if (flagName.isEmpty())
|
||||
return;
|
||||
|
||||
DebugFlagsEditDialog *d = new DebugFlagsEditDialog();
|
||||
connect(d, &DebugFlagsEditDialog::destroyed,
|
||||
this, &DebugFlagsDialog::slotRefresh);
|
||||
|
||||
addDialog(LtsWidgets::initDialog(d, flagName), m_menuGroup, QStringLiteral("EditFlag%1").arg(flagName));
|
||||
}
|
||||
|
||||
} // namespace ExerciseManagement
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ExerciseManangement - Exercise Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, NLSE, 2018-02-09
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DebugFlagsDialog;
|
||||
}
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
class DebugFlagsDialogModel;
|
||||
|
||||
class DebugFlagsDialog : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DebugFlagsDialog(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~DebugFlagsDialog();
|
||||
|
||||
bool init() { return true; }
|
||||
|
||||
private slots:
|
||||
void onAddFlag();
|
||||
void onRemoveFlag();
|
||||
void onEditFlag();
|
||||
void slotRefresh();
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void enaDisa();
|
||||
|
||||
DebugFlagsDialogModel *m_model;
|
||||
Ui::DebugFlagsDialog *m_ui;
|
||||
QString m_menuGroup;
|
||||
};
|
||||
} // namespace DeveloperTools
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DebugFlagsDialog</class>
|
||||
<widget class="QWidget" name="DebugFlagsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>238</width>
|
||||
<height>268</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Exercise Management</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for ExerciseManangement - Exercise Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#include "dev_debug_flags_dialog_model.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
DebugFlagsDialogModel::DebugFlagsDialogModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<DebugFlag>({tr("Name"),
|
||||
tr("Value")}
|
||||
, parent)
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
void DebugFlagsDialogModel::refresh()
|
||||
{
|
||||
m_vecData.clear();
|
||||
|
||||
LtsSessionData::LtsSessionData *sessionData = LtsSessionData::LtsSessionData::getInstance();
|
||||
const QMap<QString, QVariant> &debugFlags = sessionData->debugFlags();
|
||||
|
||||
for (auto i = debugFlags.constBegin(); i != debugFlags.constEnd(); ++i)
|
||||
m_vecData.append({ i.key(), i.value() });
|
||||
|
||||
emit dataChanged(QModelIndex(), QModelIndex());
|
||||
}
|
||||
|
||||
|
||||
QVariant DebugFlagsDialogModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const DebugFlag &df = m_vecData.at(index.row());
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case DebugFlagsDialogModel::Columns::Name:
|
||||
return df.name;
|
||||
case DebugFlagsDialogModel::Columns::Value:
|
||||
return df.value;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
} // namespace DeveloperTools
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ExerciseManangement - Exercise Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
struct DebugFlag
|
||||
{
|
||||
public:
|
||||
QString name;
|
||||
QVariant value;
|
||||
};
|
||||
|
||||
class DebugFlagsDialogModel : public LtsWidgets::LtsAbstractTableModel<DebugFlag>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Name,
|
||||
Value,
|
||||
};
|
||||
|
||||
explicit DebugFlagsDialogModel(QObject *parent = nullptr);
|
||||
|
||||
QVariant data(const QModelIndex &, int) const override final;
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
QVector<DebugFlag> m_debugFlags;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ExerciseManangement - Exercise Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, NLSE, 2018-02-09
|
||||
*/
|
||||
|
||||
#include "dev_debug_flags_edit_dialog.h"
|
||||
#include "ui_dev_debug_flags_edit_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsWidgets/lts_message_dialog.h>
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
DebugFlagsEditDialog::DebugFlagsEditDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_ui(new Ui::DebugFlagsEditDialog)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
DebugFlagsEditDialog::~DebugFlagsEditDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
bool DebugFlagsEditDialog::init(const QString &flagName)
|
||||
{
|
||||
m_flagName = flagName;
|
||||
|
||||
if (!m_flagName.isEmpty())
|
||||
{
|
||||
m_ui->leFlagName->setReadOnly(true);
|
||||
m_ui->leFlagName->setText(m_flagName);
|
||||
|
||||
LtsSessionData::LtsSessionData *sessionData = LtsSessionData::LtsSessionData::getInstance();
|
||||
|
||||
QVariant val = sessionData->debugFlagValue(m_flagName);
|
||||
|
||||
switch (val.type())
|
||||
{
|
||||
case QVariant::Bool:
|
||||
{
|
||||
m_ui->rbBool->setChecked(true);
|
||||
m_ui->cbBool->setCurrentIndex(val.toInt());
|
||||
break;
|
||||
}
|
||||
|
||||
case QVariant::String:
|
||||
{
|
||||
m_ui->rbString->setChecked(true);
|
||||
m_ui->leString->setText(val.toString());
|
||||
break;
|
||||
}
|
||||
|
||||
case QVariant::Int:
|
||||
{
|
||||
m_ui->rbInt->setChecked(true);
|
||||
m_ui->sbInt->setValue(val.toInt());
|
||||
break;
|
||||
}
|
||||
|
||||
case QVariant::Double:
|
||||
{
|
||||
m_ui->rbDouble->setChecked(true);
|
||||
m_ui->dsbDouble->setValue(val.toDouble());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, tr("This flag has an unknown value type. Trying to convert to string."));
|
||||
m_ui->rbString->setChecked(true);
|
||||
m_ui->leString->setText(val.toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DebugFlagsEditDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, m_flagName, (m_flagName.isEmpty()), tr("Flag"));
|
||||
|
||||
m_uiRequirements->clear();
|
||||
m_uiRequirements->addRequirement({ m_ui->lblValueType, [this]()
|
||||
{
|
||||
return (m_ui->rbBool->isChecked()
|
||||
|| m_ui->rbString->isChecked()
|
||||
|| m_ui->rbInt->isChecked()
|
||||
|| m_ui->rbDouble->isChecked());
|
||||
}, tr("Select a value type")
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
bool DebugFlagsEditDialog::apply()
|
||||
{
|
||||
QString flagName = m_ui->leFlagName->text();
|
||||
LtsSessionData::LtsSessionData *sessionData = LtsSessionData::LtsSessionData::getInstance();
|
||||
|
||||
if (m_ui->rbBool->isChecked())
|
||||
{
|
||||
sessionData->setDebugFlagValue(flagName, m_ui->cbBool->currentIndex() == 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_ui->rbString->isChecked())
|
||||
{
|
||||
sessionData->setDebugFlagValue(flagName, m_ui->leString->text());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_ui->rbInt->isChecked())
|
||||
{
|
||||
sessionData->setDebugFlagValue(flagName, m_ui->sbInt->value());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_ui->rbDouble->isChecked())
|
||||
{
|
||||
sessionData->setDebugFlagValue(flagName, m_ui->dsbDouble->value());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace DeveloperTools
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ExerciseManangement - Exercise Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, NLSE, 2018-02-09
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DebugFlagsEditDialog;
|
||||
}
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
class DebugFlagsEditDialog final : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DebugFlagsEditDialog(QWidget *parent = nullptr);
|
||||
|
||||
bool init(const QString &flagName);
|
||||
|
||||
~DebugFlagsEditDialog();
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
bool apply() override final;
|
||||
|
||||
Ui::DebugFlagsEditDialog *m_ui;
|
||||
QString m_flagName;
|
||||
};
|
||||
|
||||
} // namespace DeveloperTools
|
||||
@@ -0,0 +1,244 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DebugFlagsEditDialog</class>
|
||||
<widget class="QWidget" name="DebugFlagsEditDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>307</width>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Translated in Source</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblFlagname">
|
||||
<property name="text">
|
||||
<string>Flag name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leFlagName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblBool">
|
||||
<property name="text">
|
||||
<string>bool</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbBool">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbBool">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">false</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">true</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblString">
|
||||
<property name="text">
|
||||
<string>string</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbString">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leString">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbInt">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sbInt">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-999999999</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblInt">
|
||||
<property name="text">
|
||||
<string>int</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbDouble">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="dsbDouble">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1000000000000000032841562489204926078987012566359611695512313426258747006898787995544001315627727412683949504784322435578648490634211491840.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999999999899489893451833484927233458399740540420336951338855520357125044282616287570346763120896578585177704871391229197474064067196498264773607101557544845312.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lblDouble">
|
||||
<property name="text">
|
||||
<string>double</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblValueType">
|
||||
<property name="text">
|
||||
<string>Value type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>cbBool</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>rbBool</receiver>
|
||||
<slot>click()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>150</x>
|
||||
<y>80</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>99</x>
|
||||
<y>78</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>leString</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
<receiver>rbString</receiver>
|
||||
<slot>click()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>188</x>
|
||||
<y>110</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>101</x>
|
||||
<y>112</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>sbInt</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>rbInt</receiver>
|
||||
<slot>click()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>161</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>99</x>
|
||||
<y>147</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>dsbDouble</sender>
|
||||
<signal>valueChanged(double)</signal>
|
||||
<receiver>rbDouble</receiver>
|
||||
<slot>click()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>166</x>
|
||||
<y>179</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>100</x>
|
||||
<y>178</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
+352
@@ -0,0 +1,352 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-11-15
|
||||
*/
|
||||
|
||||
#include "dev_dialog.h"
|
||||
#include "ui_dev_dialog.h"
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsWidgets/lts_global_wait_dialog.h>
|
||||
#include <LtsAppManager/lts_app_manager.h>
|
||||
#include <LtsPluginManager/lts_plugin_manager.h>
|
||||
#include <LtsSession/lts_session_manager.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsLogin/lts_login.h>
|
||||
#include <LtsMultiMonitor/lts_multi_monitor.h>
|
||||
#include <LtsMultiMonitor/lts_dummy_widget.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QColorDialog>
|
||||
#include <QClipboard>
|
||||
#include <QInputDialog>
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
|
||||
DevDialog::DevDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_ui(new Ui::DevDialog)
|
||||
, m_t(nullptr)
|
||||
, m_thisLayout(new QVBoxLayout())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->scrollAreaWidgetContents->setLayout(m_thisLayout);
|
||||
|
||||
m_t = new QTimer(this);
|
||||
connect(m_t, &QTimer::timeout,
|
||||
this, &DevDialog::slotRefresh);
|
||||
m_t->setInterval(250);
|
||||
m_t->start();
|
||||
|
||||
connect(m_ui->cbAuto, &QCheckBox::toggled,
|
||||
this, &DevDialog::slotToggleAuto);
|
||||
connect(m_ui->pbRefresh, &QPushButton::clicked,
|
||||
this, &DevDialog::slotRefresh);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
connect(m_ui->pbLDWNormal, &QPushButton::clicked,
|
||||
this, [this]()
|
||||
{
|
||||
LtsMultiMonitor::FullscreenVideoDummyWidget *dummy = new LtsMultiMonitor::FullscreenVideoDummyWidget;
|
||||
|
||||
connect(dummy, &LtsMultiMonitor::FullscreenVideoDummyWidget::destroyed,
|
||||
this, []()
|
||||
|
||||
{
|
||||
qWarning() << "dummy widget (normal only) was destroyed!";
|
||||
});
|
||||
|
||||
connect(dummy, &LtsMultiMonitor::FullscreenVideoDummyWidget::signalWidgetPlaced,
|
||||
this, [](const QRect &globalGeo)
|
||||
{
|
||||
qWarning() << "dummy widget (normal only) was placed!" << globalGeo;
|
||||
});
|
||||
|
||||
LtsMultiMonitor::LtsMultiMonitor::getInstance()->selectScreen(dummy, nullptr, false, true);
|
||||
});
|
||||
|
||||
connect(m_ui->pbLDW, &QPushButton::clicked,
|
||||
this, [this]()
|
||||
{
|
||||
LtsMultiMonitor::FullscreenVideoDummyWidget *dummy = new LtsMultiMonitor::FullscreenVideoDummyWidget;
|
||||
|
||||
connect(dummy, &LtsMultiMonitor::FullscreenVideoDummyWidget::destroyed,
|
||||
this, []()
|
||||
|
||||
{
|
||||
qWarning() << "dummy widget was destroyed!";
|
||||
});
|
||||
|
||||
connect(dummy, &LtsMultiMonitor::FullscreenVideoDummyWidget::signalWidgetPlaced,
|
||||
this, [](const QRect &globalGeo)
|
||||
{
|
||||
qWarning() << "dummy widget was placed!" << globalGeo;
|
||||
});
|
||||
|
||||
LtsMultiMonitor::LtsMultiMonitor::getInstance()->selectScreen(dummy);
|
||||
});
|
||||
|
||||
connect(m_ui->pbCQCD, &QPushButton::clicked,
|
||||
this, [this]()
|
||||
{
|
||||
QColorDialog *cd = new QColorDialog(this);
|
||||
cd->setOption(QColorDialog::DontUseNativeDialog);
|
||||
cd->show();
|
||||
});
|
||||
|
||||
connect(m_ui->pbCOSIC, &QPushButton::clicked,
|
||||
this, []()
|
||||
{
|
||||
QApplication::clipboard()->setText(QString::fromUtf8(LtsUtils::OperatorSettings::getInstance()->exportSettings()));
|
||||
});
|
||||
|
||||
connect(m_ui->pbCPSIC, &QPushButton::clicked,
|
||||
this, []()
|
||||
{
|
||||
QApplication::clipboard()->setText(QString::fromUtf8(LtsUtils::ProjectSettings::getInstance()->exportSettings()));
|
||||
});
|
||||
|
||||
connect(m_ui->pbGWDCT, &QPushButton::clicked,
|
||||
this, [this]()
|
||||
{
|
||||
LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(QInputDialog::getText(this, QStringLiteral("Custom Text"), QStringLiteral("Custom Text")));
|
||||
});
|
||||
|
||||
|
||||
auto *mousePosTimer = new QTimer(this);
|
||||
mousePosTimer->setInterval(300);
|
||||
connect(mousePosTimer, &QTimer::timeout,
|
||||
this, [this]()
|
||||
{
|
||||
m_ui->lblMousePos->setText(QStringLiteral("x: %1 - y: %2").arg(QString::number(QCursor::pos().x()).leftJustified(4), QString::number(QCursor::pos().y()).leftJustified(4)));
|
||||
});
|
||||
mousePosTimer->start();
|
||||
}
|
||||
|
||||
|
||||
QString boolToString(bool value)
|
||||
{
|
||||
return (value ? QStringLiteral("true") : QStringLiteral("false"));
|
||||
}
|
||||
|
||||
|
||||
void AppWidget::checkSessions(const QMap<LtsSession::LtsSessionManager::SessionKey, LtsSession::LtsSession *> &sessions)
|
||||
{
|
||||
// check for deleted sessions
|
||||
for (AppSessionWidget *appSessionWidget : qAsConst(appSessionList))
|
||||
{
|
||||
const LtsSession::LtsSession *session = nullptr;
|
||||
|
||||
for (LtsSession::LtsSession *_session : qAsConst(sessions))
|
||||
{
|
||||
if (appSessionWidget->appSessionPtr == _session)
|
||||
{
|
||||
session = _session;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!session) // found
|
||||
{
|
||||
appSessionWidget->setDeleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AppSessionWidget::setDeleted()
|
||||
{
|
||||
setStyleSheet(QStringLiteral("background-color: #FFA197;"));
|
||||
}
|
||||
|
||||
|
||||
void AppWidget::setDeleted()
|
||||
{
|
||||
setStyleSheet(QStringLiteral("background-color: #FFA197;"));
|
||||
}
|
||||
|
||||
|
||||
void AppWidget::addSession(LtsSession::LtsSession *appSession)
|
||||
{
|
||||
AppSessionWidget *appSessionWidget = nullptr;
|
||||
|
||||
for (auto i = appSessionList.begin(); i != appSessionList.end(); ++i)
|
||||
{
|
||||
AppSessionWidget *_appSessionWidget = *i;
|
||||
|
||||
if (_appSessionWidget->appSessionPtr == appSession)
|
||||
{
|
||||
appSessionWidget = _appSessionWidget;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (appSessionWidget == nullptr) // NEW SESSION
|
||||
{
|
||||
appSessionWidget = new AppSessionWidget();
|
||||
appSessionWidget->appSessionPtr = appSession;
|
||||
|
||||
QFormLayout *sessionForm = new QFormLayout(appSessionWidget);
|
||||
|
||||
sessionForm->addRow(QStringLiteral("Session Id:"), appSessionWidget->sessionId);
|
||||
sessionForm->addRow(QStringLiteral("Session adr:"), appSessionWidget->session);
|
||||
sessionForm->addRow(QStringLiteral("Session name:"), appSessionWidget->name);
|
||||
sessionForm->addRow(QStringLiteral("BaseLayout adr:"), appSessionWidget->blw);
|
||||
sessionForm->addRow(QStringLiteral("Domain Id:"), appSessionWidget->domainId);
|
||||
sessionForm->addRow(QStringLiteral("Exercise Id:"), appSessionWidget->exerciseId);
|
||||
sessionForm->addRow(QStringLiteral("Partition Id:"), appSessionWidget->partId);
|
||||
sessionForm->addRow(QStringLiteral("Partition Type:"), appSessionWidget->key);
|
||||
|
||||
sessionForm->addRow(QStringLiteral("Payloads:"), appSessionWidget->payloads);
|
||||
sessionForm->addRow(QStringLiteral("Has BaseLayout:"), appSessionWidget->hasBL);
|
||||
sessionForm->addRow(QStringLiteral("BaseLayout:"), appSessionWidget->isBL);
|
||||
sessionForm->addRow(QStringLiteral("Marked for deletion:"), appSessionWidget->deletion);
|
||||
sessionForm->addRow(QStringLiteral("Init done:"), appSessionWidget->init);
|
||||
|
||||
appSessionList.append(appSessionWidget);
|
||||
thisLayout->insertWidget(0, appSessionWidget);
|
||||
}
|
||||
|
||||
// AND EXISTING SESSION
|
||||
|
||||
appSessionWidget->sessionId->setText(QString::number(appSession->id()));
|
||||
appSessionWidget->session->setText(QString::number((qintptr)appSession, 16));
|
||||
appSessionWidget->name->setText(appSession->name());
|
||||
appSessionWidget->blw->setText(QString::number((qintptr)appSession->baseLayout(), 16));
|
||||
appSessionWidget->domainId->setText(QString::number(appSession->domainId()));
|
||||
appSessionWidget->exerciseId->setText(QString::number(appSession->exerciseId()));
|
||||
appSessionWidget->partId->setText(QString::number(appSession->partitionId()));
|
||||
appSessionWidget->key->setText(LtsSession::LtsSession::partitionTypeString(appSession->partitionType()));
|
||||
|
||||
appSessionWidget->payloads->setText(boolToString(appSession->m_payloads));
|
||||
appSessionWidget->hasBL->setText(boolToString(appSession->m_hasBaseLayout));
|
||||
appSessionWidget->isBL->setText(boolToString(appSession->m_baseLayout != nullptr));
|
||||
appSessionWidget->deletion->setText(boolToString(appSession->m_markedForDeletion));
|
||||
appSessionWidget->init->setText(boolToString(appSession->m_initDone));
|
||||
}
|
||||
|
||||
|
||||
void DevDialog::addApp(LtsPluginManager::LtsPluginManager *app)
|
||||
{
|
||||
AppWidget *appWidget = nullptr;
|
||||
|
||||
for (auto i = m_appWidgetList.begin(); i != m_appWidgetList.end(); ++i)
|
||||
{
|
||||
AppWidget *_appWidget = *i;
|
||||
|
||||
if (_appWidget->appPtr == app)
|
||||
{
|
||||
appWidget = _appWidget;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (appWidget == nullptr) // NEW APP WIDGET
|
||||
{
|
||||
appWidget = new AppWidget();
|
||||
appWidget->appPtr = app;
|
||||
|
||||
QFormLayout *form = new QFormLayout(appWidget);
|
||||
|
||||
form->addRow(QStringLiteral("Name: "), appWidget->appName);
|
||||
form->addRow(QStringLiteral("Description: "), appWidget->appDescription);
|
||||
form->addRow(QStringLiteral("Initialized: "), appWidget->init);
|
||||
|
||||
// Sessions:
|
||||
form->addRow(QStringLiteral("Session count: "), appWidget->sessionCountLabel);
|
||||
form->addRow(QStringLiteral("Sessions:"), appWidget->sessionsWidget);
|
||||
|
||||
m_thisLayout->insertWidget(0, appWidget);
|
||||
m_appWidgetList.append(appWidget);
|
||||
}
|
||||
|
||||
|
||||
// AND EXISTING APP WIDGET
|
||||
|
||||
const QString &appName = app->m_app.appName;
|
||||
appWidget->appName->setText(appName.isEmpty() ? QStringLiteral("<unknown>") : appName);
|
||||
const QString &appDescription = app->description();
|
||||
appWidget->appDescription->setText(appDescription.isEmpty() ? QStringLiteral("<none>") : appDescription);
|
||||
appWidget->init->setText(boolToString(app->m_initialized));
|
||||
|
||||
|
||||
const QMap<LtsSession::LtsSessionManager::SessionKey, LtsSession::LtsSession *> &sessions = app->m_sessionManager->m_sessionMap;
|
||||
|
||||
appWidget->sessionCountLabel->setText(QString::number(sessions.count()));
|
||||
|
||||
for (LtsSession::LtsSession *appSession : sessions)
|
||||
appWidget->addSession(appSession);
|
||||
}
|
||||
|
||||
|
||||
void DevDialog::slotRefresh()
|
||||
{
|
||||
m_ui->lblLtsDialogCount->setText(QString::number(LtsWidgets::LtsDialog::s_object_count));
|
||||
|
||||
LtsAppManager::LtsAppManager *appManager = LtsAppManager::LtsAppManager::getInstance();
|
||||
|
||||
QVector<LtsPluginManager::LtsPluginManager *> appList = appManager->m_appList;
|
||||
|
||||
bool loginAppExists = (appManager->m_login != nullptr ? (appManager->m_login->m_loginApp != nullptr ? true : false) : false);
|
||||
if (loginAppExists)
|
||||
appList.append(appManager->m_login->m_loginApp);
|
||||
|
||||
m_ui->lblAppCount->setText(QString::number(appList.count()));
|
||||
|
||||
// add apps
|
||||
for (auto *app : qAsConst(appList))
|
||||
addApp(app);
|
||||
|
||||
|
||||
// check for deleted apps and sessions
|
||||
for (AppWidget *appWidget : qAsConst(m_appWidgetList))
|
||||
{
|
||||
const LtsPluginManager::LtsPluginManager *app = nullptr;
|
||||
|
||||
for (LtsPluginManager::LtsPluginManager *_app : qAsConst(appList))
|
||||
{
|
||||
if (appWidget->appPtr == _app)
|
||||
{
|
||||
app = _app;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (app) // found, check for deleted sessions
|
||||
{
|
||||
appWidget->checkSessions(app->m_sessionManager->m_sessionMap);
|
||||
}
|
||||
else // not found
|
||||
{
|
||||
appWidget->setDeleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DevDialog::slotToggleAuto(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
m_t->start();
|
||||
else
|
||||
m_t->stop();
|
||||
}
|
||||
|
||||
} // namespace DeveloperTools
|
||||
Executable
+137
@@ -0,0 +1,137 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-11-15
|
||||
*/
|
||||
|
||||
#include <QDialog>
|
||||
#include <QWidget>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <LtsSession/lts_session_manager.h>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DevDialog;
|
||||
}
|
||||
namespace LtsPluginManager
|
||||
{
|
||||
class LtsPluginManager;
|
||||
}
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
class AppWidget;
|
||||
class AppSessionWidget;
|
||||
|
||||
class DevDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DevDialog(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
void addApp(LtsPluginManager::LtsPluginManager *app);
|
||||
|
||||
Ui::DevDialog *m_ui;
|
||||
QTimer *m_t;
|
||||
QVector<AppWidget *> m_appWidgetList;
|
||||
QVBoxLayout *m_thisLayout;
|
||||
|
||||
private slots:
|
||||
void slotRefresh();
|
||||
void slotToggleAuto(bool checked);
|
||||
};
|
||||
|
||||
|
||||
class AppSessionWidget : public QGroupBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AppSessionWidget()
|
||||
: appSessionPtr(nullptr)
|
||||
, sessionId(new QLabel(this))
|
||||
, session(new QLabel(this))
|
||||
, name(new QLabel(this))
|
||||
, blw(new QLabel(this))
|
||||
, domainId(new QLabel(this))
|
||||
, exerciseId(new QLabel(this))
|
||||
, partId(new QLabel(this))
|
||||
, key(new QLabel(this))
|
||||
, payloads(new QLabel(this))
|
||||
, hasBL(new QLabel(this))
|
||||
, isBL(new QLabel(this))
|
||||
, deletion(new QLabel(this))
|
||||
, init(new QLabel(this))
|
||||
{}
|
||||
|
||||
void setDeleted();
|
||||
|
||||
void *appSessionPtr;
|
||||
|
||||
QLabel *sessionId;
|
||||
QLabel *session;
|
||||
QLabel *name;
|
||||
QLabel *blw;
|
||||
QLabel *domainId;
|
||||
QLabel *exerciseId;
|
||||
QLabel *partId;
|
||||
QLabel *key;
|
||||
|
||||
QLabel *payloads;
|
||||
QLabel *hasBL;
|
||||
QLabel *isBL;
|
||||
QLabel *deletion;
|
||||
QLabel *init;
|
||||
};
|
||||
|
||||
|
||||
class AppWidget : public QGroupBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AppWidget()
|
||||
: appPtr(nullptr)
|
||||
, thisLayout(new QVBoxLayout)
|
||||
, appName(new QLabel(this))
|
||||
, appDescription(new QLabel(this))
|
||||
, init(new QLabel(this))
|
||||
, sessionCountLabel(new QLabel(this))
|
||||
, sessionsWidget(new QGroupBox(this))
|
||||
{
|
||||
sessionsWidget->setLayout(thisLayout);
|
||||
}
|
||||
|
||||
void addSession(LtsSession::LtsSession *appSession);
|
||||
void checkSessions(const QMap<LtsSession::LtsSessionManager::SessionKey, LtsSession::LtsSession *> &sessions);
|
||||
void setDeleted();
|
||||
|
||||
void *appPtr;
|
||||
|
||||
QVBoxLayout *thisLayout;
|
||||
|
||||
QLabel *appName;
|
||||
QLabel *appDescription;
|
||||
QLabel *init;
|
||||
|
||||
QLabel *sessionCountLabel;
|
||||
QGroupBox *sessionsWidget;
|
||||
|
||||
QVector<AppSessionWidget *> appSessionList;
|
||||
};
|
||||
|
||||
|
||||
} // namespace DeveloperTools
|
||||
Executable
+201
@@ -0,0 +1,201 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DevDialog</class>
|
||||
<widget class="QWidget" name="DevDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>555</width>
|
||||
<height>900</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0,0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>535</width>
|
||||
<height>682</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pbCPSIC">
|
||||
<property name="text">
|
||||
<string>Copy ProjectSettings into Clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pbCOSIC">
|
||||
<property name="text">
|
||||
<string>Copy Operator Settings into Clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="pbLDW">
|
||||
<property name="text">
|
||||
<string>Create FullscreenVideoDummyWidget</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="pbGWDCT">
|
||||
<property name="text">
|
||||
<string>Global Wait Dialog + Custom Text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="pbCQCD">
|
||||
<property name="text">
|
||||
<string>Create QColorDialog</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="pbLDWNormal">
|
||||
<property name="text">
|
||||
<string><= ... (LtsScreenNormal only)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Tests:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>App count: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblAppCount">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>LtsDialog count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lblLtsDialogCount">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Global mouse pos:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lblMousePos">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbAuto">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto refresh (F5)</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F5</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbRefresh">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh</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>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
#include "dev_ftcmock.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsWidgets/lts_global_wait_dialog.h>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QRandomGenerator>
|
||||
#include <QLabel>
|
||||
#include <QEventLoop>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
FtcMock::FtcMock(LtsSession::LtsSession *session, int min, int max, int timers)
|
||||
: m_session(session)
|
||||
, m_exmFtc(ExerciseManagement::Interface::Ftc::create(m_session->ddsConnector()))
|
||||
, m_gen(QRandomGenerator::global())
|
||||
, m_min(min)
|
||||
, m_max(max)
|
||||
{
|
||||
for (int i = 0; i <= timers; i++)
|
||||
{
|
||||
auto *t = new QTimer(this);
|
||||
t->setSingleShot(true);
|
||||
t->setInterval(m_gen->bounded(min, max));
|
||||
QObject::connect(t, &QTimer::timeout, this, &FtcMock::mock, Qt::QueuedConnection);
|
||||
t->start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FtcMock::mock()
|
||||
{
|
||||
QPointer<QTimer> t(static_cast<QTimer *>(sender()));
|
||||
|
||||
uint32_t bit = 32;
|
||||
#define CHANCE(x) (((flags >> (bit-=x)) & x) == x)
|
||||
const uint32_t flags = m_gen->generate();
|
||||
auto exmFtc = m_exmFtc;
|
||||
|
||||
auto go = [this, flags, &bit, &exmFtc]()
|
||||
{
|
||||
bool useOwnFtc = CHANCE(0b111);
|
||||
|
||||
if (useOwnFtc)
|
||||
{
|
||||
fprintf(stderr, "ftcmock: use own, new ftc\n");
|
||||
exmFtc = ExerciseManagement::Interface::Ftc::create(m_session->ddsConnector(), true /*don't reuse*/);
|
||||
}
|
||||
|
||||
exmFtc->enableGetExerciseImage();
|
||||
auto req = ExerciseManagement::GetExerciseImageRequest();
|
||||
req.exerciseId(42);
|
||||
ExerciseManagement::GetExerciseImageReply rep;
|
||||
try
|
||||
{
|
||||
//Waiter _;
|
||||
rep = exmFtc->getExerciseImageRequest(req);
|
||||
}
|
||||
catch(const std::runtime_error &ex)
|
||||
{
|
||||
qWarning() << "!!!!!!!!!!!!!!!!! getExerciseImageRequest error: " << ex.what();
|
||||
//Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (useOwnFtc && CHANCE(0b11))
|
||||
{
|
||||
// wait for thread to time out & die
|
||||
auto *l = new QLabel;
|
||||
QEventLoop x;
|
||||
QObject::connect(l, &QLabel::linkActivated, &x, &QEventLoop::quit);
|
||||
QTimer::singleShot(13000, l, [l](){ emit l->linkActivated({}); });
|
||||
fprintf(stderr, "ftcmock: WAITING FOR THREAD TO TIME OUT & DIE....\n");
|
||||
x.exec();
|
||||
fprintf(stderr, "ftcmock: DONE!\n");
|
||||
l->deleteLater();
|
||||
|
||||
|
||||
// ... then get again to start the thread again
|
||||
ExerciseManagement::GetExerciseImageReply rep;
|
||||
try
|
||||
{
|
||||
//Waiter _;
|
||||
rep = exmFtc->getExerciseImageRequest(req);
|
||||
}
|
||||
catch(const std::runtime_error &ex)
|
||||
{
|
||||
qWarning() << "!!!!!!!!!!!!!!!!! getExerciseImageRequest #2 error: " << ex.what();
|
||||
//Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exmFtc->enableExerciseImageModify();
|
||||
auto req2 = ExerciseManagement::ExerciseImageModifyRequest(42, rep.imageData());
|
||||
try
|
||||
{
|
||||
//Waiter _;
|
||||
auto id = exmFtc->exerciseImageModifyRequest(req2);
|
||||
if (id < 1)
|
||||
{
|
||||
qWarning() << "id < 1";
|
||||
Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch(const std::runtime_error &ex)
|
||||
{
|
||||
qWarning() << "!!!!!!!!!!!!!!!!! exerciseImageModifyRequest error: " << ex.what();
|
||||
//Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
go();
|
||||
|
||||
if (CHANCE(0b11))
|
||||
{
|
||||
fprintf(stderr, "ftcmock: again #1\n");
|
||||
go(); // again
|
||||
}
|
||||
|
||||
if (CHANCE(0b11))
|
||||
{
|
||||
fprintf(stderr, "ftcmock: again #2\n");
|
||||
go(); // again
|
||||
}
|
||||
|
||||
|
||||
if (!t)
|
||||
return;
|
||||
|
||||
t->setInterval(m_gen->bounded(m_min, m_max));
|
||||
fprintf(stderr, "ftcmock: in %d ms\n", t->interval());
|
||||
t->start();
|
||||
}
|
||||
|
||||
|
||||
FtcMock::~FtcMock()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // namespace DeveloperTools
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <ExerciseManagement/exm_ftc.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
class QRandomGenerator;
|
||||
namespace LtsSession { class LtsSession; }
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
class FtcMock : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FtcMock(LtsSession::LtsSession *session, int min, int max, int timers);
|
||||
void mock();
|
||||
~FtcMock();
|
||||
|
||||
private:
|
||||
LtsSession::LtsSession *m_session;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Ftc> m_exmFtc;
|
||||
QRandomGenerator *m_gen;
|
||||
int m_min;
|
||||
int m_max;
|
||||
};
|
||||
|
||||
} // namespace DeveloperTools
|
||||
+442
@@ -0,0 +1,442 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-11-15
|
||||
*/
|
||||
|
||||
#include "dev_gui_plugin.h"
|
||||
#include "dev_dialog.h"
|
||||
#include "dev_permissions_dialog.h"
|
||||
#include "dev_debug_flags_dialog.h"
|
||||
#include "dev_ftcmock.h"
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <ngltranslator/ngltranslator.h>
|
||||
#include <LtsNotification/lts_notification.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsAppManager/lts_app_manager.h>
|
||||
#include <LtsAppDescriptor/lts_app_descriptor.h>
|
||||
#include <LtsPluginManager/lts_plugin_manager.h>
|
||||
#include <LtsWidgets/lts_base_layout_widget.h>
|
||||
#include <LtsWidgets/lts_notification_box.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
#include <QShortcut>
|
||||
#include <QTcpSocket>
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
|
||||
bool InterfaceImpl::s_devDialogVisible = false;
|
||||
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Plugins.Gui.Dev"))
|
||||
{
|
||||
#ifdef LTS_DEBUG
|
||||
if (QGuiApplication::queryKeyboardModifiers() == Qt::ControlModifier)
|
||||
showDevTools();
|
||||
#endif
|
||||
|
||||
auto *t1 = new QTimer(this);
|
||||
t1->setInterval(1000);
|
||||
connect(t1, &QTimer::timeout,
|
||||
this, &InterfaceImpl::slotCheckFlags);
|
||||
t1->start();
|
||||
|
||||
connect(LtsAppManager::LtsAppManager::getInstance(), &LtsAppManager::LtsAppManager::signalCommand,
|
||||
this, &InterfaceImpl::slotCommand, Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
|
||||
InterfaceImpl::~InterfaceImpl()
|
||||
{
|
||||
delete m_noti;
|
||||
if (m_ftcMock != nullptr)
|
||||
{
|
||||
m_ftcMock->deleteLater();
|
||||
m_ftcMock = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InterfaceImpl::slotCommand(QTcpSocket *client, const QStringList &argList)
|
||||
{
|
||||
if (argList.at(0) != QStringLiteral("ftcmock"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool k = false;
|
||||
const int sessionId = argList.at(2).toInt(&k);
|
||||
if (!k || sessionId != m_session->id())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (QStringList({QStringLiteral("start"), QStringLiteral("stop")}).indexOf(argList.at(1)))
|
||||
{
|
||||
case 0: // start
|
||||
{
|
||||
if (m_ftcMock != nullptr)
|
||||
{
|
||||
client->write("ftcmock already running for this session");
|
||||
return;
|
||||
}
|
||||
|
||||
const int min = argList.at(3).toInt(&k);
|
||||
if (!k || min < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const int max = argList.at(4).toInt(&k);
|
||||
if (!k || max < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const int timers = argList.at(5).toInt(&k);
|
||||
if (!k || timers < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_ftcMock = new FtcMock(m_session, min, max, timers);
|
||||
client->write("ftcmock now running");
|
||||
return;
|
||||
}
|
||||
|
||||
case 1: // stop
|
||||
{
|
||||
if (m_ftcMock == nullptr)
|
||||
{
|
||||
client->write("ftcmock not running for this session");
|
||||
return;
|
||||
}
|
||||
|
||||
m_ftcMock->deleteLater();
|
||||
m_ftcMock = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
client->write("Usage: ftcmock <start / stop> <sessionId>");
|
||||
}
|
||||
|
||||
|
||||
void InterfaceImpl::slotCheckFlags()
|
||||
{
|
||||
LtsSessionData::LtsSessionData *sessionData = LtsSessionData::LtsSessionData::getInstance();
|
||||
|
||||
if (sessionData->debugFlagValue(QStringLiteral("DeveloperTools.ShowSessionsOnce")) == QVariant(true)) // first DevGuiPlugin wins!
|
||||
{
|
||||
if (!m_processedFlags.contains(QStringLiteral("DeveloperTools.ShowSessionsOnce")))
|
||||
{
|
||||
m_processedFlags.append(QStringLiteral("DeveloperTools.ShowSessionsOnce"));
|
||||
showDevTools();
|
||||
}
|
||||
}
|
||||
|
||||
if (sessionData->debugFlagValue(QStringLiteral("LanguageChangeViaKey")) == QVariant(true)) // first DevGuiPlugin wins!
|
||||
{
|
||||
if (!m_processedFlags.contains(QStringLiteral("LanguageChangeViaKey")))
|
||||
{
|
||||
if (m_session->baseLayout() != nullptr)
|
||||
{
|
||||
m_processedFlags.append(QStringLiteral("LanguageChangeViaKey"));
|
||||
|
||||
QShortcut *shortcutGer = new QShortcut(QKeySequence(QStringLiteral("F1"), QKeySequence::SequenceFormat::NativeText), m_session->baseLayout(),
|
||||
nullptr, nullptr, Qt::ShortcutContext::WindowShortcut);
|
||||
|
||||
connect(shortcutGer, &QShortcut::activated,
|
||||
this, []()
|
||||
{
|
||||
#ifdef AFTER_FAT
|
||||
LtsTranslator::LtsTranslator::getInstance()->setLocale(QLocale::German, QLocale::Germany);
|
||||
#else
|
||||
NGL::setTranslationLocale(QByteArray("de_DE"));
|
||||
#endif
|
||||
});
|
||||
|
||||
|
||||
|
||||
QShortcut *shortcutEng = new QShortcut(QKeySequence(QStringLiteral("F3"), QKeySequence::SequenceFormat::NativeText), m_session->baseLayout(),
|
||||
nullptr, nullptr, Qt::ShortcutContext::WindowShortcut);
|
||||
|
||||
connect(shortcutEng, &QShortcut::activated,
|
||||
this, []()
|
||||
{
|
||||
#ifdef AFTER_FAT
|
||||
LtsTranslator::LtsTranslator::getInstance()->setLocale(QLocale::English, QLocale::UnitedKingdom);
|
||||
#else
|
||||
NGL::setTranslationLocale(QByteArray("en_GB"));
|
||||
#endif
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
if (!LtsSessionData::LtsSessionData::getInstance()->hasDebugFlag(QStringLiteral("DeveloperTools.Active")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_noti != nullptr)
|
||||
{
|
||||
delete m_noti;
|
||||
m_noti = nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int count = m_session->missingRightActions().count();
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
if (m_noti == nullptr)
|
||||
{
|
||||
m_noti = m_session->createNotification(QStringLiteral("DevPermissions"));
|
||||
|
||||
m_noti->setIcon(QIcon(QStringLiteral("icon:lock.svg")));
|
||||
m_noti->setAction([this]()
|
||||
{
|
||||
m_session->addWidget(LtsWidgets::initDialog(new PermissionsDialog(), m_session), menuGroup(), QStringLiteral("devPermissions"));
|
||||
});
|
||||
}
|
||||
|
||||
m_noti->setCount(count);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_noti;
|
||||
m_noti = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InterfaceImpl::showAutoRestart()
|
||||
{
|
||||
QMessageBox::warning(nullptr, QStringLiteral("DEV"), QStringLiteral("Warning: Auto restart can not be stopped (not yet implemented), hard kill required!"));
|
||||
|
||||
const LtsAppDescriptor::AppDescriptionVector apps = LtsAppManager::LtsAppManager::getInstance()->getAvailableApps();
|
||||
|
||||
QStringList listApps;
|
||||
listApps.reserve(apps.count());
|
||||
QMap<QString, LtsAppDescriptor::App> mapApp2Id;
|
||||
|
||||
for (const LtsAppDescriptor::AppDescription &app : apps)
|
||||
{
|
||||
listApps.append(app.appName);
|
||||
mapApp2Id[app.appName] = app.id;
|
||||
}
|
||||
|
||||
QInputDialog dialog;
|
||||
dialog.setComboBoxItems(listApps);
|
||||
dialog.setLabelText(QStringLiteral("Select app to debug: "));
|
||||
dialog.setWindowTitle(QStringLiteral("Select app to debug: "));
|
||||
|
||||
if (!dialog.exec())
|
||||
return;
|
||||
|
||||
QString strApp = dialog.textValue();
|
||||
|
||||
QInputDialog dialogInt;
|
||||
dialogInt.setLabelText(QStringLiteral("Select restart timeout value: "));
|
||||
dialogInt.setInputMode(QInputDialog::InputMode::IntInput);
|
||||
dialogInt.setIntMinimum(1000);
|
||||
dialogInt.setIntMaximum(600000);
|
||||
dialogInt.setIntStep(1000);
|
||||
dialogInt.setIntValue(4000);
|
||||
|
||||
if (!dialogInt.exec())
|
||||
return;
|
||||
|
||||
int timeoutValue = dialogInt.intValue();
|
||||
|
||||
|
||||
LtsSession::DdsConnectionParams hackParams(m_session->connParams());
|
||||
|
||||
QTimer *t = new QTimer(this);
|
||||
connect(t, &QTimer::timeout,
|
||||
this, [=]
|
||||
{
|
||||
LtsPluginManager::LtsPluginManager *pApp = LtsAppManager::LtsAppManager::getInstance()->createApp(mapApp2Id.value(strApp), hackParams);
|
||||
if (pApp == nullptr)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayoutWidget(), tr("App not could not be started"));
|
||||
return;
|
||||
}
|
||||
|
||||
connect(pApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished,
|
||||
this, [this, pApp, timeoutValue]()
|
||||
{
|
||||
QTimer *k = new QTimer(this);
|
||||
connect(pApp, &LtsPluginManager::LtsPluginManager::destroyed,
|
||||
k, &QTimer::deleteLater);
|
||||
connect(k, &QTimer::timeout, pApp,
|
||||
&LtsPluginManager::LtsPluginManager::deleteLater);
|
||||
k->setSingleShot(true);
|
||||
k->setInterval(timeoutValue);
|
||||
k->start();
|
||||
});
|
||||
|
||||
});
|
||||
t->setInterval(timeoutValue);
|
||||
t->start();
|
||||
}
|
||||
|
||||
|
||||
void InterfaceImpl::showDevTools()
|
||||
{
|
||||
if (!s_devDialogVisible)
|
||||
{
|
||||
QDialog *d = new DevDialog();
|
||||
|
||||
connect(d, &QDialog::destroyed,
|
||||
this, []()
|
||||
{
|
||||
qWarning() << "Developer Tools destroyed";
|
||||
s_devDialogVisible = false;
|
||||
});
|
||||
|
||||
d->setWindowFlags(Qt::Dialog | /*Qt::X11BypassWindowManagerHint |*/ Qt::WindowStaysOnTopHint);
|
||||
d->show();
|
||||
|
||||
qWarning() << "Developer Tools started";
|
||||
s_devDialogVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
#ifdef LTS_DEBUG
|
||||
bool actions = true;
|
||||
#else
|
||||
bool actions = false;
|
||||
#endif
|
||||
|
||||
if (LtsSessionData::LtsSessionData::getInstance()->hasDebugFlag(QStringLiteral("DeveloperTools.Actions")))
|
||||
actions = true;
|
||||
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
if (!actions)
|
||||
return ret;
|
||||
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Show Debug Dialog");
|
||||
plData.identifier = QStringLiteral("devTools");
|
||||
plData.directFunc = [this](const LtsWidgets::PluginData &)
|
||||
{
|
||||
showDevTools();
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Show Debug Flags");
|
||||
plData.identifier = QStringLiteral("devFlags");
|
||||
plData.createWidgetFunc = [this](QWidget *)
|
||||
{
|
||||
return LtsWidgets::initDialog(new DebugFlagsDialog(menuGroup()));
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("App Auto Restart");
|
||||
plData.identifier = QStringLiteral("devAutoRestart");
|
||||
plData.directFunc = [this](const LtsWidgets::PluginData &)
|
||||
{
|
||||
showAutoRestart();
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Start App ...");
|
||||
plData.identifier = QStringLiteral("devStartAppByAppId");
|
||||
plData.directFunc = [this](const LtsWidgets::PluginData &)
|
||||
{
|
||||
bool k = false;
|
||||
|
||||
int appId = QInputDialog::getInt(m_session->baseLayout(), QStringLiteral("Start App - AppId"), QStringLiteral("AppId"), (int)m_session->app(), 0, 999, 1, &k);
|
||||
if (!k) return;
|
||||
|
||||
int dId = QInputDialog::getInt(m_session->baseLayout(), QStringLiteral("Start App - Domain Id"), QStringLiteral("Domain Id"), m_session->domainId(), 0, 999, 1, &k);
|
||||
if (!k) return;
|
||||
|
||||
int exId = QInputDialog::getInt(m_session->baseLayout(), QStringLiteral("Start App - Exercise Id"), QStringLiteral("Exercise Id"), m_session->exerciseId(), 0, 999, 1, &k);
|
||||
if (!k) return;
|
||||
|
||||
int pId = QInputDialog::getInt(m_session->baseLayout(), QStringLiteral("Start App - Partition Id"), QStringLiteral("Partition Id"), m_session->exerciseId(), 0, 999, 1, &k);
|
||||
if (!k) return;
|
||||
|
||||
|
||||
LtsSession::DdsConnectionParams params(m_session->connParams());
|
||||
params.domainId = dId;
|
||||
params.exerciseId = exId;
|
||||
params.partitionId = pId;
|
||||
|
||||
if (pId != exId)
|
||||
params.partitionType = IDL::PartitionType::Replay;
|
||||
else if (pId == exId && exId != 0)
|
||||
params.partitionType = IDL::PartitionType::Exercise;
|
||||
else
|
||||
params.partitionType = IDL::PartitionType::Global;
|
||||
|
||||
|
||||
LtsAppManager::LtsAppManager::getInstance()->createApp(LtsAppDescriptor::LtsAppDescriptor::appFromInteger(appId), params);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Show Notification Box");
|
||||
plData.identifier = QStringLiteral("devShowNotiBox");
|
||||
plData.directFunc = [this](const LtsWidgets::PluginData &)
|
||||
{
|
||||
m_session->baseLayout()->showMessage(QStringLiteral("Test Title"), QStringLiteral("A long test text that notifies the user about <a href='Test'>something</a><br />that spreads over two lines to fit even more text."), LtsWidgets::LtsNotificationBox::MessageType::Info,
|
||||
[this](const QString &)
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(m_session->baseLayout(), QStringLiteral("You clicked the link!"));
|
||||
});
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace DeveloperTools
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-11-15
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Common/ProjectConfig/project_defines.h>
|
||||
|
||||
|
||||
namespace LtsNotification
|
||||
{
|
||||
class LtsNotification;
|
||||
}
|
||||
|
||||
class QTcpSocket;
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
class FtcMock;
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:dev")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QLatin1String("DeveloperToolsGuiPlugin"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType ) const override { return true; }
|
||||
};
|
||||
|
||||
|
||||
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
~InterfaceImpl();
|
||||
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
QString menuGroup() const override { return QStringLiteral("[Dev]"); }
|
||||
bool availableInPartition(IDL::PartitionType ) const override { return true; }
|
||||
|
||||
private slots:
|
||||
void slotCheckFlags();
|
||||
void slotCommand(QTcpSocket *client, const QStringList &argList);
|
||||
|
||||
private:
|
||||
void showDevTools();
|
||||
void showAutoRestart();
|
||||
|
||||
static bool s_devDialogVisible;
|
||||
LtsNotification::LtsNotification *m_noti { nullptr };
|
||||
QStringList m_processedFlags;
|
||||
FtcMock *m_ftcMock { nullptr };
|
||||
};
|
||||
|
||||
} // namespace ExerciseManagement
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
#include "dev_permissions_dialog.h"
|
||||
#include "ui_dev_permissions_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
|
||||
PermissionsDialog::PermissionsDialog()
|
||||
: LtsWidgets::LtsDialog()
|
||||
, m_ui(new Ui::PermissionsDialog())
|
||||
, m_session(nullptr)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->pushButton, &QPushButton::clicked,
|
||||
this, &PermissionsDialog::setThings);
|
||||
}
|
||||
|
||||
|
||||
PermissionsDialog::~PermissionsDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
bool PermissionsDialog::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
m_session = session;
|
||||
|
||||
setThings();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PermissionsDialog::setThings()
|
||||
{
|
||||
const QVector<LtsWidgets::PluginData> &missingRightActions = m_session->missingRightActions();
|
||||
|
||||
for (auto i = missingRightActions.constBegin(); i != missingRightActions.constEnd(); ++i)
|
||||
{
|
||||
QWidget *container = new QWidget();
|
||||
QHBoxLayout *l = new QHBoxLayout();
|
||||
container->setLayout(l);
|
||||
|
||||
const LtsWidgets::PluginData &pd = *i;
|
||||
QLabel *text = new QLabel(QStringLiteral("Menu: %1 - Text: %2 - Ident: %3").arg(pd.menuGroup, pd.menuText, pd.identifier));
|
||||
QPushButton *execute = new QPushButton(QStringLiteral("execute"));
|
||||
connect(execute, &QPushButton::clicked,
|
||||
this, [this, pd]()
|
||||
{
|
||||
if (pd.createWidgetFunc)
|
||||
{
|
||||
LtsDialog *w = pd.createWidgetFunc(this);
|
||||
|
||||
if (w)
|
||||
m_session->addWidget(w, pd.menuGroup, pd.identifier, pd.layoutArea, pd.closable);
|
||||
}
|
||||
|
||||
if (pd.directFunc)
|
||||
{
|
||||
pd.directFunc(pd);
|
||||
}
|
||||
});
|
||||
|
||||
QPushButton *allow = new QPushButton(QStringLiteral("allow"));
|
||||
|
||||
if (pd.createInstant == LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction)
|
||||
{
|
||||
allow->setCursor(QCursor(Qt::WhatsThisCursor));
|
||||
allow->setToolTip(QStringLiteral("CreateInstantType == CreateInstantAndDiscardAction !"));
|
||||
allow->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
connect(allow, &QPushButton::clicked,
|
||||
this, [this, pd /* cpy */, container]()
|
||||
{
|
||||
LtsWidgets::PluginData _pd = pd; // copy
|
||||
_pd.operatorRight = 0; // temporary allow adding this nasty action
|
||||
m_session->addAction(_pd);
|
||||
container->deleteLater(); // allowed, now delete container
|
||||
|
||||
// remove action from missing right list (session)
|
||||
QVector<LtsWidgets::PluginData> &missingRightActions = m_session->missingRightActions();
|
||||
for (int i = 0; i < missingRightActions.count(); i++)
|
||||
{
|
||||
LtsWidgets::PluginData &__pd = missingRightActions[i];
|
||||
if (__pd.identifier == _pd.identifier &&
|
||||
__pd.menuGroup == _pd.menuGroup &&
|
||||
__pd.menuText == _pd.menuText)
|
||||
{
|
||||
missingRightActions.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
l->addWidget(text, 1);
|
||||
l->addWidget(execute);
|
||||
l->addWidget(allow);
|
||||
|
||||
m_ui->verticalLayout->addWidget(container);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace DeveloperTools
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PermissionsDialog;
|
||||
}
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace DeveloperTools
|
||||
{
|
||||
class PermissionsDialog : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PermissionsDialog();
|
||||
~PermissionsDialog();
|
||||
bool init(LtsSession::LtsSession *session);
|
||||
void retranslate() override {}
|
||||
|
||||
private slots:
|
||||
void setThings();
|
||||
|
||||
private:
|
||||
Ui::PermissionsDialog *m_ui;
|
||||
LtsSession::LtsSession *m_session;
|
||||
};
|
||||
} // namespace DeveloperTools
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PermissionsDialog</class>
|
||||
<widget class="QWidget" name="PermissionsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>537</width>
|
||||
<height>344</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout"/>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Exercisemanagemt (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ExerciseManagement
|
||||
{
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
};
|
||||
|
||||
} // namespace ExerciseManagement
|
||||
Reference in new issue
Block a user