Ver Fonte

Editor can be started from Launcher (disabled for ios)

Ivan Savenko há 2 anos atrás
pai
commit
b38752bde1
6 ficheiros alterados com 25 adições e 2 exclusões
  1. 5 0
      launcher/main.cpp
  2. 1 0
      launcher/main.h
  3. 9 0
      launcher/mainwindow_moc.cpp
  4. 1 0
      launcher/mainwindow_moc.h
  5. 4 0
      lib/VCMIDirs.cpp
  6. 5 2
      lib/VCMIDirs.h

+ 5 - 0
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)
 {

+ 1 - 0
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[]);

+ 9 - 0
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();

+ 1 - 0
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();
 };

+ 4 - 0
lib/VCMIDirs.cpp

@@ -158,6 +158,7 @@ class VCMIDirsWIN32 final : public IVCMIDirs
 		std::vector<bfs::path> 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<bfs::path> 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

+ 5 - 2
lib/VCMIDirs.h

@@ -35,10 +35,13 @@ public:
 	// Paths to global system-wide data directories. First items have higher priority
 	virtual std::vector<boost::filesystem::path> 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)