mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 00:13:08 +00:00
paths setting tab
This commit is contained in:
parent
fe3ad666f2
commit
39c88ed588
@ -220,6 +220,55 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
|
||||
[](int val) { Config::setNullGpu(val); });
|
||||
}
|
||||
|
||||
// PATH TAB
|
||||
{
|
||||
for (const auto& dir : Config::getGameInstallDirs()) {
|
||||
QString path_string;
|
||||
Common::FS::PathToQString(path_string, dir);
|
||||
QListWidgetItem* item = new QListWidgetItem(path_string);
|
||||
ui->gameFoldersListWidget->addItem(item);
|
||||
}
|
||||
|
||||
ui->removeFolderButton->setEnabled(false);
|
||||
|
||||
connect(ui->addFolderButton, &QPushButton::clicked, this, [this]() {
|
||||
QString file_path_string =
|
||||
QFileDialog::getExistingDirectory(this, tr("Directory to install games"));
|
||||
auto file_path = Common::FS::PathFromQString(file_path_string);
|
||||
if (!file_path.empty()) {
|
||||
std::vector<std::filesystem::path> install_dirs = Config::getGameInstallDirs();
|
||||
install_dirs.push_back(file_path);
|
||||
Config::setGameInstallDirs(install_dirs);
|
||||
QListWidgetItem* item = new QListWidgetItem(file_path_string);
|
||||
ui->gameFoldersListWidget->addItem(item);
|
||||
}
|
||||
});
|
||||
|
||||
connect(ui->gameFoldersListWidget, &QListWidget::itemSelectionChanged, this, [this]() {
|
||||
ui->removeFolderButton->setEnabled(
|
||||
!ui->gameFoldersListWidget->selectedItems().isEmpty());
|
||||
});
|
||||
|
||||
connect(ui->removeFolderButton, &QPushButton::clicked, this, [this]() {
|
||||
QListWidgetItem* selected_item = ui->gameFoldersListWidget->currentItem();
|
||||
QString item_path_string = selected_item ? selected_item->text() : QString();
|
||||
if (!item_path_string.isEmpty()) {
|
||||
auto file_path = Common::FS::PathFromQString(item_path_string);
|
||||
std::vector<std::filesystem::path> install_dirs = Config::getGameInstallDirs();
|
||||
|
||||
auto iterator = std::remove_if(
|
||||
install_dirs.begin(), install_dirs.end(),
|
||||
[&file_path](const std::filesystem::path& dir) { return file_path == dir; });
|
||||
|
||||
if (iterator != install_dirs.end()) {
|
||||
install_dirs.erase(iterator, install_dirs.end());
|
||||
delete selected_item;
|
||||
}
|
||||
Config::setGameInstallDirs(install_dirs);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// DEBUG TAB
|
||||
{
|
||||
connect(ui->debugDump, &QCheckBox::stateChanged, this,
|
||||
|
@ -918,6 +918,76 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pathsTab">
|
||||
<attribute name="title">
|
||||
<string>Paths</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="inputTabVLayout" stretch="0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gameFoldersGroupBox">
|
||||
<property name="title">
|
||||
<string>Game Folders</string>
|
||||
</property>
|
||||
<widget class="QListWidget" name="gameFoldersListWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>20</y>
|
||||
<width>401</width>
|
||||
<height>331</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="addFolderButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>360</y>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="removeFolderButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>360</y>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Policy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="debugTab">
|
||||
<attribute name="title">
|
||||
<string>Debug</string>
|
||||
|
Loading…
Reference in New Issue
Block a user