tuned-switcher 1.1.0
Performance profile manager
Loading...
Searching...
No Matches
MainWindow Class Reference

#include <mainwindow.h>

Inheritance diagram for MainWindow:
Collaboration diagram for MainWindow:

Public Member Functions

 MainWindow (QWidget *parent=nullptr)
 
 ~MainWindow ()
 

Protected Member Functions

void mousePressEvent (QMouseEvent *) override
 
void closeEvent (QCloseEvent *) override
 
void keyPressEvent (QKeyEvent *) override
 

Private Slots

void profileChangedEvent (const QString &, const bool, const QString &)
 
void profileSelectedEvent (const QString &)
 
void closeFormEvent ()
 
void profileAutoSelectedEvent (const bool)
 
void serviceEnableEvent ()
 
void serviceDisableEvent ()
 
void serviceReloadEvent ()
 
void serviceShutdownEvent ()
 
void showSettingsEvent ()
 
void showAboutEvent ()
 

Private Member Functions

void initializeSettings ()
 
void initializeNotifications ()
 
void initializeService ()
 
void initializeTuned ()
 
void setFormEvents ()
 
void tryToStartTuned ()
 
void checkServiceRunning ()
 
void checkTunedRunning ()
 
void serviceEnable ()
 
void serviceDisable ()
 
void serviceReload ()
 
void serviceShutdown ()
 
void setProfileExplicitly ()
 
void getTunedProfiles ()
 
void subscribeToEvents ()
 
void markAutoProfileMode ()
 
void markServiceMode ()
 
void loadFormSettings ()
 
void saveFormSettings ()
 
void setDefaultFormPosition ()
 
void setSavedFormPosition ()
 
void setFormStyle ()
 
void setFormControls ()
 
void resetCurrentProfile ()
 
void setCurrentProfile (const QString &)
 
void markCurrentProfile ()
 
void setAutoProfileMode (const bool)
 
void setNotificationsMode ()
 
void exitApplication ()
 
QMenu * createServiceControlSubmenu (QWidget *)
 
QMenu * createMainMenu (QWidget *)
 

Private Attributes

Ui::MainWindow * ui
 
SettingsManagersettings
 
NotificationsManagernotifications
 
ServiceManagerserviceManager
 
TunedManagertunedManager
 

Detailed Description

Class for working with the GUI application.

Constructor & Destructor Documentation

◆ MainWindow()

MainWindow::MainWindow ( QWidget * parent = nullptr)
explicit

Main constructor of the MainWindow class.

Parameters
parentParent widget.

◆ ~MainWindow()

MainWindow::~MainWindow ( )

Destructor of the MainWindow class.

Member Function Documentation

◆ checkServiceRunning()

void MainWindow::checkServiceRunning ( )
private

Check if the Tuned service is not running and try to start it with DBus methods.

◆ checkTunedRunning()

void MainWindow::checkTunedRunning ( )
private

Check if the Tuned is not running and try to start it with DBus methods.

◆ closeEvent()

void MainWindow::closeEvent ( QCloseEvent * event)
overrideprotected

Form close event handler.

Parameters
eventEvent object instance.

◆ closeFormEvent

void MainWindow::closeFormEvent ( )
privateslot

Button "Close form" clicked event slot (handler).

◆ createMainMenu()

QMenu * MainWindow::createMainMenu ( QWidget * parent)
private

Build and create main menu.

Returns
Pointer to the QMenu instance.

◆ createServiceControlSubmenu()

QMenu * MainWindow::createServiceControlSubmenu ( QWidget * parent)
private

Build and create submenu for service control functions.

Parameters
parentParent widget.
Returns
Pointer to the QMenu instance.

◆ exitApplication()

void MainWindow::exitApplication ( )
private

Exit the application immediately.

◆ getTunedProfiles()

void MainWindow::getTunedProfiles ( )
private

Get available Tuned profiles for internal usage.

◆ initializeNotifications()

void MainWindow::initializeNotifications ( )
private

Initialize the NotificationsManager class instance.

◆ initializeService()

void MainWindow::initializeService ( )
private

Initialize the ServiceManager class instance.

◆ initializeSettings()

void MainWindow::initializeSettings ( )
private

Initialize the SettingsManager class instance.

◆ initializeTuned()

void MainWindow::initializeTuned ( )
private

Initialize the TunedManager class instance.

◆ keyPressEvent()

void MainWindow::keyPressEvent ( QKeyEvent * event)
overrideprotected

Key pressed event handler.

Parameters
eventEvent object instance.

◆ loadFormSettings()

void MainWindow::loadFormSettings ( )
private

Load form settings: position and size.

◆ markAutoProfileMode()

void MainWindow::markAutoProfileMode ( )
private

Check if the automatic mode is enabled and mark the special checkbox.

◆ markCurrentProfile()

void MainWindow::markCurrentProfile ( )
private

Get the active Tuned profile and set it on form.

◆ markServiceMode()

void MainWindow::markServiceMode ( )
private

Check whether the Tuned profile is running or not and enable or disable various form controls.

◆ mousePressEvent()

void MainWindow::mousePressEvent ( QMouseEvent * event)
overrideprotected

Mouse button press event handler.

Parameters
eventEvent object instance.

◆ profileAutoSelectedEvent

void MainWindow::profileAutoSelectedEvent ( const bool autoMode)
privateslot

Checkbox "Auto-select profile" clicked event slot (handler).

Parameters
autoMode"Auto-select profile" mode on or off.

◆ profileChangedEvent

void MainWindow::profileChangedEvent ( const QString & profile,
const bool result,
const QString & message )
privateslot

"Tuned profile changed" DBus event slot (handler).

Parameters
profileRecently switched profile name.
resultSwitch result: true - success; false - failure.
messageResult message (OK on success).

◆ profileSelectedEvent

void MainWindow::profileSelectedEvent ( const QString & profile)
privateslot

"Profile selected" event slot (handler).

Parameters
profileProfile name.

◆ resetCurrentProfile()

void MainWindow::resetCurrentProfile ( )
private

Reset the active Tuned profile.

◆ saveFormSettings()

void MainWindow::saveFormSettings ( )
private

Save form settings: position and size.

◆ serviceDisable()

void MainWindow::serviceDisable ( )
private

Disable the Tuned service with DBus methods.

◆ serviceDisableEvent

void MainWindow::serviceDisableEvent ( )
privateslot

"Disable the service" menu item clicked event slot (handler).

◆ serviceEnable()

void MainWindow::serviceEnable ( )
private

Enable the Tuned service with DBus methods.

◆ serviceEnableEvent

void MainWindow::serviceEnableEvent ( )
privateslot

"Enable the service" menu item clicked event slot (handler).

◆ serviceReload()

void MainWindow::serviceReload ( )
private

Reload the Tuned service with DBus methods.

◆ serviceReloadEvent

void MainWindow::serviceReloadEvent ( )
privateslot

"Reload the service" menu item clicked event slot (handler).

◆ serviceShutdown()

void MainWindow::serviceShutdown ( )
private

Shut down the Tuned service with DBus methods.

◆ serviceShutdownEvent

void MainWindow::serviceShutdownEvent ( )
privateslot

"Shut down the service" menu item clicked event slot (handler).

◆ setAutoProfileMode()

void MainWindow::setAutoProfileMode ( const bool autoMode)
private

Change the "Auto-select profile" mode checkbox on the form.

Parameters
autoModeNew "Auto-select profile" mode value.

◆ setCurrentProfile()

void MainWindow::setCurrentProfile ( const QString & profile)
private

Set the active Tuned profile on form.

◆ setDefaultFormPosition()

void MainWindow::setDefaultFormPosition ( )
private

Set the default form position to the center of the screen.

◆ setFormControls()

void MainWindow::setFormControls ( )
private

Set custom form controls: menu and its handlers.

◆ setFormEvents()

void MainWindow::setFormEvents ( )
private

Initialize and connect the events for the form.

◆ setFormStyle()

void MainWindow::setFormStyle ( )
private

Set custom form style: remove border, apply gradients, etc.

◆ setNotificationsMode()

void MainWindow::setNotificationsMode ( )
private

Set the notifications sound mode.

◆ setProfileExplicitly()

void MainWindow::setProfileExplicitly ( )
private

Explicitly set the active profile if it is not selected.

◆ setSavedFormPosition()

void MainWindow::setSavedFormPosition ( )
private

Set the form position based on saved settings.

◆ showAboutEvent

void MainWindow::showAboutEvent ( )
privateslot

"Show About form" menu item clicked event slot (handler).

◆ showSettingsEvent

void MainWindow::showSettingsEvent ( )
privateslot

"Show settings" menu item clicked event slot (handler).

◆ subscribeToEvents()

void MainWindow::subscribeToEvents ( )
private

Subscribe to DBus events.

◆ tryToStartTuned()

void MainWindow::tryToStartTuned ( )
private

Try to start the Tuned service if not running.

Member Data Documentation

◆ notifications

NotificationsManager* MainWindow::notifications
private

Stores pointer to the NotificationsManager class instance.

◆ serviceManager

ServiceManager* MainWindow::serviceManager
private

Stores pointer to the ServiceManager class instance.

◆ settings

SettingsManager* MainWindow::settings
private

Stores pointer to the SettingsManager class instance.

◆ tunedManager

TunedManager* MainWindow::tunedManager
private

Stores pointer to the TunedManager class instance.

◆ ui

Ui::MainWindow* MainWindow::ui
private

Stores the GUI application form instance.


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