QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
qettemplateeditor.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 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 "../qet.h"
21#include "../qetmainwindow.h"
22#include "templatelocation.h"
23#include "templateview.h"
24
25#include <QCloseEvent>
26#include <QtWidgets>
31class QETProject;
32
39 Q_OBJECT
40
41 // constructor, destructor
42 public:
43 QETTitleBlockTemplateEditor(QWidget * = nullptr);
45 private:
47
48 // attributes
49 private:
51#if TODO_LIST
52#pragma message("@TODO menus")
53#endif
62 QString filepath_;
85 QUndoStack *undo_stack_;
86 QUndoView *undo_view_;
87 QDockWidget *undo_dock_widget_;
88
89 // methods
90 public:
92 bool isEditing(const QString &ilepath);
93 void setOpenForDuplication(bool);
94 bool openForDuplication() const;
95
96 protected:
97 bool canClose();
98 void firstActivation(QEvent *) override;
99 void closeEvent(QCloseEvent *) override;
100
101 private:
102 void initActions();
103 void initMenus();
104 void initToolbars();
105 void initWidgets();
106 void initLogoManager();
107 QString currentlyEditedTitle() const;
108
109 public slots:
110 void readSettings();
111 void readSettingsState();
112 void writeSettings();
113 void selectedCellsChanged(const QList<TitleBlockCell *>&);
115 bool edit(const TitleBlockTemplateLocation &);
116 bool edit(QETProject *, const QString &);
117 bool edit(const QString &);
118 bool editCopyOf(const TitleBlockTemplate *);
119 bool edit(TitleBlockTemplate *);
120 void editLogos();
121 void newTemplate();
122 void open();
123 void openFromFile();
124 bool save();
125 bool saveAs();
126 bool saveAsFile();
127 void setReadOnly(bool);
128 void quit();
131
132 private slots:
133 TitleBlockTemplateLocation getTitleBlockTemplateLocationFromUser(const QString & = QString(), bool existing_only = true);
136 void pushUndoCommand(QUndoCommand *);
137 void updateEditorTitle();
138 void updateActions();
140 bool saveAs(const QString &);
141};
142
143#endif
Definition templatecommands.h:34
QETMainWindow(QWidget *=nullptr, Qt::WindowFlags=Qt::Widget)
Definition qetmainwindow.cpp:35
Definition qetproject.h:77
bool editCopyOf(const TitleBlockTemplate *)
Definition qettemplateeditor.cpp:304
QAction * save_as_
Definition qettemplateeditor.h:56
QMenu * display_menu_
Definition qettemplateeditor.h:54
QAction * new_
actions
Definition qettemplateeditor.h:56
bool opened_from_file_
Whether to consider the location or the filepath.
Definition qettemplateeditor.h:64
void pushUndoCommand(QUndoCommand *)
Definition qettemplateeditor.cpp:722
QMenu * edit_menu_
Definition qettemplateeditor.h:54
void closeEvent(QCloseEvent *) override
Definition qettemplateeditor.cpp:153
void updateActions()
Definition qettemplateeditor.cpp:761
void openFromFile()
Definition qettemplateeditor.cpp:852
void savePreviewWidthToApplicationSettings(int, int)
QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings Save the new preview width to appl...
Definition qettemplateeditor.cpp:1032
QAction * add_col_
Definition qettemplateeditor.h:57
TitleBlockTemplateLocation location_
Location of the currently edited template.
Definition qettemplateeditor.h:60
TitleBlockTemplate * tb_template_
Template Object edited.
Definition qettemplateeditor.h:75
TitleBlockTemplateLocation getTitleBlockTemplateLocationFromUser(const QString &=QString(), bool existing_only=true)
Definition qettemplateeditor.cpp:989
QAction * open_
Definition qettemplateeditor.h:56
QAction * zoom_out_
Definition qettemplateeditor.h:58
QAction * add_row_
Definition qettemplateeditor.h:57
~QETTitleBlockTemplateEditor() override
Definition qettemplateeditor.cpp:55
QAction * edit_logos_
Definition qettemplateeditor.h:57
bool edit(const TitleBlockTemplateLocation &)
Definition qettemplateeditor.cpp:200
void selectedCellsChanged(const QList< TitleBlockCell * > &)
Definition qettemplateeditor.cpp:685
QAction * split_cell_
Definition qettemplateeditor.h:57
void duplicateCurrentLocation()
Definition qettemplateeditor.cpp:166
QAction * paste_
Definition qettemplateeditor.h:57
bool canClose()
Definition qettemplateeditor.cpp:112
QAction * copy_
Definition qettemplateeditor.h:57
void initLogoManager()
Definition qettemplateeditor.cpp:593
void readSettings()
QETTitleBlockTemplateEditor::readSettings Read settings.
Definition qettemplateeditor.cpp:642
void editLogos()
Definition qettemplateeditor.cpp:328
QAction * edit_info_
Definition qettemplateeditor.h:57
QAction * redo_
Definition qettemplateeditor.h:57
bool read_only_
whether the currently edited template is considered read only
Definition qettemplateeditor.h:66
QAction * save_
Definition qettemplateeditor.h:56
bool first_activation_
Used to track the first activation of the editor main window.
Definition qettemplateeditor.h:73
QUndoStack * undo_stack_
Undo interface.
Definition qettemplateeditor.h:85
void firstActivation(QEvent *) override
Definition qettemplateeditor.cpp:140
void initActions()
Definition qettemplateeditor.cpp:367
bool isEditing(const QString &ilepath)
Definition qettemplateeditor.cpp:70
void setOpenForDuplication(bool)
QETTitleBlockTemplateEditor::setOpenForDuplication.
Definition qettemplateeditor.cpp:93
void pushCellUndoCommand(ModifyTitleBlockCellCommand *)
Definition qettemplateeditor.cpp:701
TitleBlockTemplateCellWidget * template_cell_editor_widget_
Definition qettemplateeditor.h:81
QAction * zoom_in_
Definition qettemplateeditor.h:58
QString currentlyEditedTitle() const
Definition qettemplateeditor.cpp:609
bool saveAsFile()
Definition qettemplateeditor.cpp:933
void newTemplate()
Definition qettemplateeditor.cpp:356
void initMenus()
Definition qettemplateeditor.cpp:440
TitleBlockTemplateLocation location() const
Definition qettemplateeditor.cpp:61
void initWidgets()
Definition qettemplateeditor.cpp:513
QMenu * file_menu_
menus TODO
Definition qettemplateeditor.h:54
QETTitleBlockTemplateEditor(const QETTitleBlockTemplateEditor &)
QETTitleBlockTemplateEditor(QWidget *=nullptr)
Definition qettemplateeditor.cpp:34
void setReadOnly(bool)
Definition qettemplateeditor.cpp:968
void updateEditorTitle()
Definition qettemplateeditor.cpp:729
QAction * zoom_fit_
Definition qettemplateeditor.h:58
QDockWidget * template_cell_editor_dock_widget_
Individual cell widget edition.
Definition qettemplateeditor.h:80
void quit()
Definition qettemplateeditor.cpp:1021
void editTemplateInformation()
Definition qettemplateeditor.cpp:1043
QAction * cut_
Definition qettemplateeditor.h:57
QAction * save_as_file_
Definition qettemplateeditor.h:56
void readSettingsState()
QETTitleBlockTemplateEditor::readSettingsState Restore the window state (docks, toolbars)....
Definition qettemplateeditor.cpp:658
QAction * zoom_reset_
Definition qettemplateeditor.h:58
bool saveAs()
Definition qettemplateeditor.cpp:903
QUndoView * undo_view_
Definition qettemplateeditor.h:86
TitleBlockTemplateLogoManager * logo_manager_
Logo manager widget.
Definition qettemplateeditor.h:83
QDockWidget * undo_dock_widget_
Definition qettemplateeditor.h:87
bool save()
Definition qettemplateeditor.cpp:880
QGraphicsScene * template_edition_area_scene_
Template preview.
Definition qettemplateeditor.h:77
QAction * merge_cells_
Definition qettemplateeditor.h:57
void pushGridUndoCommand(TitleBlockTemplateCommand *)
Definition qettemplateeditor.cpp:712
QString filepath_
Filepath of the currently edited template, if opened from a file.
Definition qettemplateeditor.h:62
void open()
Definition qettemplateeditor.cpp:837
TitleBlockTemplateView * template_edition_area_view_
Definition qettemplateeditor.h:78
bool openForDuplication() const
Definition qettemplateeditor.cpp:102
bool duplicate_
Definition qettemplateeditor.h:71
QAction * open_from_file_
Definition qettemplateeditor.h:56
void initToolbars()
Definition qettemplateeditor.cpp:482
QAction * undo_
Definition qettemplateeditor.h:57
QAction * quit_
Definition qettemplateeditor.h:56
void writeSettings()
QETTitleBlockTemplateEditor::writeSettings Write the settings.
Definition qettemplateeditor.cpp:674
The TitleBlockTemplateCellWidget class This class implements an edition widget for cells that compose...
Definition templatecellwidget.h:33
Definition templatecommands.h:67
The TitleBlockTemplate class This class represents an title block template for an electric diagram....
Definition titleblocktemplate.h:38
Definition templatelocation.h:29
Definition templatelogomanager.h:27
Definition templateview.h:35