Initial implamentation dialog individual measurement.

--HG--
branch : feature
This commit is contained in:
dismine 2014-02-22 17:16:33 +02:00
parent ccbd9415f0
commit 02ef7c0e09
6 changed files with 328 additions and 9 deletions

View File

@ -0,0 +1,109 @@
/************************************************************************
**
** @file dialogindividualmeasurements.cpp
** @author Roman Telezhinsky <dismine@gmail.com>
** @date 22 2, 2014
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** <https://bitbucket.org/dismine/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 "dialogindividualmeasurements.h"
#include "ui_dialogindividualmeasurements.h"
DialogIndividualMeasurements::DialogIndividualMeasurements(QWidget *parent) :
QDialog(parent), ui(new Ui::DialogIndividualMeasurements), _name(QString()), _tablePath(QString())
{
ui->setupUi(this);
{
const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
connect(bOk, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogAccepted);
}
{
const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel);
connect(bCansel, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogRejected);
}
CheckState();
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogIndividualMeasurements::CheckState);
connect(ui->buttonGroupPath, &QButtonGroup::buttonClicked, this, &DialogIndividualMeasurements::CheckState);
}
DialogIndividualMeasurements::~DialogIndividualMeasurements()
{
delete ui;
}
void DialogIndividualMeasurements::DialogAccepted()
{
_name = ui->lineEditName->text();
if (ui->radioButtonExistM->isChecked())
{
_tablePath = ui->lineEditPathExistM->text();
}
else
{
_tablePath = ui->lineEditPathNewM->text();
}
accept();
}
void DialogIndividualMeasurements::DialogRejected()
{
_name = "";
_tablePath = "";
reject();
}
void DialogIndividualMeasurements::CheckState()
{
bool flagName = false;
if (ui->lineEditName->text().isEmpty() == false)
{
flagName = true;
}
bool flagPath = false;
if (ui->radioButtonExistM->isChecked())
{
ui->lineEditPathExistM->setEnabled(true);
ui->toolButtonOpenExist->setEnabled(true);
ui->lineEditPathNewM->setEnabled(false);
ui->toolButtonOpenNew->setEnabled(false);
}
else
{
ui->lineEditPathNewM->setEnabled(true);
ui->toolButtonOpenNew->setEnabled(true);
ui->toolButtonOpenExist->setEnabled(false);
ui->lineEditPathExistM->setEnabled(false);
}
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
bOk->setEnabled(flagName && flagPath);
}

View File

@ -0,0 +1,57 @@
/************************************************************************
**
** @file dialogindividualmeasurements.h
** @author Roman Telezhinsky <dismine@gmail.com>
** @date 22 2, 2014
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** <https://bitbucket.org/dismine/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 DIALOGINDIVIDUALMEASUREMENTS_H
#define DIALOGINDIVIDUALMEASUREMENTS_H
#include <QDialog>
namespace Ui {
class DialogIndividualMeasurements;
}
class DialogIndividualMeasurements : public QDialog
{
Q_OBJECT
public:
explicit DialogIndividualMeasurements(QWidget *parent = 0);
~DialogIndividualMeasurements();
inline QString name() const {return _name;}
inline QString tablePath() const{return _tablePath;}
private:
Q_DISABLE_COPY(DialogIndividualMeasurements)
Ui::DialogIndividualMeasurements *ui;
QString _name;
QString _tablePath;
void DialogAccepted();
void DialogRejected();
void CheckState();
};
#endif // DIALOGINDIVIDUALMEASUREMENTS_H

View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogIndividualMeasurements</class>
<widget class="QDialog" name="DialogIndividualMeasurements">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>398</width>
<height>210</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Pattern peace name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditName"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="radioButtonExistM">
<property name="text">
<string>Exist measurements</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupPath</string>
</attribute>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="lineEditPathExistM"/>
</item>
<item>
<widget class="QToolButton" name="toolButtonOpenExist">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="document-open"/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="radioButtonNewM">
<property name="text">
<string>New measurements</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupPath</string>
</attribute>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="lineEditPathNewM"/>
</item>
<item>
<widget class="QToolButton" name="toolButtonOpenNew">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="document-new"/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogIndividualMeasurements</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>DialogIndividualMeasurements</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>
<buttongroups>
<buttongroup name="buttonGroupPath"/>
</buttongroups>
</ui>

View File

@ -38,17 +38,18 @@ DialogStandardMeasurements::DialogStandardMeasurements(QWidget *parent) :
{
const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
connect(bOk, &QPushButton::clicked, this, &DialogStandardMeasurements::Accepted);
connect(bOk, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogAccepted);
}
{
const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel);
connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::Rejected);
connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogRejected);
}
LoadStandardTables();
CheckState();
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogStandardMeasurements::CheckState);
}
DialogStandardMeasurements::~DialogStandardMeasurements()
@ -66,14 +67,14 @@ QString DialogStandardMeasurements::tablePath() const
return _tablePath;
}
void DialogStandardMeasurements::Accepted()
void DialogStandardMeasurements::DialogAccepted()
{
_name = ui->lineEditName->text();
_tablePath = "path";
accept();
}
void DialogStandardMeasurements::Rejected()
void DialogStandardMeasurements::DialogRejected()
{
_name = "";
_tablePath = "";

View File

@ -48,8 +48,8 @@ private:
Ui::DialogStandardMeasurements *ui;
QString _name;
QString _tablePath;
void Accepted();
void Rejected();
void DialogAccepted();
void DialogRejected();
void CheckState();
void LoadStandardTables();
};

View File

@ -27,7 +27,8 @@ HEADERS += \
src/dialogs/app/pages.h \
src/dialogs/app/dialogpatternproperties.h \
src/dialogs/app/dialogmeasurements.h \
src/dialogs/app/dialogstandardmeasurements.h
src/dialogs/app/dialogstandardmeasurements.h \
src/dialogs/app/dialogindividualmeasurements.h
SOURCES += \
src/dialogs/tools/dialogtriangle.cpp \
@ -57,7 +58,8 @@ SOURCES += \
src/dialogs/app/pages.cpp \
src/dialogs/app/dialogpatternproperties.cpp \
src/dialogs/app/dialogmeasurements.cpp \
src/dialogs/app/dialogstandardmeasurements.cpp
src/dialogs/app/dialogstandardmeasurements.cpp \
src/dialogs/app/dialogindividualmeasurements.cpp
FORMS += \
src/dialogs/tools/dialogtriangle.ui \
@ -84,4 +86,5 @@ FORMS += \
src/dialogs/app/dialoghistory.ui \
src/dialogs/app/dialogpatternproperties.ui \
src/dialogs/app/dialogmeasurements.ui \
src/dialogs/app/dialogstandardmeasurements.ui
src/dialogs/app/dialogstandardmeasurements.ui \
src/dialogs/app/dialogindividualmeasurements.ui