Skip to content

Commit

Permalink
Use resources instead of absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kitswas committed Aug 30, 2023
1 parent 1e8f652 commit c393a5f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 60 deletions.
35 changes: 0 additions & 35 deletions src/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,12 @@ Preferences::Preferences(QWidget *parent) : QDialog(parent), ui(new Ui::Preferen
change_key_inputs(); //saving key maps
});
ui->formLayout->setSizeConstraint(QLayout::SetMinimumSize);
Preferences::set_button_icons();
ui->formLayout->setHorizontalSpacing(50);
ui->formLayout->setVerticalSpacing(10);
ui->horizontalSlider->setValue(mouse_sensivity / 100);
Preferences::load_keys();
}

void Preferences::set_button_icons()
{
QPixmap x;
x.load("C:\\Users\\saisi\\Memory_card\\VirtualGamePad-PC\\res\\logos\\icons8-xbox-x-30.png"); // https://icons8.com/icon/80114/xbox-x
ui->xbutton->setPixmap(x);
QPixmap y;
y.load("C:\\Users\\saisi\\Memory_card\\VirtualGamePad-PC\\res\\logos\\icons8-xbox-y-30.png"); // https://icons8.com/icon/80111/xbox-y
ui->ybutton->setPixmap(y);
QPixmap a;
a.load("C:\\Users\\saisi\\Memory_card\\VirtualGamePad-PC\\res\\logos\\icons8-xbox-a-30.png"); // https://icons8.com/icon/80108/xbox-a
ui->abutton->setPixmap(a);
QPixmap b;
b.load("C:\\Users\\saisi\\Memory_card\\VirtualGamePad-PC\\res\\logos\\icons8-xbox-b-30.png"); // https://icons8.com/icon/80102/xbox-b
ui->bbutton->setPixmap(b);
QPixmap rt;
rt.load("C:\\Users\\saisi\\Memory_card\\VirtualGamePad-PC\\res\\logos\\icons8-xbox-rt-30.png"); // https://icons8.com/icon/80116/xbox-rt
ui->Rt->setPixmap(rt);
QPixmap lt;
lt.load("C:\\Users\\saisi\\Memory_card\\VirtualGamePad-PC\\res\\logos\\icons8-xbox-lt-30.png"); // https://icons8.com/icon/80107/xbox-lt
ui->Lt->setPixmap(lt);
QPixmap dpad_down;
dpad_down.load("C:\\Users\\saisi\\Memory_card\\VirtualGamePad-PC\\res\\logos\\icons8-down-30.png"); // https://icons8.com/
ui->ddown->setPixmap(dpad_down);
QPixmap dpad_up;
dpad_up.load("C:\\Users\\saisi\\Memory_card\\VirtualGamePad-PC\\res\\logos\\icons8-up-30.png"); // https://icons8.com/icon/100000/up
ui->dup->setPixmap(dpad_up);
QPixmap dpad_right;
dpad_right.load("C:\\Users\\saisi\\Memory_card\\VirtualGamePad-PC\\res\\logos\\icons8-right-30.png"); // https://icons8.com/icon/98968/right
ui->dright->setPixmap(dpad_right);
QPixmap dpad_left;
dpad_left.load("C:\\Users\\saisi\\Memory_card\\VirtualGamePad-PC\\res\\logos\\icons8-left-30.png"); // https://icons8.com/icon/98961/left
ui->dleft->setPixmap(dpad_left);
}

int Preferences::change_mouse_sensitivity(int value)
{
mouse_sensivity = value;
Expand Down
3 changes: 1 addition & 2 deletions src/preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class Preferences : public QDialog
Q_OBJECT

public:
explicit Preferences(QWidget *parent = nullptr);
void set_button_icons();
explicit Preferences(QWidget *parent = nullptr);
void load_keys();
~Preferences();

Expand Down
48 changes: 25 additions & 23 deletions src/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@
<rect>
<x>10</x>
<y>25</y>
<width>191</width>
<height>296</height>
<width>238</width>
<height>356</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="xbutton">
<property name="text">
<string>TextLabel</string>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/icons8-xbox-x-30.png</pixmap>
</property>
</widget>
</item>
Expand All @@ -121,8 +121,8 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="ybutton">
<property name="text">
<string>TextLabel</string>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/icons8-xbox-y-30.png</pixmap>
</property>
</widget>
</item>
Expand All @@ -146,8 +146,8 @@
</item>
<item row="2" column="0">
<widget class="QLabel" name="abutton">
<property name="text">
<string>TextLabel</string>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/icons8-xbox-a-30.png</pixmap>
</property>
</widget>
</item>
Expand All @@ -171,8 +171,8 @@
</item>
<item row="3" column="0">
<widget class="QLabel" name="bbutton">
<property name="text">
<string>TextLabel</string>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/icons8-xbox-b-30.png</pixmap>
</property>
</widget>
</item>
Expand All @@ -196,8 +196,8 @@
</item>
<item row="4" column="0">
<widget class="QLabel" name="Rt">
<property name="text">
<string>TextLabel</string>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/icons8-xbox-rt-30.png</pixmap>
</property>
</widget>
</item>
Expand All @@ -221,8 +221,8 @@
</item>
<item row="5" column="0">
<widget class="QLabel" name="Lt">
<property name="text">
<string>TextLabel</string>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/icons8-xbox-lt-30.png</pixmap>
</property>
</widget>
</item>
Expand All @@ -246,8 +246,8 @@
</item>
<item row="6" column="0">
<widget class="QLabel" name="ddown">
<property name="text">
<string>TextLabel</string>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/icons8-down-30.png</pixmap>
</property>
</widget>
</item>
Expand All @@ -271,8 +271,8 @@
</item>
<item row="7" column="0">
<widget class="QLabel" name="dup">
<property name="text">
<string>TextLabel</string>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/icons8-up-30.png</pixmap>
</property>
</widget>
</item>
Expand All @@ -296,8 +296,8 @@
</item>
<item row="8" column="0">
<widget class="QLabel" name="dright">
<property name="text">
<string>TextLabel</string>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/icons8-right-30.png</pixmap>
</property>
</widget>
</item>
Expand All @@ -321,8 +321,8 @@
</item>
<item row="9" column="0">
<widget class="QLabel" name="dleft">
<property name="text">
<string>TextLabel</string>
<property name="pixmap">
<pixmap resource="../res/icons.qrc">:/icons/icons8-left-30.png</pixmap>
</property>
</widget>
</item>
Expand Down Expand Up @@ -363,7 +363,9 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../res/icons.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
Expand Down

0 comments on commit c393a5f

Please sign in to comment.