VGamepad PC
The Windows app for the virtual game controller.
Loading...
Searching...
No Matches
settings.cpp File Reference
#include "settings.hpp"
#include "settings_key_variables.hpp"
#include <QDebug>
Include dependency graph for settings.cpp:

Functions

void save_setting (const QString &key, const QVariant &value)
 
QVariant load_setting (const QString &key)
 
void load_mouse_setting ()
 
void load_settings_file (QObject *parent=nullptr)
 
void load_port_number ()
 
void load_key_maps ()
 
void load_all_settings ()
 
uint is_mouse_button (UINT vk)
 

Variables

const QString SETTINGS_FILE
 
QSettings * settings
 
void(* load_functions [])(void)
 

Function Documentation

◆ is_mouse_button()

uint is_mouse_button ( UINT vk)

Function to find out if the user mapped a keyboard key or mouse button

Parameters
vkVirtual key code of the key or mouse button pressed
Returns
1 if its a mouse button else 0

◆ load_all_settings()

void load_all_settings ( )

Run the functions using the function array to load all the necessary settings.

◆ load_key_maps()

void load_key_maps ( )

Load the key maps from the settings file.

◆ load_mouse_setting()

void load_mouse_setting ( )

Loads and sets the mouse sensitivity.

◆ load_port_number()

void load_port_number ( )

Load and set the port number

◆ load_setting()

QVariant load_setting ( const QString & key)

Get the value of a setting.

Parameters
keyThe fullname including the groups of the setting in string format
Returns
The setting as QVariant can be converted into almost all data types.

◆ load_settings_file()

void load_settings_file ( QObject * parent = nullptr)

Loads the settings file for the current application.

Parameters
parentThe parent object either a widget or Qt Application e.t.c

◆ save_setting()

void save_setting ( const QString & key,
const QVariant & value )

Save a setting to the settings file

Parameters
keyThe name of the setting in string format if you want to group settings seperate the head group using </>
valueThe value of the settings can be of any data type string, int, char, float, e.t.c.

Variable Documentation

◆ load_functions

void(* load_functions[])(void) ( void )
Initial value:
void load_port_number()
Definition settings.cpp:67
void load_key_maps()
Definition settings.cpp:75
void load_mouse_setting()
Definition settings.cpp:49

◆ settings

QSettings* settings

◆ SETTINGS_FILE

const QString SETTINGS_FILE
Initial value:
= QDir::toNativeSeparators(
QDir::homePath() + "//VirtualGamePad.ini")