初步多线程

This commit is contained in:
gfdgd xi 2024-01-02 22:40:51 +08:00
parent c4b977c31c
commit 42516f874a
6 changed files with 144 additions and 6 deletions

@ -11,15 +11,18 @@ CONFIG += c++17
SOURCES += \
about_this_program.cpp \
main.cpp \
mainwindow.cpp
mainwindow.cpp \
qr.cpp
HEADERS += \
about_this_program.h \
mainwindow.h
mainwindow.h \
qr.h
FORMS += \
about_this_program.ui \
mainwindow.ui
mainwindow.ui \
qr.ui
TRANSLATIONS += \
deep-wine-runner-cpp_zh_CN.ts

@ -17,7 +17,8 @@
#include <QFile>
#include <QProcess>
using namespace std;
QComboBox *MainWindow::e1;
QMap<QString, QString> MainWindow::setting;
MainWindow::MainWindow(){
/*********
*
@ -198,6 +199,24 @@ MainWindow::MainWindow(){
if(o1->currentText() == ""){
o1->addItem("没有识别到任何Wine请在菜单栏“程序”安装Wine或安装任意Wine应用");
}
QObject::connect(button3, &QPushButton::clicked, [&](){
Runexebutton_threading *thread = new Runexebutton_threading();
thread->start();
});
}
void MainWindow::Runexebutton_threading::run(){
if(e1->currentText() == ""){
QString wineBottlePath = setting.value("DefultBotton");
}
else{
QString wineBottlePath = e1->currentText();
}
QString option = "";
if(setting.value("Architecture") != "Auto"){
QString option = option + "WINEARCH=" + setting.value("Architecture") + " ";
}
}
void MainWindow::DisableButton(bool things){

@ -6,6 +6,7 @@
#include <QCoreApplication>
#include <QPushButton>
#include <QComboBox>
#include <QThread>
class MainWindow
{
@ -21,8 +22,17 @@ public:
QString GetCommandResult(QString command);
private:
class Runexebutton_threading: public QThread{
signals:
void signal(QString str);
void showHistory(QString str);
public:
void run();
};
void runexebutton();
void DisableButton(bool things);
QString lastRunCommand = "";
QString homePath = QDir::homePath();
QString programPath = QCoreApplication::applicationDirPath();
QMap<QString, QString> wine;
@ -35,7 +45,7 @@ private:
QStringList wineBottonHistory;
QStringList isoPath;
QStringList isoPathFound;
QMap<QString, QString> setting;
static QMap<QString, QString> setting;
// 控件
QPushButton *button_r_6;
QPushButton *button1;
@ -46,7 +56,7 @@ private:
QPushButton *getProgramIcon;
QPushButton *uninstallProgram;
QPushButton *trasButton;
QComboBox *e1;
static QComboBox *e1;
QComboBox *e2;
QComboBox *o1;

14
qr.cpp Normal file

@ -0,0 +1,14 @@
#include "qr.h"
#include "ui_qr.h"
QR::QR(QWidget *parent) :
QDialog(parent),
ui(new Ui::QR)
{
ui->setupUi(this);
}
QR::~QR()
{
delete ui;
}

22
qr.h Normal file

@ -0,0 +1,22 @@
#ifndef QR_H
#define QR_H
#include <QDialog>
namespace Ui {
class QR;
}
class QR : public QDialog
{
Q_OBJECT
public:
explicit QR(QWidget *parent = nullptr);
~QR();
private:
Ui::QR *ui;
};
#endif // QR_H

70
qr.ui Normal file

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QR</class>
<widget class="QDialog" name="QR">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>656</width>
<height>410</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="windowIcon">
<iconset resource="Resources.qrc">
<normaloff>:/Icon/deepin-wine-runner.svg</normaloff>:/Icon/deepin-wine-runner.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextBrowser" name="qRShow">
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans CJK SC'; font-size:10.5pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;如果您觉得 Wine 运行器对您有帮助,可以请作者吃点零食&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;(本来想说喝一杯咖啡的,但我不喝啊)&lt;/p&gt;
&lt;hr /&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;微信:&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/Icon/QR/Icon/QR/Wechat.png&quot; width=&quot;256&quot; /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;支付宝:&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/Icon/QR/Icon/QR/Alipay.jpg&quot; width=&quot;256&quot; /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;QQ&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/Icon/QR/Icon/QR/QQ.png&quot; width=&quot;256&quot; /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<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="ok">
<property name="text">
<string>确定</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="Resources.qrc"/>
</resources>
<connections/>
</ui>