Browse Source
Add support for batch install to NAND
Add support for batch install to NAND
This adds support to batch install files to NANDnce_cpp
6 changed files with 290 additions and 124 deletions
-
6src/yuzu/CMakeLists.txt
-
72src/yuzu/install_dialog.cpp
-
35src/yuzu/install_dialog.h
-
145src/yuzu/main.cpp
-
4src/yuzu/main.h
-
2src/yuzu/main.ui
@ -0,0 +1,72 @@ |
|||
// Copyright 2020 yuzu Emulator Project
|
|||
// Licensed under GPLv2 or any later version
|
|||
// Refer to the license.txt file included.
|
|||
|
|||
#include <QCheckBox>
|
|||
#include <QDialogButtonBox>
|
|||
#include <QFileInfo>
|
|||
#include <QHBoxLayout>
|
|||
#include <QLabel>
|
|||
#include <QListWidget>
|
|||
#include <QVBoxLayout>
|
|||
#include "yuzu/install_dialog.h"
|
|||
#include "yuzu/uisettings.h"
|
|||
|
|||
InstallDialog::InstallDialog(QWidget* parent, const QStringList& files) : QDialog(parent) { |
|||
file_list = new QListWidget(this); |
|||
|
|||
for (const QString& file : files) { |
|||
QListWidgetItem* item = new QListWidgetItem(QFileInfo(file).fileName(), file_list); |
|||
item->setData(Qt::UserRole, file); |
|||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); |
|||
item->setCheckState(Qt::Checked); |
|||
} |
|||
|
|||
file_list->setMinimumWidth((file_list->sizeHintForColumn(0) * 6) / 5); |
|||
|
|||
vbox_layout = new QVBoxLayout; |
|||
|
|||
hbox_layout = new QHBoxLayout; |
|||
|
|||
description = new QLabel(tr("Please confirm these are the files you wish to install.")); |
|||
|
|||
overwrite_files = new QCheckBox(tr("Overwrite Existing Files")); |
|||
overwrite_files->setCheckState(Qt::Unchecked); |
|||
|
|||
buttons = new QDialogButtonBox; |
|||
buttons->addButton(QDialogButtonBox::Cancel); |
|||
buttons->addButton(tr("Install"), QDialogButtonBox::AcceptRole); |
|||
|
|||
connect(buttons, &QDialogButtonBox::accepted, this, &InstallDialog::accept); |
|||
connect(buttons, &QDialogButtonBox::rejected, this, &InstallDialog::reject); |
|||
|
|||
hbox_layout->addWidget(overwrite_files); |
|||
hbox_layout->addWidget(buttons); |
|||
|
|||
vbox_layout->addWidget(description); |
|||
vbox_layout->addWidget(file_list); |
|||
vbox_layout->addLayout(hbox_layout); |
|||
|
|||
setLayout(vbox_layout); |
|||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); |
|||
setWindowTitle(tr("Install Files to NAND")); |
|||
} |
|||
|
|||
InstallDialog::~InstallDialog() = default; |
|||
|
|||
QStringList InstallDialog::GetFilenames() const { |
|||
QStringList filenames; |
|||
|
|||
for (int i = 0; i < file_list->count(); ++i) { |
|||
const QListWidgetItem* item = file_list->item(i); |
|||
if (item->checkState() == Qt::Checked) { |
|||
filenames.append(item->data(Qt::UserRole).toString()); |
|||
} |
|||
} |
|||
|
|||
return filenames; |
|||
} |
|||
|
|||
bool InstallDialog::ShouldOverwriteFiles() const { |
|||
return overwrite_files->isChecked(); |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
// Copyright 2020 yuzu Emulator Project |
|||
// Licensed under GPLv2 or any later version |
|||
// Refer to the license.txt file included. |
|||
|
|||
#pragma once |
|||
|
|||
#include <QDialog> |
|||
|
|||
class QCheckBox; |
|||
class QDialogButtonBox; |
|||
class QHBoxLayout; |
|||
class QLabel; |
|||
class QListWidget; |
|||
class QVBoxLayout; |
|||
|
|||
class InstallDialog : public QDialog { |
|||
Q_OBJECT |
|||
|
|||
public: |
|||
explicit InstallDialog(QWidget* parent, const QStringList& files); |
|||
~InstallDialog() override; |
|||
|
|||
QStringList GetFilenames() const; |
|||
bool ShouldOverwriteFiles() const; |
|||
|
|||
private: |
|||
QListWidget* file_list; |
|||
|
|||
QVBoxLayout* vbox_layout; |
|||
QHBoxLayout* hbox_layout; |
|||
|
|||
QLabel* description; |
|||
QCheckBox* overwrite_files; |
|||
QDialogButtonBox* buttons; |
|||
}; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue