New dialog to improve user experience.

Most users don't understand how to work with new known measurements system. This dialog should help them.
This commit is contained in:
Roman Telezhynskyi 2024-03-14 13:35:28 +02:00
parent 47fd57113e
commit 3dfc62e99a
5 changed files with 189 additions and 1 deletions

View File

@ -0,0 +1,43 @@
/************************************************************************
**
** @file dialognoknownmeasurements.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://gitlab.com/smart-pattern/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "dialognoknownmeasurements.h"
#include "ui_dialognoknownmeasurements.h"
//---------------------------------------------------------------------------------------------------------------------
DialogNoKnownMeasurements::DialogNoKnownMeasurements(QWidget *parent)
: QDialog(parent),
ui(new Ui::DialogNoKnownMeasurements)
{
ui->setupUi(this);
}
//---------------------------------------------------------------------------------------------------------------------
DialogNoKnownMeasurements::~DialogNoKnownMeasurements()
{
delete ui;
}

View File

@ -0,0 +1,51 @@
/************************************************************************
**
** @file dialognoknownmeasurements.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://gitlab.com/smart-pattern/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef DIALOGNOKNOWNMEASUREMENTS_H
#define DIALOGNOKNOWNMEASUREMENTS_H
#include <QDialog>
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

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogNoKnownMeasurements</class>
<widget class="QDialog" name="DialogNoKnownMeasurements">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>470</width>
<height>189</height>
</rect>
</property>
<property name="windowTitle">
<string>Known measurements</string>
</property>
<property name="windowIcon">
<iconset resource="../share/resources/tapeicon.qrc">
<normaloff>:/tapeicon/64x64/logo.png</normaloff>:/tapeicon/64x64/logo.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>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?</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../share/resources/tapeicon.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogNoKnownMeasurements</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogNoKnownMeasurements</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -90,6 +90,9 @@ VToolApp {
"dialogknownmeasurementscsvcolumns.h", "dialogknownmeasurementscsvcolumns.h",
"dialogknownmeasurementscsvcolumns.ui", "dialogknownmeasurementscsvcolumns.ui",
"dialogmeasurementscsvcolumns.cpp", "dialogmeasurementscsvcolumns.cpp",
"dialognoknownmeasurements.cpp",
"dialognoknownmeasurements.h",
"dialognoknownmeasurements.ui",
"dialogrestrictdimension.cpp", "dialogrestrictdimension.cpp",
"dialogabouttape.cpp", "dialogabouttape.cpp",
"dialognewmeasurements.cpp", "dialognewmeasurements.cpp",

View File

@ -58,6 +58,7 @@
#include "dialogs/dialogmdatabase.h" #include "dialogs/dialogmdatabase.h"
#include "dialogs/dialogmeasurementscsvcolumns.h" #include "dialogs/dialogmeasurementscsvcolumns.h"
#include "dialogs/dialognewmeasurements.h" #include "dialogs/dialognewmeasurements.h"
#include "dialogs/dialognoknownmeasurements.h"
#include "dialogs/dialogrestrictdimension.h" #include "dialogs/dialogrestrictdimension.h"
#include "dialogs/dialogsetupmultisize.h" #include "dialogs/dialogsetupmultisize.h"
#include "mapplication.h" // Should be last because of definning qApp #include "mapplication.h" // Should be last because of definning qApp
@ -1710,13 +1711,23 @@ void TMainWindow::AddCustom()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::AddKnown() void TMainWindow::AddKnown()
{ {
if (m_m->KnownMeasurements().isNull())
{
DialogNoKnownMeasurements dialog(this);
if (dialog.exec() == QDialog::Accepted)
{
MApplication::VApp()->NewMainKMWindow();
}
return;
}
QScopedPointer<DialogMDataBase> const dialog(new DialogMDataBase(m_m->KnownMeasurements(), m_m->ListKnown(), this)); QScopedPointer<DialogMDataBase> const dialog(new DialogMDataBase(m_m->KnownMeasurements(), m_m->ListKnown(), this));
if (dialog->exec() == QDialog::Rejected) if (dialog->exec() == QDialog::Rejected)
{ {
return; return;
} }
vsizetype currentRow; vsizetype currentRow = -1;
const QStringList list = dialog->GetNewNames(); const QStringList list = dialog->GetNewNames();
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements());