Skip to content

Commit

Permalink
fixing the suggested changes
Browse files Browse the repository at this point in the history
fixing the broken include guard, removed the redundant functions, removed the qt::endl, fixed the typo in config file name
  • Loading branch information
franklin654 committed Aug 30, 2023
1 parent 6da54fc commit 6336624
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
load_key_maps();
this->p = new Preferences(this);
ui->setupUi(this);
ui->pushButton->connect(ui->pushButton, &QPushButton::pressed, this, [=] { this->p->show(); });
ui->settingsButton->connect(ui->settingsButton, &QPushButton::pressed, this, [=] { this->p->show(); });
}

MainWindow::~MainWindow()
Expand Down
4 changes: 2 additions & 2 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="settingsButton">
<property name="text">
<string>Preferences</string>
</property>
Expand All @@ -44,7 +44,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>17</height>
<height>21</height>
</rect>
</property>
</widget>
Expand Down
11 changes: 3 additions & 8 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "settings_key_variables.h"
#include <QDebug>

QString SETTINGS_FILE = QDir::toNativeSeparators(QDir::homePath() + "//VirtualGamePad.Ini");
QString SETTINGS_FILE = QDir::toNativeSeparators(QDir::homePath() + "//VirtualGamePad.ini");
QSettings *settings;

QString setting_keys::Mouse_sensivity = "mouse_setting/mouse_sensivity";
Expand All @@ -13,8 +13,8 @@ void save_setting(QString key, QVariant value)
{
settings->setValue(key, value);
settings->sync();
qDebug() << settings->value(key).toString() << Qt::endl;
qDebug() << settings->fileName() << Qt::endl;
qDebug() << settings->value(key).toString();
qDebug() << settings->fileName();
}

QVariant load_setting(QString key)
Expand All @@ -23,11 +23,6 @@ QVariant load_setting(QString key)
return value;
}

void set_mouse_sensivity(int sensivity) {
mouse_sensivity = sensivity;
}


void load_mouse_setting()
{
mouse_sensivity = settings->value(setting_keys::Mouse_sensivity).toInt() * 100;
Expand Down
4 changes: 2 additions & 2 deletions src/settings.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#ifndef SETTINGS_H
#define SETTINGS_H

#endif // SETTINGS_H
#include <QDir>
#include <QSettings>

Expand Down Expand Up @@ -56,3 +54,5 @@ void load_settings_file(QObject *parent);
void load_port_number();
void load_key_maps();
void load_all_settings();

#endif // SETTINGS_H
3 changes: 2 additions & 1 deletion src/settings_key_variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ std::map<UINT, const char*> vk_maps = {
{VK_DELETE, "DEL"},
{VK_OEM_PERIOD, "."},
{VK_OEM_COMMA, ","},
{VK_OEM_MINUS, "-"}
{VK_OEM_MINUS, "-"},
{VK_OEM_PLUS, "+"}
};
3 changes: 2 additions & 1 deletion src/settings_key_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#ifndef SETTINGS_KEY_VARIABLES_H
#define SETTINGS_KEY_VARIABLES_H
#include <windows.h>
#endif // SETTINGS_KEY_VARIABLES_H

#include <map>
#include "../VGP_Data_Exchange/C/GameButtons.h"
Expand All @@ -25,3 +24,5 @@ enum Thumbstick

extern std::map<Thumbstick, WORD> THUMBSTICK_KEYS;
extern std::map<UINT, const char*> vk_maps;

#endif // SETTINGS_KEY_VARIABLES_H

0 comments on commit 6336624

Please sign in to comment.