Adds initial intermediate qt6 porting state
This commit is contained in:
11247 files changed
+1891537
No files matched your search
+17
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Jörg Turla, SPDG, 2017-04-24
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Gui)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(PlanEditorGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/plan_editor_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
GuiPluginInterface
|
||||
)
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Jörg Turla, SPDG, 2017-04-24
|
||||
#
|
||||
|
||||
SET (PlanEditorGuiPlugin_SRCS
|
||||
list_chooser.cpp
|
||||
list_chooser.h
|
||||
plan_editor_gui_plugin.cpp
|
||||
plan_editor_gui_plugin.h
|
||||
)
|
||||
|
||||
SOURCE_GROUP(PlanEditorPlugin FILES ${PlanEditorGuiPlugin_SRCS})
|
||||
|
||||
NGL_ADD_LIBRARY(WS PlanEditorGuiPlugin MODULE ${PlanEditorGuiPlugin_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES( PlanEditorGuiPlugin
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
PlanEditorGuiPluginInterface
|
||||
planEditor
|
||||
svcPedDummy
|
||||
situationMap
|
||||
situationMapObjects
|
||||
GuiPluginInterface
|
||||
FlmDataPluginInterface
|
||||
OpmDataPluginInterface
|
||||
PpmDataPluginInterface
|
||||
LtsUtilsGuiDds
|
||||
LtsWidgets
|
||||
NGLLogger
|
||||
Qt5::Widgets
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(PlanEditorGuiPlugin)
|
||||
Executable
+155
@@ -0,0 +1,155 @@
|
||||
|
||||
|
||||
|
||||
#include "list_chooser.h"
|
||||
|
||||
|
||||
#include <QtCore/QEventLoop>
|
||||
#include <QtCore/QSortFilterProxyModel>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QStringListModel>
|
||||
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QListView>
|
||||
#include <QtWidgets/QPushButton>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
|
||||
namespace PlanEditorPlugin
|
||||
{
|
||||
|
||||
class ListChooserModel : public QStringListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit ListChooserModel( QObject * parent ) : QStringListModel(parent) {;}
|
||||
~ListChooserModel() = default;
|
||||
|
||||
QVariant headerData( int section, Qt::Orientation, int ) const override
|
||||
{
|
||||
if (1 != section) return QVariant();
|
||||
return tr("Name of Plan");
|
||||
}
|
||||
|
||||
|
||||
void setChooseList(const QStringList & list) { setStringList(list); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
ListChooser::ListChooser(QObject *parent) : QObject(parent)
|
||||
{
|
||||
setObjectName( QLatin1String( "PlanEditorPlugin::ListChooser" ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString ListChooser::chooseFromList( const QString & title, const QStringList & list, const QString & currentChoose, bool existingOnly )
|
||||
{
|
||||
m_dialog = new LtsWidgets::LtsFramelessDialog( static_cast<QWidget*>(parent()), LtsWidgets::Behaviour::Modal );
|
||||
m_dialog -> setWindowTitle( title );
|
||||
m_dialog -> setAttribute(Qt::WidgetAttribute::WA_DeleteOnClose);
|
||||
|
||||
QVBoxLayout * layout = new QVBoxLayout( m_dialog.data() );
|
||||
QHBoxLayout * layoutFilter = new QHBoxLayout();
|
||||
QHBoxLayout * layoutCtrl = new QHBoxLayout();
|
||||
|
||||
QLineEdit * filter = new QLineEdit( m_dialog.data() );
|
||||
QPushButton * pbFilter = new QPushButton( QIcon(QStringLiteral("icon:search.svg")), QString(), m_dialog );
|
||||
|
||||
layoutFilter->addSpacing(5);
|
||||
layoutFilter->addWidget( new QLabel(tr("Filter:"),m_dialog.data()), 0 );
|
||||
layoutFilter->addSpacing(5);
|
||||
layoutFilter->addWidget( filter , 2 );
|
||||
layoutFilter->addSpacing(5);
|
||||
layoutFilter->addWidget( pbFilter, 0 );
|
||||
layoutFilter->addSpacing(5);
|
||||
|
||||
ListChooserModel * listModel = new ListChooserModel(m_dialog.data());
|
||||
|
||||
listModel -> setChooseList(list);
|
||||
|
||||
QSortFilterProxyModel * filterProxy = new QSortFilterProxyModel( m_dialog.data() );
|
||||
|
||||
filterProxy -> setSourceModel( listModel );
|
||||
filterProxy -> setFilterWildcard( QStringLiteral("*") );
|
||||
|
||||
connect( pbFilter, &QPushButton::clicked , this, [filter,filterProxy](bool) { filterProxy->setFilterWildcard(filter->text()); } );
|
||||
connect( filter , &QLineEdit::returnPressed, this, [filter,filterProxy]() { filterProxy->setFilterWildcard(filter->text()); } );
|
||||
QListView * listView = new QListView(m_dialog.data());
|
||||
|
||||
listView -> setModel( filterProxy );
|
||||
listView -> setAlternatingRowColors( true );
|
||||
listView -> setDragEnabled( false );
|
||||
listView -> setFlow( QListView::Flow::TopToBottom );
|
||||
listView -> setSelectionMode( QAbstractItemView::SelectionMode::SingleSelection );
|
||||
listView -> setSelectionBehavior( QAbstractItemView::SelectionBehavior::SelectItems );
|
||||
listView -> setSelectionMode( existingOnly ? QAbstractItemView::SelectionMode::SingleSelection : QAbstractItemView::SelectionMode::NoSelection );
|
||||
|
||||
QLineEdit * currentSelection = new QLineEdit( m_dialog.data() );
|
||||
|
||||
connect( listView->selectionModel(), &QItemSelectionModel::currentRowChanged, currentSelection, [listModel,currentSelection]( const QModelIndex & idx, const QModelIndex & )
|
||||
{
|
||||
currentSelection->setText( listModel->data(idx,Qt::DisplayRole).toString() );
|
||||
} );
|
||||
|
||||
connect( currentSelection, &QLineEdit::textChanged, this, [this]( const QString & txt) { m_choosenString = txt; } );
|
||||
|
||||
currentSelection -> setReadOnly( existingOnly );
|
||||
currentSelection -> setText( (existingOnly || list.contains(currentChoose)) ? currentChoose : QString() );
|
||||
|
||||
QLabel * laTitel = new QLabel(title,m_dialog.data());
|
||||
laTitel->setAlignment( Qt::AlignHCenter );
|
||||
|
||||
layout->addWidget( laTitel );
|
||||
layout->addSpacing(10);
|
||||
layout->addLayout( layoutFilter, 0 );
|
||||
layout->addSpacing(10);
|
||||
layout->addWidget( listView, 2 );
|
||||
layout->addSpacing(10);
|
||||
layout->addWidget( new QLabel(tr("Choosed:"),m_dialog.data()), 0 );
|
||||
layout->addWidget( currentSelection, 0 );
|
||||
layout->addSpacing(10);
|
||||
layout->addLayout( layoutCtrl, 0 );
|
||||
|
||||
layout->setAlignment( Qt::AlignHCenter );
|
||||
|
||||
QPushButton * pbCancel = new QPushButton( QIcon(QStringLiteral(":/style/dialog-close.svg")), tr("Cancel"), m_dialog.data() );
|
||||
QPushButton * pbChoose = new QPushButton( QIcon(QStringLiteral(":/style/document_edit.svg")), tr("Choose"),m_dialog.data() );
|
||||
|
||||
layoutCtrl->addStretch(2);
|
||||
layoutCtrl->addSpacing(5);
|
||||
layoutCtrl->addWidget( pbChoose );
|
||||
layoutCtrl->addSpacing(10);
|
||||
layoutCtrl->addWidget( pbCancel );
|
||||
layoutCtrl->addSpacing(5);
|
||||
|
||||
connect( pbCancel, &QPushButton::clicked, m_dialog.data(), [this](bool)
|
||||
{
|
||||
m_choosenString.clear();
|
||||
m_dialog->reject();
|
||||
});
|
||||
|
||||
connect( pbChoose, &QPushButton::clicked, m_dialog.data(), &LtsWidgets::LtsFramelessDialog::accept );
|
||||
|
||||
connect( m_dialog.data(), &LtsWidgets::LtsFramelessDialog::accepted, this, &ListChooser::selectionIsFinished );
|
||||
connect( m_dialog.data(), &LtsWidgets::LtsFramelessDialog::rejected, this, &ListChooser::selectionIsFinished );
|
||||
|
||||
QEventLoop eventLoop;
|
||||
|
||||
connect( this, &ListChooser::selectionIsFinished, &eventLoop, &QEventLoop::quit, Qt::QueuedConnection );
|
||||
m_dialog->show();
|
||||
eventLoop.exec();
|
||||
|
||||
return m_choosenString;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "list_chooser.moc"
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_frameless_dialog.h>
|
||||
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
|
||||
class QAbstractItemModel;
|
||||
class QSortFilterProxyModel;
|
||||
class QLineEdit;
|
||||
class QListView;
|
||||
class QPushButton;
|
||||
|
||||
|
||||
namespace PlanEditorPlugin
|
||||
{
|
||||
|
||||
|
||||
|
||||
class ListChooser : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit ListChooser(QObject *parent);
|
||||
~ListChooser() = default;
|
||||
|
||||
QString chooseFromList( const QString & title, const QStringList & list, const QString & currentChoose, bool existingOnly = true );
|
||||
|
||||
QString choosenString() const { return m_choosenString; }
|
||||
|
||||
private:
|
||||
|
||||
QPointer<LtsWidgets::LtsFramelessDialog> m_dialog;
|
||||
QString m_choosenString;
|
||||
|
||||
signals:
|
||||
|
||||
void selectionIsFinished();
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
+1055
File diff suppressed because it is too large.
Load diff
Executable
+175
@@ -0,0 +1,175 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Common/ProjectConfig/project_defines.h>
|
||||
#include <Plugins/PlanEditor/PlanEditorPlugin/plan_editor_gui_plugin_interface.h>
|
||||
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class FunctionReplyObject;
|
||||
}
|
||||
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class Participant;
|
||||
}
|
||||
|
||||
|
||||
namespace PlanEditorPlugin
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
class PlanEditorGuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:planeditor")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit PlanEditorGuiPlugin() = default;
|
||||
virtual ~PlanEditorGuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QLatin1String("PlanEditorGuiPlugin"); }
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession * session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return (partition == IDL::PartitionType::Global ||
|
||||
partition == IDL::PartitionType::Exercise ||
|
||||
partition == IDL::PartitionType::Replay
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface, public ForeignGuiInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
struct InternalData;
|
||||
|
||||
InternalData * m_internal;
|
||||
|
||||
public:
|
||||
|
||||
explicit InterfaceImpl( LtsSession::LtsSession * session );
|
||||
virtual ~InterfaceImpl();
|
||||
|
||||
|
||||
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
QString menuGroup() const override;
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
|
||||
|
||||
void setPlanToEdit(const QByteArray & planXMLContent) override;
|
||||
|
||||
void addSaveSnapshotAction( const QIcon & btnIcon, const QString & btnText, const std::function<bool(const QByteArray & planXMLContent)> &saveContent ) override;
|
||||
|
||||
bool event(QEvent *e) override;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
bool fmsCreatePlan( bool clearGeometryModel = true );
|
||||
|
||||
|
||||
|
||||
void fmsReadPlan();
|
||||
|
||||
|
||||
|
||||
void fmsImportPlan();
|
||||
|
||||
|
||||
|
||||
bool fmsWritePlan( bool saveAs );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool fmsModifyPlan( int fileId, bool saveAs = false );
|
||||
|
||||
|
||||
|
||||
void fmsDeletePlan();
|
||||
|
||||
|
||||
|
||||
void readAllSymbolFavourites();
|
||||
|
||||
|
||||
|
||||
void storeAllSymbolFavourites();
|
||||
|
||||
|
||||
|
||||
void readSymbolFavouritesRequest( const QString & favName, QString & favXMLContent, bool showErrorMessage = true );
|
||||
|
||||
|
||||
|
||||
void storeSymbolFavouritesRequest( const QString & favName, const QString & favXMLContent );
|
||||
|
||||
|
||||
|
||||
LtsWidgets::LtsDialog * startupPlanEditor( QWidget * parent, const QString & widgetName );
|
||||
|
||||
|
||||
|
||||
static QString buildFavDefaultName();
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
|
||||
void onfileServiceReadSymbolFavourites( QString & favXMLContent );
|
||||
|
||||
|
||||
|
||||
void onfileServiceStoreSymbolFavourites( const QString & favXMLContent );
|
||||
|
||||
|
||||
|
||||
void onReadUserDefaultSymbolFavourites();
|
||||
|
||||
|
||||
|
||||
void onStoreUserDefaultSymbolFavourites();
|
||||
|
||||
|
||||
|
||||
void onPlanContentChanged( const FileManagement::FileContent &data, DataModification modType );
|
||||
|
||||
|
||||
|
||||
|
||||
void onIterateParticipantsSidc();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
class QByteArray;
|
||||
class QIcon;
|
||||
class QString;
|
||||
|
||||
namespace PlanEditorPlugin
|
||||
{
|
||||
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
|
||||
virtual void setPlanToEdit(const QByteArray &planXMLContent) = 0;
|
||||
virtual void addSaveSnapshotAction(const QIcon & btnIcon, const QString &btnText, const std::function<bool(const QByteArray & lanXMLContent)> &saveContent) = 0;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user