2013-11-15 13:41:26 +01:00
|
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
|
** @file tablewindow.h
|
2014-04-30 07:38:52 +02:00
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
|
** @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.
|
2013-09-18 21:16:19 +02:00
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
|
** 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.
|
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
|
** 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/>.
|
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
|
2013-08-29 12:31:50 +02:00
|
|
|
|
#ifndef TABLEWINDOW_H
|
|
|
|
|
#define TABLEWINDOW_H
|
|
|
|
|
|
2013-11-21 13:05:26 +01:00
|
|
|
|
#include <QLabel>
|
2013-08-29 12:31:50 +02:00
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
#include "widgets/vitem.h"
|
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
|
namespace Ui
|
|
|
|
|
{
|
2013-08-29 12:31:50 +02:00
|
|
|
|
class TableWindow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief TableWindow class layout window.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
class TableWindow : public QMainWindow
|
|
|
|
|
{
|
2013-08-29 12:31:50 +02:00
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief numberDetal show count details, what need placed.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
QLabel* numberDetal;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief colission show if exist colissions.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
QLabel* colission;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief TableWindow constructor.
|
|
|
|
|
* @param parent parent widget.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
2014-02-26 10:22:05 +01:00
|
|
|
|
explicit TableWindow(QWidget *parent = nullptr);
|
2013-08-29 12:31:50 +02:00
|
|
|
|
~TableWindow();
|
|
|
|
|
public slots:
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief ModelChosen show window when user want create new layout.
|
|
|
|
|
* @param listDetails list of details.
|
2014-02-19 14:50:43 +01:00
|
|
|
|
* @param description pattern description.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
2014-02-19 14:50:43 +01:00
|
|
|
|
void ModelChosen(QVector<VItem*> listDetails, const QString &fileName, const QString &description);
|
2013-08-29 12:31:50 +02:00
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief StopTable stop creation layout.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void StopTable();
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief saveScene save created layout.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void saveScene();
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief GetNextDetail put next detail on table.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void GetNextDetail();
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief itemChect turn off rotation button if don't selected detail.
|
|
|
|
|
* @param flag true - enable button.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void itemChect(bool flag);
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief itemOut handled if detail moved out paper sheet.
|
|
|
|
|
* @param number Number detail in list.
|
|
|
|
|
* @param flag set state of detail. True if detail moved out paper sheet.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void itemOut(int number, bool flag);
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief itemColliding handled if we have colission details.
|
|
|
|
|
* @param list list of colission details.
|
|
|
|
|
* @param number 0 - include to list of colission dcetails, 1 - exclude from list.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void itemColliding(QList<QGraphicsItem *> list, int number);
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief AddLength Add length paper sheet.Збільшує довжину листа на певне значення за один раз.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void AddLength();
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief RemoveLength reduce the length of paper sheet. You can reduce to the minimal value only.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void RemoveLength();
|
|
|
|
|
signals:
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief closed emit if window is closing.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void closed();
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief LengthChanged emit if changing length of paper sheet.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void LengthChanged();
|
|
|
|
|
protected:
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief closeEvent handle after close window.
|
|
|
|
|
* @param event close event.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief moveToCenter move screen to the center of window.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void moveToCenter();
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief showEvent handle after show window.
|
|
|
|
|
* @param event show event.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void showEvent ( QShowEvent * event );
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief keyPressEvent handle key press events.
|
|
|
|
|
* @param event key event.
|
2013-11-19 21:56:49 +01:00
|
|
|
|
*/
|
2013-08-29 12:31:50 +02:00
|
|
|
|
void keyPressEvent ( QKeyEvent * event );
|
|
|
|
|
private:
|
2013-09-26 20:50:52 +02:00
|
|
|
|
Q_DISABLE_COPY(TableWindow)
|
2013-08-29 12:31:50 +02:00
|
|
|
|
/**
|
2013-11-19 21:56:49 +01:00
|
|
|
|
* @brief ui keeps information about user interface Змінна для доступу до об'єктів вікна.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
Ui::TableWindow* ui;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief listDetails list of details.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
QVector<VItem*> listDetails;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief outItems true if we have details out paper sheet.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
bool outItems;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief collidingItems true if we have colission details.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
bool collidingItems;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief currentScene pointer to scene.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
2013-12-30 19:59:33 +01:00
|
|
|
|
QGraphicsScene* tableScene;
|
2013-08-29 12:31:50 +02:00
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief paper paper sheet.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
QGraphicsRectItem* paper;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief shadowPaper paper sheet shadow.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
QGraphicsRectItem* shadowPaper;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief checkNext disable next detail button if exist colission or out details.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void checkNext();
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief listOutItems list state out each detail.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
QBitArray* listOutItems;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief listCollidingItems list colissed details.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
QList<QGraphicsItem*> listCollidingItems;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief AddPaper add to the scene paper and shadow.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void AddPaper();
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief AddDetail show on scene next detail.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
void AddDetail();
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief indexDetail index next detail in list what will be shown.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
qint32 indexDetail;
|
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief sceneRect minimal size of a paper.
|
2013-08-29 12:31:50 +02:00
|
|
|
|
*/
|
|
|
|
|
QRectF sceneRect;
|
2014-01-23 17:16:28 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief fileName keep name of pattern file.
|
|
|
|
|
*/
|
2014-01-16 23:32:20 +01:00
|
|
|
|
QString fileName;
|
2014-02-19 14:50:43 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief description pattern description
|
|
|
|
|
*/
|
|
|
|
|
QString description;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief SvgFile save layout to svg file.
|
|
|
|
|
* @param name name layout file.
|
2013-11-19 21:56:49 +01:00
|
|
|
|
*/
|
2013-08-29 12:31:50 +02:00
|
|
|
|
void SvgFile(const QString &name)const;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @brief PngFile save layout to png file.
|
|
|
|
|
* @param name name layout file.
|
2013-11-19 21:56:49 +01:00
|
|
|
|
*/
|
2013-08-29 12:31:50 +02:00
|
|
|
|
void PngFile(const QString &name)const;
|
2013-11-19 21:56:49 +01:00
|
|
|
|
/**
|
2014-02-17 23:57:51 +01:00
|
|
|
|
* @brief PdfFile save layout to pdf file.
|
2014-01-23 17:16:28 +01:00
|
|
|
|
* @param name name layout file.
|
2013-11-19 21:56:49 +01:00
|
|
|
|
*/
|
2014-01-09 12:39:58 +01:00
|
|
|
|
void PdfFile(const QString &name)const;
|
2014-02-17 23:57:51 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief EpsFile save layout to eps file.
|
|
|
|
|
* @param name name layout file.
|
|
|
|
|
*/
|
|
|
|
|
void EpsFile(const QString &name)const;
|
|
|
|
|
/**
|
|
|
|
|
* @brief PsFile save layout to ps file.
|
|
|
|
|
* @param name name layout file.
|
|
|
|
|
*/
|
|
|
|
|
void PsFile(const QString &name)const;
|
2014-02-18 21:20:58 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief PdfToPs use external tool "pdftops" for converting pdf too eps or ps format.
|
|
|
|
|
* @param params string with parameter for tool. Parameters have format: "-eps input_file out_file". Use -eps when
|
|
|
|
|
* need create eps file.
|
|
|
|
|
*/
|
2014-03-14 19:47:50 +01:00
|
|
|
|
void PdfToPs(const QStringList ¶ms)const;
|
2013-08-29 12:31:50 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // TABLEWINDOW_H
|