1 /*
2  *  SPDX-FileCopyrightText: 2013-2014 Andreas Cord-Landwehr <cordlandwehr@kde.org>
3  *
4  *  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5  */
6 
7 #include "consolemodule.h"
8 
9 using namespace GraphTheory;
10 
ConsoleModule(QObject * parent)11 ConsoleModule::ConsoleModule(QObject *parent)
12     : QObject(parent)
13 {
14 }
15 
~ConsoleModule()16 ConsoleModule::~ConsoleModule()
17 {
18 }
19 
backlog() const20 QList< QPair< GraphTheory::Kernel::MessageType, QString > > ConsoleModule::backlog() const
21 {
22     return m_backlog;
23 }
24 
clear()25 void ConsoleModule::clear()
26 {
27     m_backlog.clear();
28 }
29 
log(const QString & messageString)30 void ConsoleModule::log(const QString& messageString)
31 {
32     m_backlog.append(qMakePair<Kernel::MessageType, QString>(Kernel::InfoMessage, messageString));
33     Q_EMIT message(messageString, Kernel::InfoMessage);
34 }
35 
debug(const QString & messageString)36 void ConsoleModule::debug(const QString& messageString)
37 {
38     m_backlog.append(qMakePair<Kernel::MessageType, QString>(Kernel::WarningMessage, messageString));
39     Q_EMIT message(messageString, Kernel::WarningMessage);
40 }
41 
error(const QString & messageString)42 void ConsoleModule::error(const QString& messageString)
43 {
44     m_backlog.append(qMakePair<Kernel::MessageType, QString>(Kernel::ErrorMessage, messageString));
45     Q_EMIT message(messageString, Kernel::ErrorMessage);
46 }
47