| 1 | // SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd. |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #include "LogViewerAdaptor.h" |
| 6 | #include <QtCore/QMetaObject> |
| 7 | #include <QtCore/QByteArray> |
| 8 | #include <QtCore/QList> |
| 9 | #include <QtCore/QMap> |
| 10 | #include <QtCore/QString> |
| 11 | #include <QtCore/QStringList> |
| 12 | #include <QtCore/QVariant> |
| 13 | |
| 14 | /* |
| 15 | * Implementation of adaptor class LogViewerAdaptor |
| 16 | */ |
| 17 | |
| 18 | LogViewerAdaptor::LogViewerAdaptor(QObject *parent) |
| 19 | : QDBusAbstractAdaptor(parent) |
| 20 | { |
| 21 | // constructor |
| 22 | setAutoRelaySignals(true); |
| 23 | } |
| 24 | |
| 25 | LogViewerAdaptor::~LogViewerAdaptor() |
| 26 | { |
| 27 | // destructor |
| 28 | } |
| 29 | |
| 30 | QString LogViewerAdaptor::executeCmd(const QString &cmd) |
| 31 | { |
| 32 | // handle method call com.deepin.logviewer.executeCmd |
| 33 | QString out0; |
| 34 | QMetaObject::invokeMethod(parent(), "executeCmd", Q_RETURN_ARG(QString, out0), Q_ARG(QString, cmd)); |
| 35 | return out0; |
| 36 | } |
| 37 | |
| 38 | int LogViewerAdaptor::exitCode() |
| 39 | { |
| 40 | // handle method call com.deepin.logviewer.exitCode |
| 41 | int out0; |
| 42 | QMetaObject::invokeMethod(parent(), "exitCode", Q_RETURN_ARG(int, out0)); |
| 43 | return out0; |
| 44 | } |
| 45 | |
| 46 | bool LogViewerAdaptor::exportLog(const QString &outDir, const QString &in, bool isFile) |
| 47 | { |
| 48 | // handle method call com.deepin.logviewer.exportLog |
| 49 | bool out0; |
| 50 | QMetaObject::invokeMethod(parent(), "exportLog", Q_RETURN_ARG(bool, out0), Q_ARG(QString, outDir), Q_ARG(QString, in), Q_ARG(bool, isFile)); |
| 51 | return out0; |
| 52 | } |
| 53 | |
| 54 | QStringList LogViewerAdaptor::getFileInfo(const QString &file, bool unzip) |
| 55 | { |
| 56 | // handle method call com.deepin.logviewer.getFileInfo |
| 57 | QStringList out0; |
| 58 | QMetaObject::invokeMethod(parent(), "getFileInfo", Q_RETURN_ARG(QStringList, out0), Q_ARG(QString, file), Q_ARG(bool, unzip)); |
| 59 | return out0; |
| 60 | } |
| 61 | |
| 62 | qulonglong LogViewerAdaptor::getFileSize(const QString &filePath) |
| 63 | { |
| 64 | // handle method call com.deepin.logviewer.getFileSize |
| 65 | qulonglong out0; |
| 66 | QMetaObject::invokeMethod(parent(), "getFileSize", Q_RETURN_ARG(qulonglong, out0), Q_ARG(QString, filePath)); |
| 67 | return out0; |
| 68 | } |
| 69 | |
| 70 | qlonglong LogViewerAdaptor::getLineCount(const QString &filePath) |
| 71 | { |
| 72 | // handle method call com.deepin.logviewer.getLineCount |
| 73 | qlonglong out0; |
| 74 | QMetaObject::invokeMethod(parent(), "getLineCount", Q_RETURN_ARG(qlonglong, out0), Q_ARG(QString, filePath)); |
| 75 | return out0; |
| 76 | } |
| 77 | |
| 78 | QString LogViewerAdaptor::isFileExist(const QString &filePath) |
| 79 | { |
| 80 | // handle method call com.deepin.logviewer.isFileExist |
| 81 | QString out0; |
| 82 | QMetaObject::invokeMethod(parent(), "isFileExist", Q_RETURN_ARG(QString, out0), Q_ARG(QString, filePath)); |
| 83 | return out0; |
| 84 | } |
| 85 | |
| 86 | QString LogViewerAdaptor::openLogStream(const QString &filePath) |
| 87 | { |
| 88 | // handle method call com.deepin.logviewer.openLogStream |
| 89 | QString out0; |
| 90 | QMetaObject::invokeMethod(parent(), "openLogStream", Q_RETURN_ARG(QString, out0), Q_ARG(QString, filePath)); |
| 91 | return out0; |
| 92 | } |
| 93 | |
| 94 | void LogViewerAdaptor::quit() |
| 95 | { |
| 96 | // handle method call com.deepin.logviewer.quit |
| 97 | QMetaObject::invokeMethod(parent(), "quit"); |
| 98 | } |
| 99 | |
| 100 | QString LogViewerAdaptor::readLog(int fd) |
| 101 | { |
| 102 | // handle method call com.deepin.logviewer.readLog |
| 103 | QString out0; |
| 104 | QMetaObject::invokeMethod(parent(), "readLog", Q_RETURN_ARG(QString, out0), Q_ARG(int, fd)); |
| 105 | return out0; |
| 106 | } |
| 107 | |
| 108 | QString LogViewerAdaptor::readLogInStream(const QString &token) |
| 109 | { |
| 110 | // handle method call com.deepin.logviewer.readLogInStream |
| 111 | QString out0; |
| 112 | QMetaObject::invokeMethod(parent(), "readLogInStream", Q_RETURN_ARG(QString, out0), Q_ARG(QString, token)); |
| 113 | return out0; |
| 114 | } |
| 115 | |
| 116 | QStringList LogViewerAdaptor::readLogLinesInRange(int fd, qlonglong startLine, qlonglong lineCount) |
| 117 | { |
| 118 | // handle method call com.deepin.logviewer.readLogLinesInRange |
| 119 | QStringList out0; |
| 120 | QMetaObject::invokeMethod(parent(), "readLogLinesInRange", Q_RETURN_ARG(QStringList, out0), Q_ARG(int, fd), Q_ARG(qlonglong, startLine), Q_ARG(qlonglong, lineCount)); |
| 121 | return out0; |
| 122 | } |
| 123 | |
| 124 | QStringList LogViewerAdaptor::whiteListOutPaths() |
| 125 | { |
| 126 | // handle method call com.deepin.logviewer.whiteListOutPaths |
| 127 | QStringList out0; |
| 128 | QMetaObject::invokeMethod(parent(), "whiteListOutPaths", Q_RETURN_ARG(QStringList, out0)); |
| 129 | return out0; |
| 130 | } |
| 131 |