VGamepad PC
The Windows app for the virtual game controller.
Loading...
Searching...
No Matches
settings.hpp File Reference
#include <QDir>
#include <QSettings>
#include <minwindef.h>
Include dependency graph for settings.hpp:
This graph shows which files directly or indirectly include this file:

Namespaces

namespace  setting_keys
 

Enumerations

enum  setting_keys::server_keys { setting_keys::Port }
 
enum  setting_keys::keys {
  setting_keys::A , setting_keys::B , setting_keys::X , setting_keys::Y ,
  setting_keys::RSHDR , setting_keys::LSHDR , setting_keys::DPADDOWN , setting_keys::DPADUP ,
  setting_keys::DPADRIGHT , setting_keys::DPADLEFT , setting_keys::VIEW , setting_keys::MENU
}
 

Functions

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

Variables

const QString SETTINGS_FILE
 
QString setting_keys::Mouse_sensitivity = "mouse_setting/mouse_sensitivity"
 
QSettings * settings
 
QList< QString > server_settings = {"port"}
 
const QMap< setting_keys::keys, QString > keymaps
 

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.

◆ set_mouse_sensitivity()

void set_mouse_sensitivity ( )

Variable Documentation

◆ keymaps

const QMap<setting_keys::keys, QString> keymaps
inline
Initial value:
= {
{setting_keys::keys::A, "keymaps/A"},
{setting_keys::keys::B, "keymaps/B"},
{setting_keys::keys::X, "keymaps/X"},
{setting_keys::keys::Y, "keymaps/Y"},
{setting_keys::keys::RSHDR, "keymaps/RT"},
{setting_keys::keys::LSHDR, "keymaps/LT"},
{setting_keys::keys::DPADDOWN, "keymaps/DPADDOWN"},
{setting_keys::keys::DPADUP, "keymaps/DPADUP"},
{setting_keys::keys::DPADRIGHT, "keymaps/DPADRIGHT"},
{setting_keys::keys::DPADLEFT, "keymaps/DPADLEFT"},
{setting_keys::keys::VIEW, "keymaps/VIEW"},
{setting_keys::keys::MENU, "keymaps/MENU"}}
@ A
Definition settings.hpp:21
@ DPADRIGHT
Definition settings.hpp:29
@ DPADUP
Definition settings.hpp:28
@ VIEW
Definition settings.hpp:31
@ X
Definition settings.hpp:23
@ MENU
Definition settings.hpp:32
@ DPADLEFT
Definition settings.hpp:30
@ DPADDOWN
Definition settings.hpp:27
@ Y
Definition settings.hpp:24
@ RSHDR
Definition settings.hpp:25
@ LSHDR
Definition settings.hpp:26
@ B
Definition settings.hpp:22

A Qmap to map the keys in namespace to corresponding settings name in string format.

◆ server_settings

QList<QString> server_settings = {"port"}
inline

◆ settings

QSettings* settings
extern

◆ SETTINGS_FILE

const QString SETTINGS_FILE
extern