diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-01-05 07:32:52 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-01-05 07:32:52 +0100 |
commit | 4d0caf6254fdb18f4626a3c7937e64422b40d40c (patch) | |
tree | 76b037c8f6b6c73f8438b85e8e05a2f59da89c17 /application/MainWindow.cpp | |
parent | d1e344f28f643c9fb0318feea0259be8ac72c8f7 (diff) | |
download | MultiMC-4d0caf6254fdb18f4626a3c7937e64422b40d40c.tar MultiMC-4d0caf6254fdb18f4626a3c7937e64422b40d40c.tar.gz MultiMC-4d0caf6254fdb18f4626a3c7937e64422b40d40c.tar.lz MultiMC-4d0caf6254fdb18f4626a3c7937e64422b40d40c.tar.xz MultiMC-4d0caf6254fdb18f4626a3c7937e64422b40d40c.zip |
GH-1389 wrap QDesktopServices and QProcess::startDetached
Essentially do not pass some environment variables to subprocesses:
* LD_PRELOAD
* LD_LIBRARY_PATH
* LD_DEBUG
* QT_PLUGIN_PATH
* QT_FONTPATH
Diffstat (limited to 'application/MainWindow.cpp')
-rw-r--r-- | application/MainWindow.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index fa756678..c977715b 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -26,7 +26,6 @@ #include <QtCore/QDir> #include <QtCore/QFileInfo> -#include <QtGui/QDesktopServices> #include <QtGui/QKeyEvent> #include <QtWidgets/QAction> @@ -69,6 +68,7 @@ #include <tools/BaseProfiler.h> #include <updater/DownloadTask.h> #include <updater/UpdateChecker.h> +#include <DesktopServices.h> #include "InstancePageProvider.h" #include "InstanceProxyModel.h" @@ -1197,7 +1197,7 @@ void MainWindow::on_actionAddInstance_triggered() void MainWindow::on_actionREDDIT_triggered() { - openWebPage(QUrl("https://www.reddit.com/r/MultiMC/")); + DesktopServices::openUrl(QUrl("https://www.reddit.com/r/MultiMC/")); } void MainWindow::on_actionCopyInstance_triggered() @@ -1312,7 +1312,7 @@ void MainWindow::on_actionChangeInstGroup_triggered() void MainWindow::on_actionViewInstanceFolder_triggered() { QString str = MMC->settings()->get("InstanceDir").toString(); - FS::openDirInDefaultProgram(str); + DesktopServices::openDirectory(str); } void MainWindow::on_actionRefresh_triggered() @@ -1322,7 +1322,7 @@ void MainWindow::on_actionRefresh_triggered() void MainWindow::on_actionViewCentralModsFolder_triggered() { - FS::openDirInDefaultProgram(MMC->settings()->get("CentralModsDir").toString(), true); + DesktopServices::openDirectory(MMC->settings()->get("CentralModsDir").toString(), true); } void MainWindow::on_actionConfig_Folder_triggered() @@ -1330,7 +1330,7 @@ void MainWindow::on_actionConfig_Folder_triggered() if (m_selectedInstance) { QString str = m_selectedInstance->instanceConfigFolder(); - FS::openDirInDefaultProgram(QDir(str).absolutePath()); + DesktopServices::openDirectory(QDir(str).absolutePath()); } } @@ -1384,26 +1384,30 @@ void MainWindow::on_actionManageAccounts_triggered() void MainWindow::on_actionReportBug_triggered() { - openWebPage(QUrl("https://github.com/MultiMC/MultiMC5/issues")); + DesktopServices::openUrl(QUrl("https://github.com/MultiMC/MultiMC5/issues")); } void MainWindow::on_actionPatreon_triggered() { - openWebPage(QUrl("http://www.patreon.com/multimc")); + DesktopServices::openUrl(QUrl("http://www.patreon.com/multimc")); } void MainWindow::on_actionMoreNews_triggered() { - openWebPage(QUrl("http://multimc.org/posts.html")); + DesktopServices::openUrl(QUrl("http://multimc.org/posts.html")); } void MainWindow::newsButtonClicked() { QList<NewsEntryPtr> entries = m_newsChecker->getNewsEntries(); if (entries.count() > 0) - openWebPage(QUrl(entries[0]->link)); + { + DesktopServices::openUrl(QUrl(entries[0]->link)); + } else - openWebPage(QUrl("http://multimc.org/posts.html")); + { + DesktopServices::openUrl(QUrl("http://multimc.org/posts.html")); + } } void MainWindow::on_actionAbout_triggered() @@ -1469,7 +1473,7 @@ void MainWindow::on_actionViewSelectedInstFolder_triggered() if (m_selectedInstance) { QString str = m_selectedInstance->instanceRoot(); - FS::openDirInDefaultProgram(QDir(str).absolutePath()); + DesktopServices::openDirectory(QDir(str).absolutePath()); } } @@ -1538,12 +1542,6 @@ void MainWindow::startTask(Task *task) task->start(); } -// BrowserDialog -void MainWindow::openWebPage(QUrl url) -{ - QDesktopServices::openUrl(url); -} - void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &previous) { if (!current.isValid()) |