citra-qt: Added configure storage to handle NAND and SDMC dir location
parent
d21b8fb1b1
commit
95529a8b1d
@ -0,0 +1,78 @@
|
||||
// Copyright 2016 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QUrl>
|
||||
#include "citra_qt/configuration/configure_storage.h"
|
||||
#include "core/core.h"
|
||||
#include "core/settings.h"
|
||||
#include "ui_configure_storage.h"
|
||||
|
||||
ConfigureStorage::ConfigureStorage(QWidget* parent)
|
||||
: QWidget(parent), ui(std::make_unique<Ui::ConfigureStorage>()) {
|
||||
ui->setupUi(this);
|
||||
SetConfiguration();
|
||||
|
||||
connect(ui->open_nand_dir, &QPushButton::clicked, []() {
|
||||
QString path = QString::fromStdString(Settings::values.nand_dir);
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||
});
|
||||
|
||||
connect(ui->change_nand_dir, &QPushButton::clicked, this, [this]() {
|
||||
const QString dir_path = QFileDialog::getExistingDirectory(
|
||||
this, tr("Select NAND Directory"), QString::fromStdString(Settings::values.nand_dir),
|
||||
QFileDialog::ShowDirsOnly);
|
||||
if (!dir_path.isEmpty()) {
|
||||
Settings::values.nand_dir = dir_path.toStdString();
|
||||
SetConfiguration();
|
||||
}
|
||||
});
|
||||
|
||||
connect(ui->open_sdmc_dir, &QPushButton::clicked, []() {
|
||||
QString path = QString::fromStdString(Settings::values.sdmc_dir);
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||
});
|
||||
|
||||
connect(ui->change_sdmc_dir, &QPushButton::clicked, this, [this]() {
|
||||
const QString dir_path = QFileDialog::getExistingDirectory(
|
||||
this, tr("Select SDMC Directory"), QString::fromStdString(Settings::values.sdmc_dir),
|
||||
QFileDialog::ShowDirsOnly);
|
||||
if (!dir_path.isEmpty()) {
|
||||
Settings::values.sdmc_dir = dir_path.toStdString();
|
||||
SetConfiguration();
|
||||
}
|
||||
});
|
||||
|
||||
connect(ui->toggle_virtual_sd, &QCheckBox::clicked, this, [this]() {
|
||||
ApplyConfiguration();
|
||||
SetConfiguration();
|
||||
});
|
||||
}
|
||||
|
||||
ConfigureStorage::~ConfigureStorage() = default;
|
||||
|
||||
void ConfigureStorage::SetConfiguration() {
|
||||
ui->nand_group->setVisible(Settings::values.use_virtual_sd);
|
||||
QString nand_path = QString::fromStdString(Settings::values.nand_dir);
|
||||
ui->nand_dir_path->setText(nand_path);
|
||||
ui->open_nand_dir->setEnabled(!Settings::values.nand_dir.empty());
|
||||
|
||||
ui->sdmc_group->setVisible(Settings::values.use_virtual_sd);
|
||||
QString sdmc_path = QString::fromStdString(Settings::values.sdmc_dir);
|
||||
ui->sdmc_dir_path->setText(sdmc_path);
|
||||
ui->open_sdmc_dir->setEnabled(!Settings::values.sdmc_dir.empty());
|
||||
|
||||
ui->toggle_virtual_sd->setChecked(Settings::values.use_virtual_sd);
|
||||
|
||||
ui->storage_group->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
||||
}
|
||||
|
||||
void ConfigureStorage::ApplyConfiguration() {
|
||||
Settings::values.use_virtual_sd = ui->toggle_virtual_sd->isChecked();
|
||||
}
|
||||
|
||||
void ConfigureStorage::RetranslateUI() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
// Copyright 2016 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class ConfigureStorage;
|
||||
}
|
||||
|
||||
class ConfigureStorage : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConfigureStorage(QWidget* parent = nullptr);
|
||||
~ConfigureStorage() override;
|
||||
|
||||
void ApplyConfiguration();
|
||||
void RetranslateUI();
|
||||
void SetConfiguration();
|
||||
|
||||
std::unique_ptr<Ui::ConfigureStorage> ui;
|
||||
};
|
@ -0,0 +1,188 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ConfigureStorage</class>
|
||||
<widget class="QWidget" name="ConfigureStorage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>681</width>
|
||||
<height>375</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_1">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="storage_group">
|
||||
<property name="title">
|
||||
<string>Storage</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="toggle_virtual_sd">
|
||||
<property name="text">
|
||||
<string>Use Virtual SD</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="nand_group">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>NAND Directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="nand_dir_path">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="open_nand_dir">
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>NOTE: this does not move the contents of the previous directory to the new one</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="change_nand_dir">
|
||||
<property name="text">
|
||||
<string>Change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="sdmc_group">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>SDMC Directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="sdmc_dir_path">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="open_sdmc_dir">
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>NOTE: this does not move the contents of the previous directory to the new one</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="change_sdmc_dir">
|
||||
<property name="text">
|
||||
<string>Change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue