From 4a64679422fb8eaf4129b8d1fea7b46d025fd49e Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 14 Jun 2020 17:52:02 +0200 Subject: [PATCH] Gui: [skip ci] show program version a file was created with in project information dialog --- src/App/Document.cpp | 8 ++++ src/App/Document.h | 2 + src/Gui/DlgProjectInformation.ui | 55 ++++++++++++++++++++-------- src/Gui/DlgProjectInformationImp.cpp | 1 + 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 7b0bca9af91a..831a34c5c89d 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -182,6 +182,7 @@ struct DocumentP int iUndoMode; unsigned int UndoMemSize; unsigned int UndoMaxStackSize; + std::string programVersion; #ifdef USE_OLD_DAG DependencyList DepList; std::map VertexObjectList; @@ -2731,7 +2732,9 @@ void Document::restore (const char *filename, catch (const Base::Exception& e) { Base::Console().Error("Invalid Document.xml: %s\n", e.what()); } + d->partialLoadObjects.clear(); + d->programVersion = reader.ProgramVersion; // Special handling for Gui document, the view representations must already // exist, what is done in Restore(). @@ -2886,6 +2889,11 @@ std::string Document::getFullName() const { return myName; } +const char* Document::getProgramVersion() const +{ + return d->programVersion.c_str(); +} + /// Remove all modifications. After this call The document becomes valid again. void Document::purgeTouched() { diff --git a/src/App/Document.h b/src/App/Document.h index a6f797275da4..7b316ad1c674 100644 --- a/src/App/Document.h +++ b/src/App/Document.h @@ -223,6 +223,8 @@ class AppExport Document : public App::PropertyContainer bool isSaved() const; /// Get the document name const char* getName() const; + /// Get program version the project file was created with + const char* getProgramVersion() const; //@} virtual void Save (Base::Writer &writer) const override; diff --git a/src/Gui/DlgProjectInformation.ui b/src/Gui/DlgProjectInformation.ui index 36014bc5f45b..0a3c25b0afab 100644 --- a/src/Gui/DlgProjectInformation.ui +++ b/src/Gui/DlgProjectInformation.ui @@ -105,6 +105,29 @@ + + + Program version: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 25 + + + + true + + + + Created &by: @@ -117,7 +140,7 @@ - + @@ -127,7 +150,7 @@ - + Creation &date: @@ -140,7 +163,7 @@ - + @@ -153,7 +176,7 @@ - + &Last modified by: @@ -166,7 +189,7 @@ - + @@ -176,7 +199,7 @@ - + Last &modification date: @@ -189,7 +212,7 @@ - + @@ -202,7 +225,7 @@ - + Com&pany: @@ -215,7 +238,7 @@ - + @@ -225,7 +248,7 @@ - + License information: @@ -235,10 +258,10 @@ - + - + License URL @@ -248,7 +271,7 @@ - + @@ -262,7 +285,7 @@ - + Commen&t: @@ -275,10 +298,10 @@ - + - + Qt::Vertical diff --git a/src/Gui/DlgProjectInformationImp.cpp b/src/Gui/DlgProjectInformationImp.cpp index 844d232c41ec..844fdfeea051 100644 --- a/src/Gui/DlgProjectInformationImp.cpp +++ b/src/Gui/DlgProjectInformationImp.cpp @@ -53,6 +53,7 @@ DlgProjectInformationImp::DlgProjectInformationImp(App::Document* doc, QWidget* ui->lineEditName->setText(QString::fromUtf8(doc->Label.getValue())); ui->lineEditPath->setText(QString::fromUtf8(doc->FileName.getValue())); ui->lineEditUuid->setText(QString::fromUtf8(doc->Uid.getValueStr().c_str())); + ui->lineEditProgramVersion->setText(QString::fromUtf8(doc->getProgramVersion())); ui->lineEditCreator->setText(QString::fromUtf8(doc->CreatedBy.getValue())); ui->lineEditDate->setText(QString::fromUtf8(doc->CreationDate.getValue())); ui->lineEditLastMod->setText(QString::fromUtf8(doc->LastModifiedBy.getValue()));