swift
coremodeenums.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_GUIMODEENUMS_H
7 #define SWIFT_GUI_GUIMODEENUMS_H
8 
9 #include <QString>
10 
11 namespace swift::core
12 {
14  struct CoreModes
15  {
17  enum CoreMode
18  {
19  Standalone,
20  Distributed
21  };
22 
24  static CoreMode stringToCoreMode(const QString &m)
25  {
26  QString cm(m.toLower().trimmed());
27  if (cm.isEmpty()) { return Standalone; }
28  if (m == coreModeToString(Standalone)) { return Standalone; }
29  if (m == coreModeToString(Distributed)) { return Distributed; }
30 
31  // some alternative names
32  if (cm.contains("distribute")) { return Distributed; }
33  if (cm.contains("standalone")) { return Standalone; }
34  if (cm.contains("external")) { return Distributed; }
35  if (cm.contains("gui")) { return Standalone; }
36  return Standalone;
37  }
38 
40  static QString coreModeToString(CoreMode mode)
41  {
42  switch (mode)
43  {
44  case Standalone: return QStringLiteral("standalone");
45  case Distributed: return QStringLiteral("distributed");
46  }
47  return {};
48  }
49  };
50 } // namespace swift::core
51 #endif // SWIFT_GUI_GUIMODEENUMS_H
Backend services of the swift project, like dealing with the network or the simulators.
Definition: actionbind.cpp:7
Modes, how GUI can be started (core/GUI)
Definition: coremodeenums.h:15
static CoreMode stringToCoreMode(const QString &m)
String to core mode.
Definition: coremodeenums.h:24
static QString coreModeToString(CoreMode mode)
Core mode as string.
Definition: coremodeenums.h:40
CoreMode
Core runs how and where?
Definition: coremodeenums.h:18