2015-07-10 11:49:37 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file tmainwindow.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 10 7, 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 TMAINWINDOW_H
|
|
|
|
#define TMAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2015-08-29 11:48:03 +02:00
|
|
|
#include <QTableWidget>
|
2015-07-10 11:49:37 +02:00
|
|
|
|
2015-07-13 12:48:29 +02:00
|
|
|
#include "../vmisc/def.h"
|
2015-09-14 13:53:49 +02:00
|
|
|
#include "../vmisc/vlockguard.h"
|
2015-07-15 09:16:59 +02:00
|
|
|
#include "../vformat/vmeasurements.h"
|
2015-09-15 18:49:24 +02:00
|
|
|
#include "vtablesearch.h"
|
2015-07-13 12:48:29 +02:00
|
|
|
|
2015-07-10 11:49:37 +02:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class TMainWindow;
|
|
|
|
}
|
|
|
|
|
2015-07-21 15:18:10 +02:00
|
|
|
class QComboBox;
|
2015-07-24 12:06:39 +02:00
|
|
|
class QTableWidgetItem;
|
2015-07-25 08:10:56 +02:00
|
|
|
class QLabel;
|
2015-07-21 15:18:10 +02:00
|
|
|
|
2015-07-10 11:49:37 +02:00
|
|
|
class TMainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit TMainWindow(QWidget *parent = 0);
|
|
|
|
virtual ~TMainWindow() Q_DECL_OVERRIDE;
|
|
|
|
|
2015-07-25 14:59:40 +02:00
|
|
|
QString CurrentFile() const;
|
|
|
|
|
2015-08-08 16:33:37 +02:00
|
|
|
void RetranslateTable();
|
|
|
|
|
2015-08-18 15:31:21 +02:00
|
|
|
void SetBaseMHeight(int height);
|
|
|
|
void SetBaseMSize(int size);
|
|
|
|
void SetPUnit(Unit unit);
|
|
|
|
|
2015-07-10 13:14:55 +02:00
|
|
|
public slots:
|
2015-10-11 11:06:14 +02:00
|
|
|
bool LoadFile(const QString &path);
|
2015-07-13 12:48:29 +02:00
|
|
|
void FileNew();
|
2015-07-25 14:59:40 +02:00
|
|
|
void OpenIndividual();
|
|
|
|
void OpenStandard();
|
|
|
|
void OpenTemplate();
|
2015-10-15 14:37:10 +02:00
|
|
|
void CreateFromExisting();
|
2015-07-15 09:16:59 +02:00
|
|
|
|
2015-07-18 15:01:57 +02:00
|
|
|
protected:
|
|
|
|
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
2015-08-08 16:33:37 +02:00
|
|
|
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
2015-10-29 17:20:59 +01:00
|
|
|
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
2015-07-18 15:01:57 +02:00
|
|
|
|
2015-07-15 09:16:59 +02:00
|
|
|
private slots:
|
2015-07-12 17:56:34 +02:00
|
|
|
void FileSave();
|
|
|
|
void FileSaveAs();
|
|
|
|
void AboutToShowWindowMenu();
|
|
|
|
void ShowWindow();
|
|
|
|
void AboutApplication();
|
2015-11-28 18:02:21 +01:00
|
|
|
void AboutQt();
|
2015-07-25 17:18:01 +02:00
|
|
|
|
2015-12-03 13:07:51 +01:00
|
|
|
#if defined(Q_OS_MAC)
|
2015-12-05 10:50:32 +01:00
|
|
|
void AboutToShowDockMenu();
|
2015-12-03 13:07:51 +01:00
|
|
|
void OpenAt(QAction *where);
|
|
|
|
#endif //defined(Q_OS_MAC)
|
|
|
|
|
2015-07-18 13:08:44 +02:00
|
|
|
void SaveGivenName();
|
|
|
|
void SaveFamilyName();
|
|
|
|
void SaveEmail();
|
2015-10-13 10:13:43 +02:00
|
|
|
void SaveGender(int index);
|
2015-07-18 13:08:44 +02:00
|
|
|
void SaveBirthDate(const QDate & date);
|
|
|
|
void SaveNotes();
|
2015-10-16 19:26:05 +02:00
|
|
|
void SavePMSystem(int index);
|
2015-07-18 13:08:44 +02:00
|
|
|
void ReadOnly(bool ro);
|
2015-07-22 09:01:34 +02:00
|
|
|
|
2015-07-22 08:41:04 +02:00
|
|
|
void Remove();
|
2015-10-12 16:57:11 +02:00
|
|
|
void MoveTop();
|
2015-07-22 09:01:34 +02:00
|
|
|
void MoveUp();
|
|
|
|
void MoveDown();
|
2015-10-12 16:57:11 +02:00
|
|
|
void MoveBottom();
|
2015-07-24 14:06:53 +02:00
|
|
|
void Fx();
|
2015-07-21 19:26:33 +02:00
|
|
|
|
2015-07-19 14:28:01 +02:00
|
|
|
void AddCustom();
|
|
|
|
void AddKnown();
|
2015-08-11 16:52:18 +02:00
|
|
|
void ImportFromPattern();
|
2015-07-12 17:56:34 +02:00
|
|
|
|
2015-07-21 15:18:10 +02:00
|
|
|
void ChangedSize(const QString &text);
|
|
|
|
void ChangedHeight(const QString & text);
|
|
|
|
|
2015-07-21 17:28:20 +02:00
|
|
|
void ShowMData();
|
|
|
|
|
2015-07-21 18:24:47 +02:00
|
|
|
void DeployFormula();
|
2015-07-25 15:37:07 +02:00
|
|
|
void ShowInGraphicalShell();
|
2015-07-21 18:24:47 +02:00
|
|
|
|
2015-07-22 11:44:31 +02:00
|
|
|
void SaveMName();
|
|
|
|
void SaveMValue();
|
2015-07-25 08:10:56 +02:00
|
|
|
void SaveMBaseValue(double value);
|
|
|
|
void SaveMSizeIncrease(double value);
|
|
|
|
void SaveMHeightIncrease(double value);
|
2015-07-22 11:44:31 +02:00
|
|
|
void SaveMDescription();
|
2015-07-25 10:54:39 +02:00
|
|
|
void SaveMFullName();
|
2015-07-22 11:44:31 +02:00
|
|
|
|
2015-08-01 15:14:10 +02:00
|
|
|
void NewWindow();
|
2015-08-02 17:27:18 +02:00
|
|
|
void Preferences();
|
2015-08-18 13:53:30 +02:00
|
|
|
void PatternUnitChanged(int index);
|
2015-09-15 18:49:24 +02:00
|
|
|
void Find(const QString &term);
|
|
|
|
void FindPrevious();
|
|
|
|
void FindNext();
|
2015-08-18 13:53:30 +02:00
|
|
|
|
2015-07-10 11:49:37 +02:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(TMainWindow)
|
|
|
|
Ui::TMainWindow *ui;
|
2015-07-16 11:38:54 +02:00
|
|
|
VMeasurements *m;
|
|
|
|
VContainer *data;
|
|
|
|
Unit mUnit;
|
2015-08-18 13:53:30 +02:00
|
|
|
Unit pUnit;
|
2015-07-16 11:38:54 +02:00
|
|
|
MeasurementsType mType;
|
2015-07-18 14:39:33 +02:00
|
|
|
QString curFile;
|
2015-07-21 15:18:10 +02:00
|
|
|
QComboBox *gradationHeights;
|
|
|
|
QComboBox *gradationSizes;
|
2015-08-18 13:53:30 +02:00
|
|
|
QComboBox *comboBoxUnits;
|
2015-07-21 18:24:47 +02:00
|
|
|
int formulaBaseHeight;
|
2015-10-23 19:47:33 +02:00
|
|
|
std::shared_ptr<VLockGuard<char>> lock;
|
2015-09-15 18:49:24 +02:00
|
|
|
QSharedPointer<VTableSearch> search;
|
2015-10-16 19:26:05 +02:00
|
|
|
QLabel *labelGradationHeights;
|
|
|
|
QLabel *labelGradationSizes;
|
|
|
|
QLabel *labelPatternUnit;
|
2015-10-29 17:20:59 +01:00
|
|
|
QAction *actionDockDiagram;
|
|
|
|
bool dockDiagramVisible;
|
|
|
|
bool isInitialized;
|
2015-08-01 19:09:10 +02:00
|
|
|
|
2015-07-12 16:19:53 +02:00
|
|
|
void SetupMenu();
|
2015-07-16 11:38:54 +02:00
|
|
|
void InitWindow();
|
|
|
|
void InitTable();
|
2015-07-25 08:10:56 +02:00
|
|
|
void SetDecimals();
|
2015-08-18 13:53:30 +02:00
|
|
|
void InitUnits();
|
2015-10-16 19:26:05 +02:00
|
|
|
void InitComboBoxUnits();
|
|
|
|
void InitGender(QComboBox *gender);
|
2015-07-18 14:39:33 +02:00
|
|
|
|
2015-07-21 18:13:09 +02:00
|
|
|
void ShowUnits();
|
|
|
|
void ShowHeaderUnits(QTableWidget *table, int column, const QString &unit);
|
|
|
|
|
2015-07-18 14:39:33 +02:00
|
|
|
void MeasurementsWasSaved(bool saved);
|
|
|
|
void SetCurrentFile(const QString &fileName);
|
|
|
|
bool SaveMeasurements(const QString &fileName, QString &error);
|
2015-07-18 15:01:57 +02:00
|
|
|
|
|
|
|
bool MaybeSave();
|
2015-07-19 14:28:01 +02:00
|
|
|
|
2015-09-29 16:04:24 +02:00
|
|
|
QTableWidgetItem *AddCell(const QString &text, int row, int column, int aligment, bool ok = true);
|
2015-07-21 15:18:10 +02:00
|
|
|
|
2015-10-16 19:26:05 +02:00
|
|
|
QComboBox *SetGradationList(QLabel *label, const QStringList &list);
|
2015-07-21 15:18:10 +02:00
|
|
|
void SetDefaultHeight(int value);
|
|
|
|
void SetDefaultSize(int value);
|
|
|
|
|
|
|
|
void RefreshData();
|
2015-07-24 12:06:39 +02:00
|
|
|
void RefreshTable();
|
2015-07-21 17:28:20 +02:00
|
|
|
|
|
|
|
QString ClearCustomName(const QString &name) const;
|
|
|
|
|
2015-08-25 12:35:50 +02:00
|
|
|
bool EvalFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label);
|
2015-10-29 17:20:59 +01:00
|
|
|
void ShowMDiagram(const QString &name);
|
2015-07-25 14:59:40 +02:00
|
|
|
|
|
|
|
void Open(const QString &pathTo, const QString &filter);
|
2015-07-25 17:18:01 +02:00
|
|
|
void GUIReadOnly(bool ro);
|
2015-09-09 11:45:30 +02:00
|
|
|
void MeasurementReadOnly(bool ro);
|
|
|
|
void Controls();
|
|
|
|
void MFields(bool enabled);
|
2015-08-01 19:09:10 +02:00
|
|
|
|
|
|
|
void ReadSettings();
|
|
|
|
void WriteSettings();
|
2015-08-11 16:52:18 +02:00
|
|
|
|
|
|
|
QStringList FilterMeasurements(const QStringList &mNew, const QStringList &mFilter);
|
2015-08-18 15:31:21 +02:00
|
|
|
|
|
|
|
void UpdatePatternUnit();
|
2015-10-15 14:37:10 +02:00
|
|
|
|
|
|
|
bool LoadFromExistingFile(const QString &path);
|
2015-12-03 09:43:31 +01:00
|
|
|
|
|
|
|
void CreateWindowMenu(QMenu *menu);
|
2015-12-23 14:26:29 +01:00
|
|
|
|
|
|
|
bool IgnoreLocking(int error, const QString &path);
|
2015-07-10 11:49:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TMAINWINDOW_H
|