Sayonara Player
GUI_Logger.h
1 /* GUI_Logger.h */
2 
3 /* Copyright (C) 2011-2019 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef GUI_LOGGER_H
24 #define GUI_LOGGER_H
25 
26 #include "Utils/Logger/LogListener.h"
27 #include "Gui/Utils/Widgets/Widget.h"
28 #include "Utils/Pimpl.h"
29 
30 #include <QStringList>
31 #include <QWidget>
32 
33 class QShowEvent;
34 
35 UI_FWD(GUI_Logger)
36 
37 class LogObject :
38  public QObject,
39  public LogListener
40 {
41  Q_OBJECT
42 
43  signals:
44  void sig_new_log(const QDateTime& t, Log log_type, const QString& class_name, const QString& str);
45 
46  public:
47  explicit LogObject(QObject* parent=nullptr);
48  ~LogObject();
49 
50  void add_log_line(const LogEntry& le) override;
51 };
52 
53 struct LogLine;
54 class GUI_Logger :
55  public Gui::Widget
56 {
57  Q_OBJECT
58  UI_CLASS(GUI_Logger)
59  PIMPL(GUI_Logger)
60 
61  public:
62  explicit GUI_Logger(QWidget *parent = 0);
63  ~GUI_Logger();
64 
65  LogListener* get_log_listener();
66 
67  protected:
68  void showEvent(QShowEvent* e) override;
69  void language_changed() override;
70 
71  void init_ui();
72  QString calc_log_line(const LogLine& log_line);
73 
74  private slots:
75  void current_module_changed(const QString& module);
76  void log_ready(const QDateTime& t, Log log_type, const QString& class_name, const QString& str);
77  void save_clicked();
78 };
79 
80 #endif // GUI_LOGGER_H
Definition: LogListener.h:32
Definition: GUI_Logger.h:37
Definition: GUI_Logger.h:54
Definition: LoggerUtils.h:32
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() wi...
Definition: Widget.h:38