mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-11-07 09:26:04 -10:00
Qt: Add install dir to tooltip
This commit is contained in:
1 parent
0a30785e06
commit
13a3cd4266
5 files changed
+32
-15
No files matched your search
+22
-6
@@ -858,15 +858,13 @@ package_install_result package_reader::check_target_app_version() const
|
||||
};
|
||||
}
|
||||
|
||||
bool package_reader::set_install_path()
|
||||
std::string package_reader::get_install_path() const
|
||||
{
|
||||
if (!m_is_valid)
|
||||
{
|
||||
return false;
|
||||
return {};
|
||||
}
|
||||
|
||||
m_install_path.clear();
|
||||
|
||||
// Get full path
|
||||
std::string dir = rpcs3::utils::get_hdd0_dir();
|
||||
|
||||
@@ -905,16 +903,34 @@ bool package_reader::set_install_path()
|
||||
if (m_install_dir.empty() || leaves_directory(m_install_dir))
|
||||
{
|
||||
pkg_log.error("Invalid installation directory name '%s'", m_install_dir);
|
||||
return false;
|
||||
return {};
|
||||
}
|
||||
|
||||
dir += vfs::escape(m_install_dir) + '/';
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
bool package_reader::set_install_path()
|
||||
{
|
||||
if (!m_is_valid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_install_path.clear();
|
||||
|
||||
std::string dir = get_install_path();
|
||||
if (dir.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If false, an existing directory is being overwritten: cannot cancel the operation
|
||||
m_was_null = !fs::is_dir(dir);
|
||||
|
||||
m_install_path = dir;
|
||||
m_install_path = std::move(dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -376,6 +376,7 @@ public:
|
||||
static package_install_result extract_data(std::deque<package_reader>& readers, std::deque<std::string>& bootable_paths, bool from_optical_drive);
|
||||
const psf::registry& get_psf() const { return m_psf; }
|
||||
result get_result() const { return m_result; };
|
||||
std::string get_install_path() const;
|
||||
|
||||
int get_progress(int maximum = 100) const;
|
||||
|
||||
|
||||
@@ -274,6 +274,7 @@ compat::package_info game_compatibility::GetPkgInfo(const QString& pkg_path, con
|
||||
std::string_view localized_title = psf::get_string(psf, localized_title_key);
|
||||
|
||||
info.path = pkg_path;
|
||||
info.dest_dir = QString::fromStdString(reader.get_install_path());
|
||||
info.title = QString::fromStdString(std::string(localized_title.empty() ? psf::get_string(psf, "TITLE") : localized_title));
|
||||
info.title_id = QString::fromStdString(std::string(psf::get_string(psf, "TITLE_ID")));
|
||||
info.category = QString::fromStdString(std::string(psf::get_string(psf, "CATEGORY")));
|
||||
|
||||
@@ -103,6 +103,7 @@ namespace compat
|
||||
bool is_valid = true;
|
||||
|
||||
QString path; // File path
|
||||
QString dest_dir; // Destination path
|
||||
QString title_id; // TEST12345
|
||||
QString title; // Localized
|
||||
QString changelog; // Localized, may be empty
|
||||
|
||||
@@ -50,7 +50,6 @@ pkg_install_dialog::pkg_install_dialog(const QStringList& paths, bool from_boot,
|
||||
|
||||
// We have to build our complicated localized string in some annoying manner
|
||||
QString accumulated_info;
|
||||
QString tooltip;
|
||||
|
||||
const auto append_info = [&accumulated_info](const QString& info)
|
||||
{
|
||||
@@ -88,13 +87,11 @@ pkg_install_dialog::pkg_install_dialog(const QStringList& paths, bool from_boot,
|
||||
append_info(tr("v.%0", "Version info").arg(info.version));
|
||||
}
|
||||
|
||||
if (info.changelog.isEmpty())
|
||||
QString tooltip = tr("Installation path: %0", "Installation path").arg(info.dest_dir);
|
||||
|
||||
if (!info.changelog.isEmpty())
|
||||
{
|
||||
tooltip = tr("No info", "Changelog info placeholder");
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltip = tr("Changelog:\n\n%0", "Changelog info").arg(info.changelog);
|
||||
tooltip += tr("\nChangelog:\n\n%0", "Changelog info").arg(info.changelog);
|
||||
}
|
||||
|
||||
append_info(file_info.fileName());
|
||||
@@ -252,7 +249,8 @@ void pkg_install_dialog::update_info(QLabel* installation_info, QDialogButtonBox
|
||||
u64 free_space = 0;
|
||||
|
||||
// Retrieve disk space info on data path's drive
|
||||
if (fs::device_stat stat{}; fs::statfs(rpcs3::utils::get_hdd0_game_dir(), stat))
|
||||
const std::string install_dir = rpcs3::utils::get_hdd0_dir();
|
||||
if (fs::device_stat stat{}; fs::statfs(install_dir, stat))
|
||||
{
|
||||
free_space = stat.avail_free;
|
||||
}
|
||||
@@ -267,7 +265,7 @@ void pkg_install_dialog::update_info(QLabel* installation_info, QDialogButtonBox
|
||||
|
||||
installation_info->setText(gui::utils::make_paragraph(
|
||||
tr("Installation path: %0\nAvailable disk space: %1%2\nRequired disk space: %3")
|
||||
.arg(QString::fromStdString(rpcs3::utils::get_hdd0_game_dir()))
|
||||
.arg(QString::fromStdString(install_dir))
|
||||
.arg(gui::utils::format_byte_size(free_space))
|
||||
.arg(data_size <= free_space ? QString() : tr(" - <b>NOT ENOUGH SPACE</b>"))
|
||||
.arg(gui::utils::format_byte_size(data_size))));
|
||||
|
||||
Reference in new issue
Block a user