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
|
||||
# 检查是否有 QEMU
|
||||
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的个数
|
||||
CpuCount=`cat /proc/cpuinfo| grep "processor"| wc -l`
|
||||
|
||||
|
@ -15,6 +15,8 @@ QemuSetting::QemuSetting(QWidget *parent) :
|
||||
ui(new Ui::QemuSetting)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
// 判断是否安装了 Wine 运行器
|
||||
ui->getrunner->setHidden(QFile::exists(QCoreApplication::applicationDirPath() + "/../mainwindow.py"));
|
||||
// 设置变量
|
||||
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());
|
||||
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");
|
||||
file.open(QIODevice::WriteOnly);
|
||||
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/"));
|
||||
}
|
||||
|
||||
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_enableVnc_stateChanged(int arg1);
|
||||
|
||||
void on_setDefault_clicked();
|
||||
|
||||
private:
|
||||
void SetDefaultValue();
|
||||
Ui::QemuSetting *ui;
|
||||
|
@ -159,8 +159,28 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<widget class="QPushButton" name="getrunner">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>获取
|
||||
Wine
|
||||
|
Loading…
Reference in New Issue
Block a user