summaryrefslogtreecommitdiff
path: root/src/moshortcut.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2021-02-12 03:22:52 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2021-02-12 03:22:52 -0500
commit48274f33579076711c0475e84c7adf68c52df733 (patch)
tree51e564e682430179920b7ab937a5f66c27e0645f /src/moshortcut.cpp
parent7d36bc20d0a6c327079141149a7f138c0f7726ac (diff)
- renamed instance::name() to displayName() to reduce confusion with portable instances
- better errors when running incorrect shortcuts - fixed shortcuts being created with moshortcut://Portable:exe instead of an empty instance name for portable instances
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) {