Dialog for showing progress of creation.
--HG-- branch : feature
This commit is contained in:
parent
a121845407
commit
f6380cf739
106
src/app/dialogs/app/dialoglayoutprogress.cpp
Normal file
106
src/app/dialogs/app/dialoglayoutprogress.cpp
Normal file
|
@ -0,0 +1,106 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialoglayoutprogress.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 14 1, 2015
|
||||
**
|
||||
** @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) 2015 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 "dialoglayoutprogress.h"
|
||||
#include "ui_dialoglayoutprogress.h"
|
||||
#include "../options.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
|
||||
:QDialog(parent), ui(new Ui::DialogLayoutProgress)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->progressBar->setMaximum(count);
|
||||
ui->progressBar->setValue(0);
|
||||
|
||||
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
SCASSERT(bCancel != nullptr);
|
||||
connect(bCancel, &QPushButton::clicked, this, &DialogLayoutProgress::StopWorking);
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogLayoutProgress::~DialogLayoutProgress()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutProgress::Start()
|
||||
{
|
||||
show();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutProgress::Arranged(int count)
|
||||
{
|
||||
ui->progressBar->setValue(count);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutProgress::Error(const LayoutErrors &state)
|
||||
{
|
||||
QString text;
|
||||
switch(state)
|
||||
{
|
||||
case LayoutErrors::NoError:
|
||||
return;
|
||||
case LayoutErrors::PrepareLayoutError:
|
||||
text = tr("Couldn't prepare data for creation layout");
|
||||
QMessageBox::critical(this, tr("Critical error"), text, QMessageBox::Ok, QMessageBox::Ok);
|
||||
break;
|
||||
case LayoutErrors::PaperSizeError:
|
||||
text = tr("Wrong paper size");
|
||||
QMessageBox::critical(this, tr("Critical error"), text, QMessageBox::Ok, QMessageBox::Ok);
|
||||
break;
|
||||
case LayoutErrors::ProcessStoped:
|
||||
break;
|
||||
case LayoutErrors::EmptyPaperError:
|
||||
text = tr("Several workpieces left not arranged, but none of them match for paper");
|
||||
QMessageBox::critical(this, tr("Critical error"), text, QMessageBox::Ok, QMessageBox::Ok);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
done(QDialog::Rejected);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutProgress::Finished()
|
||||
{
|
||||
done(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutProgress::StopWorking()
|
||||
{
|
||||
emit Abort();
|
||||
}
|
64
src/app/dialogs/app/dialoglayoutprogress.h
Normal file
64
src/app/dialogs/app/dialoglayoutprogress.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialoglayoutprogress.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 14 1, 2015
|
||||
**
|
||||
** @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) 2015 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 DIALOGLAYOUTPROGRESS_H
|
||||
#define DIALOGLAYOUTPROGRESS_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "../../libs/vlayout/vlayoutdef.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogLayoutProgress;
|
||||
}
|
||||
|
||||
class DialogLayoutProgress : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogLayoutProgress(int count, QWidget *parent = 0);
|
||||
~DialogLayoutProgress();
|
||||
|
||||
signals:
|
||||
void Abort();
|
||||
|
||||
public slots:
|
||||
void Start();
|
||||
void Arranged(int count);
|
||||
void Error(const LayoutErrors &state);
|
||||
void Finished();
|
||||
void StopWorking();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogLayoutProgress)
|
||||
Ui::DialogLayoutProgress *ui;
|
||||
};
|
||||
|
||||
#endif // DIALOGLAYOUTPROGRESS_H
|
66
src/app/dialogs/app/dialoglayoutprogress.ui
Normal file
66
src/app/dialogs/app/dialoglayoutprogress.ui
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogLayoutProgress</class>
|
||||
<widget class="QDialog" name="DialogLayoutProgress">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>566</width>
|
||||
<height>119</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Creation a layout</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../../share/resources/icon.qrc">
|
||||
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Finding best position for worpieces. Please, waite.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../share/resources/icon.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -42,7 +42,8 @@ HEADERS += \
|
|||
$$PWD/app/configpages/pathpage.h \
|
||||
$$PWD/app/dialogundo.h \
|
||||
$$PWD/tools/dialogcurveintersectaxis.h \
|
||||
$$PWD/app/dialoglayoutsettings.h
|
||||
$$PWD/app/dialoglayoutsettings.h \
|
||||
$$PWD/app/dialoglayoutprogress.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/tools/dialogtriangle.cpp \
|
||||
|
@ -83,7 +84,8 @@ SOURCES += \
|
|||
$$PWD/app/configpages/pathpage.cpp \
|
||||
$$PWD/app/dialogundo.cpp \
|
||||
$$PWD/tools/dialogcurveintersectaxis.cpp \
|
||||
$$PWD/app/dialoglayoutsettings.cpp
|
||||
$$PWD/app/dialoglayoutsettings.cpp \
|
||||
$$PWD/app/dialoglayoutprogress.cpp
|
||||
|
||||
FORMS += \
|
||||
$$PWD/tools/dialogtriangle.ui \
|
||||
|
@ -118,4 +120,5 @@ FORMS += \
|
|||
$$PWD/app/dialogpatternxmledit.ui \
|
||||
$$PWD/app/dialogundo.ui \
|
||||
$$PWD/tools/dialogcurveintersectaxis.ui \
|
||||
$$PWD/app/dialoglayoutsettings.ui
|
||||
$$PWD/app/dialoglayoutsettings.ui \
|
||||
$$PWD/app/dialoglayoutprogress.ui
|
||||
|
|
Loading…
Reference in New Issue
Block a user