QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
terminalstripeditorwindow.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 TERMINALSTRIPEDITORWINDOW_H
19#define TERMINALSTRIPEDITORWINDOW_H
20
21#include <QMainWindow>
22#include <QMutex>
23#include <QPointer>
24
25class QETProject;
27class TerminalStrip;
30class QAbstractButton;
31
32namespace Ui {
33 class TerminalStripEditorWindow;
34}
35
36class TerminalStripEditorWindow : public QMainWindow
37{
38 Q_OBJECT
39
40 private:
41 //We need to use a QPointer instead of a raw pointer because when window_
42 //have got a parent widget, the parent widget can delete the window_
43 //instance in her destrucor and then window_ become a dangling pointer.
44 static QPointer<TerminalStripEditorWindow> window_;
45
46 public:
47 static TerminalStripEditorWindow* instance(QETProject *project, QWidget *parent = nullptr) {
48 static QMutex mutex_;
49 if (!window_) {
50 mutex_.lock();
51 if (!window_)
52 window_ = new TerminalStripEditorWindow{project, parent};
53 mutex_.unlock();
54 } else {
55 window_->setProject(project);
56 }
57 return window_;
58 }
59
60 static void dropInstance () {
61 static QMutex mutex;
62 if (window_) {
63 mutex.lock();
64 window_->deleteLater();
65 window_.clear();
66 mutex.unlock();
67 }
68 }
69
70 static void edit(TerminalStrip *strip);
71
72 public:
73 explicit TerminalStripEditorWindow(QETProject *project, QWidget *parent = nullptr);
75
76 void setProject(QETProject *project);
77 void setCurrentStrip(TerminalStrip *strip);
78
79 private slots:
83 void on_m_button_box_clicked(QAbstractButton *button);
85
86 private:
87 void addTreeDockWidget();
89 void updateUi();
90
91 private:
92 Ui::TerminalStripEditorWindow *ui{nullptr};
93 QPointer <QETProject> m_project;
97};
98
99#endif // TERMINALSTRIPEDITORWINDOW_H
Definition freeterminaleditor.h:33
Definition qetproject.h:77
The TerminalStripEditor class Main dialog used to edit terminal strip of a project.
Definition terminalstripeditor.h:38
void updateUi()
Definition terminalstripeditorwindow.cpp:122
void on_m_button_box_clicked(QAbstractButton *button)
TerminalStripEditorWindow::on_m_button_box_clicked Action when user click on the apply/reset button.
Definition terminalstripeditorwindow.cpp:192
static void dropInstance()
Definition terminalstripeditorwindow.h:60
void on_m_reload_triggered()
TerminalStripEditorWindow::on_m_reload_triggered.
Definition terminalstripeditorwindow.cpp:181
void on_m_add_terminal_strip_triggered()
TerminalStripEditorWindow::on_m_add_terminal_strip_triggered Action when user click on add terminal s...
Definition terminalstripeditorwindow.cpp:145
static QPointer< TerminalStripEditorWindow > window_
Definition terminalstripeditorwindow.h:44
void addTreeDockWidget()
TerminalStripEditorWindow::addTreeDockWidget.
Definition terminalstripeditorwindow.cpp:103
QPointer< QETProject > m_project
Definition terminalstripeditorwindow.h:93
FreeTerminalEditor * m_free_terminal_editor
Definition terminalstripeditorwindow.h:95
void currentStripChanged(TerminalStrip *strip)
TerminalStripEditorWindow::currentStripChanged.
Definition terminalstripeditorwindow.cpp:115
TerminalStripEditorWindow(QETProject *project, QWidget *parent=nullptr)
Definition terminalstripeditorwindow.cpp:52
void on_m_remove_terminal_triggered()
TerminalStripEditorWindow::on_m_remove_terminal_triggered.
Definition terminalstripeditorwindow.cpp:165
void on_m_stacked_widget_currentChanged(int arg1)
Definition terminalstripeditorwindow.cpp:217
TerminalStripEditor * m_terminal_strip_editor
Definition terminalstripeditorwindow.h:96
void setCurrentStrip(TerminalStrip *strip)
Definition terminalstripeditorwindow.cpp:96
Ui::TerminalStripEditorWindow * ui
Definition terminalstripeditorwindow.h:92
static void edit(TerminalStrip *strip)
TerminalStripEditorWindow::TerminalStripEditorWindow.
Definition terminalstripeditorwindow.cpp:42
TerminalStripTreeDockWidget * m_tree_dock
Definition terminalstripeditorwindow.h:94
void setProject(QETProject *project)
TerminalStripEditorWindow::setProject.
Definition terminalstripeditorwindow.cpp:88
~TerminalStripEditorWindow()
TerminalStripEditorWindow::~TerminalStripEditorWindow.
Definition terminalstripeditorwindow.cpp:79
static TerminalStripEditorWindow * instance(QETProject *project, QWidget *parent=nullptr)
Definition terminalstripeditorwindow.h:47
The TerminalStrip class This class hold all the datas and configurations of a terminal strip (but the...
Definition terminalstrip.h:45
Definition terminalstriptreedockwidget.h:35
Definition autonumberingdockwidget.h:30