Loading...
Searching...
No Matches
MessagesPanel.hpp
1#pragma once
2#include <score/plugins/panel/PanelDelegate.hpp>
3#include <score/plugins/panel/PanelDelegateFactory.hpp>
4
5#include <QListView>
6#include <QWidget>
7
8#include <score_lib_base_export.h>
9#include <wobjectimpl.h>
10class QListWidget;
11class QListView;
12class QDockWidget;
13namespace score
14{
15class LogMessagesItemModel;
16
17// REFACTORME
18namespace log
19{
20static const QColor dark1 = QColor(Qt::darkGray).darker();
21static const QColor dark2 = dark1.darker(); // almost darker than black
22static const QColor dark3 = QColor(Qt::darkRed).darker();
23static const QColor dark4 = QColor(Qt::darkBlue).darker();
24}
25
26template <typename T>
27class VisibilityNotifying : public T
28{
30public:
31 using T::T;
32
33 void visibilityChanged(bool visible) W_SIGNAL(visibilityChanged, visible);
34
35 void showEvent(QShowEvent* event) override
36 {
37 visibilityChanged(true);
38 T::showEvent(event);
39 }
40 void hideEvent(QHideEvent* event) override
41 {
42 visibilityChanged(false);
43 T::hideEvent(event);
44 }
45};
46
47W_OBJECT_IMPL(VisibilityNotifying<T>, template <typename T>)
48
49class SCORE_LIB_BASE_EXPORT MessagesPanelDelegate final
50 : public QObject
51 , public score::PanelDelegate
52{
53 friend class err_sink;
54 W_OBJECT(MessagesPanelDelegate)
55
56public:
59
60 void push(const QString& str, const QColor& col);
61 void qtLog(const std::string& str);
62
63 VisibilityNotifying<QListView>* widget() override;
64
65private:
66 const score::PanelStatus& defaultPanelStatus() const override;
67
68 LogMessagesItemModel* m_itemModel{};
70};
71
73{
74 SCORE_CONCRETE("84a66cbe-aee3-496a-b7f4-0ea0d699deac")
75
76 std::unique_ptr<score::PanelDelegate>
77 make(const score::GUIApplicationContext& ctx) override;
78};
79}
Definition MessagesPanel.cpp:34
Definition MessagesPanel.hpp:73
Definition MessagesPanel.hpp:52
Reimplement this interface to register new panels.
Definition PanelDelegateFactory.hpp:10
The PanelDelegate class.
Definition PanelDelegate.hpp:50
Definition MessagesPanel.hpp:28
Base toolkit upon which the software is built.
Definition Application.cpp:90
Specializes ApplicationContext with the QMainWindow.
Definition GUIApplicationContext.hpp:15
The PanelStatus struct.
Definition PanelDelegate.hpp:24