mirror of
https://github.com/libretro/Play-.git
synced 2025-03-03 16:57:03 +00:00
linux: VFS manager ui
This commit is contained in:
parent
e28de4895c
commit
25ff166e15
159
Source/ui_unix/VfsDevice.cpp
Normal file
159
Source/ui_unix/VfsDevice.cpp
Normal file
@ -0,0 +1,159 @@
|
||||
#include "VfsDevice.h"
|
||||
#include "AppConfig.h"
|
||||
#include "PS2VM_Preferences.h"
|
||||
#include "vfsdiscselectordialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QStorageInfo>
|
||||
|
||||
CDevice::CDevice()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////
|
||||
//CDevice Implementation
|
||||
///////////////////////////////////////////
|
||||
|
||||
CDevice::~CDevice()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
//CDirectoryDevice Implementation
|
||||
///////////////////////////////////////////
|
||||
|
||||
CDirectoryDevice::CDirectoryDevice(const char* sName, const char* sPreference)
|
||||
{
|
||||
m_sName = sName;
|
||||
m_sPreference = sPreference;
|
||||
m_sValue = CAppConfig::GetInstance().GetPreferenceString(m_sPreference);
|
||||
}
|
||||
|
||||
CDirectoryDevice::~CDirectoryDevice()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const char* CDirectoryDevice::GetDeviceName()
|
||||
{
|
||||
return m_sName;
|
||||
}
|
||||
|
||||
const char* CDirectoryDevice::GetBindingType()
|
||||
{
|
||||
return "Directory";
|
||||
}
|
||||
|
||||
const char* CDirectoryDevice::GetBinding()
|
||||
{
|
||||
return m_sValue.c_str();
|
||||
}
|
||||
|
||||
|
||||
void CDirectoryDevice::Save()
|
||||
{
|
||||
CAppConfig::GetInstance().SetPreferenceString(m_sPreference, m_sValue.c_str());
|
||||
}
|
||||
|
||||
bool CDirectoryDevice::RequestModification(QWidget *parent)
|
||||
{
|
||||
QFileDialog dialog(parent);
|
||||
dialog.setFileMode(QFileDialog::Directory);
|
||||
dialog.setOption(QFileDialog::ShowDirsOnly);
|
||||
dialog.setOption(QFileDialog::DontResolveSymlinks);
|
||||
if (dialog.exec())
|
||||
{
|
||||
QString fileName = dialog.selectedFiles().first();
|
||||
|
||||
m_sValue = fileName.toStdString();
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
//CCdrom0Device Implementation
|
||||
///////////////////////////////////////////
|
||||
|
||||
CCdrom0Device::CCdrom0Device()
|
||||
{
|
||||
const char* sPath = CAppConfig::GetInstance().GetPreferenceString(PS2VM_CDROM0PATH);
|
||||
|
||||
//Detect the binding type from the path format
|
||||
QString m_sPath(sPath);
|
||||
if (m_sPath.startsWith("\\\\.\\", Qt::CaseInsensitive) || m_sPath.startsWith("/dev/", Qt::CaseInsensitive))
|
||||
{
|
||||
m_nBindingType = CDevice::BINDING_PHYSICAL;
|
||||
m_sImagePath = sPath;
|
||||
} else {
|
||||
m_nBindingType = CDevice::BINDING_IMAGE;
|
||||
if(!strcmp(sPath, ""))
|
||||
{
|
||||
m_sImagePath = "";
|
||||
} else {
|
||||
m_sImagePath = sPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CCdrom0Device::~CCdrom0Device()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const char* CCdrom0Device::GetDeviceName()
|
||||
{
|
||||
return "cdrom0";
|
||||
}
|
||||
|
||||
const char* CCdrom0Device::GetBindingType()
|
||||
{
|
||||
if(m_nBindingType == CDevice::BINDING_PHYSICAL)
|
||||
{
|
||||
return "Physical Device";
|
||||
}
|
||||
if(m_nBindingType == CDevice::BINDING_IMAGE)
|
||||
{
|
||||
return "Disk Image";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* CCdrom0Device::GetBinding()
|
||||
{
|
||||
if(m_sImagePath.length() == 0)
|
||||
{
|
||||
return "(None)";
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_sImagePath.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
void CCdrom0Device::Save()
|
||||
{
|
||||
CAppConfig::GetInstance().SetPreferenceString(PS2VM_CDROM0PATH, m_sImagePath.c_str());
|
||||
|
||||
}
|
||||
|
||||
bool CCdrom0Device::RequestModification(QWidget *parent)
|
||||
{
|
||||
bool res = false;
|
||||
VFSDiscSelectorDialog* vfsds = new VFSDiscSelectorDialog(m_sImagePath, m_nBindingType, parent);
|
||||
VFSDiscSelectorDialog::connect(vfsds, &VFSDiscSelectorDialog::onFinish, [=](QString res, BINDINGTYPE type)
|
||||
{
|
||||
m_nBindingType = type;
|
||||
m_sImagePath = res.toStdString();
|
||||
});
|
||||
res = QDialog::Accepted == vfsds->exec();
|
||||
delete vfsds;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
61
Source/ui_unix/VfsDevice.h
Normal file
61
Source/ui_unix/VfsDevice.h
Normal file
@ -0,0 +1,61 @@
|
||||
#ifndef VFSDEVICE_H
|
||||
#define VFSDEVICE_H
|
||||
#include <QWidget>
|
||||
#include <map>
|
||||
|
||||
class CDevice
|
||||
{
|
||||
public:
|
||||
CDevice();
|
||||
virtual ~CDevice();
|
||||
virtual const char* GetDeviceName() = 0 ;
|
||||
virtual const char* GetBindingType() = 0;
|
||||
virtual const char* GetBinding() = 0;
|
||||
virtual bool RequestModification(QWidget*) = 0;
|
||||
virtual void Save() = 0;
|
||||
enum BINDINGTYPE
|
||||
{
|
||||
BINDING_IMAGE = 1,
|
||||
BINDING_PHYSICAL = 2,
|
||||
};
|
||||
typedef std::map<unsigned int, CDevice *> DeviceList;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CDirectoryDevice : public CDevice
|
||||
{
|
||||
public:
|
||||
CDirectoryDevice(const char*, const char*);
|
||||
virtual ~CDirectoryDevice();
|
||||
|
||||
virtual const char* GetDeviceName() override;
|
||||
virtual const char* GetBindingType() override;
|
||||
virtual const char* GetBinding() override;
|
||||
virtual bool RequestModification(QWidget*) override;
|
||||
virtual void Save() override;
|
||||
private:
|
||||
|
||||
const char* m_sName;
|
||||
const char* m_sPreference;
|
||||
std::string m_sValue;
|
||||
};
|
||||
|
||||
class CCdrom0Device : public CDevice
|
||||
{
|
||||
public:
|
||||
CCdrom0Device();
|
||||
virtual ~CCdrom0Device();
|
||||
|
||||
virtual const char* GetDeviceName() override;
|
||||
virtual const char* GetBindingType() override;
|
||||
virtual const char* GetBinding() override;
|
||||
virtual bool RequestModification(QWidget*) override;
|
||||
virtual void Save() override;
|
||||
|
||||
private:
|
||||
std::string m_sImagePath;
|
||||
BINDINGTYPE m_nBindingType;
|
||||
};
|
||||
|
||||
#endif // VFSDEVICE_H
|
@ -9,6 +9,7 @@
|
||||
#include <QTimer>
|
||||
#include <QWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QStorageInfo>
|
||||
|
||||
#include "GSH_OpenGLQt.h"
|
||||
#include "tools/PsfPlayer/Source/SH_OpenAL.h"
|
||||
@ -20,6 +21,7 @@
|
||||
#include "PreferenceDefs.h"
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
#include "vfsmanagerdialog.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
@ -431,3 +433,9 @@ void MainWindow::on_actionMemory_Card_Manager_triggered()
|
||||
MemoryCardManagerDialog mcm;
|
||||
mcm.exec();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionVFS_Manager_triggered()
|
||||
{
|
||||
VFSManagerDialog vfsmgr;
|
||||
vfsmgr.exec();
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ private slots:
|
||||
void on_actionPause_when_focus_is_lost_triggered(bool checked);
|
||||
void on_actionReset_triggered();
|
||||
void on_actionMemory_Card_Manager_triggered();
|
||||
void on_actionVFS_Manager_triggered();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
131
Source/ui_unix/vfsdiscselectordialog.cpp
Normal file
131
Source/ui_unix/vfsdiscselectordialog.cpp
Normal file
@ -0,0 +1,131 @@
|
||||
#include "vfsdiscselectordialog.h"
|
||||
#include "ui_vfsdiscselectordialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
VFSDiscSelectorDialog::VFSDiscSelectorDialog(std::string m_sImagePath, CDevice::BINDINGTYPE m_nBindingType, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::VFSDiscSelectorDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
res = QString(m_sImagePath.c_str());
|
||||
|
||||
refresh_disc_drive();
|
||||
if (m_nBindingType == CDevice::BINDING_IMAGE)
|
||||
{
|
||||
ui->lineEdit->setText(res);
|
||||
on_disc_image_radioButton_clicked();
|
||||
ui->disc_image_radioButton->setChecked(true);
|
||||
} else {
|
||||
on_cd_device_radioButton_clicked();
|
||||
ui->cd_device_radioButton->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
VFSDiscSelectorDialog::~VFSDiscSelectorDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void VFSDiscSelectorDialog::on_iso_browse_button_clicked()
|
||||
{
|
||||
QFileDialog dialog(this);
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
dialog.setNameFilter(tr("All supported types(*.iso *.bin *.isz *.cso);;UltraISO Compressed Disk Images (*.isz);;CISO Compressed Disk Images (*.cso);;All files (*.*)"));
|
||||
if (dialog.exec())
|
||||
{
|
||||
res = dialog.selectedFiles().first();
|
||||
ui->lineEdit->setText(res);
|
||||
}
|
||||
}
|
||||
|
||||
void VFSDiscSelectorDialog::on_refresh_disc_drive_button_clicked()
|
||||
{
|
||||
refresh_disc_drive();
|
||||
}
|
||||
|
||||
void VFSDiscSelectorDialog::refresh_disc_drive()
|
||||
{
|
||||
discInfo.clear();
|
||||
ui->comboBox->clear();
|
||||
foreach (const QStorageInfo &storage, QStorageInfo::mountedVolumes())
|
||||
{
|
||||
if (storage.isValid() && storage.isReady())
|
||||
{
|
||||
QString FS(storage.fileSystemType());
|
||||
if (QString::compare(FS, "UDF", Qt::CaseInsensitive) == 0 || QString::compare(FS, "ISO9660", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
QString device(storage.device());
|
||||
QString name;
|
||||
if (!storage.name().isNull())
|
||||
{
|
||||
name = storage.name();
|
||||
} else {
|
||||
name = "Unknown";
|
||||
}
|
||||
QString item("%1 (%2)");
|
||||
ui->comboBox->addItem(item.arg(device).arg(name));
|
||||
discInfo.append(storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
ui->comboBox->setEnabled(!discInfo.isEmpty());
|
||||
if (res.startsWith("////", Qt::CaseInsensitive) || res.startsWith("/dev/", Qt::CaseInsensitive))
|
||||
{
|
||||
for (int i = 0; i < discInfo.size(); i++)
|
||||
{
|
||||
QString device(discInfo.at(i).device());
|
||||
if (QString::compare(device, res, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
ui->comboBox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VFSDiscSelectorDialog::accept()
|
||||
{
|
||||
if (ui->disc_image_radioButton->isChecked())
|
||||
{
|
||||
if (!ui->lineEdit->text().isEmpty())
|
||||
{
|
||||
emit onFinish(ui->lineEdit->text(), CDevice::BINDING_IMAGE);
|
||||
return QDialog::accept();
|
||||
}
|
||||
} else {
|
||||
if (ui->comboBox->currentIndex() > -1)
|
||||
{
|
||||
emit onFinish(QString(discInfo.at(ui->comboBox->currentIndex()).device()), CDevice::BINDING_PHYSICAL);
|
||||
return QDialog::accept();
|
||||
}
|
||||
}
|
||||
QMessageBox messageBox;
|
||||
messageBox.critical(this,"Error","Invalid selection, please try again.");
|
||||
messageBox.show();
|
||||
}
|
||||
void VFSDiscSelectorDialog::on_comboBox_currentIndexChanged(int index)
|
||||
{
|
||||
if (discInfo.size() > 0){
|
||||
res = QString(discInfo.at(index).device());
|
||||
}
|
||||
}
|
||||
|
||||
void VFSDiscSelectorDialog::on_disc_image_radioButton_clicked()
|
||||
{
|
||||
ui->lineEdit->setEnabled(true);
|
||||
ui->iso_browse_button->setEnabled(true);
|
||||
|
||||
ui->comboBox->setEnabled(false);
|
||||
ui->refresh_disc_drive_button->setEnabled(false);
|
||||
}
|
||||
|
||||
void VFSDiscSelectorDialog::on_cd_device_radioButton_clicked()
|
||||
{
|
||||
ui->comboBox->setEnabled(!discInfo.isEmpty());
|
||||
ui->refresh_disc_drive_button->setEnabled(true);
|
||||
|
||||
ui->lineEdit->setEnabled(false);
|
||||
ui->iso_browse_button->setEnabled(false);
|
||||
}
|
41
Source/ui_unix/vfsdiscselectordialog.h
Normal file
41
Source/ui_unix/vfsdiscselectordialog.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef VFSDISCSELECTORDIALOG_H
|
||||
#define VFSDISCSELECTORDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QStorageInfo>
|
||||
|
||||
#include "VfsDevice.h"
|
||||
|
||||
namespace Ui {
|
||||
class VFSDiscSelectorDialog;
|
||||
}
|
||||
|
||||
class VFSDiscSelectorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VFSDiscSelectorDialog(std::string, CDevice::BINDINGTYPE,QWidget *parent = 0);
|
||||
~VFSDiscSelectorDialog();
|
||||
|
||||
protected:
|
||||
void accept() Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void on_iso_browse_button_clicked();
|
||||
void on_refresh_disc_drive_button_clicked();
|
||||
void on_comboBox_currentIndexChanged(int index);
|
||||
void on_disc_image_radioButton_clicked();
|
||||
void on_cd_device_radioButton_clicked();
|
||||
|
||||
signals:
|
||||
void onFinish(QString, CDevice::BINDINGTYPE);
|
||||
|
||||
private:
|
||||
Ui::VFSDiscSelectorDialog *ui;
|
||||
QString res;
|
||||
QList<QStorageInfo> discInfo;
|
||||
void refresh_disc_drive();
|
||||
};
|
||||
|
||||
#endif // VFSDISCSELECTORDIALOG_H
|
42
Source/ui_unix/vfsmanagerdialog.cpp
Normal file
42
Source/ui_unix/vfsmanagerdialog.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include "vfsmanagerdialog.h"
|
||||
#include "ui_vfsmanagerdialog.h"
|
||||
#include "vfsmodel.h"
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include "AppConfig.h"
|
||||
#include "PS2VM_Preferences.h"
|
||||
|
||||
VFSManagerDialog::VFSManagerDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::VFSManagerDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
VFSModel* model= new VFSModel(this);
|
||||
model->setHeaderData(1, Qt::Orientation::Horizontal, QVariant("Device"), Qt::DisplayRole);
|
||||
model->setHeaderData(1, Qt::Orientation::Horizontal, QVariant("Binding Type"), Qt::DisplayRole);
|
||||
model->setHeaderData(1, Qt::Orientation::Horizontal, QVariant("Binding Value"), Qt::DisplayRole);
|
||||
ui->tableView->setModel(model);
|
||||
ui->tableView->horizontalHeader()->setStretchLastSection(true);
|
||||
ui->tableView->resizeColumnsToContents();
|
||||
|
||||
}
|
||||
|
||||
VFSManagerDialog::~VFSManagerDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void VFSManagerDialog::on_tableView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
VFSModel* model = static_cast<VFSModel*>(ui->tableView->model());
|
||||
model->doubleClicked(index, this);
|
||||
}
|
||||
|
||||
|
||||
void VFSManagerDialog::accept()
|
||||
{
|
||||
VFSModel* model = static_cast<VFSModel*>(ui->tableView->model());
|
||||
model->Save();
|
||||
CAppConfig::GetInstance().Save();
|
||||
QDialog::accept();
|
||||
}
|
31
Source/ui_unix/vfsmanagerdialog.h
Normal file
31
Source/ui_unix/vfsmanagerdialog.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef VFSMANAGERDIALOG_H
|
||||
#define VFSMANAGERDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "VfsDevice.h"
|
||||
|
||||
namespace Ui {
|
||||
class VFSManagerDialog;
|
||||
}
|
||||
|
||||
class VFSManagerDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VFSManagerDialog(QWidget *parent = 0);
|
||||
~VFSManagerDialog();
|
||||
Ui::VFSManagerDialog *ui;
|
||||
void UpdateList();
|
||||
|
||||
protected:
|
||||
void accept() Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void on_tableView_doubleClicked(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
CDevice::DeviceList m_devices;
|
||||
};
|
||||
|
||||
#endif // VFSMANAGERDIALOG_H
|
106
Source/ui_unix/vfsmodel.cpp
Normal file
106
Source/ui_unix/vfsmodel.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
#include "vfsmodel.h"
|
||||
#include "vfsmanagerdialog.h"
|
||||
|
||||
VFSModel::VFSModel(QObject *parent)
|
||||
:QAbstractTableModel(parent)
|
||||
{
|
||||
setupDevices();
|
||||
}
|
||||
|
||||
VFSModel::~VFSModel()
|
||||
{
|
||||
for (int i = 0; i < m_devices.size(); i++ )
|
||||
{
|
||||
delete m_devices.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
int VFSModel::rowCount(const QModelIndex & /*parent*/) const
|
||||
{
|
||||
return m_devices.size();
|
||||
}
|
||||
|
||||
int VFSModel::columnCount(const QModelIndex & /*parent*/) const
|
||||
{
|
||||
if (m_devices.size() > 0) {
|
||||
return 3;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
QVariant VFSModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
CDevice* m_device = m_devices.at(index.row());
|
||||
const char* val = "";
|
||||
switch (index.column())
|
||||
{
|
||||
case 0:
|
||||
val = m_device->GetDeviceName();
|
||||
break;
|
||||
case 1:
|
||||
val = m_device->GetBindingType();
|
||||
break;
|
||||
case 2:
|
||||
val = m_device->GetBinding();
|
||||
break;
|
||||
}
|
||||
return QVariant(val);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void VFSModel::setupDevices()
|
||||
{
|
||||
m_devices[0] = new CDirectoryDevice("mc0", "ps2.mc0.directory");
|
||||
m_devices[1] = new CDirectoryDevice("mc1", "ps2.mc1.directory");
|
||||
m_devices[2] = new CDirectoryDevice("host", "ps2.host.directory");
|
||||
m_devices[3] = new CCdrom0Device();
|
||||
}
|
||||
|
||||
bool VFSModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
|
||||
{
|
||||
if (orientation == Qt::Horizontal)
|
||||
{
|
||||
|
||||
if(role == Qt::DisplayRole)
|
||||
{
|
||||
m_h_header.insert(section, value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QAbstractTableModel::setHeaderData(section, orientation, value, role);
|
||||
}
|
||||
|
||||
QVariant VFSModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (orientation == Qt::Horizontal)
|
||||
{
|
||||
if(role == Qt::BackgroundRole)
|
||||
return QVariant(QBrush(QColor(Qt::green), Qt::SolidPattern));
|
||||
|
||||
if(role == Qt::DisplayRole)
|
||||
{
|
||||
if (section < m_h_header.size())
|
||||
return m_h_header.at(section);
|
||||
}
|
||||
}
|
||||
|
||||
return QAbstractTableModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
void VFSModel::doubleClicked(const QModelIndex &index, QWidget* parent)
|
||||
{
|
||||
CDevice* m_device = m_devices.at(index.row());
|
||||
m_device->RequestModification(parent);
|
||||
}
|
||||
|
||||
void VFSModel::Save()
|
||||
{
|
||||
for (int i = 0; i < m_devices.size(); i++ )
|
||||
{
|
||||
m_devices.at(i)->Save();
|
||||
}
|
||||
}
|
31
Source/ui_unix/vfsmodel.h
Normal file
31
Source/ui_unix/vfsmodel.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef VFSMODEL_H
|
||||
#define VFSMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include "VfsDevice.h"
|
||||
|
||||
class VFSModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VFSModel(QObject *parent);
|
||||
~VFSModel();
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const ;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
||||
void addData(const QStringList data) const;
|
||||
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
|
||||
void doubleClicked(const QModelIndex &index, QWidget *parent = 0);
|
||||
void Save();
|
||||
|
||||
protected:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
CDevice::DeviceList m_devices;
|
||||
QVariantList m_h_header;
|
||||
|
||||
void setupDevices();
|
||||
};
|
||||
#endif // VFSMODEL_H
|
@ -60,6 +60,7 @@
|
||||
</property>
|
||||
<addaction name="actionSettings"/>
|
||||
<addaction name="actionMemory_Card_Manager"/>
|
||||
<addaction name="actionVFS_Manager"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuVirtualMachine">
|
||||
<property name="title">
|
||||
@ -169,6 +170,11 @@
|
||||
<string>Memory Card Manager...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionVFS_Manager">
|
||||
<property name="text">
|
||||
<string>VFS Manager...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
@ -26,7 +26,12 @@ SOURCES += ../Source/ui_unix/main.cpp\
|
||||
../Source/ui_unix/settingsdialog.cpp \
|
||||
../Source/ui_unix/openglwindow.cpp \
|
||||
../Source/ui_unix/memorycardmanagerdialog.cpp \
|
||||
../Source/ui_unix/MemoryCard.cpp
|
||||
../Source/ui_unix/MemoryCard.cpp \
|
||||
../Source/ui_unix/vfsmanagerdialog.cpp \
|
||||
../Source/ui_unix/vfsmodel.cpp \
|
||||
../Source/ui_unix/vfsdiscselectordialog.cpp \
|
||||
../Source/ui_unix/VfsDevice.cpp
|
||||
|
||||
|
||||
|
||||
HEADERS += ../Source/ui_unix/mainwindow.h \
|
||||
@ -37,12 +42,18 @@ HEADERS += ../Source/ui_unix/mainwindow.h \
|
||||
../Source/ui_unix/PreferenceDefs.h \
|
||||
../Source/ui_unix/openglwindow.h \
|
||||
../Source/ui_unix/memorycardmanagerdialog.h \
|
||||
../Source/ui_unix/MemoryCard.h
|
||||
../Source/ui_unix/MemoryCard.h \
|
||||
../Source/ui_unix/vfsmanagerdialog.h \
|
||||
../Source/ui_unix/vfsmodel.h \
|
||||
../Source/ui_unix/vfsdiscselectordialog.h \
|
||||
../Source/ui_unix/VfsDevice.h
|
||||
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
settingsdialog.ui \
|
||||
memorycardmanager.ui
|
||||
memorycardmanager.ui \
|
||||
vfsmanagerdialog.ui \
|
||||
vfsdiscselectordialog.ui
|
||||
|
||||
RESOURCES = resources.qrc
|
||||
|
||||
|
175
build_unix/vfsdiscselectordialog.ui
Normal file
175
build_unix/vfsdiscselectordialog.ui
Normal file
@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>VFSDiscSelectorDialog</class>
|
||||
<widget class="QDialog" name="VFSDiscSelectorDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>414</width>
|
||||
<height>210</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>ISO9660 Disk Image</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="disc_image_radioButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="iso_browse_button">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Physical CD/DVD Reader Device</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="cd_device_radioButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="refresh_disc_drive_button">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CD/DVD Device will be visible once the disc is inserted.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>VFSDiscSelectorDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>VFSDiscSelectorDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
102
build_unix/vfsmanagerdialog.ui
Normal file
102
build_unix/vfsmanagerdialog.ui
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>VFSManagerDialog</class>
|
||||
<widget class="QDialog" name="VFSManagerDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>578</width>
|
||||
<height>283</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Warning: Changing file system bindings while a program is running might be dangerous. Changes to 'cdrom0' bindings will take effect next time you load an executable.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableView" name="tableView">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="gridStyle">
|
||||
<enum>Qt::NoPen</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderHighlightSections">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>VFSManagerDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>VFSManagerDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user