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,81 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# Created by Mike Wille, SLSE, 2016-03-17
#
SET(pre_script_gui_SRCS
pre_script_gui_plugin.cpp
pre_script_gui_plugin.h
pre_script_dialog.h
pre_script_dialog.cpp
pre_storyboard.cpp
pre_storyboard.h
pre_journal_types.h
pre_journal_types.cpp
pre_journal_dialog.h
pre_journal_dialog.cpp
pre_screen.h
pre_screen.cpp
filter_topic.h
filter_topic.cpp
)
QT5_WRAP_UI(pre_script_gui_SRCS
pre_storyboard.ui
pre_script_dialog.ui
pre_journal_dialog.ui
)
NGL_ADD_LIBRARY(WS PreScriptGuiPlugin MODULE ${pre_script_gui_SRCS})
NGL_TARGET_LINK_LIBRARIES(PreScriptGuiPlugin
NGLLogger
LtsSession
PreDataPluginInterface
PrePresentationGuiPluginInterface
PreGuiCommon
PreGuiScriptCommon
svcPreCommon
Qt5::Widgets
LtsWidgets
LtsDataView
LtsUtilsGuiDds
LtsSessionData
ProjectConfig
LtsScriptTimeline
LtsMultiMonitor
LtsAppManager # start replay app
LtsSessionData # set partition preset for replay app
TopicEditorInterface
TopicEditorBase
LtsPluginManager # manipulate apps
# for Topics
EvlGuiPluginInterface
SrmDataPluginInterface # start playback
LtsPrinting
SituationMapGuiPluginInterface
# Script Player Controls:
SrpGuiPluginInterface
# file topic
FlmExplorerGuiPluginInterface
# building topic
BdvViewerGuiPluginInterface
# report topic
RepGuiPluginInterface
LtsReportDisplay
MrkCommon # for ApplyFilter @ SitmapFilter
LtsUtilsSettings
ngltools # DTG
situationMap # set time string on map
ExportBdvTopicSetting
)
NGL_INSTALL_TARGET(PreScriptGuiPlugin)
@@ -0,0 +1,17 @@
#include "filter_topic.h"
namespace PresentationManagement
{
FilterTopic::~FilterTopic()
{
//delete filterTopic;
}
FilterTopic::FilterTopic(const FilterTopic &other)
{
mainTopicId = other.mainTopicId;
filterTopic = other.filterTopic;//new LtsScriptTimeline::TrackEntry(other.filterTopic);
}
} // namespace PresentationManagement
@@ -0,0 +1,28 @@
#pragma once
#include <LtsScriptTimeline/track_entry.h>
namespace PresentationManagement
{
class FilterTopic
{
public:
FilterTopic()
: mainTopicId(-1)
, filterTopic(nullptr)
{}
FilterTopic(int _mainTopicId, LtsScriptTimeline::TrackEntry *_filterTopic)
: mainTopicId(_mainTopicId)
, filterTopic(_filterTopic)
{}
FilterTopic(const FilterTopic &other);
~FilterTopic();
int mainTopicId;
LtsScriptTimeline::TrackEntry *filterTopic;
};
} // namespace PresentationManagement
@@ -0,0 +1,81 @@
#include "pre_journal_dialog.h"
#include "ui_pre_journal_dialog.h"
#include <LtsPrinting/printing.h>
namespace PresentationManagement
{
JournalDialog::JournalDialog(LtsSession::LtsSession *session, QWidget *parent)
: LtsWidgets::LtsDialog(parent)
, m_ui(new Ui::JournalDialog)
, m_journal(nullptr)
, m_session(session)
{
m_ui->setupUi(this);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &JournalDialog::slotPrint);
}
JournalDialog::~JournalDialog()
{
delete m_ui;
}
void JournalDialog::slotPrint()
{
LtsPrinting::printView(m_session, this, m_ui->listWidget);
}
bool JournalDialog::init(MainJournal *journal)
{
m_journal = journal;
return true;
}
void JournalDialog::retranslate()
{
translate(m_ui, tr("Script Journal"));
fillJournal();
}
void JournalDialog::fillJournal()
{
m_ui->listWidget->clear();
if (!m_journal)
return;
m_ui->listWidget->addItem(m_journal->getText());
for (const Journal *j : qAsConst(m_journal->journalList))
m_ui->listWidget->addItem(j->getText());
}
} // namespace PresentationManagement
@@ -0,0 +1,37 @@
#pragma once
#include "pre_journal_types.h"
#include <LtsWidgets/lts_dialog.h>
#include <LtsSession/lts_session.h>
namespace Ui
{
class JournalDialog;
}
namespace PresentationManagement
{
class JournalDialog : public LtsWidgets::LtsDialog
{
Q_OBJECT
public:
explicit JournalDialog(LtsSession::LtsSession *session, QWidget *parent);
~JournalDialog();
bool init(MainJournal *journal);
void retranslate() override final;
private slots:
void slotPrint();
private:
void fillJournal();
Ui::JournalDialog *m_ui;
MainJournal *m_journal;
LtsSession::LtsSession *m_session;
};
} // namespace PresentationManagement
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>JournalDialog</class>
<widget class="QWidget" name="JournalDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>707</width>
<height>464</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string notr="true">Script Editor</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>9</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QListWidget" name="listWidget">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,90 @@
#include "pre_journal_types.h"
#include <QDateTime>
#include <ngltools/ngltools_dtg.h>
namespace PresentationManagement
{
QString ttt(qint64 msecsSinceEpoch)
{
return DTG::toStringMSec(msecsSinceEpoch);
}
QString pttt(int presentationTime)
{
return QTime::fromMSecsSinceStartOfDay(presentationTime * 1000).toString();
}
Journal::Journal()
: m_started(QDateTime::currentMSecsSinceEpoch())
{}
QString Journal::started() const
{
return ttt(m_started);
}
MainJournal::~MainJournal()
{
qDeleteAll(journalList);
}
QString MainJournal::getText() const
{
return Journal::tr("Script Player started on %1").arg(ttt(started));
}
NextTopicJournal::NextTopicJournal(int presentationTime, bool isFilter, const QString &topicTypeName, int length)
: Journal()
, m_isFilter(isFilter)
, m_topicTypeName(topicTypeName)
, m_length(length)
, m_presentationTime(presentationTime)
{}
QString NextTopicJournal::getText() const
{
return Journal::tr("%1 '%2' started at %3 for %4 seconds on %5").arg(m_isFilter ? tr("FilterTopic") : tr("Topic"),
m_topicTypeName, pttt(m_presentationTime)).arg(m_length).arg(started());
}
QString PlayJournal::getText() const
{
return Journal::tr("Started / resumed script at %1 on %2").arg(pttt(m_presentationTime), started());
}
QString PauseJournal::getText() const
{
return Journal::tr("Paused script at %1 on %2").arg(pttt(m_presentationTime), started());
}
QString EndedJournal::getText() const
{
return Journal::tr("Script ended at %1 on %2").arg(pttt(m_presentationTime), started());
}
QString StopJournal::getText() const
{
return Journal::tr("Script stopped at %1 on %2").arg(pttt(m_presentationTime), started());
}
QString SetTimeJournal::getText() const
{
return Journal::tr("Position time set to %1 on %2").arg(pttt(m_toPresentationTime), started());
}
} // namespace PresentationManagement
@@ -0,0 +1,131 @@
#pragma once
#include <QCoreApplication>
#include <QVector>
namespace PresentationManagement
{
class Journal
{
Q_DECLARE_TR_FUNCTIONS(Journal)
public:
Journal();
virtual ~Journal() = default;
QString started() const;
virtual QString getText() const = 0;
qint64 m_started;
};
class MainJournal
{
public:
~MainJournal();
QString getText() const;
qint64 started = 0;
QVector<Journal *> journalList;
};
class NextTopicJournal : public Journal
{
public:
NextTopicJournal(int presentationTime, bool isFilter, /*int topicId, */const QString &topicTypeName, int length);
QString getText() const override final;
bool m_isFilter;
//int m_topicId;
QString m_topicTypeName;
int m_length;
int m_presentationTime;
};
class PlayJournal : public Journal
{
public:
explicit PlayJournal(int presentationTime)
: Journal()
, m_presentationTime(presentationTime)
{}
QString getText() const override final;
int m_presentationTime;
};
class PauseJournal : public Journal
{
public:
explicit PauseJournal(int presentationTime)
: Journal()
, m_presentationTime(presentationTime)
{}
QString getText() const override final;
int m_presentationTime;
};
class EndedJournal : public Journal
{
public:
explicit EndedJournal(int presentationTime)
: Journal()
, m_presentationTime(presentationTime)
{}
QString getText() const override final;
int m_presentationTime;
};
class StopJournal : public Journal
{
public:
explicit StopJournal(int presentationTime)
: Journal()
, m_presentationTime(presentationTime)
{}
QString getText() const override final;
int m_presentationTime;
};
class SetTimeJournal : public Journal
{
public:
explicit SetTimeJournal(int toPresentationTime)
: Journal()
, m_toPresentationTime(toPresentationTime)
{}
QString getText() const override final;
int m_toPresentationTime;
};
} // namespace PresentationManagement
@@ -0,0 +1,35 @@
#include "pre_screen.h"
#include <QStyleOption>
#include <QPainter>
Screen::Screen()
: QWidget()
{
setBgColor(QColor("black"));
setContentsMargins(0, 0, 0, 0);
}
Screen::~Screen()
{
const auto p1Widgets = findChildren<QWidget *>(QString(), Qt::FindDirectChildrenOnly);
for (QWidget *w : p1Widgets)
w->setParent(nullptr);
}
void Screen::setBgColor(const QColor &color)
{
setStyleSheet(QStringLiteral("Screen { background: %1; background-color: %1; }").arg(color.name()));
}
void Screen::paintEvent(QPaintEvent *) // needed to apply the style sheet...........
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
@@ -0,0 +1,18 @@
#pragma once
#include <QWidget>
class Screen : public QWidget
{
Q_OBJECT
public:
Screen();
virtual ~Screen();
void setBgColor(const QColor &color);
private:
void paintEvent(QPaintEvent *) override;
};
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,402 @@
/**
* @RDE_HEADER@
* PresentationManagement - Script Editor
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2017-03-17
*/
#pragma once
#include "pre_screen.h"
#include "pre_journal_types.h"
#include "pre_storyboard.h" // QPointer
#include "filter_topic.h"
#include <DDS/Core/core_dtc.h>
#include <PluginInterfaces/topic_replay_interface.h>
#include <LtsPluginManager/lts_plugin_manager.h>
#include <LtsWidgets/lts_dialog.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <LtsScriptTimeline/track_entry_painters.h> // TET
#include <LtsScriptTimeline/temporary_pointer_vector.h>
#include <LtsSession/lts_session.h>
#include <Plugins/PresentationManagement/Gui/Common/topic_assignment.h>
#include <Services/PresentationManagement/pre_dtc.h>
#include <Services/PresentationManagement/pre_ftc.h>
#include <Services/PresentationManagement/logger.h>
#include <Services/SituationReplayManagement/srm_ftc.h>
#include <Services/OperatorManagement/opm_dtc.h>
// foreign gui plugins for the topic playback
#include <Plugins/SituationReplay/srp_gui_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <QString>
#include <QStringList>
#include <QMap>
#include <functional>
#include <memory>
namespace TakeHomePackageGenerator
{
class ExportProcess;
}
namespace Ui
{
class ScriptDialog;
}
namespace LtsScriptTimeline
{
class TrackEntry;
}
namespace SituationReplayManagement
{
class ForeignDataInterface;
}
namespace LtsPluginManager
{
class LtsPluginManager;
}
namespace Ui
{
class ScriptPlayerDialog;
}
namespace LtsScriptTimeline
{
class TrackEntry;
}
namespace LtsUtils
{
class Promise;
}
namespace PresentationManagement
{
class TopicDesigner;
namespace Interface
{
class Ftc;
}
class ScriptDialog : public LtsWidgets::LtsDialog
, protected PresentationManagement::Interface::Ftc::PresentationModifyReplyHandler
, protected PresentationManagement::Interface::Ftc::GetPresentationContentReplyHandler
, protected SituationReplayManagement::Interface::Ftc::ReplayPartitionCreateReplyHandler
, protected SituationReplayManagement::Interface::Ftc::ReplayPartitionRemoveReplyHandler
{
public:
Q_OBJECT
public:
explicit ScriptDialog(const QString &menuGroup, QWidget *parent = nullptr);
~ScriptDialog();
LtsSession::LtsSession *eVSession() { return m_essentialsViewSession; }
bool init(LtsSession::LtsSession *session,
const int scriptId,
const std::shared_ptr<Interface::Dtc> &dtc,
const std::shared_ptr<Interface::Ftc> &ftc,
const std::shared_ptr<SituationReplayManagement::ForeignDataInterface> &srmForeign,
const std::shared_ptr<Core::Interface::Dtc> &coreDtc,
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc);
void loadScript();
TopicEditorBase::TopicEditor *createTopic(const TopicAssignment &ta);
TopicEditorBase::TopicEditor *createTopic(const LtsScriptTimeline::TrackEntry &data);
void createTopicFromTrackEntry(LtsScriptTimeline::TrackEntry *data);
bool topicStringToType(const QString &typeName, LtsScriptTimeline::TrackEntryType &tet) const;
int getCurrentScriptEndTime() const;
bool isEssentialsViewOpened() const;
static LtsScriptTimeline::TrackEntry *trackEntryFromContent(const PresentationManagement::PresentationContent &content,
int topicId,
LtsScriptTimeline::TrackEntryType trackType);
bool importTrackEntries(const QVector<LtsScriptTimeline::TrackEntry *> &tes);
std::shared_ptr<SituationReplay::ForeignGuiInterface> getReplayGuiIfc() const
{
return m_essentialsViewsSrpGuiIfc;
}
private:
enum class ProjectionWidget
{
Unknown = 0,
Screen1,
Screen2,
};
enum class SpecialTopicType
{
NonSpecial = 0,
ReplayTopic,
FilterTopic,
};
class PlayingTopic
{
public:
PlayingTopic() = default;
~PlayingTopic()
{
if (topicReplayIfc != nullptr)
{
topicReplayIfc->playbackStop();
delete topicReplayIfc;
}
// if (replayWidget) HACK: FIXME: trading memory for security BUT dont delete if it's the situation map app's base layout !
// delete replayWidget;
}
QString topicTypeName;
LtsScriptTimeline::TrackEntry *topic = nullptr;
TopicReplay::Interface *topicReplayIfc = nullptr; // 1 instance per 1 currently playing topic
QWidget *replayWidget = nullptr;
LtsScriptTimeline::TrackEntryType trackEntryType = LtsScriptTimeline::TrackEntryType::INVALID;
bool isFilter = false;
};
void onPresentationModifyReply(const Core::FunctionReplyObject &replyObject) override { if (m_requestHelper != nullptr) m_requestHelper->requestReply(replyObject); }
void onGetPresentationContentReply(const GetPresentationContentReply &reply) override { if (m_requestHelper != nullptr) m_requestHelper->requestReply(reply); }
void onReplayPartitionCreateReply(const Core::FunctionReplyObject &reply) override { if (m_requestHelper != nullptr) m_requestHelper->requestReply(reply); }
void onReplayPartitionRemoveReply(const Core::FunctionReplyObject &) override { /* ignore */ }
void retranslate() override;
bool apply() override;
void aboutToClose() override;
void getPresentationContent(); // tryAddTopics has to be called first to populate m_trackEntryAssignments
TopicEditorBase::TopicEditor *createTopicEditor(LtsScriptTimeline::TrackEntry *te);
bool topicTypeOnEssentialsView(LtsScriptTimeline::TrackEntryType tet) const;
void startEssentialsViewStage2(const Core::ReplayPartition &replay);
bool tryAddTopics(QStringList &resultList);
void fillTopicVector();
void createSitMapApp();
void startReplaySession();
void exportPresentationContent(const Core::FunctionReply &baseReply);
void disableSessionDialog(LtsSession::LtsSession *pSession, bool disable);
void deletePlayingTopic(PlayingTopic *playingTopic); // WARNING: use a mutable iterator while iterating over m_currentlyPlayingTopics and remove the entry before calling this method!
static QString toReadableTime(qint64 seconds);
ProjectionWidget identifyProjectionWidget(LtsScriptTimeline::TrackEntry *topic) const;
bool usesAvsWindow(LtsScriptTimeline::TrackEntryType trackEntryType) const;
void playTopic(LtsScriptTimeline::TrackEntry *topic);
bool enableFireEventFlash(bool enable);
void pausePlayingTopics();
static bool isFilter(LtsScriptTimeline::TrackEntryType tet);
void initProjectionWidget(Screen **pointerToWidgetPointer);
void deleteProjectionWidget(Screen **pointerToWidgetPointer);
bool _tryAddTopic(LtsScriptTimeline::TrackEntryType trackEntryType,
const std::shared_ptr<TopicEditorBase::Interface> &topicEditorIfc,
const std::shared_ptr<TopicReplay::Factory> &topicReplayFactory,
const std::shared_ptr<TopicReplay::Factory> &topicExportFactory,
QStringList &resultList,
const SpecialTopicType &specialTopicType = SpecialTopicType::NonSpecial);
void initFailed(int reason);
void setFreestanding(bool freestanding, const ProjectionWidget &pw);
void setReplayWidgetFreestanding(PlayingTopic *playingTopic, bool freestanding);
void printCurrentlyPlayingTopics();
void addReplayWidget(PlayingTopic *playingTopic, QWidget *replayWidget);
Screen *getProjectionWidget(const ScriptDialog::ProjectionWidget &projectionWidget);
bool isScreenFreestanding(const ProjectionWidget &pw) const;
void previewSecond(int time, int ignoreTopicForReplay = -1);
void setReplayWidgetPosition(PlayingTopic *playingTopic);
void avsFreestandingHack(bool freestanding, QWidget *projectionWidget, QWidget **parentForScreen);
void avsVisibilityHack(QWidget *parentForScreen, bool visible);
void stop(bool ended = false, bool ignoreFireEventFlashing = false);
void changelogCheck();
int previousTopicTime() const;
bool hasPreviousTopic() const { return previousTopicTime() > -1; }
int nextTopicTime() const;
bool hasNextTopic() const { return nextTopicTime() > -1; }
void setPositionTime(int positionTime, bool setByUser = false);
void setPositionTimeActive(int positionTime, bool setByUser = false); // setPositionTime, but, if playing, also ticks and resets timeout
template <typename TopicEditorInterface>
std::shared_ptr<TopicEditorBase::Interface> getTopicEditorIfc(LtsScriptTimeline::TrackEntryType trackEntryType)
{
std::shared_ptr<TopicEditorBase::Interface> topicEditorIfc;
if (!m_exerciseSession->interfaceFromGui<TopicEditorInterface>(topicEditorIfc))
{
ERROR_LOG(m_logger) << "getTopicEditorIfc failed: Cannot add topic type "
<< LtsScriptTimeline::trackEntryTypeName(trackEntryType)
<< " because topic editor ifc is missing.";
return nullptr;
}
return topicEditorIfc;
}
template <typename TopicReplayInterface>
std::shared_ptr<TopicReplay::Factory> getTopicReplayFactory(LtsScriptTimeline::TrackEntryType trackEntryType)
{
std::shared_ptr<TopicReplay::Factory> topicReplayFactory;
if (!m_replaySession->interfaceFromGui<TopicReplayInterface>(topicReplayFactory))
{
ERROR_LOG(m_logger) << "getTopicIfcFactory failed: Cannot add topic type "
<< LtsScriptTimeline::trackEntryTypeName(trackEntryType)
<< " because topic ifc factory is missing.";
return nullptr;
}
return topicReplayFactory;
}
template <typename TopicEditorGuiInterface,
typename TopicReplayFactory = TopicReplay::Factory,
typename TopicExportFactory = TopicReplayFactory>
bool tryAddTopic(LtsScriptTimeline::TrackEntryType trackEntryType,
QStringList &resultList,
const SpecialTopicType &specialTopicType = SpecialTopicType::NonSpecial)
{
std::shared_ptr<TopicEditorBase::Interface> topicEditorIfc;
std::shared_ptr<TopicReplay::Factory> topicReplayFactory;
std::shared_ptr<TopicReplay::Factory> topicExportFactory;
if (!std::is_same<TopicEditorBase::Interface, TopicEditorGuiInterface>::value)
{
topicEditorIfc = getTopicEditorIfc<TopicEditorGuiInterface>(trackEntryType);
if (topicEditorIfc == nullptr)
{
resultList.append(LtsScriptTimeline::trackEntryTypeName(trackEntryType));
return false;
}
}
if (!std::is_same<TopicReplay::Factory, TopicReplayFactory>::value)
{
topicReplayFactory = getTopicReplayFactory<TopicReplayFactory>(trackEntryType);
if (topicReplayFactory == nullptr)
{
resultList.append(LtsScriptTimeline::trackEntryTypeName(trackEntryType));
return false;
}
}
if (!std::is_same<TopicReplay::Factory, TopicExportFactory>::value)
{
topicExportFactory = getTopicReplayFactory<TopicExportFactory>(trackEntryType);
if (topicExportFactory == nullptr)
{
resultList.append(LtsScriptTimeline::trackEntryTypeName(trackEntryType));
return false;
}
}
else
topicExportFactory = topicReplayFactory;
return _tryAddTopic(trackEntryType, topicEditorIfc, topicReplayFactory, topicExportFactory, resultList, specialTopicType);
}
Ui::ScriptDialog *m_ui;
LtsSession::LtsSession *m_essentialsViewSession;
std::shared_ptr<SituationReplay::ForeignGuiInterface> m_essentialsViewsSrpGuiIfc;
std::shared_ptr<PresentationManagement::Interface::Dtc> m_dtc;
std::shared_ptr<PresentationManagement::Interface::Ftc> m_ftc;
std::shared_ptr<SituationReplayManagement::ForeignDataInterface> m_srmForeign;
std::shared_ptr<Core::Interface::Dtc> m_coreDtc;
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
QString m_menuGroup;
LtsUtils::RequestHelper *m_requestHelper;
int m_selectedTeId;
TopicEditorBase::TopicEditor *m_currentTopicEditor;
int m_scriptId;
QMap<QString, TopicAssignment> m_trackEntryAssignments;
QMap<LtsScriptTimeline::TrackEntryType, TopicAssignment> m_trackEntryToTopicAssignment;
LtsPluginManager::LtsPluginManager *m_essentialsViewApp;
QString m_scriptName;
QString m_scriptOwner;
qint64 m_lastModified = 0;
QVector<LtsScriptTimeline::TrackEntry *> m_topicVector;
QMultiMap<int, LtsScriptTimeline::TrackEntry *> m_topicMap; // <seconds, trackEntry>
QVector<FilterTopic> m_filterTopicVector;
TakeHomePackageGenerator::ExportProcess *m_exportProcess;
LtsSession::LtsSession *m_exerciseSession; // aka. script editor app
LtsSession::LtsSession *m_replaySession;
QTimer *m_presentationTimer;
int m_lowestTime;
int m_highestTime;
int m_positionTime;
int m_duration;
int m_nextPauseTime;
QVector<PlayingTopic *> m_currentlyPlayingTopics; // also indicates that the script is either playing or in paused state if NOT empty
Screen *m_projectionWidget1;
Screen *m_projectionWidget2;
MainJournal m_journal;
int m_scriptsExerciseId;
QString m_exerciseName;
LtsPluginManager::LtsPluginManager *m_sitMapApp;
LtsSession::LtsSession *m_sitMapSession;
bool m_currentlyFreestandingTopicsScreen1;
bool m_currentlyFreestandingTopicsScreen2;
TopicReplay::Interface *m_sitMapTopicIfc;
bool m_firstPlayAfterStop;
bool m_enableApply;
bool m_stopAfterPlayingFilterTopic;
QWidget *m_previousParentForScreen1;
QWidget *m_previousParentForScreen2;
int m_ignoreTopicForReplay;
QPointer<TopicDesigner> m_currentTopicDesigner;
bool m_avsVisibilityHackActive;
QPointer<StoryboardDialog> m_storyboardDialog;
bool m_ignoreChanges;
bool m_scriptRunning;
bool m_bTimerTickRecursionGuard;
bool m_isPlayTopicMethodStillRunning;
LOGGER_T m_logger;
private slots:
void slotEditEntry(const int topicId);
void slotTrackEntrySelectionChanged(LtsScriptTimeline::TrackEntry *);
void slotChangesWereMade();
void slotTrackEntryModified();
void slotNull(QObject *obj);
void slotDiscard();
void slotStartEssentialsView();
void slotLoadScript();
void slotExportScript();
void slotExportSuccessful(const QString &path, const QString &failedTopics);
void slotBurnDvD(const QString &strExportPath);
void slotBurningFinished(bool success);
void slotPlay();
void slotPause();
void slotStop();
void slotTimerTick();
void slotShowStoryboard();
void slotShowJournal();
void slotToNextTopic();
void slotToPreviousTopic();
void slotPlayUntilNextTopic();
void slotSetTopicPosition(QWidget *previewWidget, int ignoreTopicForReplay);
void slotTrackEntryDeleted(const int topicId);
void slotEditSelectedEntry();
void slotCheckNewTopicLength(int newLength, LtsUtils::Promise *promise);
void slotAddFakeLegacyPlanTopic();
void slotChangesMade();
};
} // namespace PresentationManagement
@@ -0,0 +1,320 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ScriptDialog</class>
<widget class="QWidget" name="ScriptDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1010</width>
<height>587</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Script Editor</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="999,0">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="LtsScriptTimeline::ScriptTimeline" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="replayControls">
<property name="title">
<string>Replay Controls</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QWidget" name="replayControlsWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,999">
<item>
<layout class="QHBoxLayout" name="replayControlsLayout">
<item>
<layout class="QVBoxLayout" name="replayControlsMainLayout">
<item>
<layout class="QHBoxLayout" name="replayControlsScreensLayout">
<item>
<widget class="QPushButton" name="pbInitScr1">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Set Screen 1</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbInitScr2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Set Screen 2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pbStop">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbPause">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Pause</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbPlay">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Play</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="replayControlsJumpLayout">
<item>
<widget class="QPushButton" name="pbUntilNextTopic">
<property name="text">
<string>Play Until Next Topic</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbPreviousTopic">
<property name="text">
<string>Previous Topic</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbNextTopic">
<property name="text">
<string>Next Topic</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QFormLayout" name="replayInfoLayout">
<property name="horizontalSpacing">
<number>9</number>
</property>
<property name="verticalSpacing">
<number>9</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="durationLabel">
<property name="text">
<string>Presentation duration:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lblDuration">
<property name="text">
<string notr="true"> - </string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="posLabel">
<property name="text">
<string>Pos:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSlider" name="posSlider">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="const" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="currentPosLabel">
<property name="text">
<string>Current position:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="currentositionLayout">
<item>
<widget class="QLabel" name="lblPos">
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="slashLabel">
<property name="text">
<string>/</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblMax">
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<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>
</item>
<item>
<layout class="QVBoxLayout" name="statusLayout">
<item>
<widget class="QLabel" name="statusLabel">
<property name="text">
<string>Status:</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="lwStatus">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="movement">
<enum>QListView::Free</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsScriptTimeline::ScriptTimeline</class>
<extends>QWidget</extends>
<header location="global">LtsScriptTimeline/script_timeline.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,376 @@
/**
* @RDE_HEADER@
* GUI Plugin for Script Editor
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2017-03-17
*/
#include "pre_script_gui_plugin.h"
#include "pre_script_dialog.h"
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
#include <Plugins/PresentationManagement/Gui/Script/Common/ScriptChooser/script_chooser.h>
#include <Plugins/PresentationManagement/Gui/Common/pre_edit_dialog.h>
#include <LtsWidgets/lts_base_layout_widget.h>
#include <LtsSession/lts_session.h>
#include <LtsSession/lts_session_manager.h>
#include <LtsSession/lts_session_data.h>
#include <LtsWidgets/lts_background_widget.h>
#include <LtsWidgets/lts_message_dialog.h>
#include <LtsScriptTimeline/track_entry.h>
#include <LtsScriptTimeline/temporary_pointer_vector.h>
#include <Common/TopicEditorBase/topic_editor_base.h>
// Control- & Widget-Ifcs:
#include <Plugins/SituationReplay/srp_gui_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
#include <Plugins/BuildingViewer/bdv_viewer_gui_plugin_interface.h>
#include <Plugins/AudioVideoManagement/avm_menu_edit_gui_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_script_filter_gui_plugin_interface.h>
#include <Plugins/MarkerManagement/mrk_gui_plugin_interface.h>
#include <Plugins/Evaluations/evl_gui_plugin_interface.h>
#include <Plugins/ReportManagement/rep_gui_plugin_interface.h>
#include <Plugins/PlanOverlays/plan_overlays_plugin_interface.h>
#include <Services/PresentationManagement/pre_operator_rights.h>
#include <Services/PresentationManagement/pre_dtc.h>
#include <QDir>
#include <QJsonParseError>
#include <QJsonDocument>
#include <QProgressDialog>
#include <QTimer>
#include <QFileDialog>
#include <QVBoxLayout>
#include <QDateTime>
#include <stdlib.h> // for abort
namespace PresentationManagement
{
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
{
return std::make_shared<InterfaceImpl>(session);
}
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
: GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Pre.Script"))
, m_dtc(nullptr)
, m_opmDtc(nullptr)
, m_ftc(nullptr)
, m_repForeign(nullptr)
, m_scriptDialog(nullptr)
, m_scriptId(0) // invalid
, m_requestHelper(new LtsUtils::RequestHelper(this))
{
connect(this, &InterfaceImpl::signalSuccess, m_session, &LtsSession::LtsSession::slotExecuteNextPayload, Qt::QueuedConnection);
}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
{
LtsWidgets::PluginData data;
data.menuGroup = menuGroup();
data.identifier = QStringLiteral("PresentationManagement.ScriptDialog");
data.menuText = tr("Show Script Editor");
if (getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::MAIN))
{
data.layoutArea = LtsWidgets::LayoutArea::eMainTab;
data.createInstant = LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction;
data.closable = false;
}
else // (as dialog) = rather unlikely..
{
data.layoutArea = LtsWidgets::LayoutArea::eDialogTab;
}
data.operatorRight = OperatorRights::ScriptEditorShow;
data.createWidgetFunc = [this](QWidget *parent)
{
return onShowScriptDialog(parent);
};
ret.append(data);
}
{
LtsWidgets::PluginData data;
data.menuGroup = menuGroup();
data.identifier = QLatin1String("PresentationManagement.ScriptDialog.ImportScript");
data.menuIcon = QIcon(QLatin1String("icon:import_documents.svg"));
data.menuText = tr("Insert Script");
data.operatorRight = OperatorRights::ScriptEditorEdit;
data.directFunc = [this](const LtsWidgets::PluginData &)
{
return onImportScript();
};
data.createWidgetFunc = nullptr;
ret.append(data);
}
return ret;
}
bool InterfaceImpl::fetchInterfaces()
{
if (!m_session->getDtc<PresentationManagement::DataInterface>(m_dtc))
{
DEBUG_LOG(m_logger) << "getDtc for PresentationManagement::DataInterface failed.";
return false;
}
if (!m_session->getFtc<PresentationManagement::DataInterface>(m_ftc))
{
DEBUG_LOG(m_logger) << "getFtc for PresentationManagement::DataInterface failed.";
return false;
}
if (!m_session->getDtc<OperatorManagement::DataInterface>(m_opmDtc))
{
DEBUG_LOG(m_logger) << "getDtc for OperatorManagement::DataInterface failed.";
return false;
}
if (!m_session->getDtc<SituationReplayManagement::DataInterface>(m_coreDtc))
{
DEBUG_LOG(m_logger) << "getDtc for SituationReplayManagement::DataInterface failed.";
return false;
}
if (!m_session->getForeignDataInterface<SituationReplayManagement::DataInterface>(m_repForeign))
{
WARNING_LOG(m_logger) << "getForeignDataInterface for SituationReplayManagement::DataInterface failed.";
return false;
}
return true;
}
void InterfaceImpl::clearInterfaces()
{
m_repForeign = nullptr;
m_coreDtc = nullptr;
m_opmDtc = nullptr;
m_ftc = nullptr;
m_dtc = nullptr;
}
QString InterfaceImpl::menuGroup() const
{
return tr("Presentation");
}
LtsWidgets::LtsDialog *InterfaceImpl::onShowScriptDialog(QWidget *parent)
{
m_scriptDialog = new ScriptDialog(menuGroup(), parent);
if (!m_scriptDialog->init(m_session, m_scriptId, m_dtc, m_ftc, m_repForeign, m_coreDtc, m_opmDtc))
{
m_scriptDialog->deleteLater();
m_scriptDialog = nullptr;
// dialog is app's main dialog, close app if dialog cannot initialize
emit m_session->signalClose();
}
return m_scriptDialog.data();
}
void InterfaceImpl::onImportScript()
{
ScriptChooser *scriptChooser = new ScriptChooser(m_dtc, m_opmDtc, false, true);
scriptChooser->setAttribute(Qt::WA_DeleteOnClose);
connect(scriptChooser, &ScriptChooser::signalSelectScript,
this, &InterfaceImpl::slotImportScript, Qt::QueuedConnection);
connect(scriptChooser, &ScriptChooser::signalQuit,
m_session, &LtsSession::LtsSession::signalQuit);
if (!LtsSessionData::LtsSessionData::getInstance()->isTablet())
scriptChooser->setModal(true);
scriptChooser->show();
}
void InterfaceImpl::slotNewScript()
{
// prepare request
PresentationModifyRequest req;
req.name(tr("New Script").toStdString());
req.description(tr("No description available.").toStdString());
req.operatorId(LtsSessionData::LtsSessionData::getInstance()->getOperatorId());
req.lastModified(QDateTime::currentMSecsSinceEpoch());
req.fileStatus(FileStatus::Valid);
if (m_requestHelper->startSingleRequest([this, req]()
{
return m_ftc->presentationModifyRequest(req, this);
}))
{
//slotSelectScript(m_requestHelper->getRepliedId());
}
}
void InterfaceImpl::slotAddScript()
{
PresentationEditDialog *dialog = new PresentationEditDialog(nullptr);
if (!dialog->init(-1 /* new presentation */, m_dtc, m_ftc, m_opmDtc))
{
delete dialog;
return;
}
QObject::connect(dialog, &PresentationEditDialog::rejected, dialog, &PresentationEditDialog::deleteLater);
dialog->show();
}
void InterfaceImpl::executePayload(LtsWidgets::LtsBackgroundWidget *mainBackground)
{
Q_UNUSED(mainBackground);
if (m_session->partitionType() != IDL::PartitionType::Exercise) // only on valid exercise
{
emit signalSuccess();
return;
}
int scriptId = m_session->getSavegame()[QStringLiteral("ScriptId")].toInt();
if (scriptId > 0)
{
slotSelectScript(scriptId);
return;
}
ScriptChooser *scriptChooser = new ScriptChooser(m_dtc, m_opmDtc, false, false, mainBackground);
scriptChooser->setAttribute(Qt::WA_DeleteOnClose);
connect(scriptChooser, &ScriptChooser::signalSelectScript,
this, &InterfaceImpl::slotSelectScript, Qt::QueuedConnection);
connect(scriptChooser, &ScriptChooser::signalQuit,
m_session, &LtsSession::LtsSession::signalQuit);
connect(scriptChooser, &ScriptChooser::signalNewScript,
this, &InterfaceImpl::slotAddScript);
if (!LtsSessionData::LtsSessionData::getInstance()->isTablet())
scriptChooser->setModal(true);
scriptChooser->show();
}
void InterfaceImpl::slotSelectScript(int scriptId)
{
m_scriptId = scriptId;
// std::shared_ptr<ForeignGuiInterface> preGuiIfc;
// if (!m_session->getForeignGuiInterface<ForeignGuiInterface>(preGuiIfc))
// {
// // TODO: MSG !!1
// return;
// }
// preGuiIfc->setScriptId(scriptId);
emit signalSuccess();
}
void InterfaceImpl::slotImportScript(int scriptId)
{
if (m_scriptId == scriptId)
{
ERROR_LOG(m_logger) << "Not possible to import same script!";
LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("Not possible to import same script!"));
return;
}
if (!importScript(scriptId))
{
ERROR_LOG(m_logger) << "Failed to import script Id " << scriptId;
LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("Failed to import Script Id %1").arg(scriptId));
return;
}
DEBUG_LOG(m_logger) << "Succesfully imported script Id " << scriptId ;
//LtsWidgets::LtsMessageDialog::showMessage(nullptr, tr("Successfully imported Script Id %1").arg(scriptId));
}
bool InterfaceImpl::importScript(int idSource)
{
if (!m_scriptDialog)
{
ERROR_LOG(m_logger) << "no script dialog open for import script";
return false;
}
PresentationManagement::Presentation preSource = m_dtc->presentation(idSource);
if (preSource.id() < 1)
return false;
// import topics
std::function<void(const Core::FunctionReply &baseReply)> importPresentationContent = [&](const Core::FunctionReply &baseReply)
{
const GetPresentationContentReply &reply = static_cast<const GetPresentationContentReply &>(baseReply);
const auto &contentList = reply.content();
if (contentList.size() < 1)
{
ERROR_LOG(m_logger) << "No Presentation Content for Script Id " << reply.id();
return;
}
LtsScriptTimeline::TemporaryPointerVector<LtsScriptTimeline::TrackEntry *> importedTes;
for (const PresentationManagement::PresentationContent &content : contentList)
{
LtsScriptTimeline::TrackEntryType tet = LtsScriptTimeline::TrackEntryType::INVALID;
if (!m_scriptDialog->topicStringToType(QString::fromStdString(content.presentationTopicType()), tet))
{
ERROR_LOG(m_logger) << "Topic ignored - invalid topic type for presentation's content id " << content.id();
continue;
}
importedTes.append(ScriptDialog::trackEntryFromContent(content, 0, tet));
}
if (m_scriptDialog->importTrackEntries(importedTes))
importedTes.setDiscardable(false); // don't delete tes if they could be imported and finally be managed by the script timeline
};
GetPresentationContentRequest req(idSource);
req.presentationId(idSource);
if (!m_requestHelper->startSingleRequest([req, this]()
{
return m_ftc->getPresentationContentRequest(req, this);
}, importPresentationContent))
{
LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("There is no content to import for this script."));
return false;
}
return true;
}
} // namespace PresentationManagement
@@ -0,0 +1,100 @@
/**
* @RDE_HEADER@
* GUI Plugin for Script Editor
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2017-03-17
*/
#pragma once
#include <PresentationManagement/logger.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/PresentationManagement/pre_data_plugin_interface.h>
#include <Plugins/PresentationManagement/pre_script_gui_plugin_interface.h>
#include <Services/PresentationManagement/pre_ftc.h> // reply handler
#include <Services/OperatorManagement/opm_dtc.h>
#include <Plugins/SituationReplayManagement/srm_data_plugin_interface.h>
#include <Common/ProjectConfig/project_defines.h>
#include <LtsUtilsGuiDds/request_helper.h>
// test:
#include <LtsScriptTimeline/track_entry_painters.h>
#include "pre_script_dialog.h"
#include <LtsSession/lts_session.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <PluginInterfaces/topic_replay_interface.h>
#include <Plugins/PresentationManagement/Gui/Common/topic_assignment.h>
namespace PresentationManagement
{
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "gui:3:pre.script.edit")
Q_INTERFACES(GuiPluginBase::Plugin)
public:
explicit GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return ForeignScriptDialogGuiInterface::pluginName(); }
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
bool availableInPartition(IDL::PartitionType partition) const override
{ return (partition == IDL::PartitionType::Exercise); }
};
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface
, protected PresentationManagement::Interface::Ftc::PresentationModifyReplyHandler
, protected PresentationManagement::Interface::Ftc::GetPresentationContentReplyHandler
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
QVector<LtsWidgets::PluginData> getActions() override;
QString menuGroup() const override;
bool fetchInterfaces() override;
void clearInterfaces() override;
bool availableInPartition(IDL::PartitionType partition) const override
{ return partition == IDL::PartitionType::Exercise; }
// be able to show script chooser
int executionPriority() const override { return 9999; }
void executePayload(LtsWidgets::LtsBackgroundWidget *mainBackground) override;
protected:
void onPresentationModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
void onGetPresentationContentReply(const GetPresentationContentReply &reply) override { m_requestHelper->requestReply(reply); }
private:
LtsWidgets::LtsDialog *onShowScriptDialog(QWidget *parent);
void onImportScript();
bool importScript(/*int idDest, */int idSource);
std::shared_ptr<PresentationManagement::Interface::Dtc> m_dtc;
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
std::shared_ptr<PresentationManagement::Interface::Ftc> m_ftc;
std::shared_ptr<SituationReplayManagement::ForeignDataInterface> m_repForeign;
std::shared_ptr<Core::Interface::Dtc> m_coreDtc;
QPointer<PresentationManagement::ScriptDialog> m_scriptDialog;
int m_scriptId;
LtsUtils::RequestHelper *m_requestHelper;
signals:
void signalSuccess();
private slots:
void slotSelectScript(int scriptId);
void slotNewScript();
void slotImportScript(int scriptId);
void slotAddScript();
};
} // namespace PresentationManagement
@@ -0,0 +1,152 @@
#include "pre_storyboard.h"
#include "ui_pre_storyboard.h"
#include <LtsPrinting/printing.h>
#include <LtsScriptTimeline/track_entry.h>
#include <ngltools/ngltools_dtg.h>
using namespace LtsScriptTimeline;
namespace PresentationManagement
{
StoryboardDialog::StoryboardDialog(QWidget *parent, LtsSession::LtsSession *session)
: LtsWidgets::LtsDialog(parent)
, m_ui(new Ui::StoryboardDialog)
, m_session(session)
, m_alreadyTranslated(false)
{
m_ui->setupUi(this);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &StoryboardDialog::slotPrint);
}
StoryboardDialog::~StoryboardDialog()
{
delete m_ui;
}
void StoryboardDialog::slotPrint()
{
QString headingHtml = (QStringLiteral("<H1>"));
headingHtml.append (tr("Scriptname:"));
headingHtml.append(m_scriptName);
headingHtml.append(QStringLiteral("</H1>"));
headingHtml.append(QStringLiteral("<H3>"));
headingHtml.append(tr("Script Owner: "));
headingHtml.append(m_scriptOwner);
headingHtml.append(QStringLiteral("</H3>"));
headingHtml.append(QStringLiteral("<H3>"));
headingHtml.append(tr("Last modified: "));
headingHtml.append(DTG::toStringMSec(m_lastModified));
headingHtml.append(QStringLiteral("<br>"));
headingHtml.append(tr("Duration: "));
QString durationStr = m_duration;
headingHtml.append(durationStr);
headingHtml.append(QStringLiteral("</H3><br>"));
LtsPrinting::printView(m_session, this, m_ui->listWidget, headingHtml);
}
bool StoryboardDialog::init(const QVector<LtsScriptTimeline::TrackEntry *> &topicVector,
const QVector<FilterTopic> &filterTopicVector,
const QString &scriptName,
const QString &scriptOwner,
const qint64 lastModified,
const QString duration)
{
m_topicVector = topicVector; // cpy
m_filterTopicVector = filterTopicVector; // cpy
m_scriptName = scriptName; // cpy
m_scriptOwner = scriptOwner;
m_lastModified = lastModified;
m_duration = duration;
// sort storyboard by time
std::sort(m_topicVector.begin(), m_topicVector.end(), [](const TrackEntry *a, const TrackEntry *b) -> bool
{
return a->m_startTime < b->m_startTime;
});
return true;
}
void StoryboardDialog::retranslate()
{
translate(m_ui, tr("Script Storyboard"));
if (m_alreadyTranslated)
return;
fillStoryboard();
m_alreadyTranslated = true;
}
void StoryboardDialog::fillStoryboard()
{
m_ui->listWidget->clear();
QVector<FilterTopic> correspondingFilterTopics;
int ii1 = 1;
for (const LtsScriptTimeline::TrackEntry *te : qAsConst(m_topicVector))
{
QString itemText = tr("Topic %1: %2 - %3 (%4 seconds)\n Type: %5").arg(
ii1).arg(QTime::fromMSecsSinceStartOfDay(te->m_startTime * 1000).toString(),
QTime::fromMSecsSinceStartOfDay((te->m_startTime + te->m_length) * 1000).toString()).arg(
te->m_length).arg(LtsScriptTimeline::translateTrackEntryType(te->m_type));
if (!te->m_description.isEmpty())
itemText += QStringLiteral("\n ") + tr("Description: %1").arg(te->m_description);
m_ui->listWidget->addItem(itemText);
// look for filters for this topic:
correspondingFilterTopics.clear();
for (const FilterTopic &_ft : qAsConst(m_filterTopicVector))
{
if (_ft.mainTopicId != te->m_topicId)
continue;
correspondingFilterTopics.append(_ft);
}
// sort filter topics by start time
std::sort(correspondingFilterTopics.begin(), correspondingFilterTopics.end(), [](const FilterTopic &a, const FilterTopic &b) -> bool
{
return a.filterTopic->m_startTime < b.filterTopic->m_startTime;
});
int ii2 = 1;
for (const FilterTopic &_ft : qAsConst(correspondingFilterTopics))
{
if (_ft.mainTopicId != te->m_topicId)
continue;
const LtsScriptTimeline::TrackEntry *fte = _ft.filterTopic;
QString filterItemText = tr(" > Filter %1: %2 - %3 (%4 seconds)\n Type: %5").arg(
ii2).arg(QTime::fromMSecsSinceStartOfDay(fte->m_startTime * 1000).toString(),
QTime::fromMSecsSinceStartOfDay((fte->m_startTime + te->m_length) * 1000).toString()).arg(
fte->m_length).arg(LtsScriptTimeline::translateTrackEntryType(te->m_type));
if (!fte->m_description.isEmpty())
filterItemText += QStringLiteral("\n ") + tr("Description: %1").arg(fte->m_description);
m_ui->listWidget->addItem(filterItemText);
ii2++;
}
ii1++;
}
}
} // namespace PresentationManagement
@@ -0,0 +1,50 @@
#pragma once
#include "filter_topic.h"
#include <LtsWidgets/lts_dialog.h>
#include <LtsScriptTimeline/track_entry.h>
#include <LtsSession/lts_session.h>
#include <QVector>
namespace Ui
{
class StoryboardDialog;
}
namespace PresentationManagement
{
class StoryboardDialog : public LtsWidgets::LtsDialog
{
Q_OBJECT
public:
StoryboardDialog(QWidget *parent, LtsSession::LtsSession *session);
~StoryboardDialog();
bool init(const QVector<LtsScriptTimeline::TrackEntry *> &topicVector,
const QVector<FilterTopic> &filterTopicVector,
const QString &scriptName,
const QString &scriptOwner,
const qint64 lastModified,
const QString duration);
void fillStoryboard();
void retranslate() override final;
private:
Ui::StoryboardDialog *m_ui;
QVector<LtsScriptTimeline::TrackEntry *> m_topicVector;
QVector<FilterTopic> m_filterTopicVector;
LtsSession::LtsSession *m_session;
QString m_scriptName = QString();
QString m_scriptOwner = QString();
qint64 m_lastModified = 0;
QString m_duration = QString();
bool m_alreadyTranslated;
public slots:
void slotPrint();
};
} // namespace PresentationManagement
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StoryboardDialog</class>
<widget class="QWidget" name="StoryboardDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>707</width>
<height>464</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string notr="true">Script Editor</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>9</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QListWidget" name="listWidget">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,69 @@
/**
* @RDE_HEADER@
* Dialog for the Topic Designer
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2017-06-09
*/
#include "pre_topic_designer_dialog.h"
#include "ui_pre_topic_designer_dialog.h"
namespace PresentationManagement
{
TopicDesignerDialog::TopicDesignerDialog(QWidget *parent)
: LtsDialog(parent)
, m_ui(new Ui::TopicDesignerDialog)
{
m_ui->setupUi(this);
setFocusPolicy(Qt::StrongFocus);
connect(m_ui->widget, &TopicDesigner::signalTopicSelected,
this, &TopicDesignerDialog::signalTopicSelected);
connect(m_ui->widget, &TopicDesigner::signalDeleteTrackEntry,
this, &TopicDesignerDialog::signalDeleteTrackEntry);
connect(m_ui->widget, &TopicDesigner::signalUnselect,
this, &TopicDesignerDialog::signalUnselect);
connect(m_ui->widget, &TopicDesigner::signalChangesMade,
this, &LtsWidgets::LtsDialog::signalChangesMade);
// connect(m_ui->pbToFront, &QPushButton::clicked,
// m_ui->widget, &TopicDesigner::to)
}
void TopicDesignerDialog::retranslate()
{
translate(m_ui, tr("Topic Designer"));
}
TopicDesignerDialog::~TopicDesignerDialog()
{
delete m_ui;
}
QVector<LtsScriptTimeline::TrackEntry *> TopicDesignerDialog::exportTopicList() const
{
return m_ui->widget->exportTopicList();
}
void TopicDesignerDialog::selectTopic(int topicId)
{
m_ui->widget->selectTopic(topicId);
}
void TopicDesignerDialog::loadTopicList(const QVector<LtsScriptTimeline::TrackEntry *> &topicsList)
{
m_ui->widget->loadTopicList(topicsList);
}
} // namespace PresentationManagement
@@ -0,0 +1,57 @@
/**
* @RDE_HEADER@
* Dialog for the Topic Designer
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2017-06-09
*/
#pragma once
#include <LtsWidgets/lts_dialog.h>
#include <QVector>
namespace Ui
{
class TopicDesignerDialog;
}
namespace LtsScriptTimeline
{
class TrackEntry;
}
namespace PresentationManagement
{
class TopicDesignerDialog : public LtsWidgets::LtsDialog
{
public:
Q_OBJECT
public:
explicit TopicDesignerDialog(QWidget *parent = nullptr);
~TopicDesignerDialog();
void loadTopicList(const QVector<LtsScriptTimeline::TrackEntry *> &topicsList);
QVector<LtsScriptTimeline::TrackEntry *> exportTopicList() const;
void selectTopic(int topicId);
signals:
void signalTopicSelected(int topicId);
void signalDeleteTrackEntry(int topicId);
void signalUnselect();
private:
void retranslate() override;
Ui::TopicDesignerDialog *m_ui;
};
} // namespace PresentationManagement
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TopicDesignerDialog</class>
<widget class="QWidget" name="TopicDesignerDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>338</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string notr="true">Script Editor</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string notr="true">Some text</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="pbToFront">
<property name="text">
<string>To Front</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbIncIdx">
<property name="text">
<string>Inc Idx</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbDecIdx">
<property name="text">
<string>Dec Idx</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbToBack">
<property name="text">
<string>To Back</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="PresentationManagement::TopicDesigner" 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>300</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>PresentationManagement::TopicDesigner</class>
<extends>QWidget</extends>
<header>topic_designer.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>