File: logcollectormain.h

package info (click to toggle)
deepin-log-viewer 6.5.8%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 14,752 kB
  • sloc: cpp: 61,723; ansic: 1,732; xml: 81; sh: 59; makefile: 12
file content (106 lines) | stat: -rw-r--r-- 2,764 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef LOGCOLLECTORMAIN_H
#define LOGCOLLECTORMAIN_H
#include "displaycontent.h"
#include "filtercontent.h"
#include "loglistview.h"
#include "logtreeview.h"

#include <DMainWindow>
#include <DSearchEdit>
#include <DSplitter>
#include <DTreeView>
#include <DSettings>
#include <qsettingbackend.h>

#include <QHBoxLayout>
#include <QShortcut>
#include <QSplitter>
#include <QVBoxLayout>
#include <QTimer>
DCORE_USE_NAMESPACE

class DSplitter;
class ExportProgressDlg;
/**
 * @brief The LogCollectorMain class 主窗口类
 */
class LogCollectorMain : public Dtk::Widget::DMainWindow
{
public:
    explicit LogCollectorMain(QWidget *parent = nullptr);
    ~LogCollectorMain();

    void initUI();
    void initConnection();
    void initSettings();
    void initShortCut();
    void initTitlebarExtensions();
    void exportAllLogs();
public slots:
    bool handleApplicationTabEventNotify(QObject *obj, QKeyEvent *evt);
    void switchRefreshActionTriggered(QAction *action);

    /**
     * @brief slotClearInfoandFocus  清空检索信息和设置焦点到标题上
     */
    void slotClearInfoandFocus();

private slots:
    /**
     * @brief 根据布局模式(紧凑)变更更新界面布局
     */
    void updateSizeMode();
protected:
    void closeEvent(QCloseEvent *event);

private:
    /**
     * @brief m_searchEdt titlebar上的搜索框
     */
    Dtk::Widget::DSearchEdit *m_searchEdt {nullptr};
    /**
     * @brief m_topRightWgt 筛选控件
     */
    FilterContent *m_topRightWgt {nullptr};
    /**
     * @brief m_logCatelogue  日志类型选择器
     */
    LogListView *m_logCatelogue {nullptr};
    /**
     * @brief m_midRightWgt 数据展示控件,包括表格和详情页
     */
    DisplayContent *m_midRightWgt {nullptr};
    /**
     * @brief m_hLayout 主layout,用来放m_logCatelogue和m_vLayout
     */
    QHBoxLayout *m_hLayout {nullptr};
    /**
     * @brief m_vLayout 用来放置m_midRightWgt和m_topRightWgt
     */
    QVBoxLayout *m_vLayout {nullptr};

    Dtk::Widget::DSplitter *m_hSplitter;
    // Resize Window      --> Ctrl+Alt+F
    QShortcut *m_scWndReize {nullptr};
    // Find font          --> Ctrl+F
    QShortcut *m_scFindFont {nullptr};
    // export file          --> Ctrl+E
    QShortcut *m_scExport {nullptr};
    int m_originFilterWidth = 0;

    QList<QAction *> m_refreshActions;
    QTimer *m_refreshTimer {nullptr};
    DSettings *m_settings {nullptr};

    DIconButton *m_refreshBtn {nullptr};
    DIconButton *m_exportAllBtn {nullptr};
    ExportProgressDlg *m_exportDlg {nullptr};

    QSettingBackend  *m_backend {nullptr};
};

#endif // LOGCOLLECTORMAIN_H