File: dldbushandler.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 (47 lines) | stat: -rw-r--r-- 1,516 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
// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef DLDBUSHANDLER_H
#define DLDBUSHANDLER_H

#include "dldbusinterface.h"
#include <QObject>

class DLDBusHandler : public QObject
{
    Q_OBJECT
public:
    static DLDBusHandler *instance(QObject *parent = nullptr);
    ~DLDBusHandler();
    QString readLog(const QString &filePath);
    QStringList readLogLinesInRange(const QString &filePath, qint64 startLine = 0, qint64 lineCount = 500, bool bReverse = true);
    QStringList getFileInfo(const QString &flag, bool unzip = true);
    QStringList getOtherFileInfo(const QString &flag, bool unzip = true);
    int exitCode();
    void quit();
    bool exportLog(const QString &outDir, const QString &in, bool isFile);
    bool isFileExist(const QString &filePath);
    quint64 getFileSize(const QString &filePath);
    qint64 getLineCount(const QString &filePath);
    QString executeCmd(const QString &cmd);
    QString openLogStream(const QString &filePath);
    QString readLogInStream(const QString &token);
    QStringList whiteListOutPaths();

private:
    explicit DLDBusHandler(QObject *parent = nullptr);

private:
    QString createFilePathCacheFile(const QString& logFilePath);
    void releaseFilePathCacheFile(const QString &cacheFilePath);

private:
    static DLDBusHandler *m_statichandeler;
    DeepinLogviewerInterface *m_dbus;
    QStringList filePath;

    QTemporaryDir m_tempDir;
};

#endif // DLDBUSHANDLER_H