diff --git a/src/app/tape/dialogs/dialognoknownmeasurements.cpp b/src/app/tape/dialogs/dialognoknownmeasurements.cpp new file mode 100644 index 000000000..3932a9f62 --- /dev/null +++ b/src/app/tape/dialogs/dialognoknownmeasurements.cpp @@ -0,0 +1,43 @@ +/************************************************************************ + ** + ** @file dialognoknownmeasurements.cpp + ** @author Roman Telezhynskyi + ** @date 14 3, 2024 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2024 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#include "dialognoknownmeasurements.h" +#include "ui_dialognoknownmeasurements.h" + +//--------------------------------------------------------------------------------------------------------------------- +DialogNoKnownMeasurements::DialogNoKnownMeasurements(QWidget *parent) + : QDialog(parent), + ui(new Ui::DialogNoKnownMeasurements) +{ + ui->setupUi(this); +} + +//--------------------------------------------------------------------------------------------------------------------- +DialogNoKnownMeasurements::~DialogNoKnownMeasurements() +{ + delete ui; +} diff --git a/src/app/tape/dialogs/dialognoknownmeasurements.h b/src/app/tape/dialogs/dialognoknownmeasurements.h new file mode 100644 index 000000000..4801c998d --- /dev/null +++ b/src/app/tape/dialogs/dialognoknownmeasurements.h @@ -0,0 +1,51 @@ +/************************************************************************ + ** + ** @file dialognoknownmeasurements.h + ** @author Roman Telezhynskyi + ** @date 14 3, 2024 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2024 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#ifndef DIALOGNOKNOWNMEASUREMENTS_H +#define DIALOGNOKNOWNMEASUREMENTS_H + +#include + +namespace Ui +{ +class DialogNoKnownMeasurements; +} + +class DialogNoKnownMeasurements : public QDialog +{ + Q_OBJECT // NOLINT + +public: + explicit DialogNoKnownMeasurements(QWidget *parent = nullptr); + ~DialogNoKnownMeasurements() override; + +private: + Ui::DialogNoKnownMeasurements *ui; + Q_DISABLE_COPY_MOVE(DialogNoKnownMeasurements) // NOLINT +}; + +#endif // DIALOGNOKNOWNMEASUREMENTS_H diff --git a/src/app/tape/dialogs/dialognoknownmeasurements.ui b/src/app/tape/dialogs/dialognoknownmeasurements.ui new file mode 100644 index 000000000..4b08b75be --- /dev/null +++ b/src/app/tape/dialogs/dialognoknownmeasurements.ui @@ -0,0 +1,80 @@ + + + DialogNoKnownMeasurements + + + + 0 + 0 + 470 + 189 + + + + Known measurements + + + + :/tapeicon/64x64/logo.png:/tapeicon/64x64/logo.png + + + + + + The measurements file is not currently connected to the database of known measurements. Before adding known measurements, you'll need to create a database and connect it to your measurements file. To connect to one of the known sets, please navigate to the 'Information' tab. After doing so, you can retry your action. Alternatively, you can create a new database of known measurements and connect it to your measurements file. Would you like to create it now? + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::No|QDialogButtonBox::Yes + + + + + + + + + + + buttonBox + accepted() + DialogNoKnownMeasurements + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogNoKnownMeasurements + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/app/tape/tape.qbs b/src/app/tape/tape.qbs index a9fb5fa82..955724f33 100644 --- a/src/app/tape/tape.qbs +++ b/src/app/tape/tape.qbs @@ -90,6 +90,9 @@ VToolApp { "dialogknownmeasurementscsvcolumns.h", "dialogknownmeasurementscsvcolumns.ui", "dialogmeasurementscsvcolumns.cpp", + "dialognoknownmeasurements.cpp", + "dialognoknownmeasurements.h", + "dialognoknownmeasurements.ui", "dialogrestrictdimension.cpp", "dialogabouttape.cpp", "dialognewmeasurements.cpp", diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 9c61d7e7a..df50d01b7 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -58,6 +58,7 @@ #include "dialogs/dialogmdatabase.h" #include "dialogs/dialogmeasurementscsvcolumns.h" #include "dialogs/dialognewmeasurements.h" +#include "dialogs/dialognoknownmeasurements.h" #include "dialogs/dialogrestrictdimension.h" #include "dialogs/dialogsetupmultisize.h" #include "mapplication.h" // Should be last because of definning qApp @@ -1710,13 +1711,23 @@ void TMainWindow::AddCustom() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::AddKnown() { + if (m_m->KnownMeasurements().isNull()) + { + DialogNoKnownMeasurements dialog(this); + if (dialog.exec() == QDialog::Accepted) + { + MApplication::VApp()->NewMainKMWindow(); + } + return; + } + QScopedPointer const dialog(new DialogMDataBase(m_m->KnownMeasurements(), m_m->ListKnown(), this)); if (dialog->exec() == QDialog::Rejected) { return; } - vsizetype currentRow; + vsizetype currentRow = -1; const QStringList list = dialog->GetNewNames(); VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements());