2016-04-05 19:14:12 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file dialoggroup.cpp
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 4 4, 2016
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2016-04-05 19:14:12 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2016 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 "dialoggroup.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
2016-04-05 19:14:12 +02:00
|
|
|
#include "ui_dialoggroup.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
|
2016-04-05 19:14:12 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
DialogGroup::DialogGroup(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
|
|
|
: DialogTool(data, toolId, parent),
|
|
|
|
ui(new Ui::DialogGroup),
|
|
|
|
group()
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
InitOkCancel(ui);
|
2017-03-31 10:54:05 +02:00
|
|
|
DialogTool::CheckState();
|
2016-04-05 19:14:12 +02:00
|
|
|
|
|
|
|
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogGroup::NameChanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
DialogGroup::~DialogGroup()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogGroup::SetName(const QString &name)
|
|
|
|
{
|
|
|
|
ui->lineEditName->setText(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString DialogGroup::GetName() const
|
|
|
|
{
|
|
|
|
return ui->lineEditName->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogGroup::ShowDialog(bool click)
|
|
|
|
{
|
|
|
|
if (not click)
|
|
|
|
{
|
|
|
|
if (group.isEmpty())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetName(tr("New group"));
|
|
|
|
|
|
|
|
setModal(true);
|
|
|
|
emit ToolTip("");
|
|
|
|
show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogGroup::SelectedObject(bool selected, quint32 object, quint32 tool)
|
|
|
|
{
|
|
|
|
if (selected)
|
|
|
|
{
|
|
|
|
group.insert(object, tool);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
group.remove(object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogGroup::NameChanged()
|
|
|
|
{
|
|
|
|
ui->lineEditName->text().isEmpty() ? flagName = false : flagName = true;
|
|
|
|
CheckState();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QMap<quint32, quint32> DialogGroup::GetGroup() const
|
|
|
|
{
|
|
|
|
return group;
|
|
|
|
}
|