File indexing completed on 2022-11-23 12:12:12

0001 /*
0002     SPDX-FileCopyrightText: 2009 George Kiagiadakis <gkiagia@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2021 Harald Sitter <sitter@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 #ifndef DRKONQI_H
0008 #define DRKONQI_H
0009 
0010 #include <QString>
0011 
0012 class QWidget;
0013 
0014 class SystemInformation;
0015 class DebuggerManager;
0016 class CrashedApplication;
0017 class AbstractDrKonqiBackend;
0018 
0019 class DrKonqi
0020 {
0021 public:
0022     static bool init();
0023 
0024     static SystemInformation *systemInformation();
0025     static DebuggerManager *debuggerManager();
0026     static CrashedApplication *crashedApplication();
0027 
0028     static void saveReport(const QString &reportText, QWidget *parent = nullptr);
0029     static void shutdownSaveReport();
0030     static void setSignal(int signal);
0031     static void setAppName(const QString &appName);
0032     static void setAppPath(const QString &appPath);
0033     static void setAppVersion(const QString &appVersion);
0034     static void setBugAddress(const QString &bugAddress);
0035     static void setProgramName(const QString &programName);
0036     static void setProductName(const QString &productName);
0037     static void setPid(int pid);
0038     static void setKdeinit(bool kdeinit);
0039     static void setSafer(bool safer);
0040     static void setRestarted(bool restarted);
0041     static void setKeepRunning(bool keepRunning);
0042     static void setThread(int thread);
0043     static void setStartupId(const QString &startupId);
0044 
0045     static int signal();
0046     static const QString &appName();
0047     static const QString &appPath();
0048     static const QString &appVersion();
0049     static const QString &bugAddress();
0050     static const QString &programName();
0051     static const QString &productName();
0052     static int pid();
0053     static bool isKdeinit();
0054     static bool isSafer();
0055     static bool isRestarted();
0056     static bool isKeepRunning();
0057     static int thread();
0058     static bool ignoreQuality();
0059     // Whether bugstest.kde.org is used.
0060     static bool isTestingBugzilla();
0061     static const QString &kdeBugzillaURL();
0062     static const QString &startupId();
0063     static QString backendClassName();
0064 
0065     // An ephemeral crash is one that cannot be restarted at a later point.
0066     // e.g. KCrashBackend is ephemeral, CoredumpBackend is not.
0067     static bool isEphemeralCrash();
0068 
0069     // Clean before quitting. This is not meant to ever get called if the quitting isn't the direct result of
0070     // an intentional quit. The primary effect of this function is that the backend will clean up persistent
0071     // backing data, such as coredumpd metadata files. We only want this to happen when we are certain
0072     // that the user has seen the crash but chosen to ignore it (e.g. closed the dialog window)
0073     static void cleanupBeforeQuit();
0074 
0075 private:
0076     DrKonqi();
0077     ~DrKonqi();
0078     static DrKonqi *instance();
0079 
0080     SystemInformation *m_systemInformation = nullptr;
0081     AbstractDrKonqiBackend *m_backend = nullptr;
0082 
0083     int m_signal;
0084     QString m_appName;
0085     QString m_appPath;
0086     QString m_appVersion;
0087     QString m_bugAddress;
0088     QString m_programName;
0089     QString m_productName;
0090     int m_pid;
0091     bool m_kdeinit;
0092     bool m_safer;
0093     bool m_restarted;
0094     bool m_keepRunning;
0095     int m_thread;
0096     QString m_startupId;
0097 };
0098 
0099 #endif