Fix several bugs in dialogs.
--HG-- branch : feature
This commit is contained in:
parent
3677a0484f
commit
8bb3377a60
|
@ -37,8 +37,7 @@
|
||||||
DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent)
|
DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||||
: DialogTool(data, toolId, parent),
|
: DialogTool(data, toolId, parent),
|
||||||
ui(new Ui::DialogPiecePath),
|
ui(new Ui::DialogPiecePath),
|
||||||
m_showMode(false),
|
m_showMode(false)
|
||||||
m_saWidth(0)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
InitOkCancel(ui);
|
InitOkCancel(ui);
|
||||||
|
@ -88,15 +87,7 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget
|
||||||
connect(ui->comboBoxAngle, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
connect(ui->comboBoxAngle, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
&DialogPiecePath::NodeAngleChanged);
|
&DialogPiecePath::NodeAngleChanged);
|
||||||
|
|
||||||
if (not m_showMode)
|
vis = new VisToolPiecePath(data);
|
||||||
{
|
|
||||||
vis = new VisToolPiecePath(data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->comboBoxType->setDisabled(true);
|
|
||||||
ui->comboBoxPiece->setDisabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->tabWidget->removeTab(1);
|
ui->tabWidget->removeTab(1);
|
||||||
}
|
}
|
||||||
|
@ -111,6 +102,8 @@ DialogPiecePath::~DialogPiecePath()
|
||||||
void DialogPiecePath::EnbleShowMode(bool disable)
|
void DialogPiecePath::EnbleShowMode(bool disable)
|
||||||
{
|
{
|
||||||
m_showMode = disable;
|
m_showMode = disable;
|
||||||
|
ui->comboBoxType->setDisabled(m_showMode);
|
||||||
|
ui->comboBoxPiece->setDisabled(m_showMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -308,7 +301,7 @@ void DialogPiecePath::NodeChanged(int index)
|
||||||
qreal w1 = node.GetSABefore();
|
qreal w1 = node.GetSABefore();
|
||||||
if (w1 < 0)
|
if (w1 < 0)
|
||||||
{
|
{
|
||||||
w1 = m_saWidth;
|
w1 = ui->doubleSpinBoxSeams->value();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -319,7 +312,7 @@ void DialogPiecePath::NodeChanged(int index)
|
||||||
qreal w2 = node.GetSAAfter();
|
qreal w2 = node.GetSAAfter();
|
||||||
if (w2 < 0)
|
if (w2 < 0)
|
||||||
{
|
{
|
||||||
w2 = m_saWidth;
|
w2 = ui->doubleSpinBoxSeams->value();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -588,6 +581,8 @@ void DialogPiecePath::SetPieceId(quint32 id)
|
||||||
ui->comboBoxType->setCurrentIndex(index);
|
ui->comboBoxType->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ValidObjects(PathIsValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -595,8 +590,8 @@ void DialogPiecePath::SetSAWidth(qreal width)
|
||||||
{
|
{
|
||||||
if (width >=0)
|
if (width >=0)
|
||||||
{
|
{
|
||||||
m_saWidth = width;
|
ui->tabWidget->addTab(ui->tabSeamAllowance, tr("Seam allowance"));
|
||||||
ui->tabWidget->addTab(ui->tabSeamAllowance, QString());
|
ui->doubleSpinBoxSeams->setValue(width);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,6 @@ private:
|
||||||
Q_DISABLE_COPY(DialogPiecePath)
|
Q_DISABLE_COPY(DialogPiecePath)
|
||||||
Ui::DialogPiecePath *ui;
|
Ui::DialogPiecePath *ui;
|
||||||
bool m_showMode;
|
bool m_showMode;
|
||||||
qreal m_saWidth;
|
|
||||||
|
|
||||||
void InitPathTypes();
|
void InitPathTypes();
|
||||||
void InitListPieces();
|
void InitListPieces();
|
||||||
|
|
|
@ -641,12 +641,21 @@ void DialogSeamAllowance::PathDialogClosed(int result)
|
||||||
SCASSERT(not m_dialog.isNull());
|
SCASSERT(not m_dialog.isNull());
|
||||||
DialogPiecePath *dialogTool = qobject_cast<DialogPiecePath*>(m_dialog.data());
|
DialogPiecePath *dialogTool = qobject_cast<DialogPiecePath*>(m_dialog.data());
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const VPiecePath newPath = dialogTool->GetPiecePath();
|
try
|
||||||
const VPiecePath oldPath = data->GetPiecePath(dialogTool->GetPieceId());
|
{
|
||||||
|
const VPiecePath newPath = dialogTool->GetPiecePath();
|
||||||
|
const VPiecePath oldPath = data->GetPiecePath(dialogTool->GetToolId());
|
||||||
|
|
||||||
SavePiecePathOptions *saveCommand = new SavePiecePathOptions(newPath, oldPath, qApp->getCurrentDocument(),
|
SavePiecePathOptions *saveCommand = new SavePiecePathOptions(oldPath, newPath, qApp->getCurrentDocument(),
|
||||||
const_cast<VContainer *>(data), toolId);
|
const_cast<VContainer *>(data),
|
||||||
qApp->getUndoStack()->push(saveCommand);
|
dialogTool->GetToolId());
|
||||||
|
qApp->getUndoStack()->push(saveCommand);
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
qCritical("%s\n\n%s\n\n%s", qUtf8Printable(tr("Error. Can't save piece path.")),
|
||||||
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
delete m_dialog;
|
delete m_dialog;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user