mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-13 01:58:27 +08:00
更新UI+新增磁盘文件添加/导出/删除功能
This commit is contained in:
parent
5443654791
commit
466a7c5596
@ -215,13 +215,21 @@ void MainWindow::on_addQemuDisk_triggered()
|
||||
if(path == ""){
|
||||
return;
|
||||
}
|
||||
QDir dir(QDir::homePath() + "/Qemu/Windows/Windows.qcow2");
|
||||
QDir dir(QDir::homePath() + "/Qemu/Windows");
|
||||
if(!dir.exists()){
|
||||
dir.mkpath(QDir::homePath() + "/Qemu/Windows/Windows.qcow2");
|
||||
dir.mkpath(QDir::homePath() + "/Qemu/Windows");
|
||||
}
|
||||
if(!QFile::remove(QDir::homePath() + "/Qemu/Windows/Windows.qcow2") | !QFile::copy(path, QDir::homePath() + "/Qemu/Windows/Windows.qcow2")){
|
||||
QMessageBox::critical(this, "提示", "添加错误!");
|
||||
return;
|
||||
if(QFile::exists(QDir::homePath() + "/Qemu/Windows/Windows.qcow2")){
|
||||
if(!QFile::remove(QDir::homePath() + "/Qemu/Windows/Windows.qcow2") | !QFile::copy(path, QDir::homePath() + "/Qemu/Windows/Windows.qcow2")){
|
||||
QMessageBox::critical(this, "提示", "添加错误!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!QFile::copy(path, QDir::homePath() + "/Qemu/Windows/Windows.qcow2")){
|
||||
QMessageBox::critical(this, "提示", "添加错误!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
QMessageBox::information(this, "提示", "添加完成!");
|
||||
}
|
||||
@ -234,3 +242,29 @@ void MainWindow::on_delQemuDisk_triggered()
|
||||
}
|
||||
std::system(("xdg-open \"" + QDir::homePath() + "/Qemu/Windows/\"").toUtf8());
|
||||
}
|
||||
|
||||
void MainWindow::on_addQemuDiskButton_clicked()
|
||||
{
|
||||
MainWindow::on_addQemuDisk_triggered();
|
||||
}
|
||||
|
||||
void MainWindow::on_saveQemuDiskButton_clicked()
|
||||
{
|
||||
MainWindow::on_delQemuDisk_triggered();
|
||||
}
|
||||
|
||||
void MainWindow::on_delQemuDiskButton_clicked()
|
||||
{
|
||||
if(!QFile::exists(QDir::homePath() + "/Qemu/Windows/Windows.qcow2")){
|
||||
QMessageBox::information(this, "提示", "不存在磁盘文件,无法移除");
|
||||
return;
|
||||
}
|
||||
if(QMessageBox::question(this, "提示", "是否删除?\n删除后将无法恢复!") == QMessageBox::No){
|
||||
return;
|
||||
}
|
||||
if(!QFile::remove(QDir::homePath() + "/Qemu/Windows/Windows.qcow2")){
|
||||
QMessageBox::critical(this, "提示", "移除失败");
|
||||
return;
|
||||
}
|
||||
QMessageBox::information(this, "提示", "移除成功");
|
||||
}
|
||||
|
@ -38,6 +38,12 @@ private slots:
|
||||
|
||||
void on_delQemuDisk_triggered();
|
||||
|
||||
void on_addQemuDiskButton_clicked();
|
||||
|
||||
void on_saveQemuDiskButton_clicked();
|
||||
|
||||
void on_delQemuDiskButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
long m_cpuAll;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>807</width>
|
||||
<height>429</height>
|
||||
<width>1058</width>
|
||||
<height>512</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -25,7 +25,7 @@
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@ -142,6 +142,13 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="getQemu">
|
||||
<property name="text">
|
||||
<string>安装 Qemu</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="qemuSetting">
|
||||
<property name="text">
|
||||
@ -150,9 +157,23 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="getQemu">
|
||||
<widget class="QPushButton" name="addQemuDiskButton">
|
||||
<property name="text">
|
||||
<string>安装 Qemu</string>
|
||||
<string>添加/覆盖Qemu磁盘</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveQemuDiskButton">
|
||||
<property name="text">
|
||||
<string>导出Qemu磁盘</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="delQemuDiskButton">
|
||||
<property name="text">
|
||||
<string>移除Qemu磁盘</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -374,24 +395,6 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>807</width>
|
||||
<height>36</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuQemu">
|
||||
<property name="title">
|
||||
<string>Qemu磁盘镜像</string>
|
||||
</property>
|
||||
<addaction name="addQemuDisk"/>
|
||||
<addaction name="delQemuDisk"/>
|
||||
</widget>
|
||||
<addaction name="menuQemu"/>
|
||||
</widget>
|
||||
<action name="action">
|
||||
<property name="text">
|
||||
<string>退出</string>
|
||||
|
Loading…
Reference in New Issue
Block a user