diff --git a/src/app/launcher/launcher.cpp b/src/app/launcher/launcher.cpp index 91184dd..0fa0209 100644 --- a/src/app/launcher/launcher.cpp +++ b/src/app/launcher/launcher.cpp @@ -23,10 +23,6 @@ Launcher::Launcher(QObject *parent) : mainWindow(qobject_cast(parent)), app_dir(QDir(QCoreApplication::applicationDirPath())) { - if (!mainWindow) { - qCritical() << "Failed to cast parent object to MainWindow"; - } - OS_type = "linux"; #ifdef Q_OS_WIN QString vcsBinPath = app_dir.absoluteFilePath(".vcs/bin"); @@ -46,11 +42,7 @@ Launcher::~Launcher() { void Launcher::startProcess(QString &username, QString &uuid, QString &access_token) { - if (run_status) { - qDebug() << "Process is already running"; - return; - } - run_status = true; + if (run_status) { return; } run_status = true; selected_profile = this->mainWindow->ui->selected_profile->currentText(); client_dir = app_dir.absolutePath() + "/" + selected_profile; @@ -65,20 +57,8 @@ void Launcher::startProcess(QString &username, QString &uuid, QString &access_to garbarge_collector = garbarge_collector.isEmpty() ? "default_collector" : garbarge_collector; version = "1.12.2"; } - arguments = get_args->getCrossPlatformArgs(RAM, username, uuid, access_token, garbarge_collector); - if (version == "1.12.2") { - sync_dirs - << "java/zulu8" - << "versions/1.12.2" - << "libraries/1.12.2" - << selected_profile; - sync_files - << "PunkLauncher" - << "PunkLauncher.exe"; - } - QEventLoop loop; connect(this, &Launcher::updateFinished, &loop, &QEventLoop::quit); update(); @@ -86,9 +66,8 @@ void Launcher::startProcess(QString &username, QString &uuid, QString &access_to process->setWorkingDirectory(client_dir); process->start(java_path, arguments); - + this->mainWindow->hide(); if (!process->waitForStarted()) { - qDebug() << "Failed to start process"; qDebug() << process->errorString(); run_status = false; return; @@ -98,8 +77,6 @@ void Launcher::startProcess(QString &username, QString &uuid, QString &access_to this->mainWindow->show(); run_status = false; }); - - this->mainWindow->hide(); } @@ -121,7 +98,6 @@ void Launcher::update() { } } }); - connect(rsyncProcess, &QProcess::readyReadStandardError, [this, rsyncProcess]() { QString errorOutput = rsyncProcess->readAllStandardError(); this->mainWindow->ui->download_bar->setText(errorOutput); @@ -130,23 +106,30 @@ void Launcher::update() { QStringList rsyncArgs; rsyncArgs << "-azH" << "--info=progress2" << "--no-perms" << "--no-owner" << "--no-group"; + if (version == "1.12.2") { + sync_dirs + << "java/zulu8" + << "versions/1.12.2" + << "libraries/1.12.2" + << selected_profile; + sync_files + << "PunkLauncher" + << "PunkLauncher.exe"; + } for (const QString &dir : sync_dirs) { rsyncArgs << "--include=" + dir + "/**"; } for (const QString &file : sync_files) { rsyncArgs << "--include=" + file; } - - QStringList excludeFiles = { + QStringList exclude_exist_files = { "./" + selected_profile + "/options.txt", "./" + selected_profile + "/optionsof.txt", "./" + selected_profile + "/optionsshaders.txt" - }; - - for (const QString &filePath : excludeFiles) { + }; + for (const QString &filePath : exclude_exist_files) { QFileInfo fileInfo(filePath); if (fileInfo.exists() && fileInfo.isFile()) { QString relativePath = QDir().relativeFilePath(fileInfo.absoluteFilePath()); rsyncArgs << "--exclude=" + relativePath; } } - rsyncArgs << "--exclude=./*"; rsyncArgs << "punkcraft.ru::PunkCraft/" + OS_type + "/uncompressed/" << "./"; @@ -163,8 +146,8 @@ void Launcher::update() { rsyncProcess->deleteLater(); rsyncProcess2->setWorkingDirectory(app_dir.absolutePath()); - QStringList modsArgs; - modsArgs + QStringList rsyncArgs2; + rsyncArgs2 << "-azH" << "--info=progress2" << "--no-perms" << "--no-owner" << "--no-group" << "--delete-after" << "--include=" + selected_profile << "--include=" + selected_profile + "/mods/" @@ -175,7 +158,7 @@ void Launcher::update() { << "--exclude=" + selected_profile + "/*" << "punkcraft.ru::PunkCraft/" + OS_type + "/uncompressed/" << "./"; - rsyncProcess2->start("rsync", modsArgs); + rsyncProcess2->start("rsync", rsyncArgs2); connect(rsyncProcess2, QOverload::of(&QProcess::finished), [this, rsyncProcess2]() { rsyncProcess2->deleteLater(); diff --git a/src/resources/main/banner.jpg b/src/resources/main/banner.jpg deleted file mode 100644 index 16e1eb2..0000000 Binary files a/src/resources/main/banner.jpg and /dev/null differ diff --git a/src/resources/main/banner.kra b/src/resources/main/banner.kra new file mode 100644 index 0000000..9fed93e Binary files /dev/null and b/src/resources/main/banner.kra differ diff --git a/src/resources/main/banner.png b/src/resources/main/banner.png new file mode 100644 index 0000000..0a74bfc Binary files /dev/null and b/src/resources/main/banner.png differ diff --git a/src/resources/mainwindow.ui b/src/resources/mainwindow.ui index 4fdff4f..e805718 100644 --- a/src/resources/mainwindow.ui +++ b/src/resources/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 1009 - 658 + 657 @@ -176,7 +176,7 @@ QLineEdit::placeholder { } - 1 + 2 @@ -480,7 +480,7 @@ QPushButton:pressed { QWidget#CyberExtrieme { - border-image: url(:/main/banner.jpg) 0 0 0 0 stretch stretch; + border-image: url(:/main/banner.png) 0 0 0 0 stretch stretch; } @@ -525,8 +525,8 @@ QPushButton:pressed { - 280 - 32 + 320 + 45 @@ -566,7 +566,7 @@ QPushButton:pressed { и styleSheet виджета, поэтому пользуемся :) Здесь padding-left как затычка чтобы в глаза не бросалось */ - padding-left: 60px; + padding-left: 85px; } diff --git a/src/resources/resources.qrc b/src/resources/resources.qrc index 2bfb2dc..2ab6fda 100644 --- a/src/resources/resources.qrc +++ b/src/resources/resources.qrc @@ -1,11 +1,11 @@ + main/banner.png auth/logo.png app.ico main/selected_profile.png main/settings_pressed_32x32.png main/settings_hover_32x32.png main/settings_32x32.png - main/banner.jpg