summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/FilesystemWidget.cpp
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2021-08-04 21:54:07 +0100
committerGitHub <noreply@github.com>2021-08-04 21:54:07 +0100
commit9c65519e79ddc4231f035427feeceb685702bf6d (patch)
treecca1adfffcd6f769fbc0029d24a4653819cf8ad6 /Source/Core/DolphinQt/Config/FilesystemWidget.cpp
parent28b7e2ef30fd5183b3f9cd1d13cf6b9928d557aa (diff)
parent0b86a03438933f6391a2d14e97b91937a6cd39d9 (diff)
Merge pull request #9986 from Pokechu22/partition-info
FilesystemWidget: Show more information about partitions
Diffstat (limited to 'Source/Core/DolphinQt/Config/FilesystemWidget.cpp')
-rw-r--r--Source/Core/DolphinQt/Config/FilesystemWidget.cpp56
1 files changed, 55 insertions, 1 deletions
diff --git a/Source/Core/DolphinQt/Config/FilesystemWidget.cpp b/Source/Core/DolphinQt/Config/FilesystemWidget.cpp
index c2aa1a74eb..b830a2e015 100644
--- a/Source/Core/DolphinQt/Config/FilesystemWidget.cpp
+++ b/Source/Core/DolphinQt/Config/FilesystemWidget.cpp
@@ -16,6 +16,8 @@
#include <future>
+#include "Common/StringUtil.h"
+
#include "DiscIO/DiscExtractor.h"
#include "DiscIO/DiscUtils.h"
#include "DiscIO/Filesystem.h"
@@ -101,7 +103,7 @@ void FilesystemWidget::PopulateView()
for (size_t i = 0; i < partitions.size(); i++)
{
- auto* item = new QStandardItem(tr("Partition %1").arg(i));
+ auto* item = new QStandardItem;
item->setEditable(false);
item->setIcon(Resources::GetScaledIcon("isoproperties_disc"));
@@ -123,6 +125,58 @@ void FilesystemWidget::PopulateView()
void FilesystemWidget::PopulateDirectory(int partition_id, QStandardItem* root,
const DiscIO::Partition& partition)
{
+ auto partition_type = m_volume->GetPartitionType(partition);
+ auto game_id = m_volume->GetGameID(partition);
+ auto title_id = m_volume->GetTitleID(partition);
+
+ QString text = root->text();
+
+ if (!text.isEmpty())
+ text += QStringLiteral(" - ");
+
+ if (partition_type)
+ {
+ QString partition_type_str;
+ switch (partition_type.value())
+ {
+ case DiscIO::PARTITION_DATA:
+ partition_type_str = tr("Data Partition (%1)").arg(partition_type.value());
+ break;
+ case DiscIO::PARTITION_UPDATE:
+ partition_type_str = tr("Update Partition (%1)").arg(partition_type.value());
+ break;
+ case DiscIO::PARTITION_CHANNEL:
+ partition_type_str = tr("Channel Partition (%1)").arg(partition_type.value());
+ break;
+ case DiscIO::PARTITION_INSTALL:
+ partition_type_str = tr("Install Partition (%1)").arg(partition_type.value());
+ break;
+ default:
+ partition_type_str =
+ tr("Other Partition (%1)").arg(partition_type.value(), 8, 16, QLatin1Char('0'));
+ break;
+ }
+ text += partition_type_str + QStringLiteral(" - ");
+ }
+
+ text += QString::fromStdString(game_id);
+
+ if (title_id)
+ {
+ text += QStringLiteral(" - %1 (").arg(title_id.value(), 16, 16, QLatin1Char('0'));
+ for (u32 i = 0; i < 4; i++)
+ {
+ char c = static_cast<char>(title_id.value() >> 8 * (3 - i));
+ if (IsPrintableCharacter(c))
+ text += QLatin1Char(c);
+ else
+ text += QLatin1Char('.');
+ }
+ text += QLatin1Char(')');
+ }
+
+ root->setText(text);
+
const DiscIO::FileSystem* const file_system = m_volume->GetFileSystem(partition);
if (file_system)
PopulateDirectory(partition_id, root, file_system->GetRoot());