QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
qettemplateeditor.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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 writeSettings();
112 void selectedCellsChanged(const QList<TitleBlockCell *>&);
114 bool edit(const TitleBlockTemplateLocation &);
115 bool edit(QETProject *, const QString &);
116 bool edit(const QString &);
117 bool editCopyOf(const TitleBlockTemplate *);
118 bool edit(TitleBlockTemplate *);
119 void editLogos();
120 void newTemplate();
121 void open();
122 void openFromFile();
123 bool save();
124 bool saveAs();
125 bool saveAsFile();
126 void setReadOnly(bool);
127 void quit();
130
131 private slots:
132 TitleBlockTemplateLocation getTitleBlockTemplateLocationFromUser(const QString & = QString(), bool existing_only = true);
135 void pushUndoCommand(QUndoCommand *);
136 void updateEditorTitle();
137 void updateActions();
139 bool saveAs(const QString &);
140};
141
142#endif
Definition templatecommands.h:34
Definition qetmainwindow.h:26
Definition qetproject.h:62
Definition qettemplateeditor.h:38
bool editCopyOf(const TitleBlockTemplate *)
Definition qettemplateeditor.cpp:303
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:703
QMenu * edit_menu_
Definition qettemplateeditor.h:54
void closeEvent(QCloseEvent *) override
Definition qettemplateeditor.cpp:152
void updateActions()
Definition qettemplateeditor.cpp:742
void openFromFile()
Definition qettemplateeditor.cpp:820
void savePreviewWidthToApplicationSettings(int, int)
QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings Save the new preview width to appl...
Definition qettemplateeditor.cpp:985
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:942
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:54
QAction * edit_logos_
Definition qettemplateeditor.h:57
bool edit(const TitleBlockTemplateLocation &)
Definition qettemplateeditor.cpp:199
void selectedCellsChanged(const QList< TitleBlockCell * > &)
Definition qettemplateeditor.cpp:666
QAction * split_cell_
Definition qettemplateeditor.h:57
void duplicateCurrentLocation()
Definition qettemplateeditor.cpp:165
QAction * paste_
Definition qettemplateeditor.h:57
bool canClose()
Definition qettemplateeditor.cpp:111
QAction * copy_
Definition qettemplateeditor.h:57
void initLogoManager()
Definition qettemplateeditor.cpp:589
void readSettings()
QETTitleBlockTemplateEditor::readSettings Read settings.
Definition qettemplateeditor.cpp:638
void editLogos()
Definition qettemplateeditor.cpp:327
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:139
void initActions()
Definition qettemplateeditor.cpp:365
bool isEditing(const QString &ilepath)
Definition qettemplateeditor.cpp:69
void setOpenForDuplication(bool)
QETTitleBlockTemplateEditor::setOpenForDuplication.
Definition qettemplateeditor.cpp:92
void pushCellUndoCommand(ModifyTitleBlockCellCommand *)
Definition qettemplateeditor.cpp:682
TitleBlockTemplateCellWidget * template_cell_editor_widget_
Definition qettemplateeditor.h:81
QAction * zoom_in_
Definition qettemplateeditor.h:58
QString currentlyEditedTitle() const
Definition qettemplateeditor.cpp:605
bool saveAsFile()
Definition qettemplateeditor.cpp:886
void newTemplate()
Definition qettemplateeditor.cpp:355
void initMenus()
Definition qettemplateeditor.cpp:438
TitleBlockTemplateLocation location() const
Definition qettemplateeditor.cpp:60
void initWidgets()
Definition qettemplateeditor.cpp:511
QMenu * file_menu_
menus TODO
Definition qettemplateeditor.h:54
QETTitleBlockTemplateEditor(const QETTitleBlockTemplateEditor &)
void setReadOnly(bool)
Definition qettemplateeditor.cpp:921
void updateEditorTitle()
Definition qettemplateeditor.cpp:710
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:974
void editTemplateInformation()
Definition qettemplateeditor.cpp:996
QAction * cut_
Definition qettemplateeditor.h:57
QAction * save_as_file_
Definition qettemplateeditor.h:56
QAction * zoom_reset_
Definition qettemplateeditor.h:58
bool saveAs()
Definition qettemplateeditor.cpp:871
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:848
QGraphicsScene * template_edition_area_scene_
Template preview.
Definition qettemplateeditor.h:77
QAction * merge_cells_
Definition qettemplateeditor.h:57
void pushGridUndoCommand(TitleBlockTemplateCommand *)
Definition qettemplateeditor.cpp:693
QString filepath_
Filepath of the currently edited template, if opened from a file.
Definition qettemplateeditor.h:62
void open()
Definition qettemplateeditor.cpp:805
TitleBlockTemplateView * template_edition_area_view_
Definition qettemplateeditor.h:78
bool openForDuplication() const
Definition qettemplateeditor.cpp:101
bool duplicate_
Definition qettemplateeditor.h:71
QAction * open_from_file_
Definition qettemplateeditor.h:56
void initToolbars()
Definition qettemplateeditor.cpp:480
QAction * undo_
Definition qettemplateeditor.h:57
QAction * quit_
Definition qettemplateeditor.h:56
void writeSettings()
QETTitleBlockTemplateEditor::writeSettings Write the settings.
Definition qettemplateeditor.cpp:655
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:37
Definition templatelocation.h:29
Definition templatelogomanager.h:27
Definition templateview.h:33