Upload code.
This commit is contained in:
parent
7ba7a98c10
commit
3ab76774f8
|
@ -1,3 +1,6 @@
|
|||
# parallel_desktop_launcher
|
||||
A full free pd launcher for the user of Parallels Desktop v17.0.1 and below.
|
||||
|
||||
A full free pd launcher for the user of Parallels Desktop v17.0.1 and below.
|
||||
I think it's no need for anyone to spend 30~50 yuan to buy a launcher, so I spent 10 minutes building a simple, free and open source program to replace the free technology that someone is selling at a premium.
|
||||
|
||||
Enjoy it.
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#include "pdlauncher.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
PDLauncher w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
#include "pdlauncher.h"
|
||||
#include "ui_pdlauncher.h"
|
||||
#include <QProcess>
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
|
||||
PDLauncher::PDLauncher(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::PDLauncher)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
PDLauncher::~PDLauncher()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void PDLauncher::on_other_clicked(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
ui->windows10->setChecked(false);
|
||||
ui->windows11->setChecked(false);
|
||||
ui->ubuntu->setChecked(false);
|
||||
ui->other_le->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PDLauncher::on_quit_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
void PDLauncher::on_start_clicked()
|
||||
{
|
||||
QProcess process;
|
||||
QString command = "/usr/local/bin/prlctl start ";
|
||||
if (ui->windows10->isChecked())
|
||||
{
|
||||
process.start(command+"\"Windows 10\"");
|
||||
}
|
||||
else if (ui->windows11->isChecked())
|
||||
{
|
||||
process.start(command+"\"Windows 11\"");
|
||||
}
|
||||
else if (ui->ubuntu->isChecked())
|
||||
{
|
||||
process.start(command+"\"Ubuntu Linux\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
process.start(command+"\""+ui->other_le->text()+"\"");
|
||||
}
|
||||
process.waitForFinished();
|
||||
QMessageBox msgbox;
|
||||
msgbox.setText(process.readAllStandardOutput());
|
||||
msgbox.setButtonText(QMessageBox::Ok,"好");
|
||||
msgbox.exec();
|
||||
}
|
||||
|
||||
|
||||
void PDLauncher::on_windows10_clicked(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
ui->other->setChecked(false);
|
||||
ui->windows11->setChecked(false);
|
||||
ui->ubuntu->setChecked(false);
|
||||
ui->other_le->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PDLauncher::on_windows11_clicked(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
ui->other->setChecked(false);
|
||||
ui->windows10->setChecked(false);
|
||||
ui->ubuntu->setChecked(false);
|
||||
ui->other_le->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PDLauncher::on_ubuntu_clicked(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
ui->windows10->setChecked(false);
|
||||
ui->windows11->setChecked(false);
|
||||
ui->other->setChecked(false);
|
||||
ui->other_le->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef PDLAUNCHER_H
|
||||
#define PDLAUNCHER_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class PDLauncher; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class PDLauncher : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PDLauncher(QWidget *parent = nullptr);
|
||||
~PDLauncher();
|
||||
|
||||
private slots:
|
||||
void on_other_clicked(bool checked);
|
||||
|
||||
void on_quit_clicked();
|
||||
|
||||
void on_start_clicked();
|
||||
|
||||
void on_windows10_clicked(bool checked);
|
||||
|
||||
void on_windows11_clicked(bool checked);
|
||||
|
||||
void on_ubuntu_clicked(bool checked);
|
||||
|
||||
private:
|
||||
Ui::PDLauncher *ui;
|
||||
};
|
||||
#endif // PDLAUNCHER_H
|
|
@ -0,0 +1,25 @@
|
|||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
CONFIG += c++11
|
||||
TARGET = PD启动器
|
||||
|
||||
# You can make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
pdlauncher.cpp
|
||||
|
||||
HEADERS += \
|
||||
pdlauncher.h
|
||||
|
||||
FORMS += \
|
||||
pdlauncher.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
|
@ -0,0 +1,127 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PDLauncher</class>
|
||||
<widget class="QMainWindow" name="PDLauncher">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>306</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>PD启动器</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="1,5,5,5,5,5,5" columnstretch="5,5,1,1,1,5">
|
||||
<item row="0" column="0" rowspan="7">
|
||||
<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 row="3" column="1">
|
||||
<widget class="QRadioButton" name="ubuntu">
|
||||
<property name="text">
|
||||
<string>Ubuntu Linux</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="4">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="4">
|
||||
<widget class="QLineEdit" name="other_le">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QRadioButton" name="windows10">
|
||||
<property name="text">
|
||||
<string>Windows 10</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QRadioButton" name="other">
|
||||
<property name="text">
|
||||
<string>其他:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5" rowspan="7">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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 row="6" column="1" colspan="4">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QRadioButton" name="windows11">
|
||||
<property name="text">
|
||||
<string>Windows 11</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QPushButton" name="quit">
|
||||
<property name="text">
|
||||
<string>退出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="start">
|
||||
<property name="text">
|
||||
<string>启动</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue