File indexing completed on 2024-06-16 04:16:26

0001 /*
0002  *  SPDX-FileCopyrightText: 2017 Boudewijn Rempt <boud@valdyas.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "buginfo.h"
0008 
0009 #include <cmath>
0010 
0011 #include <klocalizedstring.h>
0012 #include <kis_debug.h>
0013 #include <kpluginfactory.h>
0014 #include <kis_icon.h>
0015 #include <KisViewManager.h>
0016 #include <kis_action.h>
0017 #include "DlgKritaLog.h"
0018 #include "DlgSysInfo.h"
0019 
0020 #ifdef Q_OS_ANDROID
0021 #include "DlgAndroidLogcatDumper.h"
0022 #endif
0023 
0024 #if defined(Q_OS_ANDROID) || defined(Q_OS_WIN)
0025 #include "DlgCrashLog.h"
0026 #endif
0027 
0028 K_PLUGIN_FACTORY_WITH_JSON(BugInfoFactory, "kritabuginfo.json", registerPlugin<BugInfo>();)
0029 
0030 
0031 
0032 BugInfo::BugInfo(QObject *parent, const QVariantList &)
0033         : KisActionPlugin(parent)
0034 {
0035     KisAction *actionBug  = createAction("buginfo");
0036     KisAction *actionSys  = createAction("sysinfo");
0037     connect(actionBug, SIGNAL(triggered()), this, SLOT(slotKritaLog()));
0038     connect(actionSys, SIGNAL(triggered()), this, SLOT(slotSysInfo()));
0039 
0040 #ifdef Q_OS_ANDROID
0041     KisAction *actionLogcatdump = createAction("logcatdump");
0042     connect(actionLogcatdump, SIGNAL(triggered()), this, SLOT(slotDumpLogcat()));
0043 #endif
0044 
0045 #if defined(Q_OS_ANDROID) || defined(Q_OS_WIN)
0046     KisAction *actionCrashLog = createAction("crashlog");
0047     connect(actionCrashLog, SIGNAL(triggered()), this, SLOT(slotCrashLog()));
0048 #endif
0049 }
0050 
0051 
0052 BugInfo::~BugInfo()
0053 {
0054 }
0055 
0056 void BugInfo::slotKritaLog()
0057 {
0058     DlgKritaLog dlgKritaLog(viewManager()->mainWindowAsQWidget());
0059     dlgKritaLog.exec();
0060 }
0061 
0062 void BugInfo::slotSysInfo()
0063 {
0064     DlgSysInfo dlgSysInfo(viewManager()->mainWindowAsQWidget());
0065     dlgSysInfo.exec();
0066 }
0067 
0068 #ifdef Q_OS_ANDROID
0069 void BugInfo::slotDumpLogcat()
0070 {
0071     DlgAndroidLogcatDumper dlgLogcatDumper(viewManager()->mainWindowAsQWidget());
0072     dlgLogcatDumper.exec();
0073 }
0074 #endif
0075 
0076 #if defined(Q_OS_ANDROID) || defined(Q_OS_WIN)
0077 void BugInfo::slotCrashLog()
0078 {
0079     DlgCrashLog dlgCrashLog(viewManager()->mainWindowAsQWidget());
0080     dlgCrashLog.exec();
0081 }
0082 #endif
0083 
0084 #include "buginfo.moc"