|
@@ -11,7 +11,6 @@
|
|
#include "mainwindow_moc.h"
|
|
#include "mainwindow_moc.h"
|
|
#include "ui_mainwindow_moc.h"
|
|
#include "ui_mainwindow_moc.h"
|
|
|
|
|
|
-#include <QProcess>
|
|
|
|
#include <QDir>
|
|
#include <QDir>
|
|
|
|
|
|
#include "../lib/CConfigHandler.h"
|
|
#include "../lib/CConfigHandler.h"
|
|
@@ -22,9 +21,6 @@
|
|
#include "updatedialog_moc.h"
|
|
#include "updatedialog_moc.h"
|
|
#include "main.h"
|
|
#include "main.h"
|
|
|
|
|
|
-int __argc;
|
|
|
|
-char ** __argv;
|
|
|
|
-
|
|
|
|
void MainWindow::load()
|
|
void MainWindow::load()
|
|
{
|
|
{
|
|
// Set current working dir to executable folder.
|
|
// Set current working dir to executable folder.
|
|
@@ -116,48 +112,7 @@ MainWindow::~MainWindow()
|
|
delete ui;
|
|
delete ui;
|
|
}
|
|
}
|
|
|
|
|
|
-void MainWindow::startGame(const QStringList & args)
|
|
|
|
-{
|
|
|
|
- __argc = args.size() + 1; //first argument is omitted
|
|
|
|
- __argv = new char*[__argc];
|
|
|
|
- __argv[0] = "vcmiclient";
|
|
|
|
- for(int i = 1; i < __argc; ++i)
|
|
|
|
- {
|
|
|
|
- const char * s = args[i - 1].toLocal8Bit().constData();
|
|
|
|
- __argv[i] = new char[strlen(s)];
|
|
|
|
- strcpy(__argv[i], s);
|
|
|
|
- }
|
|
|
|
-#ifdef Q_OS_IOS
|
|
|
|
- logGlobal->warn("Starting game with the arguments: %s", args.join(" ").toStdString());
|
|
|
|
- qApp->quit();
|
|
|
|
-#else
|
|
|
|
- startExecutable(pathToQString(VCMIDirs::get().clientPath()), args);
|
|
|
|
-#endif
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void MainWindow::on_startGameButton_clicked()
|
|
void MainWindow::on_startGameButton_clicked()
|
|
{
|
|
{
|
|
startGame({});
|
|
startGame({});
|
|
}
|
|
}
|
|
-
|
|
|
|
-#ifndef Q_OS_IOS
|
|
|
|
-void MainWindow::startExecutable(QString name, const QStringList & args)
|
|
|
|
-{
|
|
|
|
- QProcess process;
|
|
|
|
-
|
|
|
|
- // Start the executable
|
|
|
|
- if(process.startDetached(name, args))
|
|
|
|
- {
|
|
|
|
- close(); // exit launcher
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- QMessageBox::critical(this,
|
|
|
|
- "Error starting executable",
|
|
|
|
- "Failed to start " + name + "\n"
|
|
|
|
- "Reason: " + process.errorString(),
|
|
|
|
- QMessageBox::Ok,
|
|
|
|
- QMessageBox::Ok);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-#endif
|
|
|