summaryrefslogtreecommitdiff
path: root/src/moshortcut.cpp
diff options
context:
space:
mode:
authorMikaƫl Capelle <capelle.mikael@gmail.com>2021-02-12 18:09:15 +0100
committerGitHub <noreply@github.com>2021-02-12 18:09:15 +0100
commit607fafa364a1f3935b289172e3291eafed13014b (patch)
treea4695ea1507a8c25fada52617ff4e2b7d58e9ae3 /src/moshortcut.cpp
parent7dc28b10d9ed4cd4af15eeaca89b50996d6fd27d (diff)
parent48274f33579076711c0475e84c7adf68c52df733 (diff)
Merge pull request #1408 from isanae/portable-shortcuts
Fixes for portable shortcuts
Diffstat (limited to 'src/moshortcut.cpp')
-rw-r--r--src/moshortcut.cpp67
1 files changed, 46 insertions, 21 deletions
diff --git a/src/moshortcut.cpp b/src/moshortcut.cpp
index 4efedbdb..4bbd61a4 100644
--- a/src/moshortcut.cpp
+++ b/src/moshortcut.cpp
@@ -1,25 +1,5 @@
-/*
-Copyright (C) 2016 Sebastian Herbord. All rights reserved.
-
-This file is part of Mod Organizer.
-
-Mod Organizer is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Mod Organizer 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 General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-
#include "moshortcut.h"
-
+#include "instancemanager.h"
MOShortcut::MOShortcut(const QString& link)
: m_valid(link.startsWith("moshortcut://"))
@@ -41,6 +21,51 @@ MOShortcut::MOShortcut(const QString& link)
}
}
+bool MOShortcut::isValid() const
+{
+ return m_valid;
+}
+
+bool MOShortcut::hasInstance() const
+{
+ return m_hasInstance;
+}
+
+bool MOShortcut::hasExecutable() const
+{
+ return m_hasExecutable;
+}
+
+QString MOShortcut::instanceDisplayName() const
+{
+ return (m_instance == "" ? QObject::tr("Portable") : m_instance);
+}
+
+const QString& MOShortcut::instanceName() const
+{
+ return m_instance;
+}
+
+const QString& MOShortcut::executableName() const
+{
+ return m_executable;
+}
+
+bool MOShortcut::isForInstance(const Instance& i) const
+{
+ if (!m_hasInstance) {
+ // no instance name was specified, so the current one is fine
+ return true;
+ }
+
+ if (m_instance == "") {
+ // empty instance name means portable
+ return i.isPortable();
+ } else {
+ return (i.displayName() == m_instance);
+ }
+}
+
QString MOShortcut::toString() const
{
if (m_hasInstance) {