File indexing completed on 2024-05-05 09:45:48

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 setSignal(int signal);
0030     static void setAppName(const QString &appName);
0031     static void setAppPath(const QString &appPath);
0032     static void setAppVersion(const QString &appVersion);
0033     static void setBugAddress(const QString &bugAddress);
0034     static void setProgramName(const QString &programName);
0035     static void setProductName(const QString &productName);
0036     static void setPid(int pid);
0037     static void setKdeinit(bool kdeinit);
0038     static void setSafer(bool safer);
0039     static void setRestarted(bool restarted);
0040     static void setKeepRunning(bool keepRunning);
0041     static void setThread(int thread);
0042     static void setStartupId(const QString &startupId);
0043 
0044     static int signal();
0045     static const QString &appName();
0046     static const QString &appPath();
0047     static const QString &appVersion();
0048     static const QString &bugAddress();
0049     static const QString &programName();
0050     static const QString &productName();
0051     static int pid();
0052     static bool isKdeinit();
0053     static bool isSafer();
0054     static bool isRestarted();
0055     static bool isKeepRunning();
0056     static int thread();
0057     static bool ignoreQuality();
0058     // Whether bugstest.kde.org is used.
0059     static bool isTestingBugzilla();
0060     static const QString &kdeBugzillaURL();
0061     static const QString &startupId();
0062     static QString backendClassName();
0063 
0064     // An ephemeral crash is one that cannot be restarted at a later point.
0065     // e.g. KCrashBackend is ephemeral, CoredumpBackend is not.
0066     static bool isEphemeralCrash();
0067 
0068     // Clean before quitting. This is not meant to ever get called if the quitting isn't the direct result of
0069     // an intentional quit. The primary effect of this function is that the backend will clean up persistent
0070     // backing data, such as coredumpd metadata files. We only want this to happen when we are certain
0071     // that the user has seen the crash but chosen to ignore it (e.g. closed the dialog window)
0072     static void cleanupBeforeQuit();
0073 
0074     // Whether to use the minimalistic UI or not. Defaults to false.
0075     static bool minimalMode();
0076 
0077     static DrKonqi *instance();
0078     QString m_glRenderer;
0079     QString m_exceptionName;
0080     QString m_exceptionWhat;
0081 
0082 private:
0083     DrKonqi();
0084     ~DrKonqi();
0085 
0086     SystemInformation *m_systemInformation = nullptr;
0087     AbstractDrKonqiBackend *m_backend = nullptr;
0088 
0089     int m_signal;
0090     QString m_appName;
0091     QString m_appPath;
0092     QString m_appVersion;
0093     QString m_bugAddress;
0094     QString m_programName;
0095     QString m_productName;
0096     int m_pid;
0097     bool m_kdeinit;
0098     bool m_safer;
0099     bool m_restarted;
0100     bool m_keepRunning;
0101     int m_thread;
0102     QString m_startupId;
0103 };
0104 
0105 #endif