Sayonara Player
GUI_Logger.h
1 /* GUI_Logger.h */
2 
3 /* Copyright (C) 2011-2017 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 "Helper/Logger/LogListener.h"
27 #include "GUI/Helper/SayonaraWidget/SayonaraWidget.h"
28 
29 #include <QStringList>
30 #include <QWidget>
31 
32 class QShowEvent;
33 namespace Ui
34 {
35  class GUI_Logger;
36 }
37 
38 class LogObject :
39  public QObject,
40  public LogListener
41 {
42  Q_OBJECT
43 
44  signals:
45  void sig_new_log(const QString& str);
46 
47  public:
48  explicit LogObject(QObject* parent=nullptr);
49  ~LogObject();
50 
51  void add_log_line(const QString& str) override;
52 };
53 
54 
55 class GUI_Logger :
56  public SayonaraWidget
57 {
58  Q_OBJECT
59 
60  public:
61  explicit GUI_Logger(QWidget *parent = 0);
62  ~GUI_Logger();
63 
64  LogListener* get_log_listener();
65 
66  protected:
67  void showEvent(QShowEvent* e) override;
68 
69  private:
70  Ui::GUI_Logger* ui=nullptr;
71  QStringList _buffer;
72 
73  void init_ui();
74 
75  private slots:
76  void language_changed() override;
77  void log_ready(const QString& str);
78  void save_clicked();
79 };
80 
81 #endif // GUI_LOGGER_H
Definition: LogListener.h:27
Definition: ui_GUI_Logger.h:83
Definition: ui_GUI_SomaFM.h:216
Definition: GUI_Logger.h:38
Definition: GUI_Logger.h:55
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() wi...
Definition: SayonaraWidget.h:36