QElectroTech  0.70
qettemplateeditor.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef TITLEBLOCK_SLASH_QET_TEMPLATE_EDITOR_H
19 #define TITLEBLOCK_SLASH_QET_TEMPLATE_EDITOR_H
20 #include <QtWidgets>
21 #include "qetmainwindow.h"
22 #include "qet.h"
23 #include "templateview.h"
24 #include "templatelocation.h"
29 class QETProject;
30 
37  Q_OBJECT
38 
39  // constructor, destructor
40  public:
41  QETTitleBlockTemplateEditor(QWidget * = nullptr);
43  private:
45 
46  // attributes
47  private:
57  QString filepath_;
61  bool read_only_;
66  bool duplicate_;
80  QUndoStack *undo_stack_;
81  QUndoView *undo_view_;
82  QDockWidget *undo_dock_widget_;
83 
84  // methods
85  public:
87  bool isEditing(const QString &ilepath);
88  void setOpenForDuplication(bool);
89  bool openForDuplication() const;
90 
91  protected:
92  bool canClose();
93  void firstActivation(QEvent *) override;
94  void closeEvent(QCloseEvent *) override;
95 
96  private:
97  void initActions();
98  void initMenus();
99  void initToolbars();
100  void initWidgets();
101  void initLogoManager();
102  QString currentlyEditedTitle() const;
103 
104  public slots:
105  void readSettings();
106  void writeSettings();
107  void selectedCellsChanged(const QList<TitleBlockCell *>&);
109  bool edit(const TitleBlockTemplateLocation &);
110  bool edit(QETProject *, const QString &);
111  bool edit(const QString &);
112  bool editCopyOf(const TitleBlockTemplate *);
113  bool edit(TitleBlockTemplate *);
114  void editLogos();
115  void newTemplate();
116  void open();
117  void openFromFile();
118  bool save();
119  bool saveAs();
120  bool saveAsFile();
121  void setReadOnly(bool);
122  void quit();
125 
126  private slots:
127  TitleBlockTemplateLocation getTitleBlockTemplateLocationFromUser(const QString & = QString(), bool existing_only = true);
130  void pushUndoCommand(QUndoCommand *);
131  void updateEditorTitle();
132  void updateActions();
133  bool saveAs(const TitleBlockTemplateLocation &);
134  bool saveAs(const QString &);
135 };
136 
137 #endif
void closeEvent(QCloseEvent *) override
bool editCopyOf(const TitleBlockTemplate *)
bool read_only_
whether the currently edited template is considered read only
QString filepath_
Filepath of the currently edited template, if opened from a file.
bool first_activation_
Used to track the first activation of the editor main window.
void pushGridUndoCommand(TitleBlockTemplateCommand *)
void pushUndoCommand(QUndoCommand *)
TitleBlockTemplate * tb_template_
Template Object edited.
TitleBlockTemplateCellWidget * template_cell_editor_widget_
bool isEditing(const QString &ilepath)
QGraphicsScene * template_edition_area_scene_
Template preview.
TitleBlockTemplateView * template_edition_area_view_
void savePreviewWidthToApplicationSettings(int, int)
QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings Save the new preview width to appl...
QDockWidget * template_cell_editor_dock_widget_
Individual cell widget edition.
TitleBlockTemplateLocation location() const
void pushCellUndoCommand(ModifyTitleBlockCellCommand *)
void writeSettings()
QETTitleBlockTemplateEditor::writeSettings Write the settings.
bool edit(const TitleBlockTemplateLocation &)
void selectedCellsChanged(const QList< TitleBlockCell *> &)
TitleBlockTemplateLocation getTitleBlockTemplateLocationFromUser(const QString &=QString(), bool existing_only=true)
void readSettings()
QETTitleBlockTemplateEditor::readSettings Read settings.
QMenu * file_menu_
menus TODO
TitleBlockTemplateLogoManager * logo_manager_
Logo manager widget.
void firstActivation(QEvent *) override
bool opened_from_file_
Whether to consider the location or the filepath.
QUndoStack * undo_stack_
Undo interface.
QETTitleBlockTemplateEditor(QWidget *=nullptr)
TitleBlockTemplateLocation location_
Location of the currently edited template.