diff --git a/launcher/main.cpp b/launcher/main.cpp index acc5f0cde..68064f70b 100644 --- a/launcher/main.cpp +++ b/launcher/main.cpp @@ -64,6 +64,11 @@ void startGame(const QStringList & args) #endif } +void startEditor(const QStringList & args) +{ + startExecutable(pathToQString(VCMIDirs::get().editorPath()), args); +} + #ifndef Q_OS_IOS void startExecutable(QString name, const QStringList & args) { diff --git a/launcher/main.h b/launcher/main.h index 371d68e7f..ee7f1ea3f 100644 --- a/launcher/main.h +++ b/launcher/main.h @@ -10,6 +10,7 @@ #pragma once void startGame(const QStringList & args); +void startEditor(const QStringList & args); #ifdef VCMI_IOS extern "C" void launchGame(int argc, char * argv[]); diff --git a/launcher/mainwindow_moc.cpp b/launcher/mainwindow_moc.cpp index 35591185e..f9221cc1a 100644 --- a/launcher/mainwindow_moc.cpp +++ b/launcher/mainwindow_moc.cpp @@ -69,6 +69,10 @@ MainWindow::MainWindow(QWidget * parent) move(position); } +#ifdef Q_OS_IOS + ui->startEditorButton->hide(); +#endif + ui->tabListWidget->setCurrentIndex(0); ui->settingsView->isExtraResolutionsModEnabled = ui->modlistView->isExtraResolutionsModEnabled(); @@ -103,6 +107,11 @@ void MainWindow::on_startGameButton_clicked() startGame({}); } +void MainWindow::on_startEditorButton_clicked() +{ + startEditor({}); +} + const CModList & MainWindow::getModList() const { return ui->modlistView->getModList(); diff --git a/launcher/mainwindow_moc.h b/launcher/mainwindow_moc.h index 1ac2a85a8..9165431db 100644 --- a/launcher/mainwindow_moc.h +++ b/launcher/mainwindow_moc.h @@ -52,4 +52,5 @@ private slots: void on_modslistButton_clicked(); void on_settingsButton_clicked(); void on_lobbyButton_clicked(); + void on_startEditorButton_clicked(); }; diff --git a/lib/VCMIDirs.cpp b/lib/VCMIDirs.cpp index f56a6549b..a6031be1d 100644 --- a/lib/VCMIDirs.cpp +++ b/lib/VCMIDirs.cpp @@ -158,6 +158,7 @@ class VCMIDirsWIN32 final : public IVCMIDirs std::vector dataPaths() const override; bfs::path clientPath() const override; + bfs::path editorPath() const override; bfs::path serverPath() const override; bfs::path libraryPath() const override; @@ -348,6 +349,7 @@ std::vector VCMIDirsWIN32::dataPaths() const } bfs::path VCMIDirsWIN32::clientPath() const { return binaryPath() / "VCMI_client.exe"; } +bfs::path VCMIDirsWIN32::editorPath() const { return binaryPath() / "VCMI_editor.exe"; } bfs::path VCMIDirsWIN32::serverPath() const { return binaryPath() / "VCMI_server.exe"; } bfs::path VCMIDirsWIN32::libraryPath() const { return "."; } @@ -359,6 +361,7 @@ class IVCMIDirsUNIX : public IVCMIDirs { public: bfs::path clientPath() const override; + bfs::path editorPath() const override; bfs::path serverPath() const override; virtual bool developmentMode() const; @@ -371,6 +374,7 @@ bool IVCMIDirsUNIX::developmentMode() const } bfs::path IVCMIDirsUNIX::clientPath() const { return binaryPath() / "vcmiclient"; } +bfs::path IVCMIDirsUNIX::editorPath() const { return binaryPath() / "vcmieditor"; } bfs::path IVCMIDirsUNIX::serverPath() const { return binaryPath() / "vcmiserver"; } #ifdef VCMI_APPLE diff --git a/lib/VCMIDirs.h b/lib/VCMIDirs.h index 50b385f5d..33d38af73 100644 --- a/lib/VCMIDirs.h +++ b/lib/VCMIDirs.h @@ -35,10 +35,13 @@ public: // Paths to global system-wide data directories. First items have higher priority virtual std::vector dataPaths() const = 0; - // Full path to client executable, including server name (e.g. /usr/bin/vcmiclient) + // Full path to client executable, including name (e.g. /usr/bin/vcmiclient) virtual boost::filesystem::path clientPath() const = 0; - // Full path to server executable, including server name (e.g. /usr/bin/vcmiserver) + // Full path to editor executable, including name (e.g. /usr/bin/vcmieditor) + virtual boost::filesystem::path editorPath() const = 0; + + // Full path to server executable, including name (e.g. /usr/bin/vcmiserver) virtual boost::filesystem::path serverPath() const = 0; // Path where vcmi libraries can be found (in AI and Scripting subdirectories)