From 16bc0531f467fe233e00551f7f6389a406362fc4 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 4 Apr 2022 16:42:38 +0800 Subject: [PATCH] Simplify code --- src/app/cmdoptions.cpp | 3 +-- src/gui/utils.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app/cmdoptions.cpp b/src/app/cmdoptions.cpp index a1fbc5932..62fce4a5e 100644 --- a/src/app/cmdoptions.cpp +++ b/src/app/cmdoptions.cpp @@ -308,8 +308,7 @@ namespace friend bool operator==(const TriStateBoolOption &option, const QString &arg) { - const QStringList parts = arg.split(u'='); - return parts[0] == option.fullParameter(); + return arg.section(u'=', 0, 0) == option.fullParameter(); } bool m_defaultValue; diff --git a/src/gui/utils.cpp b/src/gui/utils.cpp index 82a19d904..3665a82df 100644 --- a/src/gui/utils.cpp +++ b/src/gui/utils.cpp @@ -142,10 +142,10 @@ QPoint Utils::Gui::screenCenter(const QWidget *w) void Utils::Gui::openPath(const Path &path) { // Hack to access samba shares with QDesktopServices::openUrl - if (path.data().startsWith(u"//")) - QDesktopServices::openUrl(QUrl(u"file:" + path.toString())); - else - QDesktopServices::openUrl(QUrl::fromLocalFile(path.data())); + const QUrl url = path.data().startsWith(u"//") + ? QUrl(u"file:" + path.data()) + : QUrl::fromLocalFile(path.data()); + QDesktopServices::openUrl(url); } // Open the parent directory of the given path with a file manager and select