valentina/src/app/tablewindow.h

147 lines
4.5 KiB
C
Raw Normal View History

/************************************************************************
**
** @file tablewindow.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date November 15, 2013
**
** @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.
**
** 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/>.
**
*************************************************************************/
2013-08-29 12:31:50 +02:00
#ifndef TABLEWINDOW_H
#define TABLEWINDOW_H
#include <QLabel>
2013-08-29 12:31:50 +02:00
#include <QMainWindow>
#include "widgets/vitem.h"
namespace Ui
{
2013-08-29 12:31:50 +02:00
class TableWindow;
}
/**
* @brief TableWindow class layout window.
2013-08-29 12:31:50 +02:00
*/
class TableWindow : public QMainWindow
{
2013-08-29 12:31:50 +02:00
Q_OBJECT
public:
/** @brief numberDetal show count details, what need placed. */
2013-08-29 12:31:50 +02:00
QLabel* numberDetal;
/** @brief colission show if exist colissions. */
2013-08-29 12:31:50 +02:00
QLabel* colission;
explicit TableWindow(QWidget *parent = nullptr);
2013-08-29 12:31:50 +02:00
~TableWindow();
public slots:
void ModelChosen(QVector<VItem*> listDetails, const QString &fileName, const QString &description);
2013-08-29 12:31:50 +02:00
void StopTable();
2013-08-29 12:31:50 +02:00
void saveScene();
2013-08-29 12:31:50 +02:00
void GetNextDetail();
2013-08-29 12:31:50 +02:00
void itemChect(bool flag);
2013-08-29 12:31:50 +02:00
void itemOut(int number, bool flag);
2013-08-29 12:31:50 +02:00
void itemColliding(QList<QGraphicsItem *> list, int number);
2013-08-29 12:31:50 +02:00
void AddLength();
2013-08-29 12:31:50 +02:00
void RemoveLength();
signals:
/**
* @brief closed emit if window is closing.
2013-08-29 12:31:50 +02:00
*/
void closed();
/**
* @brief LengthChanged emit if changing length of paper sheet.
2013-08-29 12:31:50 +02:00
*/
void LengthChanged();
protected:
2013-08-29 12:31:50 +02:00
void closeEvent(QCloseEvent *event);
2013-08-29 12:31:50 +02:00
void moveToCenter();
2013-08-29 12:31:50 +02:00
void showEvent ( QShowEvent * event );
2013-08-29 12:31:50 +02:00
void keyPressEvent ( QKeyEvent * event );
private:
Q_DISABLE_COPY(TableWindow)
/** @brief ui keeps information about user interface */
2013-08-29 12:31:50 +02:00
Ui::TableWindow* ui;
/** @brief listDetails list of details. */
2013-08-29 12:31:50 +02:00
QVector<VItem*> listDetails;
/** @brief outItems true if we have details out paper sheet. */
2013-08-29 12:31:50 +02:00
bool outItems;
/** @brief collidingItems true if we have colission details. */
2013-08-29 12:31:50 +02:00
bool collidingItems;
/** @brief currentScene pointer to scene. */
QGraphicsScene* tableScene;
/** @brief paper paper sheet. */
2013-08-29 12:31:50 +02:00
QGraphicsRectItem* paper;
/** @brief shadowPaper paper sheet shadow. */
2013-08-29 12:31:50 +02:00
QGraphicsRectItem* shadowPaper;
/** @brief listOutItems list state out each detail. */
2013-08-29 12:31:50 +02:00
QBitArray* listOutItems;
/** @brief listCollidingItems list colissed details. */
2013-08-29 12:31:50 +02:00
QList<QGraphicsItem*> listCollidingItems;
/** @brief indexDetail index next detail in list what will be shown. */
2013-08-29 12:31:50 +02:00
qint32 indexDetail;
/** @brief sceneRect minimal size of a paper. */
2013-08-29 12:31:50 +02:00
QRectF sceneRect;
/** @brief fileName keep name of pattern file. */
QString fileName;
/** @brief description pattern description */
QString description;
void checkNext();
void AddPaper();
void AddDetail();
void SvgFile(const QString &name)const;
void PngFile(const QString &name)const;
void PdfFile(const QString &name)const;
void EpsFile(const QString &name)const;
void PsFile(const QString &name)const;
void PdfToPs(const QStringList &params)const;
void ObjFile(const QString &name)const;
2013-08-29 12:31:50 +02:00
};
#endif // TABLEWINDOW_H