Abstracts the GUI from the target backend (DesktopGUI, ...)
More...
#include <gui.h>
|
static GUI & | getInstance () |
| Returns the singleton instance. More...
|
|
static QWidget * | getMainWidget () |
| Get the main widget. More...
|
|
static void | setEnabled (bool state) |
| Will enable or disable the GUI. More...
|
|
static void | setWindowTitle (const QString &title) |
| Change the title of the main window. More...
|
|
static void | reloadTheme () |
| Reloads the application theme and redraw the window. More...
|
|
static void | showInfo (const QString &title, const QString &msg) |
| Show some text to the user. More...
|
|
static void | showWarning (const QString &title, const QString &msg) |
| Show a warning to the user. More...
|
|
static void | showError (const QString &title, const QString &msg) |
| Show an error to the user. More...
|
|
static bool | askQuestion (const QString &title, const QString &msg, bool defaultAns=false, bool warning=true, bool yesno=true) |
| Asks the user a question with Ok/Cancel or Yes/No buttons. More...
|
|
static bool | askQuestion (const QString &title, const QString &msg, const QString &button1, const QString &button2, bool defaultAns=false, bool warning=true) |
| Asks the user a question. More...
|
|
|
void | _setEnabled (bool state) |
|
void | _setWindowTitle (const QString &title) |
|
void | _showInfo (const QString &title, const QString &msg) |
|
void | _showWarning (const QString &title, const QString &msg) |
|
void | _showError (const QString &title, const QString &msg) |
|
bool | _askQuestion (const QString &title, const QString &msg, bool defaultAns=false, bool warning=true, bool yesno=true) |
|
bool | _askQuestion (const QString &title, const QString &msg, const QString &button1, const QString &button2, bool defaultAns=false, bool warning=true) |
|
|
| GUI (QObject *parent=nullptr) |
|
Abstracts the GUI from the target backend (DesktopGUI, ...)
All the functions exposed here are thread-safe. Prefer calling this class to calling a GUI backend directly.
Definition at line 27 of file gui.h.
◆ GUI()
GUI::GUI |
( |
QObject * |
parent = nullptr | ) |
|
|
explicitprivate |
◆ _askQuestion [1/2]
bool GUI::_askQuestion |
( |
const QString & |
title, |
|
|
const QString & |
msg, |
|
|
bool |
defaultAns = false , |
|
|
bool |
warning = true , |
|
|
bool |
yesno = true |
|
) |
| |
|
privateslot |
◆ _askQuestion [2/2]
bool GUI::_askQuestion |
( |
const QString & |
title, |
|
|
const QString & |
msg, |
|
|
const QString & |
button1, |
|
|
const QString & |
button2, |
|
|
bool |
defaultAns = false , |
|
|
bool |
warning = true |
|
) |
| |
|
privateslot |
◆ _setEnabled
void GUI::_setEnabled |
( |
bool |
state | ) |
|
|
privateslot |
◆ _setWindowTitle
void GUI::_setWindowTitle |
( |
const QString & |
title | ) |
|
|
privateslot |
◆ _showError
void GUI::_showError |
( |
const QString & |
title, |
|
|
const QString & |
msg |
|
) |
| |
|
privateslot |
◆ _showInfo
void GUI::_showInfo |
( |
const QString & |
title, |
|
|
const QString & |
msg |
|
) |
| |
|
privateslot |
◆ _showWarning
void GUI::_showWarning |
( |
const QString & |
title, |
|
|
const QString & |
msg |
|
) |
| |
|
privateslot |
◆ askQuestion() [1/2]
bool GUI::askQuestion |
( |
const QString & |
title, |
|
|
const QString & |
msg, |
|
|
bool |
defaultAns = false , |
|
|
bool |
warning = true , |
|
|
bool |
yesno = true |
|
) |
| |
|
static |
Asks the user a question with Ok/Cancel or Yes/No buttons.
- Parameters
-
title | Title of question window. |
msg | Text in question window. |
defaultAns | If is true, default was positive answer. Negative otherwise. |
warning | If is true, we will use a special warning style. |
yesno | Show "Yes" and "No" buttons. |
- Returns
- True if the answer is positive, false otherwise.
Definition at line 169 of file gui.cpp.
◆ askQuestion() [2/2]
bool GUI::askQuestion |
( |
const QString & |
title, |
|
|
const QString & |
msg, |
|
|
const QString & |
button1, |
|
|
const QString & |
button2, |
|
|
bool |
defaultAns = false , |
|
|
bool |
warning = true |
|
) |
| |
|
static |
Asks the user a question.
The text for the displayed buttons can be specified.
- Parameters
-
title | Title of question window. |
msg | Text in question window. |
button1 | Text of positive button. |
button2 | Text of negative button. |
defaultAns | If is true, default was positive answer. Negative otherwise. |
warning | If is true, we will use a special warning style. |
- Returns
- True if the answer is positive, false otherwise.
Definition at line 195 of file gui.cpp.
◆ getInstance()
GUI & GUI::getInstance |
( |
| ) |
|
|
static |
Returns the singleton instance.
Definition at line 56 of file gui.cpp.
◆ getMainWidget()
QWidget * GUI::getMainWidget |
( |
| ) |
|
|
static |
Get the main widget.
- Returns
- The main QWidget* of the application
Definition at line 280 of file gui.cpp.
◆ reloadTheme()
void GUI::reloadTheme |
( |
| ) |
|
|
static |
Reloads the application theme and redraw the window.
For reload theme need connect signal themeReload() to function for reload For example: connect(&GUI::getInstance(), &GUI::themeReload, this, &SomeClass::reloadTheme);
Definition at line 101 of file gui.cpp.
◆ setEnabled()
void GUI::setEnabled |
( |
bool |
state | ) |
|
|
static |
Will enable or disable the GUI.
- Note
- A disabled GUI can't be interacted with by the user.
- Parameters
-
Definition at line 69 of file gui.cpp.
◆ setWindowTitle()
void GUI::setWindowTitle |
( |
const QString & |
title | ) |
|
|
static |
Change the title of the main window.
- Parameters
-
This is usually always visible to the user.
Definition at line 85 of file gui.cpp.
◆ showError()
void GUI::showError |
( |
const QString & |
title, |
|
|
const QString & |
msg |
|
) |
| |
|
static |
Show an error to the user.
- Parameters
-
title | Title of error window. |
msg | Text in error window. |
Definition at line 145 of file gui.cpp.
◆ showInfo()
void GUI::showInfo |
( |
const QString & |
title, |
|
|
const QString & |
msg |
|
) |
| |
|
static |
Show some text to the user.
- Parameters
-
title | Title of information window. |
msg | Text in information window. |
Definition at line 115 of file gui.cpp.
◆ showWarning()
void GUI::showWarning |
( |
const QString & |
title, |
|
|
const QString & |
msg |
|
) |
| |
|
static |
Show a warning to the user.
- Parameters
-
title | Title of warning window. |
msg | Text in warning window. |
Definition at line 130 of file gui.cpp.
◆ themeReload
void GUI::themeReload |
( |
| ) |
|
|
signal |
The documentation for this class was generated from the following files: