QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
dialogwaiting.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
19#ifndef DIALOGWAITING_H
20#define DIALOGWAITING_H
21
22#include <QDialog>
23#include <QMutex>
24
25namespace Ui {
26 class DialogWaiting;
27}
28
29class DialogWaiting : public QDialog
30{
31 Q_OBJECT
32 public:
33 static DialogWaiting* instance(QWidget *parent = nullptr)
34 {
35 static QMutex mutex;
37 {
38 mutex.lock();
40 m_static_dialog = new DialogWaiting(parent);
41 mutex.unlock();
42 }
43 return m_static_dialog;
44 }
45
46 static bool hasInstance()
47 {
48 if(m_static_dialog == nullptr)
49 return false;
50 else
51 return true;
52 }
53
54 static void dropInstance()
55 {
56 static QMutex mutex;
58 {
59 mutex.lock();
60 m_static_dialog->deleteLater();
61 m_static_dialog = nullptr;
62 mutex.unlock();
63 }
64 }
65 private:
67
68
69 public:
70 explicit DialogWaiting(QWidget *parent = nullptr);
71 ~DialogWaiting() override;
72
73 void setProgressBar(int val);
74 void setProgressBarRange(int min, int max);
75 void setProgressReset();
76 void setTitle(const QString& val);
77 void setDetail(const QString& val);
78 int progressBarValue() const;
79
80 private:
81 Ui::DialogWaiting *ui;
82};
83
84#endif // DIALOGWAITING_H
Definition dialogwaiting.h:30
void setTitle(const QString &val)
DialogWaiting::setTitle of action.
Definition dialogwaiting.cpp:77
void setProgressReset()
DialogWaiting::setProgressReset, clear progressBar and reset.
Definition dialogwaiting.cpp:58
void setProgressBarRange(int min, int max)
DialogWaiting::setProgressBarRange.
Definition dialogwaiting.cpp:68
~DialogWaiting() override
DialogWaiting::~DialogWaiting.
Definition dialogwaiting.cpp:41
void setDetail(const QString &val)
DialogWaiting::setDetail of action.
Definition dialogwaiting.cpp:85
static DialogWaiting * m_static_dialog
Definition dialogwaiting.h:66
int progressBarValue() const
DialogWaiting::progressBarValue.
Definition dialogwaiting.cpp:93
void setProgressBar(int val)
DialogWaiting::setProgressBar.
Definition dialogwaiting.cpp:50
static DialogWaiting * instance(QWidget *parent=nullptr)
Definition dialogwaiting.h:33
static void dropInstance()
Definition dialogwaiting.h:54
static bool hasInstance()
Definition dialogwaiting.h:46
Ui::DialogWaiting * ui
Definition dialogwaiting.h:81
Definition autonumberingdockwidget.h:26