File: logdetailinfowidget.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 (78 lines) | stat: -rw-r--r-- 2,505 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
// SPDX-FileCopyrightText: 2019 - 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef LOGDETAILINFOWIDGET_H
#define LOGDETAILINFOWIDGET_H
#include "logiconbutton.h"
#include "logdetailedit.h"
#include "structdef.h"

#include <DHorizontalLine>
#include <DLabel>
#include <DWidget>
#include <DTextBrowser>

#include <QModelIndex>
#include <QStandardItemModel>

DWIDGET_USE_NAMESPACE
class QStandardItemModel;
class QVBoxLayout;
/**
 * @brief The logDetailInfoWidget class 详情页控件
 */
class logDetailInfoWidget : public Dtk::Widget::DWidget
{
    Q_OBJECT
public:
    explicit logDetailInfoWidget(QWidget *parent = nullptr);

    void cleanText();

    void hideLine(bool isHidden);

private:
    void initUI();
    void setTextCustomSize(QWidget *w);

    void fillDetailInfo(QString deamonName, QString usrName, QString pid, QString dateTime,
                        QModelIndex level, QString msg, QString status = "", QString action = "",
                        QString uname = "", QString event = "");  // modified by Airy
    //其他日志或者自定义日志数据显示
    void fillOOCDetailInfo(const QString &data, const int error = 0);

protected:
    void paintEvent(QPaintEvent *event) override;
public slots:
    void slot_DetailInfo(const QModelIndex &index, QStandardItemModel *pModel, const QString &data, const int error);

private:
    //m_daemonName:进程名显示控件 m_dateTime:时间显示控件 m_userName:用户名显示控件  m_pid:进程号显示控件 m_action:动作显示控件  m_status:状态显示控件 m_name:开关机日志用户名显示控件 m_event: 开关机日志时间类型显示
    Dtk::Widget::DLabel *m_daemonName, *m_dateTime, *m_userName, *m_pid, *m_action, *m_status,
        *m_name, *m_event;  // modified by Airy
    /**
     * @brief m_level 日志等级显示控件
     */
    LogIconButton *m_level;
    Dtk::Widget::DLabel *m_userLabel, *m_pidLabel, *m_statusLabel, *m_actionLabel, *m_nameLabel,
        *m_eventLabel, *m_errorLabel;  // modified by Airy
    /**
     * @brief m_textBrowser 日志信息显示控件
     */
    logDetailEdit *m_textBrowser;
    /**
     * @brief m_hline 中间的分割线
     */
    Dtk::Widget::DHorizontalLine *m_hline;
    /**
     * @brief m_pModel 当前主表的model
     */
    QStandardItemModel *m_pModel;
    /**
     * @brief m_bottomLayer 底部框
     */
    QVBoxLayout *m_bottomLayer;
};

#endif  // LOGDETAILINFOWIDGET_H