286 lines
8.5 KiB
C++
Executable File
286 lines
8.5 KiB
C++
Executable File
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "lts_session_data_dds.h"
|
|
#include "lts_session_manager.h"
|
|
|
|
#include <LtsSession/ltssession_export.h>
|
|
#include <LtsWidgets/lts_base.h>
|
|
#include <QtCore/qobjectdefs.h>
|
|
|
|
#include <memory>
|
|
#include <QMap>
|
|
#include <QJsonObject>
|
|
#include <QPointer>
|
|
#include <QVector>
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
namespace LtsWidgets
|
|
{
|
|
class LtsBackgroundWidget;
|
|
class LtsTabWidget;
|
|
class LtsBaseLayoutWidget;
|
|
struct ExerciseData;
|
|
class LtsDialog;
|
|
class LtsDragIcon;
|
|
}
|
|
namespace LtsNotification
|
|
{
|
|
class LtsNotification;
|
|
class LtsNotificationController;
|
|
}
|
|
namespace LtsPluginManager
|
|
{
|
|
struct PluginInstance;
|
|
struct AppPluginInstance;
|
|
}
|
|
namespace DeveloperTools
|
|
{
|
|
class DevDialog;
|
|
class AppWidget;
|
|
}
|
|
namespace Core
|
|
{
|
|
namespace Interface
|
|
{
|
|
class Ftc;
|
|
}
|
|
}
|
|
namespace OnlineHelp
|
|
{
|
|
class ForeignOnlineHelpViewerGuiInterface;
|
|
}
|
|
|
|
|
|
|
|
namespace LtsSession
|
|
{
|
|
class LTSSESSION_EXPORT LtsSession : public LtsSessionDataDds
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
static bool s_valgrind;
|
|
static int s_nextSessionId;
|
|
|
|
enum class PluginInstanceStatus
|
|
{
|
|
UNKNOWN = 0,
|
|
LOADED,
|
|
FAILED,
|
|
};
|
|
|
|
static QString appToString(LtsAppDescriptor::App app);
|
|
static QString appIconFilename(LtsAppDescriptor::App app);
|
|
static QIcon appToIcon(LtsAppDescriptor::App app);
|
|
|
|
explicit LtsSession(LtsSessionManager *sessionManager);
|
|
~LtsSession();
|
|
|
|
QString toString() const;
|
|
|
|
LtsSessionManager *getSessionManager();
|
|
bool init(const DdsConnectionParams &connParams,
|
|
const QVector<LtsPluginManager::AppPluginInstance> &dataPluginList,
|
|
const QVector<LtsPluginManager::AppPluginInstance> &guiPluginList, bool hidden);
|
|
bool init(const dds::domain::DomainParticipant &dp,
|
|
const DdsConnectionParams &connParams,
|
|
const QVector<LtsPluginManager::AppPluginInstance> &dataPluginList,
|
|
const QVector<LtsPluginManager::AppPluginInstance> &guiPluginList);
|
|
void makeVisible();
|
|
void setPayloadsEnabled() { m_payloads = true; }
|
|
void aboutToClose();
|
|
bool isInitializationDone() const { return m_initDone; }
|
|
void presetBaseLayoutAsSecondaryWidget() { m_presetBaseLayoutAsSecondaryWidget = true; }
|
|
|
|
|
|
|
|
LtsWidgets::LtsDragIcon *addAction(const LtsWidgets::PluginData &plData, bool isFirstRun = false);
|
|
void setMenuVisible(bool visible = true);
|
|
bool removeMenuAction(LtsWidgets::LtsDragIcon *icon);
|
|
int screenId() const;
|
|
int screenContainerId() const;
|
|
int screenTypeId() const;
|
|
LtsAppDescriptor::App app() const;
|
|
void setScreenIdPreset(int screenId) { m_screenIdPreset = screenId; }
|
|
void setScreenContainerIdPreset(int screenPart) { m_screenContainerIdPreset = screenPart; }
|
|
bool isForeverInvisible() const { return m_foreverInvisible; }
|
|
|
|
LtsNotification::LtsNotification *createNotification(const QString &identifier);
|
|
|
|
|
|
|
|
void setExerciseData(const LtsWidgets::ExerciseData &exerciseData);
|
|
const LtsWidgets::ExerciseData *exerciseData() const;
|
|
void setProfilePicture(const QPixmap &pixmap);
|
|
void setBaseLayoutVisible() { m_hasBaseLayout = true; }
|
|
bool isVisible() const { return (m_baseLayout != nullptr); }
|
|
const QString &name() const { return m_name; }
|
|
void setName(const QString &name) { m_name = name; }
|
|
|
|
|
|
bool isChildOfSession(QWidget* child);
|
|
LtsWidgets::LtsBaseLayoutWidget* baseLayout() { return m_baseLayout; }
|
|
QWidget *baseLayoutWidget();
|
|
void setMarkForDeletion() { m_markedForDeletion = true; }
|
|
void doneInitializingSession();
|
|
bool notifyUnsavedChanges();
|
|
const QVector<LtsWidgets::LtsBackgroundWidget *> &bgWidgets() const { return m_bgWidgets; }
|
|
|
|
|
|
bool widgetExists(const QString &menuGroup, const QString &identifier, LtsWidgets::LayoutArea area) const;
|
|
|
|
|
|
bool addWidget(LtsWidgets::LtsDialog *widget,
|
|
const QString &menuGroup,
|
|
const QString &identifier,
|
|
LtsWidgets::LayoutArea area = LtsWidgets::LayoutArea::eUnknown,
|
|
bool setClosable = true);
|
|
|
|
LtsWidgets::LtsDialog *getWidget(const QString &menuGroup, const QString &identifier, LtsWidgets::LayoutArea area);
|
|
bool focusTab(const QString &menuGroup, const QString &identifier, LtsWidgets::LayoutArea area);
|
|
|
|
|
|
|
|
LtsWidgets::LtsTabWidget *locateWidget(QWidget *widgetToLocate, LtsWidgets::LayoutArea area);
|
|
|
|
|
|
|
|
|
|
void enableBaseLayoutMenu(bool on = true);
|
|
|
|
|
|
|
|
void enableBaseLayoutArea(LtsWidgets::LayoutArea area, bool on = true);
|
|
|
|
|
|
|
|
static int workstationIp();
|
|
|
|
|
|
static QString workstationName();
|
|
|
|
|
|
|
|
QVector<LtsWidgets::PluginData> &missingRightActions() { return m_missingRightActions; }
|
|
|
|
void setSavegame(const QJsonObject &sg) { m_savegame = sg; }
|
|
const QJsonObject &getSavegame() const { return m_savegame; }
|
|
|
|
void setHidden() { m_hidden = true; }
|
|
|
|
const QString workspaceId() const;
|
|
void setWorkspaceId(const QString &newWorkspaceId);
|
|
|
|
LtsWidgets::ExcState exerciseState() const;
|
|
|
|
void setLoadedFromSavegame() { m_loadedFromSavegame = true; }
|
|
bool isLoadedFromSavegame() const { return m_loadedFromSavegame; }
|
|
void addDeveloperActions();
|
|
void refetchActions();
|
|
void setDependency(LtsSession *session);
|
|
bool hasDependency(LtsSession *session) { return (m_dependency.data() == session); }
|
|
LtsSession *dependency() const { return m_dependency; }
|
|
|
|
|
|
void setNeedsToBeSuccessfullyPlaced(bool needed = true) { m_needsToBeSuccessfullyPlaced = needed; }
|
|
|
|
int id() const { return m_id; }
|
|
|
|
public slots:
|
|
void slotExecuteNextPayload();
|
|
void slotPluginInitDone();
|
|
void slotShowOnlineHelp(const QString &fileName);
|
|
|
|
|
|
private slots:
|
|
void slotShowOperatorSettings();
|
|
void slotSwap();
|
|
void slotStapleTopicLockHandler(LtsWidgets::LtsDialog *widget);
|
|
void slotStopWaitDialog();
|
|
void slotStartPluginInit();
|
|
void slotMonitorSelected();
|
|
void delayScriptEditorStart();
|
|
|
|
signals:
|
|
void signalInitializationAborted();
|
|
void _signalDoneInitializingSession();
|
|
void signalDoneInitializingSession();
|
|
void signalClose();
|
|
void signalLogout();
|
|
void signalQuit();
|
|
void signalStillAlive();
|
|
void signalExerciseDataChanged();
|
|
void signalScreenIdChanged(int screenId, int screenContainerId, int screenTypeId);
|
|
void sessionAboutToBeDestroyed(LtsSession *session);
|
|
void workspaceIdChanged(const QString &newWorkspaceId);
|
|
void signalTakeOverBdv();
|
|
void hideAllOtherBLWs(QObject *caller);
|
|
void taskSwitch(QObject *caller);
|
|
|
|
private:
|
|
friend class DeveloperTools::DevDialog;
|
|
friend class DeveloperTools::AppWidget;
|
|
friend class LtsSessionManager;
|
|
|
|
bool event(QEvent *e) override;
|
|
void createBaseLayout();
|
|
void initializePlugins(const QVector<LtsPluginManager::AppPluginInstance> &dataPluginList, const QVector<LtsPluginManager::AppPluginInstance> &guiPluginList);
|
|
void initializeDataPlugins(const QVector<LtsPluginManager::AppPluginInstance> &dataPluginList);
|
|
void initializeGuiPlugins(const QVector<LtsPluginManager::AppPluginInstance> &guiPluginList);
|
|
bool tryInitGuiPlugin(const QString &guiPluginKey, std::shared_ptr<GuiPluginBase::Interface> &guiPlugin);
|
|
void clearDataPluginInterfaces();
|
|
void clearGuiPluginInterfaces();
|
|
void executePayloads();
|
|
void connectOnlineHelpButton(LtsWidgets::LtsDialog *widget);
|
|
|
|
void aboutToCloseTab(LtsWidgets::LayoutArea area);
|
|
|
|
QPointer<LtsSessionManager> m_sessionManager;
|
|
QMap<int , std::shared_ptr<GuiPluginBase::Interface> > m_payloadPriorityMap;
|
|
QList<std::shared_ptr<GuiPluginBase::Interface> > m_payloadList;
|
|
LtsWidgets::LtsBackgroundWidget *m_mainBackground;
|
|
bool m_hasBaseLayout;
|
|
LtsWidgets::LtsBaseLayoutWidget *m_baseLayout;
|
|
bool m_markedForDeletion;
|
|
bool m_payloads;
|
|
QVector<LtsNotification::LtsNotificationController *> m_notiCtlList;
|
|
bool m_initDone;
|
|
bool m_payloadsDone { false };
|
|
bool m_menuVisible;
|
|
|
|
bool m_firstActionsFetch;
|
|
LtsWidgets::ExerciseData *m_exerciseData;
|
|
QVector<LtsWidgets::PluginData> m_missingRightActions;
|
|
std::shared_ptr<Core::Interface::Ftc> m_coreFtc;
|
|
GuiPluginBase::Interface *m_currentInitIfc;
|
|
bool m_slotPluginInitDoneMutex;
|
|
bool m_pluginInitDone;
|
|
QJsonObject m_savegame;
|
|
bool m_hidden;
|
|
int m_screenId { -1 };
|
|
int m_screenContainerId { -1 };
|
|
int m_screenIdPreset { -1 };
|
|
int m_screenContainerIdPreset { -1 };
|
|
bool m_loadedFromSavegame;
|
|
std::shared_ptr<OnlineHelp::ForeignOnlineHelpViewerGuiInterface> m_ohvIfc;
|
|
bool m_foreverInvisible;
|
|
QStringList m_failedFetches;
|
|
QVector<LtsWidgets::LtsBackgroundWidget *> m_bgWidgets;
|
|
QString m_workspaceId;
|
|
bool m_needsToBeSuccessfullyPlaced { true };
|
|
QString m_name;
|
|
QTimer *m_blub { nullptr };
|
|
QTimer *m_scriptEditorTimer { nullptr };
|
|
int m_blub2;
|
|
QPointer<LtsSession> m_dependency;
|
|
bool m_presetBaseLayoutAsSecondaryWidget { false };
|
|
int m_id;
|
|
};
|
|
|
|
}
|