mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 17:11:23 +00:00
Qt: add rap files to pkg install file dialog
This commit is contained in:
parent
815d6f4223
commit
fab1f7d939
@ -482,12 +482,22 @@ void main_window::BootRsxCapture(std::string path)
|
||||
}
|
||||
}
|
||||
|
||||
bool main_window::InstallRapFile(const QString& path, const std::string& filename)
|
||||
{
|
||||
if (path.isEmpty() || filename.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return fs::copy_file(sstr(path), Emulator::GetHddDir() + "/home/" + Emu.GetUsr() + "/exdata/" + filename, true);
|
||||
}
|
||||
|
||||
void main_window::InstallPackages(QStringList file_paths, bool show_confirm)
|
||||
{
|
||||
if (file_paths.isEmpty())
|
||||
{
|
||||
const QString path_last_pkg = m_gui_settings->GetValue(gui::fd_install_pkg).toString();
|
||||
const QString file_path = QFileDialog::getOpenFileName(this, tr("Select PKG To Install"), path_last_pkg, tr("PKG files (*.pkg);;All files (*.*)"));
|
||||
const QStringList file_path = QFileDialog::getOpenFileNames(this, tr("Select packages and/or rap files to install"),
|
||||
path_last_pkg, tr("All relevant (*.pkg *.rap);;Package files (*.pkg);;Rap files (*.rap);;All files (*.*)"));
|
||||
|
||||
if (!file_path.isEmpty())
|
||||
{
|
||||
@ -504,6 +514,27 @@ void main_window::InstallPackages(QStringList file_paths, bool show_confirm)
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_paths.isEmpty())
|
||||
{
|
||||
for (const auto& rap : file_paths.filter(QRegExp(".*\\.rap")))
|
||||
{
|
||||
const QFileInfo file_info(rap);
|
||||
const std::string rapname = sstr(file_info.fileName());
|
||||
|
||||
if (InstallRapFile(rap, rapname))
|
||||
{
|
||||
gui_log.success("Successfully copied rap file: %s", rapname);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_log.warning("Could not copy rap file: %s", rapname);
|
||||
}
|
||||
|
||||
m_gui_settings->SetValue(gui::fd_install_pkg, file_info.path());
|
||||
}
|
||||
|
||||
file_paths = file_paths.filter(QRegExp(".*\\.pkg"));
|
||||
|
||||
if (!file_paths.isEmpty())
|
||||
{
|
||||
// Handle the actual installations with a timeout. Otherwise the source explorer instance is not usable during the following file processing.
|
||||
@ -512,6 +543,7 @@ void main_window::InstallPackages(QStringList file_paths, bool show_confirm)
|
||||
HandlePackageInstallation(file_paths);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main_window::HandlePackageInstallation(QStringList file_paths)
|
||||
@ -552,8 +584,6 @@ void main_window::HandlePackageInstallation(QStringList file_paths)
|
||||
const std::string path = sstr(file_path);
|
||||
const std::string file_name = sstr(file_info.fileName());
|
||||
|
||||
m_gui_settings->SetValue(gui::fd_install_pkg, file_info.path());
|
||||
|
||||
// Run PKG unpacking asynchronously
|
||||
named_thread worker("PKG Installer", [path, &progress, &error]
|
||||
{
|
||||
@ -2317,22 +2347,28 @@ void main_window::dropEvent(QDropEvent* event)
|
||||
}
|
||||
case drop_type::drop_rap: // import rap files to exdata dir
|
||||
{
|
||||
int installed_rap_count = 0;
|
||||
|
||||
for (const auto& rap : drop_paths)
|
||||
{
|
||||
const std::string rapname = sstr(QFileInfo(rap).fileName());
|
||||
|
||||
if (!fs::copy_file(sstr(rap), Emulator::GetHddDir() + "/home/" + Emu.GetUsr() + "/exdata/" + rapname, false))
|
||||
if (InstallRapFile(rap, rapname))
|
||||
{
|
||||
gui_log.warning("Could not copy rap file by drop: %s", rapname);
|
||||
gui_log.success("Successfully copied rap file by drop: %s", rapname);
|
||||
installed_rap_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_log.success("Successfully copied rap file by drop: %s", rapname);
|
||||
gui_log.error("Could not copy rap file by drop: %s", rapname);
|
||||
}
|
||||
}
|
||||
|
||||
if (installed_rap_count > 0)
|
||||
{
|
||||
// Refresh game list since we probably unlocked some games now.
|
||||
m_game_list_frame->Refresh(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case drop_type::drop_dir: // import valid games to gamelist (games.yaml)
|
||||
|
@ -131,6 +131,8 @@ private:
|
||||
void EnableMenus(bool enabled);
|
||||
void ShowTitleBars(bool show);
|
||||
|
||||
static bool InstallRapFile(const QString& path, const std::string& filename);
|
||||
|
||||
void InstallPackages(QStringList file_paths = QStringList(), bool show_confirm = true);
|
||||
void HandlePackageInstallation(QStringList file_paths = QStringList());
|
||||
|
||||
|
@ -141,7 +141,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1058</width>
|
||||
<height>22</height>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
@ -392,7 +392,7 @@
|
||||
</action>
|
||||
<action name="bootInstallPkgAct">
|
||||
<property name="text">
|
||||
<string>Install .pkg</string>
|
||||
<string>Install Packages/Raps</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Install application from a .pkg file</string>
|
||||
|
Loading…
Reference in New Issue
Block a user