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 mainwindow.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.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2013-11-15 13:41:26 +01:00
|
|
|
** <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-06-20 16:09:50 +02:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
2015-05-12 14:42:19 +02:00
|
|
|
#include "mainwindowsnogui.h"
|
2015-07-10 11:24:47 +02:00
|
|
|
#include "../vwidgets/vmaingraphicsview.h"
|
|
|
|
#include "../vtools/dialogs/tooldialogs.h"
|
2013-09-10 14:29:06 +02:00
|
|
|
#include "dialogs/dialogs.h"
|
2013-10-27 12:56:05 +01:00
|
|
|
#include "tools/vtooldetail.h"
|
2013-12-29 17:48:57 +01:00
|
|
|
#include "tools/vtooluniondetails.h"
|
2013-09-10 14:29:06 +02:00
|
|
|
#include "tools/drawTools/drawtools.h"
|
2013-06-20 16:09:50 +02:00
|
|
|
|
2015-08-20 10:54:48 +02:00
|
|
|
#include <QFileSystemWatcher>
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class MainWindow;
|
2013-06-20 16:09:50 +02:00
|
|
|
}
|
|
|
|
|
2014-08-26 19:23:08 +02:00
|
|
|
class VToolOptionsPropertyBrowser;
|
2015-08-01 19:09:10 +02:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
|
|
|
class QLockFile;
|
|
|
|
#endif
|
2014-08-26 19:23:08 +02:00
|
|
|
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-23 11:11:42 +01:00
|
|
|
* @brief The MainWindow class main windows.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2015-05-12 14:42:19 +02:00
|
|
|
class MainWindow : public MainWindowsNoGUI
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2013-06-20 16:09:50 +02:00
|
|
|
public:
|
2014-05-27 11:27:02 +02:00
|
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual ~MainWindow() Q_DECL_OVERRIDE;
|
2014-02-10 17:10:20 +01:00
|
|
|
void LoadPattern(const QString &curFile);
|
2014-10-30 11:19:17 +01:00
|
|
|
void ReopenFilesAfterCrash(QStringList &args);
|
2013-07-03 14:29:26 +02:00
|
|
|
public slots:
|
2013-11-06 22:11:12 +01:00
|
|
|
void mouseMove(const QPointF &scenePos);
|
2014-10-24 20:49:59 +02:00
|
|
|
void ArrowTool();
|
2014-05-30 14:04:21 +02:00
|
|
|
|
2013-09-10 14:29:06 +02:00
|
|
|
void ActionDraw(bool checked);
|
|
|
|
void ActionDetails(bool checked);
|
2014-05-30 14:04:21 +02:00
|
|
|
void ActionLayout(bool checked);
|
2015-05-01 19:24:16 +02:00
|
|
|
|
2014-05-30 14:04:21 +02:00
|
|
|
void ActionTable(bool checked);
|
|
|
|
void ActionHistory(bool checked);
|
2015-05-01 19:24:16 +02:00
|
|
|
void ActionCurveDetailsMode(bool checked);
|
|
|
|
void DrawOption();
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
void ClosedActionTable();
|
|
|
|
void ClosedActionHistory();
|
|
|
|
|
2015-05-01 19:24:16 +02:00
|
|
|
void New();
|
2014-02-10 17:10:20 +01:00
|
|
|
bool SaveAs();
|
|
|
|
bool Save();
|
|
|
|
void Open();
|
2015-05-01 19:24:16 +02:00
|
|
|
void NewPP();
|
|
|
|
|
2014-06-03 10:17:58 +02:00
|
|
|
void Preferences();
|
2014-11-06 14:07:08 +01:00
|
|
|
void RepotBug();
|
2014-12-01 13:11:25 +01:00
|
|
|
void OnlineHelp();
|
2015-05-01 19:24:16 +02:00
|
|
|
void About();
|
|
|
|
void AboutQt();
|
|
|
|
void PatternProperties();
|
2014-07-04 16:52:11 +02:00
|
|
|
void ShowToolTip(const QString &toolTip);
|
|
|
|
void OpenRecentFile();
|
|
|
|
void Clear();
|
2014-11-13 13:38:55 +01:00
|
|
|
void ResetWindow();
|
2014-05-30 14:04:21 +02:00
|
|
|
|
2014-07-16 10:45:42 +02:00
|
|
|
void currentPPChanged(int index);
|
2015-05-01 19:24:16 +02:00
|
|
|
|
2013-09-10 14:29:06 +02:00
|
|
|
void ChangedSize(const QString &text);
|
2014-02-05 15:03:26 +01:00
|
|
|
void ChangedHeight(const QString & text);
|
2014-05-30 14:04:21 +02:00
|
|
|
|
2014-06-09 15:13:15 +02:00
|
|
|
void PatternWasModified(bool saved);
|
2014-05-30 14:04:21 +02:00
|
|
|
|
2013-09-10 14:29:06 +02:00
|
|
|
void ToolEndLine(bool checked);
|
|
|
|
void ToolLine(bool checked);
|
|
|
|
void ToolAlongLine(bool checked);
|
|
|
|
void ToolShoulderPoint(bool checked);
|
|
|
|
void ToolNormal(bool checked);
|
|
|
|
void ToolBisector(bool checked);
|
|
|
|
void ToolLineIntersect(bool checked);
|
|
|
|
void ToolSpline(bool checked);
|
2013-12-18 12:13:32 +01:00
|
|
|
void ToolCutSpline(bool checked);
|
2013-09-10 14:29:06 +02:00
|
|
|
void ToolArc(bool checked);
|
|
|
|
void ToolSplinePath(bool checked);
|
2013-12-18 12:13:32 +01:00
|
|
|
void ToolCutSplinePath(bool checked);
|
2013-09-10 14:29:06 +02:00
|
|
|
void ToolPointOfContact(bool checked);
|
|
|
|
void ToolDetail(bool checked);
|
2013-10-18 12:03:01 +02:00
|
|
|
void ToolHeight(bool checked);
|
2013-10-18 20:20:54 +02:00
|
|
|
void ToolTriangle(bool checked);
|
2013-10-21 16:09:05 +02:00
|
|
|
void ToolPointOfIntersection(bool checked);
|
2013-12-29 17:48:57 +01:00
|
|
|
void ToolUnionDetails(bool checked);
|
2014-01-08 15:05:32 +01:00
|
|
|
void ToolCutArc(bool checked);
|
2014-10-20 19:41:02 +02:00
|
|
|
void ToolLineIntersectAxis(bool checked);
|
2014-10-23 10:38:57 +02:00
|
|
|
void ToolCurveIntersectAxis(bool checked);
|
2015-05-27 18:24:20 +02:00
|
|
|
void ToolPointOfIntersectionArcs(bool checked);
|
2015-05-30 12:02:20 +02:00
|
|
|
void ToolPointOfIntersectionCircles(bool checked);
|
2015-06-05 15:43:41 +02:00
|
|
|
void ToolPointFromCircleAndTangent(bool checked);
|
2015-06-06 08:33:19 +02:00
|
|
|
void ToolPointFromArcAndTangent(bool checked);
|
2015-06-09 20:23:37 +02:00
|
|
|
void ToolArcWithLength(bool checked);
|
2015-06-24 16:30:07 +02:00
|
|
|
void ToolTrueDarts(bool checked);
|
2014-05-30 14:04:21 +02:00
|
|
|
|
2013-09-10 14:29:06 +02:00
|
|
|
void ClosedDialogDetail(int result);
|
2013-12-29 17:48:57 +01:00
|
|
|
void ClosedDialogUnionDetails(int result);
|
2014-05-30 14:04:21 +02:00
|
|
|
|
2015-02-21 16:38:11 +01:00
|
|
|
//tmp
|
2015-05-27 18:24:20 +02:00
|
|
|
void LastUsedTool();
|
2015-02-21 16:38:11 +01:00
|
|
|
|
2014-06-12 09:22:29 +02:00
|
|
|
/**
|
2014-05-16 14:51:39 +02:00
|
|
|
* @brief Edit XML code of pattern
|
|
|
|
*/
|
|
|
|
void EditPatternCode();
|
2014-06-05 14:10:16 +02:00
|
|
|
void FullParseFile();
|
2015-05-01 19:24:16 +02:00
|
|
|
|
2014-06-24 10:23:39 +02:00
|
|
|
void SetEnabledGUI(bool enabled);
|
2015-05-01 19:24:16 +02:00
|
|
|
|
2014-07-23 10:56:32 +02:00
|
|
|
void ClickEndVisualization();
|
2014-07-23 15:13:08 +02:00
|
|
|
void Layout();
|
2014-08-08 21:46:05 +02:00
|
|
|
void UpdateGradation();
|
2014-11-10 15:49:39 +01:00
|
|
|
void GlobalChangePP(const QString &patternPiece);
|
2015-02-10 20:27:11 +01:00
|
|
|
void WindowsLocale();
|
2015-04-11 20:20:37 +02:00
|
|
|
void ToolBarStyles();
|
2015-05-12 18:52:07 +02:00
|
|
|
|
|
|
|
void ShowPaper(int index);
|
2013-08-29 12:31:50 +02:00
|
|
|
signals:
|
2014-10-29 09:26:12 +01:00
|
|
|
void RefreshHistory();
|
2015-02-09 10:54:19 +01:00
|
|
|
void EnableItemMove(bool move);
|
2013-07-13 12:51:31 +02:00
|
|
|
protected:
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
virtual void customEvent(QEvent * event) Q_DECL_OVERRIDE;
|
2015-05-12 17:15:10 +02:00
|
|
|
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual void CleanLayout() Q_DECL_OVERRIDE;
|
|
|
|
virtual void PrepareSceneList() Q_DECL_OVERRIDE;
|
2015-08-17 12:26:27 +02:00
|
|
|
private slots:
|
|
|
|
void LoadIndividual();
|
|
|
|
void LoadStandard();
|
2015-08-18 12:36:17 +02:00
|
|
|
void CreateMeasurements();
|
2015-08-18 16:53:33 +02:00
|
|
|
void ShowMeasurements();
|
2015-08-20 10:54:48 +02:00
|
|
|
void MeasurementsChanged(const QString &path);
|
2013-06-20 16:09:50 +02:00
|
|
|
private:
|
2013-09-26 20:50:52 +02:00
|
|
|
Q_DISABLE_COPY(MainWindow)
|
2014-05-30 14:04:21 +02:00
|
|
|
/** @brief ui keeps information about user interface */
|
2013-09-10 14:29:06 +02:00
|
|
|
Ui::MainWindow *ui;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
2015-08-20 10:54:48 +02:00
|
|
|
QFileSystemWatcher *watcher;
|
|
|
|
|
2014-05-30 14:04:21 +02:00
|
|
|
/** @brief tool current tool */
|
2015-02-21 16:38:11 +01:00
|
|
|
Tool currentTool;
|
|
|
|
|
|
|
|
/** @brief tool last used tool */
|
|
|
|
Tool lastUsedTool;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
/** @brief sceneDraw draw scene. */
|
2013-09-10 14:29:06 +02:00
|
|
|
VMainGraphicsScene *sceneDraw;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
/** @brief sceneDetails details scene. */
|
2013-09-10 14:29:06 +02:00
|
|
|
VMainGraphicsScene *sceneDetails;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */
|
2013-09-10 14:29:06 +02:00
|
|
|
QLabel *mouseCoordinate;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
/** @brief helpLabel help show tooltip. */
|
2013-09-10 14:29:06 +02:00
|
|
|
QLabel *helpLabel;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
/** @brief isInitialized true after first show window. */
|
2013-09-10 14:29:06 +02:00
|
|
|
bool isInitialized;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
2013-09-10 14:29:06 +02:00
|
|
|
DialogIncrements *dialogTable;
|
2014-02-06 14:57:23 +01:00
|
|
|
DialogTool *dialogTool;
|
2013-12-29 17:48:57 +01:00
|
|
|
DialogHistory *dialogHistory;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
/** @brief comboBoxDraws comboc who show name of pattern peaces. */
|
2013-09-10 14:29:06 +02:00
|
|
|
QComboBox *comboBoxDraws;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
/** @brief mode keep current draw mode. */
|
2014-07-25 14:22:46 +02:00
|
|
|
Draw mode;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
/** @brief currentDrawIndex save current selected pattern peace. */
|
2014-01-02 16:50:01 +01:00
|
|
|
qint32 currentDrawIndex;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
/** @brief currentToolBoxIndex save current set of tools. */
|
2014-01-08 21:45:42 +01:00
|
|
|
qint32 currentToolBoxIndex;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
|
|
|
/** @brief drawMode true if we current draw scene. */
|
2014-01-12 20:23:44 +01:00
|
|
|
bool drawMode;
|
2014-05-30 14:04:21 +02:00
|
|
|
|
2014-02-10 20:31:22 +01:00
|
|
|
enum { MaxRecentFiles = 5 };
|
|
|
|
QAction *recentFileActs[MaxRecentFiles];
|
|
|
|
QAction *separatorAct;
|
2015-06-29 19:06:26 +02:00
|
|
|
QLabel *leftGoToStage;
|
|
|
|
QLabel *rightGoToStage;
|
2014-02-14 12:29:04 +01:00
|
|
|
QTimer *autoSaveTimer;
|
2014-06-24 10:23:39 +02:00
|
|
|
bool guiEnabled;
|
2014-08-08 21:46:05 +02:00
|
|
|
QComboBox *gradationHeights;
|
|
|
|
QComboBox *gradationSizes;
|
2014-08-26 19:23:08 +02:00
|
|
|
VToolOptionsPropertyBrowser *toolOptions;
|
2015-04-05 16:31:28 +02:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
2014-11-28 17:50:22 +01:00
|
|
|
QLockFile *lock;
|
2015-04-05 16:31:28 +02:00
|
|
|
#endif
|
2014-08-26 19:23:08 +02:00
|
|
|
|
2013-09-10 14:29:06 +02:00
|
|
|
void ToolBarOption();
|
2015-06-29 19:06:26 +02:00
|
|
|
void ToolBarStages();
|
2013-09-10 14:29:06 +02:00
|
|
|
void ToolBarDraws();
|
2014-06-24 10:47:28 +02:00
|
|
|
void ToolBarTools();
|
2014-03-26 05:39:07 +01:00
|
|
|
void InitToolButtons();
|
2014-01-16 14:54:01 +01:00
|
|
|
void CancelTool();
|
2015-05-01 19:24:16 +02:00
|
|
|
|
2013-09-10 14:29:06 +02:00
|
|
|
void SetEnableWidgets(bool enable);
|
|
|
|
void SetEnableTool(bool enable);
|
2015-05-14 14:27:04 +02:00
|
|
|
void SetLayoutModeActions(bool enable);
|
2015-05-01 19:24:16 +02:00
|
|
|
|
2014-01-11 15:09:44 +01:00
|
|
|
void SaveCurrentScene();
|
2014-01-23 11:11:42 +01:00
|
|
|
void RestoreCurrentScene();
|
2014-05-30 14:04:21 +02:00
|
|
|
void MinimumScrollBar();
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
template <typename Dialog, typename Func>
|
2014-06-12 09:22:29 +02:00
|
|
|
void SetToolButton(bool checked, Tool t, const QString &cursor, const QString &toolTip,
|
2014-02-06 14:57:23 +01:00
|
|
|
Func closeDialogSlot);
|
2014-05-25 23:50:21 +02:00
|
|
|
template <typename Dialog, typename Func, typename Func2>
|
2014-06-12 09:22:29 +02:00
|
|
|
void SetToolButtonWithApply(bool checked, Tool t, const QString &cursor, const QString &toolTip,
|
2014-07-25 14:22:46 +02:00
|
|
|
Func closeDialogSlot, Func2 applyDialogSlot);
|
2014-02-06 14:57:23 +01:00
|
|
|
template <typename DrawTool>
|
|
|
|
void ClosedDialog(int result);
|
2014-05-26 13:48:42 +02:00
|
|
|
template <typename DrawTool>
|
2014-06-09 15:00:26 +02:00
|
|
|
void ClosedDialogWithApply(int result);
|
2014-05-25 23:50:21 +02:00
|
|
|
template <typename DrawTool>
|
|
|
|
void ApplyDialog();
|
2014-11-20 18:52:51 +01:00
|
|
|
bool SavePattern(const QString &curFile, QString &error);
|
2013-10-04 16:00:19 +02:00
|
|
|
void AutoSavePattern();
|
2014-02-10 17:10:20 +01:00
|
|
|
void setCurrentFile(const QString &fileName);
|
|
|
|
QString strippedName(const QString &fullFileName);
|
2015-04-22 16:22:47 +02:00
|
|
|
|
2014-02-10 17:10:20 +01:00
|
|
|
void ReadSettings();
|
|
|
|
void WriteSettings();
|
2015-04-22 16:22:47 +02:00
|
|
|
|
2014-02-10 17:10:20 +01:00
|
|
|
bool MaybeSave();
|
2014-02-10 20:31:22 +01:00
|
|
|
void UpdateRecentFileActions();
|
|
|
|
void CreateMenus();
|
|
|
|
void CreateActions();
|
2014-02-14 12:29:04 +01:00
|
|
|
void InitAutoSave();
|
2014-03-03 16:30:04 +01:00
|
|
|
QString PatternPieceName(const QString &text);
|
2015-08-16 17:56:06 +02:00
|
|
|
QString CheckPathToMeasurements(const QString &path);
|
2014-08-08 21:46:05 +02:00
|
|
|
QComboBox *SetGradationList(const QString &label, const QStringList &list);
|
2014-09-10 19:57:08 +02:00
|
|
|
void ChangePP(int index, bool zoomBestFit = true);
|
2014-07-23 10:56:32 +02:00
|
|
|
/**
|
|
|
|
* @brief EndVisualization try show dialog after and working with tool visualization.
|
|
|
|
*/
|
|
|
|
void EndVisualization(bool click = false);
|
2014-07-26 10:56:34 +02:00
|
|
|
void ZoomFirstShow();
|
2014-08-08 21:46:05 +02:00
|
|
|
void UpdateHeightsList(const QStringList &list);
|
|
|
|
void UpdateSizesList(const QStringList &list);
|
|
|
|
void SetDefaultHeight(int value);
|
|
|
|
void SetDefaultSize(int value);
|
2014-08-26 19:23:08 +02:00
|
|
|
|
|
|
|
void AddDocks();
|
|
|
|
void PropertyBrowser();
|
2014-11-28 18:55:27 +01:00
|
|
|
bool OpenNewValentina(const QString &fileName = QString())const;
|
2014-11-13 13:38:55 +01:00
|
|
|
void FileClosedCorrect();
|
2014-11-28 17:50:22 +01:00
|
|
|
QStringList GetUnlokedRestoreFileList()const;
|
2015-04-11 20:20:37 +02:00
|
|
|
void ToolBarStyle(QToolBar *bar);
|
2015-05-01 19:24:16 +02:00
|
|
|
|
2015-08-16 17:56:06 +02:00
|
|
|
void AddPP(const QString &PPName);
|
2015-05-12 14:42:19 +02:00
|
|
|
|
|
|
|
void InitScenes();
|
2015-08-17 12:26:27 +02:00
|
|
|
|
2015-08-20 10:54:48 +02:00
|
|
|
bool LoadMeasurements(const QString &path);
|
2013-06-20 16:09:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|