mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-05 08:52:36 +00:00
delete pkg on install checkbox + use game icon for finish window
This commit is contained in:
parent
45367d9fc3
commit
04e0ae3a23
@ -59,6 +59,10 @@ QWidget* InstallDirSelect::SetupInstallDirList() {
|
|||||||
connect(checkbox, &QCheckBox::toggled, this, &InstallDirSelect::setUseForAllQueued);
|
connect(checkbox, &QCheckBox::toggled, this, &InstallDirSelect::setUseForAllQueued);
|
||||||
vlayout->addWidget(checkbox);
|
vlayout->addWidget(checkbox);
|
||||||
|
|
||||||
|
auto checkbox2 = new QCheckBox(tr("Delete PKG File on Install"));
|
||||||
|
connect(checkbox2, &QCheckBox::toggled, this, &InstallDirSelect::setDeleteFileOnInstall);
|
||||||
|
vlayout->addWidget(checkbox2);
|
||||||
|
|
||||||
group->setLayout(vlayout);
|
group->setLayout(vlayout);
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
@ -76,6 +80,10 @@ void InstallDirSelect::setUseForAllQueued(bool enabled) {
|
|||||||
use_for_all_queued = enabled;
|
use_for_all_queued = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InstallDirSelect::setDeleteFileOnInstall(bool enabled) {
|
||||||
|
delete_file_on_install = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
QWidget* InstallDirSelect::SetupDialogActions() {
|
QWidget* InstallDirSelect::SetupDialogActions() {
|
||||||
auto actions = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
auto actions = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
|
@ -26,11 +26,17 @@ public:
|
|||||||
return use_for_all_queued;
|
return use_for_all_queued;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool deleteFileOnInstall() {
|
||||||
|
return delete_file_on_install;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* SetupInstallDirList();
|
QWidget* SetupInstallDirList();
|
||||||
QWidget* SetupDialogActions();
|
QWidget* SetupDialogActions();
|
||||||
void setSelectedDirectory(QListWidgetItem* item);
|
void setSelectedDirectory(QListWidgetItem* item);
|
||||||
|
void setDeleteFileOnInstall(bool enabled);
|
||||||
void setUseForAllQueued(bool enabled);
|
void setUseForAllQueued(bool enabled);
|
||||||
std::filesystem::path selected_dir;
|
std::filesystem::path selected_dir;
|
||||||
|
bool delete_file_on_install = false;
|
||||||
bool use_for_all_queued = false;
|
bool use_for_all_queued = false;
|
||||||
};
|
};
|
||||||
|
@ -726,8 +726,7 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
|
|||||||
}
|
}
|
||||||
auto category = psf.GetString("CATEGORY");
|
auto category = psf.GetString("CATEGORY");
|
||||||
|
|
||||||
std::filesystem::path game_install_dir = last_install_dir;
|
if (!use_for_all_queued || pkgNum == 1) {
|
||||||
if (!use_for_all_queued) {
|
|
||||||
InstallDirSelect ids;
|
InstallDirSelect ids;
|
||||||
const auto selected = ids.exec();
|
const auto selected = ids.exec();
|
||||||
if (selected == QDialog::Rejected) {
|
if (selected == QDialog::Rejected) {
|
||||||
@ -735,8 +734,10 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
last_install_dir = ids.getSelectedDirectory();
|
last_install_dir = ids.getSelectedDirectory();
|
||||||
|
delete_file_on_install = ids.deleteFileOnInstall();
|
||||||
use_for_all_queued = ids.useForAllQueued();
|
use_for_all_queued = ids.useForAllQueued();
|
||||||
}
|
}
|
||||||
|
std::filesystem::path game_install_dir = last_install_dir;
|
||||||
|
|
||||||
auto game_folder_path = game_install_dir / pkg.GetTitleID();
|
auto game_folder_path = game_install_dir / pkg.GetTitleID();
|
||||||
QString pkgType = QString::fromStdString(pkg.GetPkgFlags());
|
QString pkgType = QString::fromStdString(pkg.GetPkgFlags());
|
||||||
@ -889,8 +890,14 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
|
|||||||
if (pkgNum == nPkg) {
|
if (pkgNum == nPkg) {
|
||||||
QString path;
|
QString path;
|
||||||
Common::FS::PathToQString(path, game_install_dir);
|
Common::FS::PathToQString(path, game_install_dir);
|
||||||
|
QIcon windowIcon(
|
||||||
|
Common::FS::PathToUTF8String(game_folder_path / "sce_sys/icon0.png")
|
||||||
|
.c_str());
|
||||||
QMessageBox extractMsgBox(this);
|
QMessageBox extractMsgBox(this);
|
||||||
extractMsgBox.setWindowTitle(tr("Extraction Finished"));
|
extractMsgBox.setWindowTitle(tr("Extraction Finished"));
|
||||||
|
if (!windowIcon.isNull()) {
|
||||||
|
extractMsgBox.setWindowIcon(windowIcon);
|
||||||
|
}
|
||||||
extractMsgBox.setText(
|
extractMsgBox.setText(
|
||||||
QString(tr("Game successfully installed at %1")).arg(path));
|
QString(tr("Game successfully installed at %1")).arg(path));
|
||||||
extractMsgBox.addButton(QMessageBox::Ok);
|
extractMsgBox.addButton(QMessageBox::Ok);
|
||||||
@ -904,6 +911,9 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
|
|||||||
});
|
});
|
||||||
extractMsgBox.exec();
|
extractMsgBox.exec();
|
||||||
}
|
}
|
||||||
|
if (delete_file_on_install) {
|
||||||
|
std::filesystem::remove(file);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
connect(&dialog, &QProgressDialog::canceled, [&]() { futureWatcher.cancel(); });
|
connect(&dialog, &QProgressDialog::canceled, [&]() { futureWatcher.cancel(); });
|
||||||
connect(&futureWatcher, &QFutureWatcher<void>::progressValueChanged, &dialog,
|
connect(&futureWatcher, &QFutureWatcher<void>::progressValueChanged, &dialog,
|
||||||
|
@ -125,5 +125,6 @@ protected:
|
|||||||
void resizeEvent(QResizeEvent* event) override;
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
|
|
||||||
std::filesystem::path last_install_dir = "";
|
std::filesystem::path last_install_dir = "";
|
||||||
|
bool delete_file_on_install = false;
|
||||||
bool use_for_all_queued = false;
|
bool use_for_all_queued = false;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user