diff --git a/CMakeLists.txt b/CMakeLists.txt index 90ba4d83..50538ab7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ endif() project(shadPS4) -option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" OFF) +option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" ON) # This function should be passed a list of all files in a target. It will automatically generate file groups # following the directory hierarchy, so that the layout of the files in IDEs matches the one in the filesystem. diff --git a/CMakeSettings.json b/CMakeSettings.json index 9242e080..376f8984 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -20,7 +20,12 @@ "cmakeCommandArgs": "", "buildCommandArgs": "", "ctestCommandArgs": "", - "inheritEnvironments": [ "clang_cl_x64_x64" ] + "inheritEnvironments": [ "clang_cl_x64_x64" ], + "environments": [ + { + "PATH": "C:/Qt/6.7.2/msvc2019_64/bin;${env.PATH}" + } + ] }, { "name": "x64-Clang-RelWithDebInfo", diff --git a/src/qt_gui/game_install_dialog.cpp b/src/qt_gui/game_install_dialog.cpp index 4b2b8528..7ddc5109 100644 --- a/src/qt_gui/game_install_dialog.cpp +++ b/src/qt_gui/game_install_dialog.cpp @@ -13,11 +13,16 @@ #include #include "game_install_dialog.h" +#include GameInstallDialog::GameInstallDialog() : m_gamesDirectory(nullptr) { auto layout = new QVBoxLayout(this); layout->addWidget(SetupGamesDirectory()); + + layout->addWidget(GameDirectoryList()); + // call list dialog here later + layout->addStretch(); layout->addWidget(SetupDialogActions()); @@ -27,9 +32,55 @@ GameInstallDialog::GameInstallDialog() : m_gamesDirectory(nullptr) { GameInstallDialog::~GameInstallDialog() {} +QWidget* GameInstallDialog::GameDirectoryList() { + auto group = new QGroupBox("Gamepaths"); + auto layout = new QHBoxLayout(group); + + // Input. + + /* + newItem->setText(path); + listWidget->insertItem(1, newItem); + */ + // Browse button. + //auto browse = new QPushButton("Browse"); + + //connect(browse, &QPushButton::clicked, this, &GameInstallDialog::Browse); + + QListWidget* listWidget = new QListWidget(this); + QFile file("shadPS4-gamepaths.txt"); + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&file); + while (!in.atEnd()) { + QString path = in.readLine(); + if (!path.isEmpty() && path.endsWith(";")) { + path.chop(1); + listWidget->addItem(path); + } + } + file.close(); + } + layout->addWidget(listWidget); + + return group; +} + +QWidget* GameInstallDialog::GameDirectoryListDialog() { + auto actions = new QDialogButtonBox(QDialogButtonBox::Ok); + connect(actions, &QDialogButtonBox::accepted, this, &GameInstallDialog::Save); + return actions; +} + void GameInstallDialog::Browse() { auto path = QFileDialog::getExistingDirectory(this, "Directory to install games"); + QFile file("shadPS4-gamepaths.txt"); + if (file.open(QIODevice::Append | QIODevice::Text)) { + QTextStream out(&file); + out << path << ";\n"; + file.close(); + } + if (!path.isEmpty()) { m_gamesDirectory->setText(QDir::toNativeSeparators(path)); } diff --git a/src/qt_gui/game_install_dialog.h b/src/qt_gui/game_install_dialog.h index 6f439e81..0bc50394 100644 --- a/src/qt_gui/game_install_dialog.h +++ b/src/qt_gui/game_install_dialog.h @@ -15,6 +15,9 @@ public: GameInstallDialog(); ~GameInstallDialog(); + QWidget* GameDirectoryList(); + QWidget* GameDirectoryListDialog(); + private slots: void Browse();