added basic setting class ( startup code for #6)

This commit is contained in:
georgemoralis 2023-03-03 18:48:09 +02:00
parent 907c32967e
commit 9ba1ad6c93
7 changed files with 39 additions and 3 deletions

View File

@ -0,0 +1,8 @@
#include "gui_settings.h"
gui_settings::gui_settings(QObject* parent)
{
m_settings.reset(new QSettings("shadps4.ini", QSettings::Format::IniFormat, parent));
}

View File

@ -0,0 +1,14 @@
#pragma once
#include <QSettings>
class gui_settings
{
public:
explicit gui_settings(QObject* parent = nullptr);
private:
std::unique_ptr<QSettings> m_settings;
};

View File

@ -7,8 +7,9 @@
#include <QMessageBox>
#include <QProgressDialog>
shadps4gui::shadps4gui(QWidget *parent)
shadps4gui::shadps4gui(std::shared_ptr<gui_settings> gui_settings, QWidget* parent)
: QMainWindow(parent)
, m_gui_settings(std::move(gui_settings))
{
ui.setupUi(this);
game_list = new GameListViewer();

View File

@ -3,13 +3,14 @@
#include <QMainWindow>
#include "ui_shadps4gui.h"
#include "GameListViewer.h"
#include "gui_settings.h"
class shadps4gui : public QMainWindow
{
Q_OBJECT
public:
shadps4gui(QWidget *parent = nullptr);
shadps4gui(std::shared_ptr<gui_settings> gui_settings, QWidget* parent = nullptr);
~shadps4gui();
public slots:
@ -18,4 +19,5 @@ public slots:
private:
Ui::shadps4guiClass ui;
GameListViewer* game_list;
std::shared_ptr<gui_settings> m_gui_settings;
};

View File

@ -1,10 +1,13 @@
#include "gui/shadps4gui.h"
#include <QtWidgets/QApplication>
#include "gui/gui_settings.h"
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
shadps4gui w;
std::shared_ptr<gui_settings> m_gui_settings;
m_gui_settings.reset(new gui_settings());
shadps4gui w(m_gui_settings,nullptr);
w.show();
return a.exec();
}

View File

@ -16,6 +16,7 @@
<ClCompile Include="emulator\fileFormat\PSF.cpp" />
<ClCompile Include="emulator\Loader.cpp" />
<ClCompile Include="gui\GameListViewer.cpp" />
<ClCompile Include="gui\gui_settings.cpp" />
<ClCompile Include="gui\shadps4gui.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
@ -33,6 +34,7 @@
<ClInclude Include="emulator\fileFormat\PKG.h" />
<ClInclude Include="emulator\fileFormat\PSF.h" />
<ClInclude Include="emulator\Loader.h" />
<ClInclude Include="gui\gui_settings.h" />
<ClInclude Include="Types.h" />
</ItemGroup>
<PropertyGroup Label="Globals">

View File

@ -56,6 +56,9 @@
<ClCompile Include="emulator\fileFormat\PKG.cpp">
<Filter>emulator\fileFormat</Filter>
</ClCompile>
<ClCompile Include="gui\gui_settings.cpp">
<Filter>gui</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtUic Include="gui\shadps4gui.ui">
@ -86,5 +89,8 @@
<ClInclude Include="emulator\fileFormat\PKG.h">
<Filter>emulator\fileFormat</Filter>
</ClInclude>
<ClInclude Include="gui\gui_settings.h">
<Filter>gui</Filter>
</ClInclude>
</ItemGroup>
</Project>