diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-07-10 01:11:06 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-07-10 01:11:06 +0200 |
commit | 8e7caf4e25dc3f56877a504c45d157860215496b (patch) | |
tree | 4ce3ea68190d4b693519ad6f76473b5b8f4da8be /logic/launch/MessageLevel.cpp | |
parent | 5dd48e89f5a7facf8355641d0caf8deaec2a03ec (diff) | |
download | MultiMC-8e7caf4e25dc3f56877a504c45d157860215496b.tar MultiMC-8e7caf4e25dc3f56877a504c45d157860215496b.tar.gz MultiMC-8e7caf4e25dc3f56877a504c45d157860215496b.tar.lz MultiMC-8e7caf4e25dc3f56877a504c45d157860215496b.tar.xz MultiMC-8e7caf4e25dc3f56877a504c45d157860215496b.zip |
GH-1053 move launch related things and rename them
Diffstat (limited to 'logic/launch/MessageLevel.cpp')
-rw-r--r-- | logic/launch/MessageLevel.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/logic/launch/MessageLevel.cpp b/logic/launch/MessageLevel.cpp new file mode 100644 index 00000000..a5191290 --- /dev/null +++ b/logic/launch/MessageLevel.cpp @@ -0,0 +1,36 @@ +#include "MessageLevel.h" + +MessageLevel::Enum MessageLevel::getLevel(const QString& levelName) +{ + if (levelName == "MultiMC") + return MessageLevel::MultiMC; + else if (levelName == "Debug") + return MessageLevel::Debug; + else if (levelName == "Info") + return MessageLevel::Info; + else if (levelName == "Message") + return MessageLevel::Message; + else if (levelName == "Warning") + return MessageLevel::Warning; + else if (levelName == "Error") + return MessageLevel::Error; + else if (levelName == "Fatal") + return MessageLevel::Fatal; + // Skip PrePost, it's not exposed to !![]! + // Also skip StdErr and StdOut + else + return MessageLevel::Unknown; +} + +MessageLevel::Enum MessageLevel::fromLine(QString &line) +{ + // Level prefix + int endmark = line.indexOf("]!"); + if (line.startsWith("!![") && endmark != -1) + { + auto level = MessageLevel::getLevel(line.left(endmark).mid(3)); + line = line.mid(endmark + 2); + return level; + } + return MessageLevel::Unknown; +} |