Skip to content
loggerwidget.h 784 B
Newer Older
#ifndef LOGGERWIDGET_H
#define LOGGERWIDGET_H

#include <QWidget>
#include <QString>

class QTextEdit;

GigAnon's avatar
GigAnon committed
/**
 * @brief A simple widget to display logs.
 */
GigAnon's avatar
GigAnon committed
    Q_OBJECT
GigAnon's avatar
GigAnon committed
        /**
         * @brief Constructor
         * @param parent The parent widget
         */
        explicit LoggerWidget(QWidget *parent = nullptr);

GigAnon's avatar
GigAnon committed
        /**
         * @brief Add a line to the log
         * @param text The text to add
         * @param isDebug If set, this line will be displayed as 'debug'
         */
        void log(const QString& text, bool isDebug = false);

GigAnon's avatar
GigAnon committed
        /**
         * @return The entierety of the logs
         */
        QString getLogs() const;

    private:

        QTextEdit* m_log;
};

#endif // LOGGERWIDGET_H