diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp new file mode 100644 index 000000000..e24a13593 --- /dev/null +++ b/src/dialogs/app/dialogindividualmeasurements.cpp @@ -0,0 +1,109 @@ +/************************************************************************ + ** + ** @file dialogindividualmeasurements.cpp + ** @author Roman Telezhinsky + ** @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 + ** 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 "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); +} diff --git a/src/dialogs/app/dialogindividualmeasurements.h b/src/dialogs/app/dialogindividualmeasurements.h new file mode 100644 index 000000000..2f122c8e4 --- /dev/null +++ b/src/dialogs/app/dialogindividualmeasurements.h @@ -0,0 +1,57 @@ +/************************************************************************ + ** + ** @file dialogindividualmeasurements.h + ** @author Roman Telezhinsky + ** @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 + ** 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 DIALOGINDIVIDUALMEASUREMENTS_H +#define DIALOGINDIVIDUALMEASUREMENTS_H + +#include + +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 diff --git a/src/dialogs/app/dialogindividualmeasurements.ui b/src/dialogs/app/dialogindividualmeasurements.ui new file mode 100644 index 000000000..d2fc3ea04 --- /dev/null +++ b/src/dialogs/app/dialogindividualmeasurements.ui @@ -0,0 +1,149 @@ + + + DialogIndividualMeasurements + + + + 0 + 0 + 398 + 210 + + + + Dialog + + + + + + + + Pattern peace name + + + + + + + + + + + + + + Exist measurements + + + false + + + buttonGroupPath + + + + + + + + + + + + ... + + + + + + + + + + + + + + + + New measurements + + + true + + + buttonGroupPath + + + + + + + + + + + + ... + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DialogIndividualMeasurements + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogIndividualMeasurements + reject() + + + 316 + 260 + + + 286 + 274 + + + + + + + + diff --git a/src/dialogs/app/dialogstandardmeasurements.cpp b/src/dialogs/app/dialogstandardmeasurements.cpp index 65a40ea55..9d84b4d1c 100644 --- a/src/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/dialogs/app/dialogstandardmeasurements.cpp @@ -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 = ""; diff --git a/src/dialogs/app/dialogstandardmeasurements.h b/src/dialogs/app/dialogstandardmeasurements.h index 357ca732e..2a7156f50 100644 --- a/src/dialogs/app/dialogstandardmeasurements.h +++ b/src/dialogs/app/dialogstandardmeasurements.h @@ -48,8 +48,8 @@ private: Ui::DialogStandardMeasurements *ui; QString _name; QString _tablePath; - void Accepted(); - void Rejected(); + void DialogAccepted(); + void DialogRejected(); void CheckState(); void LoadStandardTables(); }; diff --git a/src/dialogs/dialogs.pri b/src/dialogs/dialogs.pri index d4267b31c..99388667c 100644 --- a/src/dialogs/dialogs.pri +++ b/src/dialogs/dialogs.pri @@ -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