Skip to content

Commit

Permalink
Gui: [skip ci] show program version a file was created with in projec…
Browse files Browse the repository at this point in the history
…t information dialog
  • Loading branch information
wwmayer committed Jun 14, 2020
1 parent f5a5bf7 commit 4a64679
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 16 deletions.
8 changes: 8 additions & 0 deletions src/App/Document.cpp
Expand Up @@ -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<DocumentObject*,Vertex> VertexObjectList;
Expand Down Expand Up @@ -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().
Expand Down Expand Up @@ -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()
{
Expand Down
2 changes: 2 additions & 0 deletions src/App/Document.h
Expand Up @@ -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;
Expand Down
55 changes: 39 additions & 16 deletions src/Gui/DlgProjectInformation.ui
Expand Up @@ -105,6 +105,29 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="textLabelProgramVersion">
<property name="text">
<string>Program version:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditProgramVersion">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="textLabelCreator">
<property name="text">
<string>Created &amp;by:</string>
Expand All @@ -117,7 +140,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QLineEdit" name="lineEditCreator">
<property name="minimumSize">
<size>
Expand All @@ -127,7 +150,7 @@
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="textLabelCreateDate">
<property name="text">
<string>Creation &amp;date:</string>
Expand All @@ -140,7 +163,7 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QLineEdit" name="lineEditDate">
<property name="minimumSize">
<size>
Expand All @@ -153,7 +176,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="textLabelLastMod">
<property name="text">
<string>&amp;Last modified by:</string>
Expand All @@ -166,7 +189,7 @@
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QLineEdit" name="lineEditLastMod">
<property name="minimumSize">
<size>
Expand All @@ -176,7 +199,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="textLabelLastModDate">
<property name="text">
<string>Last &amp;modification date:</string>
Expand All @@ -189,7 +212,7 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QLineEdit" name="lineEditLastModDate">
<property name="minimumSize">
<size>
Expand All @@ -202,7 +225,7 @@
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="textLabelCompany">
<property name="text">
<string>Com&amp;pany:</string>
Expand All @@ -215,7 +238,7 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QLineEdit" name="lineEditCompany">
<property name="minimumSize">
<size>
Expand All @@ -225,7 +248,7 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="textLabelLicense">
<property name="text">
<string>License information:</string>
Expand All @@ -235,10 +258,10 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QComboBox" name="comboLicense"/>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QLabel" name="textLabelLicenseURL">
<property name="text">
<string>License URL</string>
Expand All @@ -248,7 +271,7 @@
</property>
</widget>
</item>
<item row="9" column="1">
<item row="10" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="lineEditLicenseURL"/>
Expand All @@ -262,7 +285,7 @@
</item>
</layout>
</item>
<item row="10" column="0">
<item row="11" column="0">
<widget class="QLabel" name="textLabelComment">
<property name="text">
<string>Commen&amp;t:</string>
Expand All @@ -275,10 +298,10 @@
</property>
</widget>
</item>
<item row="10" column="1" rowspan="2">
<item row="11" column="1" rowspan="2">
<widget class="QTextEdit" name="textEditComment"/>
</item>
<item row="11" column="0">
<item row="12" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand Down
1 change: 1 addition & 0 deletions src/Gui/DlgProjectInformationImp.cpp
Expand Up @@ -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()));
Expand Down

0 comments on commit 4a64679

Please sign in to comment.