mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-02 16:49:04 +00:00
import_dialog: UI improvements
1. A warning regarding system data and system archives are added 2. Disable button when nothing is selected
This commit is contained in:
@@ -182,10 +182,22 @@ void ImportDialog::InsertSecondLevelItem(std::size_t row, const Core::ContentSpe
|
||||
ui->main->setItemWidget(item, 0, checkBox);
|
||||
|
||||
connect(checkBox, &QCheckBox::stateChanged,
|
||||
[this, item, size = content.maximum_size](int state) {
|
||||
[this, item, size = content.maximum_size, type = content.type,
|
||||
exists = content.already_exists](int state) {
|
||||
if (state == Qt::Checked) {
|
||||
total_size += size;
|
||||
} else {
|
||||
if (!warning_shown && !exists &&
|
||||
(type == Core::ContentType::SystemArchive ||
|
||||
type == Core::ContentType::Sysdata)) {
|
||||
|
||||
QMessageBox::warning(
|
||||
this, tr("Warning"),
|
||||
tr("System Archive and System Data are important files that may "
|
||||
"be necessary for your imported games to run.\nIt is highly "
|
||||
"recommended to import these contents if they do not exist yet."));
|
||||
warning_shown = true;
|
||||
}
|
||||
total_size -= size;
|
||||
}
|
||||
UpdateSizeDisplay();
|
||||
@@ -278,8 +290,7 @@ void ImportDialog::UpdateSizeDisplay() {
|
||||
LOG_ERROR(Frontend, "Storage {} is not good", user_path);
|
||||
QMessageBox::critical(
|
||||
this, tr("Bad Storage"),
|
||||
tr("An error occured while trying to get available space for the storage.\nPlease "
|
||||
"ensure that your SD card is well connected and try again."));
|
||||
tr("An error occured while trying to get available space for the storage."));
|
||||
reject();
|
||||
}
|
||||
|
||||
@@ -288,7 +299,7 @@ void ImportDialog::UpdateSizeDisplay() {
|
||||
ui->totalSize->setText(tr("Total Size: %1").arg(ReadableByteSize(total_size)));
|
||||
|
||||
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)
|
||||
->setEnabled(total_size <= static_cast<u64>(storage.bytesAvailable()));
|
||||
->setEnabled(total_size > 0 && total_size <= static_cast<u64>(storage.bytesAvailable()));
|
||||
}
|
||||
|
||||
void ImportDialog::UpdateItemCheckState(QTreeWidgetItem* item) {
|
||||
|
||||
@@ -46,6 +46,9 @@ private:
|
||||
// TODO: Is there a more elegant way of doing the same?
|
||||
bool program_trigger = false;
|
||||
|
||||
// Whether the System Archive / System Data warning has been shown
|
||||
bool warning_shown = false;
|
||||
|
||||
// TODO: Why this won't work as locals?
|
||||
Core::ContentSpecifier current_content = {};
|
||||
u64 current_count = 0;
|
||||
|
||||
Reference in New Issue
Block a user