QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
terminalstripeditorwindow.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 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 {
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 }
55 return window_;
56 }
57
58 static void dropInstance () {
59 static QMutex mutex;
60 if (window_) {
61 mutex.lock();
62 window_->deleteLater();
63 window_.clear();
64 mutex.unlock();
65 }
66 }
67
68 static void edit(TerminalStrip *strip);
69
70 public:
71 explicit TerminalStripEditorWindow(QETProject *project, QWidget *parent = nullptr);
73
74 void setCurrentStrip(TerminalStrip *strip);
75
76 private slots:
80 void on_m_button_box_clicked(QAbstractButton *button);
82
83 private:
84 void addTreeDockWidget();
86 void updateUi();
87
88 private:
89 Ui::TerminalStripEditorWindow *ui{nullptr};
94};
95
96#endif // TERMINALSTRIPEDITORWINDOW_H
Definition freeterminaleditor.h:33
Definition qetproject.h:62
The TerminalStripEditor class Main dialog used to edit terminal strip of a project.
Definition terminalstripeditor.h:38
Definition terminalstripeditorwindow.h:37
void updateUi()
Definition terminalstripeditorwindow.cpp:105
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:175
static void dropInstance()
Definition terminalstripeditorwindow.h:58
void on_m_reload_triggered()
TerminalStripEditorWindow::on_m_reload_triggered.
Definition terminalstripeditorwindow.cpp:164
QETProject * m_project
Definition terminalstripeditorwindow.h:90
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:128
static QPointer< TerminalStripEditorWindow > window_
Definition terminalstripeditorwindow.h:44
void addTreeDockWidget()
TerminalStripEditorWindow::addTreeDockWidget.
Definition terminalstripeditorwindow.cpp:86
FreeTerminalEditor * m_free_terminal_editor
Definition terminalstripeditorwindow.h:92
void currentStripChanged(TerminalStrip *strip)
TerminalStripEditorWindow::currentStripChanged.
Definition terminalstripeditorwindow.cpp:98
void on_m_remove_terminal_triggered()
TerminalStripEditorWindow::on_m_remove_terminal_triggered.
Definition terminalstripeditorwindow.cpp:148
void on_m_stacked_widget_currentChanged(int arg1)
Definition terminalstripeditorwindow.cpp:200
TerminalStripEditor * m_terminal_strip_editor
Definition terminalstripeditorwindow.h:93
void setCurrentStrip(TerminalStrip *strip)
Definition terminalstripeditorwindow.cpp:79
Ui::TerminalStripEditorWindow * ui
Definition terminalstripeditorwindow.h:89
static void edit(TerminalStrip *strip)
TerminalStripEditorWindow::TerminalStripEditorWindow.
Definition terminalstripeditorwindow.cpp:42
TerminalStripTreeDockWidget * m_tree_dock
Definition terminalstripeditorwindow.h:91
~TerminalStripEditorWindow()
TerminalStripEditorWindow::~TerminalStripEditorWindow.
Definition terminalstripeditorwindow.cpp:74
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:34
Definition autonumberingdockwidget.h:26