mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-12 17:48:27 +08:00
支持设置默认项
This commit is contained in:
parent
20fc7f75f2
commit
c0eb6410ee
@ -15,6 +15,12 @@ if [[ 0 == $? ]]; then
|
|||||||
fi
|
fi
|
||||||
# 检查是否有 QEMU
|
# 检查是否有 QEMU
|
||||||
if [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
if [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
||||||
|
if [[ -f "$HOME/.config/deepin-wine-runner/QemuSetting.json" ]]; then
|
||||||
|
echo 有设置文件,读设置文件
|
||||||
|
cd `dirname $0`
|
||||||
|
python3 ./VM/StartQemu.py
|
||||||
|
exit
|
||||||
|
fi
|
||||||
# 查看逻辑CPU的个数
|
# 查看逻辑CPU的个数
|
||||||
CpuCount=`cat /proc/cpuinfo| grep "processor"| wc -l`
|
CpuCount=`cat /proc/cpuinfo| grep "processor"| wc -l`
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ QemuSetting::QemuSetting(QWidget *parent) :
|
|||||||
ui(new Ui::QemuSetting)
|
ui(new Ui::QemuSetting)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
// 判断是否安装了 Wine 运行器
|
||||||
|
ui->getrunner->setHidden(QFile::exists(QCoreApplication::applicationDirPath() + "/../mainwindow.py"));
|
||||||
// 设置变量
|
// 设置变量
|
||||||
if(QFile::exists(QDir::homePath() + "/.config/deepin-wine-runner/QemuSetting.json")){
|
if(QFile::exists(QDir::homePath() + "/.config/deepin-wine-runner/QemuSetting.json")){
|
||||||
// 读取配置文件
|
// 读取配置文件
|
||||||
@ -89,6 +91,10 @@ void QemuSetting::on_save_clicked()
|
|||||||
object.insert("CPU", ui->cpuNumber->value());
|
object.insert("CPU", ui->cpuNumber->value());
|
||||||
qDebug() << QJsonDocument(object).toJson();
|
qDebug() << QJsonDocument(object).toJson();
|
||||||
// 读取配置文件
|
// 读取配置文件
|
||||||
|
QDir dir(QDir::homePath() + "/.config/deepin-wine-runner/");
|
||||||
|
if(!dir.exists()){
|
||||||
|
dir.mkpath(QDir::homePath() + "/.config/deepin-wine-runner/");
|
||||||
|
}
|
||||||
QFile file(QDir::homePath() + "/.config/deepin-wine-runner/QemuSetting.json");
|
QFile file(QDir::homePath() + "/.config/deepin-wine-runner/QemuSetting.json");
|
||||||
file.open(QIODevice::WriteOnly);
|
file.open(QIODevice::WriteOnly);
|
||||||
file.write(QJsonDocument(object).toJson());
|
file.write(QJsonDocument(object).toJson());
|
||||||
@ -105,3 +111,19 @@ void QemuSetting::on_getrunner_clicked()
|
|||||||
{
|
{
|
||||||
QDesktopServices::openUrl(QUrl("https://gitee.com/gfdgd-xi/deep-wine-runner/"));
|
QDesktopServices::openUrl(QUrl("https://gitee.com/gfdgd-xi/deep-wine-runner/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QemuSetting::on_enableVnc_stateChanged(int arg1)
|
||||||
|
{
|
||||||
|
// 控件的开启/关闭
|
||||||
|
ui->vncNumber->setEnabled(ui->enableVnc->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void QemuSetting::on_setDefault_clicked()
|
||||||
|
{
|
||||||
|
if(QMessageBox::question(this, "提示", "你确定要重置为默认?重置后将无法恢复") == QMessageBox::No){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QFile::remove(QDir::homePath() + "/.config/deepin-wine-runner/QemuSetting.json");
|
||||||
|
this->SetDefaultValue();
|
||||||
|
QMessageBox::information(this, "提示", "设置完成!");
|
||||||
|
}
|
||||||
|
@ -27,6 +27,10 @@ private slots:
|
|||||||
|
|
||||||
void on_getrunner_clicked();
|
void on_getrunner_clicked();
|
||||||
|
|
||||||
|
void on_enableVnc_stateChanged(int arg1);
|
||||||
|
|
||||||
|
void on_setDefault_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetDefaultValue();
|
void SetDefaultValue();
|
||||||
Ui::QemuSetting *ui;
|
Ui::QemuSetting *ui;
|
||||||
|
@ -159,8 +159,28 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="setDefault">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>重置
|
||||||
|
默认</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="getrunner">
|
<widget class="QPushButton" name="getrunner">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>获取
|
<string>获取
|
||||||
Wine
|
Wine
|
||||||
|
Loading…
Reference in New Issue
Block a user