-- fyerabend

This commit is contained in:
2025-08-08 21:39:33 +02:00
parent 666a2a9440
commit 5919d9d90d
15 changed files with 228 additions and 257 deletions

View File

@@ -16,9 +16,7 @@
#include <xqitem.h>
#include <QFile>
//! firz
XQDocument::XQDocument(const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQViewModel* aModelView )
: fileName{ aFileName }, friendlyName{ aFriendlyName }, treeItem{ aTreeItem }, modelView{ aModelView }
@@ -26,6 +24,8 @@ XQDocument::XQDocument(const QString& aFileName, const QString& aFriendlyName, X
}
//! firz
XQDocument::~XQDocument()
{
//delete _documentRoot;
@@ -37,6 +37,8 @@ XQDocument::~XQDocument()
///
//! firz
XQDocumentStore::~XQDocumentStore()
{
//for (auto entry : *this)
@@ -46,6 +48,7 @@ XQDocumentStore::~XQDocumentStore()
}
//! firz
void XQDocumentStore::addDocument( const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQViewModel* aModelView )
{

View File

@@ -26,18 +26,15 @@
#include <xqitemfactory.h>
//! default konstruktor.
XQMainModel::XQMainModel(QObject *parent )
: XQViewModel{parent}
{
}
XQMainModel::~XQMainModel()
{
// delete
}
//! initialisiert dieses model über den namen.
void XQMainModel::initModel(const QString& modelName)
{
@@ -56,6 +53,8 @@ void XQMainModel::initModel(const QString& modelName)
}
//! erzeugt einen eintrag in der baum-übersicht.
XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
{
for(const auto& section : _sections )
@@ -75,6 +74,7 @@ XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
throw XQException( "createTreeEntry: main model should not be emtpy!" );
}
//! firz
void XQMainModel::initContextMenu()
{

View File

@@ -30,7 +30,7 @@ class XQMainModel : public XQViewModel
public:
explicit XQMainModel(QObject *parent = nullptr);
virtual ~XQMainModel();
virtual ~XQMainModel() = default;
void initModel(const QString& modelName) override;
XQItem* createTreeEntry( XQNodePtr contentNode );

View File

@@ -23,6 +23,7 @@
#include <xqnodewriter.h>
//! firz
XQMainWindow::XQMainWindow( QWidget* parent )
: QMainWindow(parent)
@@ -32,6 +33,9 @@ XQMainWindow::XQMainWindow( QWidget* parent )
initMainWindow();
}
//! firz
void XQMainWindow::initMainWindow()
{
@@ -97,6 +101,9 @@ void XQMainWindow::initMainWindow()
}
//! firz
void XQMainWindow::onUndo()
{
qDebug() << " --- undo Pressed";
@@ -105,6 +112,9 @@ void XQMainWindow::onUndo()
}
//!
void XQMainWindow::onRedo()
{
qDebug() << " --- redo Pressed";
@@ -114,12 +124,16 @@ void XQMainWindow::onRedo()
}
//! erzeugt ein document
void XQMainWindow::onCreateDocument()
{
qDebug() << " ---- create document Pressed!";
}
//! öffnet ein XML document
void XQMainWindow::onOpenDocument()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Project"), c_DocumentDirectory, tr("project data(*.xtr)") );
@@ -137,6 +151,7 @@ void XQMainWindow::onOpenDocument()
}
//! speichert ein XML document
void XQMainWindow::onSaveDocument()
{
@@ -145,6 +160,9 @@ void XQMainWindow::onSaveDocument()
}
//! fragt nach einem datei-namen und speichert das akutelle XML
//! document unter diesem
void XQMainWindow::onSaveDocumentAs()
{
QString fileName = QFileDialog::getSaveFileName(this, "Save as", c_DocumentDirectory, tr("project data(*.xtr)") );
@@ -162,17 +180,24 @@ void XQMainWindow::onSaveDocumentAs()
}
//! wird aufgerufen, wenn ein XML geschlossen werden soll.
void XQMainWindow::onCloseDocument()
{
qDebug() << " ---- close Pressed!";
}
//! beendet diese application
void XQMainWindow::onExit()
{
qApp->exit();
}
//! zeigt den about-dialog
void XQMainWindow::onAbout()
{
@@ -189,6 +214,7 @@ void XQMainWindow::onAbout()
}
//! firz
// when item in the left tree is clicked, switch view on the right side
void XQMainWindow::onTreeItemClicked(const QModelIndex& index )
{
@@ -207,6 +233,8 @@ void XQMainWindow::onTreeItemClicked(const QModelIndex& index )
}
//! firz
// when item in the left tree is clicked, switch view on the right side
void XQMainWindow::onTabClicked( int index )
{
@@ -215,10 +243,12 @@ void XQMainWindow::onTabClicked( int index )
_mainTreeView->setCurrentIndex( _documentStore[index].treeItem->index() );
}
//! liest eine XML datei namens 'fileName'
void XQMainWindow::loadDocument( const QString& fileName )
{
//ntThrowIfNullPtr
// gibts die Datei?
// gibts die Datei?
if( !QFile::exists( fileName) )
throw XQException( "no such file", fileName );
@@ -271,6 +301,8 @@ void XQMainWindow::loadDocument( const QString& fileName )
}
//! speichert ein XML unter dem 'filename'
void XQMainWindow::saveDocument( const QString& fileName )
{
XQNodeWriter nodeWriter;