mirror of
				https://github.com/JakubMelka/PDF4QT.git
				synced 2025-06-05 21:59:17 +02:00 
			
		
		
		
	Issue #159: Linux fix
This commit is contained in:
		| @@ -22,6 +22,7 @@ | |||||||
| #include <QLabel> | #include <QLabel> | ||||||
| #include <QPushButton> | #include <QPushButton> | ||||||
| #include <QProcess> | #include <QProcess> | ||||||
|  | #include <QMessageBox> | ||||||
|  |  | ||||||
| LaunchDialog::LaunchDialog(QWidget* parent) | LaunchDialog::LaunchDialog(QWidget* parent) | ||||||
|     : QDialog(parent, Qt::WindowStaysOnTopHint | Qt::Window | Qt::Dialog) |     : QDialog(parent, Qt::WindowStaysOnTopHint | Qt::Window | Qt::Dialog) | ||||||
| @@ -79,26 +80,38 @@ LaunchDialog::~LaunchDialog() | |||||||
|  |  | ||||||
| void LaunchDialog::startEditor() | void LaunchDialog::startEditor() | ||||||
| { | { | ||||||
|     startProgram("./Pdf4QtEditor"); |     startProgram("Pdf4QtEditor"); | ||||||
| } | } | ||||||
|  |  | ||||||
| void LaunchDialog::startViewer() | void LaunchDialog::startViewer() | ||||||
| { | { | ||||||
|     startProgram("./Pdf4QtViewer"); |     startProgram("Pdf4QtViewer"); | ||||||
| } | } | ||||||
|  |  | ||||||
| void LaunchDialog::startPageMaster() | void LaunchDialog::startPageMaster() | ||||||
| { | { | ||||||
|     startProgram("./Pdf4QtPageMaster"); |     startProgram("Pdf4QtPageMaster"); | ||||||
| } | } | ||||||
|  |  | ||||||
| void LaunchDialog::startDiff() | void LaunchDialog::startDiff() | ||||||
| { | { | ||||||
|     startProgram("./Pdf4QtDiff"); |     startProgram("Pdf4QtDiff"); | ||||||
| } | } | ||||||
|  |  | ||||||
| void LaunchDialog::startProgram(const QString& program) | void LaunchDialog::startProgram(const QString& program) | ||||||
| { | { | ||||||
|  | #ifndef Q_OS_WIN | ||||||
|  |     QString appDir = qgetenv("APPDIR"); | ||||||
|  |     QString internalToolPath = appDir.isEmpty() ? QString("./%1").arg(program) | ||||||
|  |                                                 : QString("%1/usr/bin/%2").arg(appDir, program); | ||||||
|  |  | ||||||
|  |     qint64 pid = 0; | ||||||
|  |     if (!QProcess::startDetached(internalToolPath, {}, QString(), &pid)) | ||||||
|  |     { | ||||||
|  |         QMessageBox::critical(this, tr("Error"), tr("Failed to start process '%1'").arg(internalToolPath)); | ||||||
|  |     } | ||||||
|  | #else | ||||||
|     QProcess::startDetached(program); |     QProcess::startDetached(program); | ||||||
|  | #endif | ||||||
|     close(); |     close(); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -14,22 +14,6 @@ | |||||||
| // | // | ||||||
| //    You should have received a copy of the GNU Lesser General Public License | //    You should have received a copy of the GNU Lesser General Public License | ||||||
| //    along with PDF4QT.  If not, see <https://www.gnu.org/licenses/>. | //    along with PDF4QT.  If not, see <https://www.gnu.org/licenses/>. | ||||||
| //    Copyright (C) 2024 Jakub Melka |  | ||||||
| // |  | ||||||
| //    This file is part of PDF4QT. |  | ||||||
| // |  | ||||||
| //    PDF4QT is free software: you can redistribute it and/or modify |  | ||||||
| //    it under the terms of the GNU Lesser General Public License as published by |  | ||||||
| //    the Free Software Foundation, either version 3 of the License, or |  | ||||||
| //    with the written consent of the copyright owner, any later version. |  | ||||||
| // |  | ||||||
| //    PDF4QT is distributed in the hope that it will be useful, |  | ||||||
| //    but WITHOUT ANY WARRANTY; without even the implied warranty of |  | ||||||
| //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  | ||||||
| //    GNU Lesser General Public License for more details. |  | ||||||
| // |  | ||||||
| //    You should have received a copy of the GNU Lesser General Public License |  | ||||||
| //    along with PDF4QT.  If not, see <https://www.gnu.org/licenses/>. |  | ||||||
|  |  | ||||||
| #include "launchdialog.h" | #include "launchdialog.h" | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user