File indexing completed on 2024-04-28 04:32:00

0001 /*
0002  * Copyright (C) 20102-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  */
0010 
0011 #ifndef FilePropertiesDlg_H
0012 #define FilePropertiesDlg_H
0013 
0014 #include <QDialog>
0015 
0016 #include "configuration.h"
0017 #include "ui_FileProperties.h"
0018 
0019 class Document;
0020 class QHideEvent;
0021 class QShowEvent;
0022 class QWidget;
0023 
0024 class FilePropertiesDlg : public QDialog
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     FilePropertiesDlg(QWidget *, Document *);
0030     virtual ~FilePropertiesDlg() = default;
0031 
0032     int documentWidth() const;
0033     int documentHeight() const;
0034     Configuration::EnumDocument_UnitsFormat::type unitsFormat() const;
0035     double horizontalClothCount() const;
0036     bool clothCountLink() const;
0037     double verticalClothCount() const;
0038     Configuration::EnumEditor_ClothCountUnits::type clothCountUnits() const;
0039     QString title() const;
0040     QString author() const;
0041     QString copyright() const;
0042     QString fabric() const;
0043     QColor fabricColor() const;
0044     QString instructions() const;
0045     QString flossScheme() const;
0046 
0047 protected:
0048     virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
0049     virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
0050 
0051 private slots:
0052     void on_UnitsFormat_activated(int);
0053     void on_PatternWidth_valueChanged(double);
0054     void on_PatternHeight_valueChanged(double);
0055     void on_HorizontalClothCount_valueChanged(double);
0056     void on_VerticalClothCount_valueChanged(double);
0057     void on_ClothCountLink_clicked(bool);
0058     void on_DialogButtonBox_accepted();
0059     void on_DialogButtonBox_rejected();
0060     void on_DialogButtonBox_helpRequested();
0061 
0062 private:
0063     void updatePatternSizes();
0064 
0065     Ui::FileProperties ui;
0066 
0067     Document *m_document;
0068 
0069     int m_widthStitches;
0070     int m_heightStitches;
0071     int m_minWidthStitches;
0072     int m_minHeightStitches;
0073 
0074     double m_horizontalClothCount;
0075     double m_verticalClothCount;
0076     bool m_clothCountLink;
0077 
0078     Configuration::EnumDocument_UnitsFormat::type m_unitsFormat;
0079     Configuration::EnumEditor_ClothCountUnits::type m_clothCountUnits;
0080 };
0081 
0082 #endif // FilePropertiesDlg_H