qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
Signals | Static Public Member Functions | Private Slots | Private Member Functions | List of all members
GUI Class Reference

Abstracts the GUI from the target backend (DesktopGUI, ...) More...

#include <gui.h>

Inheritance diagram for GUI:
Inheritance graph
Collaboration diagram for GUI:
Collaboration graph

Signals

void themeReload ()
 

Static Public Member Functions

static GUIgetInstance ()
 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...
 

Private Slots

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)
 

Private Member Functions

 GUI (QObject *parent=nullptr)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ GUI()

GUI::GUI ( QObject *  parent = nullptr)
explicitprivate

Definition at line 46 of file gui.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ _askQuestion [1/2]

bool GUI::_askQuestion ( const QString &  title,
const QString &  msg,
bool  defaultAns = false,
bool  warning = true,
bool  yesno = true 
)
privateslot

Definition at line 251 of file gui.cpp.

Here is the caller graph for this function:

◆ _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

Definition at line 260 of file gui.cpp.

Here is the call graph for this function:

◆ _setEnabled

void GUI::_setEnabled ( bool  state)
privateslot

Definition at line 212 of file gui.cpp.

◆ _setWindowTitle

void GUI::_setWindowTitle ( const QString &  title)
privateslot

Definition at line 219 of file gui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _showError

void GUI::_showError ( const QString &  title,
const QString &  msg 
)
privateslot

Definition at line 244 of file gui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _showInfo

void GUI::_showInfo ( const QString &  title,
const QString &  msg 
)
privateslot

Definition at line 230 of file gui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _showWarning

void GUI::_showWarning ( const QString &  title,
const QString &  msg 
)
privateslot

Definition at line 237 of file gui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
titleTitle of question window.
msgText in question window.
defaultAnsIf is true, default was positive answer. Negative otherwise.
warningIf is true, we will use a special warning style.
yesnoShow "Yes" and "No" buttons.
Returns
True if the answer is positive, false otherwise.

Definition at line 169 of file gui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
titleTitle of question window.
msgText in question window.
button1Text of positive button.
button2Text of negative button.
defaultAnsIf is true, default was positive answer. Negative otherwise.
warningIf 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.

Here is the call graph for this function:

◆ getInstance()

GUI & GUI::getInstance ( )
static

Returns the singleton instance.

Definition at line 56 of file gui.cpp.

Here is the caller graph for this function:

◆ getMainWidget()

QWidget * GUI::getMainWidget ( )
static

Get the main widget.

Returns
The main QWidget* of the application

Definition at line 280 of file gui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
stateEnable/disable GUI.

Definition at line 69 of file gui.cpp.

Here is the caller graph for this function:

◆ setWindowTitle()

void GUI::setWindowTitle ( const QString &  title)
static

Change the title of the main window.

Parameters
titleTitile to set.

This is usually always visible to the user.

Definition at line 85 of file gui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showError()

void GUI::showError ( const QString &  title,
const QString &  msg 
)
static

Show an error to the user.

Parameters
titleTitle of error window.
msgText in error window.

Definition at line 145 of file gui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showInfo()

void GUI::showInfo ( const QString &  title,
const QString &  msg 
)
static

Show some text to the user.

Parameters
titleTitle of information window.
msgText in information window.

Definition at line 115 of file gui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showWarning()

void GUI::showWarning ( const QString &  title,
const QString &  msg 
)
static

Show a warning to the user.

Parameters
titleTitle of warning window.
msgText in warning window.

Definition at line 130 of file gui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ themeReload

void GUI::themeReload ( )
signal
Here is the caller graph for this function:

The documentation for this class was generated from the following files: