From c0c85bb2d5b0406162bda8e7aac22ed65041bca3 Mon Sep 17 00:00:00 2001 From: Ronan Le Tiec Date: Wed, 11 Nov 2020 19:14:06 +0100 Subject: [PATCH] Layout name und description persistence --- src/app/puzzle/vplayout.cpp | 25 +++++++++++++++++++++++++ src/app/puzzle/vplayout.h | 27 +++++++++++++++++++++++++++ src/app/puzzle/vpmainwindow.cpp | 6 ++++++ src/app/puzzle/vpmainwindow.ui | 4 ++-- 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/app/puzzle/vplayout.cpp b/src/app/puzzle/vplayout.cpp index fe77d2959..6f14c4cae 100644 --- a/src/app/puzzle/vplayout.cpp +++ b/src/app/puzzle/vplayout.cpp @@ -141,6 +141,31 @@ bool VPLayout::GetWarningPiecesOutOfBound() const return m_warningPiecesOutOfBound; } +//--------------------------------------------------------------------------------------------------------------------- +void VPLayout::SetTitle(QString title) +{ + m_title = title; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VPLayout::GetTitle() const +{ + return m_title; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPLayout::SetDescription(QString description) +{ + m_description = description; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VPLayout::GetDescription() const +{ + return m_description; +} + + //--------------------------------------------------------------------------------------------------------------------- void VPLayout::ClearSelection() { diff --git a/src/app/puzzle/vplayout.h b/src/app/puzzle/vplayout.h index a81017bb8..17a529a9b 100644 --- a/src/app/puzzle/vplayout.h +++ b/src/app/puzzle/vplayout.h @@ -78,6 +78,30 @@ public: void SetWarningPiecesOutOfBound(bool state); bool GetWarningPiecesOutOfBound() const; + /** + * @brief SetTitle Sets the title of the layout to the given value + * @param title the title of the layout + */ + void SetTitle(QString title); + + /** + * @brief GetTitle Returns the title of the layout + * @return + */ + QString GetTitle() const; + + /** + * @brief SetDescription Sets the description of the layout to the given value + * @param description the description of the layout + */ + void SetDescription(QString description); + + /** + * @brief GetDescription Returns the description of the layout. + * @return + */ + QString GetDescription() const; + /** * @brief ClearSelection goes through the unplaced pieces and through the sheets and calls * SetIsSelected(false) for the pieces that were selected. @@ -141,6 +165,9 @@ private: bool m_warningSuperpositionOfPieces{false}; bool m_warningPiecesOutOfBound{false}; + QString m_title{}; + QString m_description{}; + }; diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index 34ed3bd96..26e19bbb0 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -73,6 +73,8 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) : m_layout->SetUnit(Unit::Cm); m_layout->SetWarningSuperpositionOfPieces(true); + m_layout->SetTitle(QString("My Test Layout")); + m_layout->SetDescription(QString("Description of my Layout")); // -------------------------------------------------------- ui->setupUi(this); @@ -250,6 +252,10 @@ void VPMainWindow::InitPropertyTabCurrentPiece() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::InitPropertyTabLayout() { + // --------------- init the title and derscription ----------------- + ui->lineEditLayoutName->setText(m_layout->GetTitle()); + ui->plainTextEditLayoutDescription->setPlainText(m_layout->GetDescription()); + // -------------------- init the unit combobox --------------------- ui->comboBoxLayoutUnit->addItem(tr("Centimeters"), QVariant(UnitsToStr(Unit::Cm))); ui->comboBoxLayoutUnit->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm))); diff --git a/src/app/puzzle/vpmainwindow.ui b/src/app/puzzle/vpmainwindow.ui index 0ad8dd2c2..fbbf5e704 100644 --- a/src/app/puzzle/vpmainwindow.ui +++ b/src/app/puzzle/vpmainwindow.ui @@ -176,7 +176,7 @@ QTabWidget::Rounded - 1 + 3 @@ -1089,7 +1089,7 @@ - My layout +