From 3ab76774f886c20ec363cdb328749ccef78a2b58 Mon Sep 17 00:00:00 2001 From: Mentalflow <312902918@qq.com> Date: Tue, 19 Oct 2021 09:19:51 +0800 Subject: [PATCH] Upload code. --- README.md | 5 +- main.cpp | 11 +++++ pdlauncher.cpp | 100 ++++++++++++++++++++++++++++++++++++++ pdlauncher.h | 34 +++++++++++++ pdlauncher.pro | 25 ++++++++++ pdlauncher.ui | 127 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 main.cpp create mode 100644 pdlauncher.cpp create mode 100644 pdlauncher.h create mode 100644 pdlauncher.pro create mode 100644 pdlauncher.ui diff --git a/README.md b/README.md index bf068d7..341f3cf 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +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. diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..c1c6d74 --- /dev/null +++ b/main.cpp @@ -0,0 +1,11 @@ +#include "pdlauncher.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + PDLauncher w; + w.show(); + return a.exec(); +} diff --git a/pdlauncher.cpp b/pdlauncher.cpp new file mode 100644 index 0000000..0f0b471 --- /dev/null +++ b/pdlauncher.cpp @@ -0,0 +1,100 @@ +#include "pdlauncher.h" +#include "ui_pdlauncher.h" +#include +#include +#include + +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); + } +} + diff --git a/pdlauncher.h b/pdlauncher.h new file mode 100644 index 0000000..69badab --- /dev/null +++ b/pdlauncher.h @@ -0,0 +1,34 @@ +#ifndef PDLAUNCHER_H +#define PDLAUNCHER_H + +#include + +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 diff --git a/pdlauncher.pro b/pdlauncher.pro new file mode 100644 index 0000000..da1487c --- /dev/null +++ b/pdlauncher.pro @@ -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 diff --git a/pdlauncher.ui b/pdlauncher.ui new file mode 100644 index 0000000..99d8190 --- /dev/null +++ b/pdlauncher.ui @@ -0,0 +1,127 @@ + + + PDLauncher + + + + 0 + 0 + 306 + 191 + + + + PD启动器 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Ubuntu Linux + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + false + + + + + + + Windows 10 + + + + + + + 其他: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Windows 11 + + + true + + + + + + + 退出 + + + + + + + 启动 + + + + + + + + +