Removed 'Encryption' column

This commit is contained in:
Pengfei
2021-08-09 10:53:37 +08:00
parent 09f3f46515
commit 6013879213
4 changed files with 124 additions and 153 deletions
+7 -14
View File
@@ -535,8 +535,8 @@ bool SDMCImporter::LoadTMD(const ContentSpecifier& specifier, TitleMetadata& out
return LoadTMD(specifier.type, specifier.id, out); return LoadTMD(specifier.type, specifier.id, out);
} }
// English short title name, extdata id, encryption, seed, icon // English short title name, extdata id, icon
using TitleData = std::tuple<std::string, u64, EncryptionType, bool, std::vector<u16>>; using TitleData = std::tuple<std::string, u64, std::vector<u16>>;
TitleData LoadTitleData(NCCHContainer& ncch) { TitleData LoadTitleData(NCCHContainer& ncch) {
std::string codeset_name; std::string codeset_name;
@@ -572,13 +572,8 @@ TitleData LoadTitleData(NCCHContainer& ncch) {
u64 extdata_id{}; u64 extdata_id{};
ncch.ReadExtdataId(extdata_id); ncch.ReadExtdataId(extdata_id);
EncryptionType encryption = EncryptionType::None;
ncch.ReadEncryptionType(encryption);
bool seed_crypto{};
ncch.ReadSeedCrypto(seed_crypto);
return {Common::UTF16BufferToUTF8(smdh.GetShortTitle(SMDH::TitleLanguage::English)), extdata_id, return {Common::UTF16BufferToUTF8(smdh.GetShortTitle(SMDH::TitleLanguage::English)), extdata_id,
encryption, seed_crypto, smdh.GetIcon(false)}; smdh.GetIcon(false)};
} }
static std::string NormalizeFilename(std::string filename) { static std::string NormalizeFilename(std::string filename) {
@@ -917,13 +912,12 @@ void SDMCImporter::ListTitle(std::vector<ContentSpecifier>& out) const {
break; break;
} }
const auto& [name, extdata_id, encryption, seed_crypto, icon] = const auto& [name, extdata_id, icon] = LoadTitleData(ncch);
LoadTitleData(ncch);
const auto size = const auto size =
FileUtil::GetDirectoryTreeSize(directory + virtual_name + "/content/") + FileUtil::GetDirectoryTreeSize(directory + virtual_name + "/content/") +
TitleSizeAllowance; TitleSizeAllowance;
out.push_back({type, id, FileUtil::Exists(citra_path + "content/"), size, out.push_back({type, id, FileUtil::Exists(citra_path + "content/"), size,
name, extdata_id, encryption, seed_crypto, icon}); name, extdata_id, icon});
} while (false); } while (false);
} }
@@ -994,15 +988,14 @@ void SDMCImporter::ListNandTitle(std::vector<ContentSpecifier>& out) const {
break; break;
} }
const auto& [name, extdata_id, encryption, seed_crypto, icon] = const auto& [name, extdata_id, icon] = LoadTitleData(ncch);
LoadTitleData(ncch);
const auto type = (id >> 32) == 0x00040030 ? ContentType::SystemApplet const auto type = (id >> 32) == 0x00040030 ? ContentType::SystemApplet
: ContentType::SystemTitle; : ContentType::SystemTitle;
const auto size = const auto size =
FileUtil::GetDirectoryTreeSize(directory + virtual_name + "/content/") + FileUtil::GetDirectoryTreeSize(directory + virtual_name + "/content/") +
TitleSizeAllowance; TitleSizeAllowance;
out.push_back({type, id, FileUtil::Exists(citra_path + "content/"), size, out.push_back({type, id, FileUtil::Exists(citra_path + "content/"), size,
name, extdata_id, encryption, seed_crypto, icon}); name, extdata_id, icon});
} while (false); } while (false);
} }
return true; return true;
+1 -3
View File
@@ -68,9 +68,7 @@ struct ContentSpecifier {
u64 maximum_size; ///< The maximum size of the content. May be slightly bigger than real size. u64 maximum_size; ///< The maximum size of the content. May be slightly bigger than real size.
std::string name; ///< Optional. The content's preferred display name. std::string name; ///< Optional. The content's preferred display name.
u64 extdata_id; ///< Extdata ID for Applications. u64 extdata_id; ///< Extdata ID for Applications.
EncryptionType encryption = EncryptionType::None; ///< Only for NCCHs. Encryption scheme. std::vector<u16> icon; ///< Optional. The content's icon.
bool seed_crypto = false; ///< Only for NCCHs. Whether seed crypto is used.
std::vector<u16> icon; ///< Optional. The content's icon.
}; };
/** /**
+4 -19
View File
@@ -124,10 +124,9 @@ ImportDialog::ImportDialog(QWidget* parent, const Core::Config& config_)
// Set up column widths. // Set up column widths.
// These values are tweaked with regard to the default dialog size. // These values are tweaked with regard to the default dialog size.
ui->main->setColumnWidth(0, width() * 0.11); ui->main->setColumnWidth(0, width() * 0.11);
ui->main->setColumnWidth(1, width() * 0.415); ui->main->setColumnWidth(1, width() * 0.525);
ui->main->setColumnWidth(2, width() * 0.14); ui->main->setColumnWidth(2, width() * 0.18);
ui->main->setColumnWidth(3, width() * 0.17); ui->main->setColumnWidth(3, width() * 0.10);
ui->main->setColumnWidth(4, width() * 0.08);
connect(ui->main, &QTreeWidget::customContextMenuRequested, this, &ImportDialog::OnContextMenu); connect(ui->main, &QTreeWidget::customContextMenuRequested, this, &ImportDialog::OnContextMenu);
} }
@@ -246,22 +245,8 @@ void ImportDialog::InsertSecondLevelItem(std::size_t row, const Core::ContentSpe
name = replace_name; name = replace_name;
} }
QString encryption = tr(EncryptionTypeMap.at(content.encryption));
if (content.seed_crypto) {
encryption.append(tr(" (Seed)"));
}
if (content.type != Core::ContentType::Application &&
content.type != Core::ContentType::Update && content.type != Core::ContentType::DLC &&
content.type != Core::ContentType::SystemTitle &&
content.type != Core::ContentType::SystemApplet) {
// Do not display encryption in this case
encryption.clear();
}
auto* item = new QTreeWidgetItem{{QString{}, name, ReadableByteSize(content.maximum_size), auto* item = new QTreeWidgetItem{{QString{}, name, ReadableByteSize(content.maximum_size),
encryption, content.already_exists ? tr("Yes") : tr("No")}}; content.already_exists ? tr("Yes") : tr("No")}};
QPixmap icon; QPixmap icon;
if (replace_icon.isNull()) { if (replace_icon.isNull()) {
+112 -117
View File
@@ -1,117 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>ImportDialog</class> <class>ImportDialog</class>
<widget class="QDialog" name="ImportDialog"> <widget class="QDialog" name="ImportDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>560</width> <width>560</width>
<height>320</height> <height>320</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Select Contents</string> <string>Select Contents</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<item> <item>
<widget class="QPushButton" name="advanced_button"> <widget class="QPushButton" name="advanced_button">
<property name="text"> <property name="text">
<string>Advanced...</string> <string>Advanced...</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer> <spacer>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="title_view_button"> <widget class="QRadioButton" name="title_view_button">
<property name="text"> <property name="text">
<string>Title View</string> <string>Title View</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="group_view_button"> <widget class="QRadioButton" name="group_view_button">
<property name="text"> <property name="text">
<string>Group View</string> <string>Group View</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QTreeWidget" name="main"> <widget class="QTreeWidget" name="main">
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>
<column> <column>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Name</string> <string>Name</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Size</string> <string>Size</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Encryption</string> <string>Exists</string>
</property> </property>
</column> </column>
<column> </widget>
<property name="text"> </item>
<string>Exists</string> <item>
</property> <layout class="QHBoxLayout">
</column> <item>
</widget> <widget class="QLabel" name="availableSpace">
</item> <property name="text">
<item> <string>Available Space:</string>
<layout class="QHBoxLayout"> </property>
<item> </widget>
<widget class="QLabel" name="availableSpace"> </item>
<property name="text"> <item>
<string>Available Space:</string> <spacer>
</property> <property name="orientation">
</widget> <enum>Qt::Horizontal</enum>
</item> </property>
<item> </spacer>
<spacer> </item>
<property name="orientation"> <item>
<enum>Qt::Horizontal</enum> <widget class="QLabel" name="totalSize">
</property> <property name="text">
</spacer> <string>Total Size:</string>
</item> </property>
<item> </widget>
<widget class="QLabel" name="totalSize"> </item>
<property name="text"> </layout>
<string>Total Size:</string> </item>
</property> <item>
</widget> <widget class="QDialogButtonBox" name="buttonBox">
</item> <property name="standardButtons">
</layout> <set>QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Reset</set>
</item> </property>
<item> </widget>
<widget class="QDialogButtonBox" name="buttonBox"> </item>
<property name="standardButtons"> </layout>
<set>QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Reset</set> </widget>
</property> <resources/>
</widget> <connections/>
</item> </ui>
</layout>
</widget>
<resources/>
<connections/>
</ui>