summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/GuiUtil.cpp4
-rw-r--r--application/MainWindow.cpp32
-rw-r--r--application/MainWindow.h3
-rw-r--r--application/MultiMC.cpp8
-rw-r--r--application/dialogs/EditAccountDialog.cpp4
-rw-r--r--application/dialogs/ModEditDialogCommon.cpp2
-rw-r--r--application/dialogs/ModEditDialogCommon.h2
-rw-r--r--application/pages/LegacyJarModPage.cpp4
-rw-r--r--application/pages/ModFolderPage.cpp5
-rw-r--r--application/pages/ScreenshotsPage.cpp8
-rw-r--r--application/pages/WorldListPage.cpp7
-rw-r--r--application/widgets/PageContainer.cpp4
-rw-r--r--application/widgets/ServerStatus.cpp4
13 files changed, 41 insertions, 46 deletions
diff --git a/application/GuiUtil.cpp b/application/GuiUtil.cpp
index cc06d711..f10095c1 100644
--- a/application/GuiUtil.cpp
+++ b/application/GuiUtil.cpp
@@ -1,7 +1,6 @@
#include "GuiUtil.h"
#include <QClipboard>
-#include <QDesktopServices>
#include <QApplication>
#include <QFileDialog>
@@ -11,6 +10,7 @@
#include "MultiMC.h"
#include <settings/SettingsObject.h>
+#include <DesktopServices.h>
#include <BuildConfig.h>
void GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
@@ -42,7 +42,7 @@ void GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
{
const QString link = paste->pasteLink();
setClipboardText(link);
- QDesktopServices::openUrl(link);
+ DesktopServices::openUrl(link);
CustomMessageBox::selectable(
parentWidget, QObject::tr("Upload finished"),
QObject::tr("The <a href=\"%1\">link to the uploaded log</a> has been opened in "
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 &current, const QModelIndex &previous)
{
if (!current.isValid())
diff --git a/application/MainWindow.h b/application/MainWindow.h
index 0685c9f8..0a6167bc 100644
--- a/application/MainWindow.h
+++ b/application/MainWindow.h
@@ -166,9 +166,6 @@ private:
void finalizeInstance(InstancePtr inst);
void launch(InstancePtr instance, bool online = true, BaseProfilerFactory *profiler = nullptr);
- /// open a web page in the default browser
- void openWebPage(QUrl url);
-
private:
std::unique_ptr<Ui> ui;
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index a2a14506..fb82510d 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -17,7 +17,6 @@
#include <QLibraryInfo>
#include <QMessageBox>
#include <QStringList>
-#include <QDesktopServices>
#include <QDebug>
#include "InstanceList.h"
@@ -54,6 +53,7 @@
#include <Commandline.h>
#include <FileSystem.h>
+#include <DesktopServices.h>
using namespace Commandline;
@@ -932,12 +932,12 @@ bool MultiMC::openJsonEditor(const QString &filename)
const QString file = QDir::current().absoluteFilePath(filename);
if (m_settings->get("JsonEditor").toString().isEmpty())
{
- return QDesktopServices::openUrl(QUrl::fromLocalFile(file));
+ return DesktopServices::openUrl(QUrl::fromLocalFile(file));
}
else
{
- return QProcess::startDetached(m_settings->get("JsonEditor").toString(), QStringList()
- << file);
+ //return DesktopServices::openFile(m_settings->get("JsonEditor").toString(), file);
+ return DesktopServices::run(m_settings->get("JsonEditor").toString(), {});
}
}
diff --git a/application/dialogs/EditAccountDialog.cpp b/application/dialogs/EditAccountDialog.cpp
index 7c2ff981..f7e25f6f 100644
--- a/application/dialogs/EditAccountDialog.cpp
+++ b/application/dialogs/EditAccountDialog.cpp
@@ -15,7 +15,7 @@
#include "EditAccountDialog.h"
#include "ui_EditAccountDialog.h"
-#include <QDesktopServices>
+#include <DesktopServices.h>
#include <QUrl>
EditAccountDialog::EditAccountDialog(const QString &text, QWidget *parent, int flags)
@@ -37,7 +37,7 @@ EditAccountDialog::~EditAccountDialog()
void EditAccountDialog::on_label_linkActivated(const QString &link)
{
- QDesktopServices::openUrl(QUrl(link));
+ DesktopServices::openUrl(QUrl(link));
}
void EditAccountDialog::setUsername(const QString & user) const
diff --git a/application/dialogs/ModEditDialogCommon.cpp b/application/dialogs/ModEditDialogCommon.cpp
index 4a2115d8..4201bdad 100644
--- a/application/dialogs/ModEditDialogCommon.cpp
+++ b/application/dialogs/ModEditDialogCommon.cpp
@@ -28,7 +28,7 @@ void showWebsiteForMod(QWidget *parentDlg, Mod &m)
{
url = "http://" + url;
}
- QDesktopServices::openUrl(url);
+ DesktopServices::openUrl(url);
}
else
{
diff --git a/application/dialogs/ModEditDialogCommon.h b/application/dialogs/ModEditDialogCommon.h
index e2afb98a..fc5e3c2b 100644
--- a/application/dialogs/ModEditDialogCommon.h
+++ b/application/dialogs/ModEditDialogCommon.h
@@ -1,6 +1,6 @@
#pragma once
#include <QModelIndex>
-#include <QDesktopServices>
+#include <DesktopServices.h>
#include <QWidget>
#include <minecraft/Mod.h>
diff --git a/application/pages/LegacyJarModPage.cpp b/application/pages/LegacyJarModPage.cpp
index 2ff6b6de..b329ba70 100644
--- a/application/pages/LegacyJarModPage.cpp
+++ b/application/pages/LegacyJarModPage.cpp
@@ -25,7 +25,7 @@
#include "minecraft/ModList.h"
#include "minecraft/LegacyInstance.h"
#include "Env.h"
-#include <FileSystem.h>
+#include <DesktopServices.h>
#include "MultiMC.h"
#include <GuiUtil.h>
@@ -146,7 +146,7 @@ void LegacyJarModPage::on_rmJarBtn_clicked()
void LegacyJarModPage::on_viewJarBtn_clicked()
{
- FS::openDirInDefaultProgram(m_inst->jarModsDir(), true);
+ DesktopServices::openDirectory(m_inst->jarModsDir(), true);
}
void LegacyJarModPage::jarCurrent(QModelIndex current, QModelIndex previous)
diff --git a/application/pages/ModFolderPage.cpp b/application/pages/ModFolderPage.cpp
index 6791a59e..3c68b23f 100644
--- a/application/pages/ModFolderPage.cpp
+++ b/application/pages/ModFolderPage.cpp
@@ -19,7 +19,6 @@
#include <QMessageBox>
#include <QEvent>
#include <QKeyEvent>
-#include <QDesktopServices>
#include <QAbstractItemModel>
#include "MultiMC.h"
@@ -29,7 +28,7 @@
#include "minecraft/ModList.h"
#include "minecraft/Mod.h"
#include "minecraft/VersionFilterData.h"
-#include <FileSystem.h>
+#include <DesktopServices.h>
ModFolderPage::ModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods, QString id,
QString iconName, QString displayName, QString helpPage,
@@ -162,7 +161,7 @@ void ModFolderPage::on_rmModBtn_clicked()
void ModFolderPage::on_viewModBtn_clicked()
{
- FS::openDirInDefaultProgram(m_mods->dir().absolutePath(), true);
+ DesktopServices::openDirectory(m_mods->dir().absolutePath(), true);
}
void ModFolderPage::modCurrent(const QModelIndex &current, const QModelIndex &previous)
diff --git a/application/pages/ScreenshotsPage.cpp b/application/pages/ScreenshotsPage.cpp
index 2b2fe31f..5b406f3d 100644
--- a/application/pages/ScreenshotsPage.cpp
+++ b/application/pages/ScreenshotsPage.cpp
@@ -12,7 +12,6 @@
#include <QEvent>
#include <QPainter>
#include <QClipboard>
-#include <QDesktopServices>
#include <QKeyEvent>
#include <MultiMC.h>
@@ -26,6 +25,7 @@
#include "RWStorage.h"
#include <FileSystem.h>
+#include <DesktopServices.h>
typedef RWStorage<QString, QIcon> SharedIconCache;
typedef std::shared_ptr<SharedIconCache> SharedIconCachePtr;
@@ -271,12 +271,12 @@ void ScreenshotsPage::onItemActivated(QModelIndex index)
return;
auto info = m_model->fileInfo(index);
QString fileName = info.absoluteFilePath();
- FS::openFileInDefaultProgram(info.absoluteFilePath());
+ DesktopServices::openFile(info.absoluteFilePath());
}
void ScreenshotsPage::on_viewFolderBtn_clicked()
{
- FS::openDirInDefaultProgram(m_folder, true);
+ DesktopServices::openDirectory(m_folder, true);
}
void ScreenshotsPage::on_uploadBtn_clicked()
@@ -312,7 +312,7 @@ void ScreenshotsPage::on_uploadBtn_clicked()
auto link = QString("https://imgur.com/a/%1").arg(imgurAlbum->id());
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(link);
- QDesktopServices::openUrl(link);
+ DesktopServices::openUrl(link);
CustomMessageBox::selectable(
this, tr("Upload finished"),
tr("The <a href=\"%1\">link to the uploaded album</a> has been opened in the "
diff --git a/application/pages/WorldListPage.cpp b/application/pages/WorldListPage.cpp
index 4e7eeedc..befb6b5e 100644
--- a/application/pages/WorldListPage.cpp
+++ b/application/pages/WorldListPage.cpp
@@ -16,7 +16,7 @@
#include "WorldListPage.h"
#include "ui_WorldListPage.h"
#include "minecraft/WorldList.h"
-#include <FileSystem.h>
+#include <DesktopServices.h>
#include "dialogs/ModEditDialogCommon.h"
#include <QEvent>
#include <QKeyEvent>
@@ -123,7 +123,7 @@ void WorldListPage::on_rmWorldBtn_clicked()
void WorldListPage::on_viewFolderBtn_clicked()
{
- FS::openDirInDefaultProgram(m_worlds->dir().absolutePath(), true);
+ DesktopServices::openDirectory(m_worlds->dir().absolutePath(), true);
}
QModelIndex WorldListPage::getSelectedWorld()
@@ -193,7 +193,8 @@ void WorldListPage::on_mcEditBtn_clicked()
if(program.size())
{
qint64 pid = 0;
- QProcess::startDetached(program, QStringList() << fullPath, mceditPath, &pid);
+
+ DesktopServices::openFile(program, fullPath, mceditPath, &pid);
if(pid == 0)
{
QMessageBox::warning(this->parentWidget(), tr("MCEdit failed to start!"), tr("MCEdit failed to start.\nIt may be necessary to reinstall it."));
diff --git a/application/widgets/PageContainer.cpp b/application/widgets/PageContainer.cpp
index 66d94e6c..90aad26e 100644
--- a/application/widgets/PageContainer.cpp
+++ b/application/widgets/PageContainer.cpp
@@ -25,13 +25,13 @@
#include <QLabel>
#include <QDialogButtonBox>
#include <QGridLayout>
-#include <QDesktopServices>
#include "MultiMC.h"
#include "settings/SettingsObject.h"
#include "widgets/IconLabel.h"
#include "PageContainer_p.h"
#include <MultiMC.h>
+#include <DesktopServices.h>
class PageEntryFilterModel : public QSortFilterProxyModel
{
@@ -195,7 +195,7 @@ void PageContainer::help()
QString pageId = m_currentPage->helpPage();
if (pageId.isEmpty())
return;
- QDesktopServices::openUrl(QUrl("https://github.com/MultiMC/MultiMC5/wiki/" + pageId));
+ DesktopServices::openUrl(QUrl("https://github.com/MultiMC/MultiMC5/wiki/" + pageId));
}
}
diff --git a/application/widgets/ServerStatus.cpp b/application/widgets/ServerStatus.cpp
index f0a7f97a..4602dde5 100644
--- a/application/widgets/ServerStatus.cpp
+++ b/application/widgets/ServerStatus.cpp
@@ -2,6 +2,7 @@
#include "LineSeparator.h"
#include "IconLabel.h"
#include "status/StatusChecker.h"
+#include <DesktopServices.h>
#include "MultiMC.h"
@@ -11,7 +12,6 @@
#include <QMap>
#include <QToolButton>
#include <QAction>
-#include <QDesktopServices>
class ClickableLabel : public QLabel
{
@@ -127,7 +127,7 @@ void ServerStatus::addStatus(QString key, QString name)
void ServerStatus::clicked()
{
- QDesktopServices::openUrl(QUrl("https://help.mojang.com/"));
+ DesktopServices::openUrl(QUrl("https://help.mojang.com/"));
}
void ServerStatus::setStatus(QString key, int value)