WSL/SLF GitLab Repository

Logger.h 1.55 KB
Newer Older
Mathias Bavay's avatar
Mathias Bavay committed
1
//SPDX-License-Identifier: GPL-3.0-or-later
2
3
4
5
6
/*****************************************************************************/
/*  Copyright 2019 WSL Institute for Snow and Avalanche Research  SLF-DAVOS  */
/*****************************************************************************/
/* This file is part of INIshell.
   INIshell is free software: you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License as published by
8
9
10
11
12
13
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   INIshell 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
14
   GNU General Public License for more details.
15

16
17
   You should have received a copy of the GNU General Public License
   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
18
19
*/

20
21
/*
 * A logging window to display info and warnings on demand.
22
 * 2019-10
23
24
25
26
27
 */

#ifndef LOGGER_H
#define LOGGER_H

28
#include <QKeyEvent>
29
30
31
32
33
34
35
36
37
#include <QListWidget>
#include <QString>
#include <QWidget>

class Logger : public QWidget {
	Q_OBJECT

	public:
		explicit Logger(QWidget *parent = nullptr);
38
39
		void log(const QString &message, const QString &color = "normal",
		    const bool &no_timestamp = false);
40
41
		void logSystemInfo();

42
43
44
	protected:
		void keyPressEvent(QKeyEvent *event) override;

45
	private:
46
		QListWidget *loglist_ = nullptr;
47
48
49
50

	private slots:
		void saveLog();
		void closeLogger();
Michael Reisecker's avatar
Michael Reisecker committed
51
		void clearLog();
52
53
54
};

#endif // LOGGER_H