drkonqi: remove debug package installer

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-03-07 18:25:57 +02:00
parent d065c61a17
commit 8e74da840e
7 changed files with 10 additions and 275 deletions

View file

@ -3,10 +3,6 @@ project(drkonqi)
check_function_exists("strsignal" HAVE_STRSIGNAL)
check_function_exists("uname" HAVE_UNAME)
if(NOT DEBUG_PACKAGE_INSTALLER_NAME)
set (DEBUG_PACKAGE_INSTALLER_NAME "installdbgsymbols.sh")
endif()
configure_file(
config-drkonqi.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-drkonqi.h
@ -26,7 +22,6 @@ set(drkonqi_SRCS
drkonqi.cpp
drkonqibackends.cpp
detachedprocessmonitor.cpp
debugpackageinstaller.cpp
systeminformation.cpp
crashedapplication.cpp
debugger.cpp

View file

@ -49,12 +49,6 @@ BacktraceWidget::BacktraceWidget(BacktraceGenerator *generator, QWidget *parent,
{
ui.setupUi(this);
//Debug package installer
m_debugPackageInstaller = new DebugPackageInstaller(this);
connect(m_debugPackageInstaller, SIGNAL(error(QString)), this, SLOT(debugPackageError(QString)));
connect(m_debugPackageInstaller, SIGNAL(packagesInstalled()), this, SLOT(regenerateBacktrace()));
connect(m_debugPackageInstaller, SIGNAL(canceled()), this, SLOT(debugPackageCanceled()));
connect(m_btGenerator, SIGNAL(done()) , this, SLOT(loadData()));
connect(m_btGenerator, SIGNAL(someError()) , this, SLOT(loadData()));
connect(m_btGenerator, SIGNAL(failedToStart()) , this, SLOT(loadData()));
@ -74,13 +68,6 @@ BacktraceWidget::BacktraceWidget(BacktraceGenerator *generator, QWidget *parent,
"a better backtrace.")));
connect(ui.m_reloadBacktraceButton, SIGNAL(clicked()), this, SLOT(regenerateBacktrace()));
ui.m_installDebugButton->setGuiItem(
KGuiItem2(i18nc("@action:button", "&Install Debug Symbols"),
KIcon("system-software-update"), i18nc("@info:tooltip", "Use this button to "
"install the missing debug symbols packages.")));
ui.m_installDebugButton->setVisible(false);
connect(ui.m_installDebugButton, SIGNAL(clicked()), this, SLOT(installDebugPackages()));
ui.m_copyButton->setGuiItem(KGuiItem2(QString(), KIcon("edit-copy"),
i18nc("@info:tooltip", "Use this button to copy the "
"crash information (backtrace) to the clipboard.")));
@ -142,7 +129,6 @@ void BacktraceWidget::setAsLoading()
ui.m_extraDetailsLabel->setVisible(false);
ui.m_extraDetailsLabel->clear();
ui.m_installDebugButton->setVisible(false);
ui.m_reloadBacktraceButton->setEnabled(false);
ui.m_copyButton->setEnabled(false);
@ -195,7 +181,6 @@ void BacktraceWidget::anotherDebuggerRunning()
"the crashed application. Therefore, the DrKonqi debugger cannot "
"fetch the backtrace. Please close the other debugger and "
"click <interface>Reload</interface>."));
ui.m_installDebugButton->setVisible(false);
ui.m_reloadBacktraceButton->setEnabled(true);
}
@ -249,34 +234,13 @@ void BacktraceWidget::loadData()
if (btParser->backtraceUsefulness() != BacktraceParser::ReallyUseful) {
//Not a perfect bactrace, ask the user to try to improve it
ui.m_extraDetailsLabel->setVisible(true);
if (canInstallDebugPackages()) {
//The script to install the debug packages is available
ui.m_extraDetailsLabel->setText(i18nc("@info/rich", "You can click the <interface>"
"Install Debug Symbols</interface> button in order to automatically "
"install the missing debugging information packages. If this method "
"does not work: please read <link url='%1'>How to "
"create useful crash reports</link> to learn how to get a useful "
"backtrace; install the needed packages (<link url='%2'>"
"list of files</link>) and click the "
"<interface>Reload</interface> button.",
QLatin1String(TECHBASE_HOWTO_DOC),
QLatin1String("#missingDebugPackages")));
ui.m_installDebugButton->setVisible(true);
//Retrieve the libraries with missing debug info
QStringList missingLibraries = btParser->librariesWithMissingDebugSymbols().toList();
m_debugPackageInstaller->setMissingLibraries(missingLibraries);
} else {
//No automated method to install the missing debug info
//Tell the user to read the howto and reload
ui.m_extraDetailsLabel->setText(i18nc("@info/rich", "Please read <link url='%1'>How to "
"create useful crash reports</link> to learn how to get a useful "
"backtrace; install the needed packages (<link url='%2'>"
"list of files</link>) and click the "
"<interface>Reload</interface> button.",
QLatin1String(TECHBASE_HOWTO_DOC),
QLatin1String("#missingDebugPackages")));
}
ui.m_extraDetailsLabel->setText(i18nc("@info/rich", "Please read <link url='%1'>How to "
"create useful crash reports</link> to learn how to get a useful "
"backtrace; install the needed packages (<link url='%2'>"
"list of files</link>) and click the "
"<interface>Reload</interface> button.",
QLatin1String(TECHBASE_HOWTO_DOC),
QLatin1String("#missingDebugPackages")));
}
ui.m_copyButton->setEnabled(true);
@ -346,34 +310,6 @@ void BacktraceWidget::hilightExtraDetailsLabel(bool hilight)
ui.m_extraDetailsLabel->setStyleSheet(stylesheet);
}
void BacktraceWidget::focusImproveBacktraceButton()
{
ui.m_installDebugButton->setFocus();
}
void BacktraceWidget::installDebugPackages()
{
ui.m_installDebugButton->setVisible(false);
m_debugPackageInstaller->installDebugPackages();
}
void BacktraceWidget::debugPackageError(const QString & errorMessage)
{
ui.m_installDebugButton->setVisible(true);
KMessageBox::error(this, errorMessage, i18nc("@title:window", "Error during the installation of"
" debug symbols"));
}
void BacktraceWidget::debugPackageCanceled()
{
ui.m_installDebugButton->setVisible(true);
}
bool BacktraceWidget::canInstallDebugPackages() const
{
return m_debugPackageInstaller->canInstallDebugPackages();
}
void BacktraceWidget::toggleBacktrace(bool show)
{
ui.m_backtraceStack->setCurrentWidget(show ? ui.backtracePage : ui.backtraceHelpPage);

View file

@ -21,11 +21,10 @@
#define BACKTRACEWIDGET__H
#include <QWidget>
#include <QSyntaxHighlighter>
#include "debugpackageinstaller.h"
#include "ui_backtracewidget.h"
#include <QSyntaxHighlighter>
class BacktraceRatingWidget;
class BacktraceGenerator;
@ -37,12 +36,9 @@ public:
explicit BacktraceWidget(BacktraceGenerator *generator, QWidget *parent = 0,
bool showToggleBacktrace = false);
bool canInstallDebugPackages() const;
public Q_SLOTS:
void generateBacktrace();
void hilightExtraDetailsLabel(bool hilight);
void focusImproveBacktraceButton();
void toggleBacktrace(bool show);
void extraDetailsLinkActivated(QString link);
@ -51,11 +47,10 @@ Q_SIGNALS:
void stateChanged();
private:
BacktraceGenerator * m_btGenerator;
BacktraceGenerator *m_btGenerator;
Ui::Form ui;
BacktraceRatingWidget * m_backtraceRatingWidget;
BacktraceRatingWidget *m_backtraceRatingWidget;
QSyntaxHighlighter *m_highlighter;
DebugPackageInstaller * m_debugPackageInstaller;
void setAsLoading();
@ -69,10 +64,6 @@ private Q_SLOTS:
void copyClicked();
void anotherDebuggerRunning();
void installDebugPackages();
void debugPackageError(const QString &);
void debugPackageCanceled();
};
#endif

View file

@ -112,9 +112,6 @@
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="m_installDebugButton"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">

View file

@ -1,3 +1,2 @@
#cmakedefine HAVE_STRSIGNAL 1
#cmakedefine HAVE_UNAME 1
#define DEBUG_PACKAGE_INSTALLER_NAME "@DEBUG_PACKAGE_INSTALLER_NAME@"

View file

@ -1,127 +0,0 @@
/*******************************************************************
* debugpackageinstaller.cpp
* Copyright 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************/
#include <config-drkonqi.h>
#include "debugpackageinstaller.h"
#include <KStandardDirs>
#include <KDebug>
#include <KLocalizedString>
#include <KProgressDialog>
#include "drkonqi.h"
#include "crashedapplication.h"
DebugPackageInstaller::DebugPackageInstaller(QObject *parent)
: QObject(parent), m_installerProcess(0), m_progressDialog(0)
{
m_executablePath = KStandardDirs::findExe(DEBUG_PACKAGE_INSTALLER_NAME); //defined from CMakeLists.txt
}
bool DebugPackageInstaller::canInstallDebugPackages() const
{
return !m_executablePath.isEmpty();
}
void DebugPackageInstaller::setMissingLibraries(const QStringList & libraries)
{
m_missingLibraries = libraries;
}
void DebugPackageInstaller::installDebugPackages()
{
Q_ASSERT(canInstallDebugPackages());
if (!m_installerProcess) {
//Run process
m_installerProcess = new QProcess(this);
connect(m_installerProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(processFinished(int,QProcess::ExitStatus)));
QStringList installerArguments;
installerArguments << DrKonqi::crashedApplication()->executable().absoluteFilePath()
<< m_missingLibraries;
m_installerProcess->start(m_executablePath, installerArguments);
//Show dialog
m_progressDialog = new KProgressDialog(qobject_cast<QWidget*>(parent()));
connect(m_progressDialog, SIGNAL(cancelClicked()), this, SLOT(progressDialogCanceled()));
m_progressDialog->progressBar()->setRange(0,0);
m_progressDialog->setWindowTitle(i18nc("@title:window", "Missing debug symbols"));
m_progressDialog->setLabelText(i18nc("@info:progress", "Requesting installation of missing "
"debug symbols packages..."));
m_progressDialog->show();
}
}
void DebugPackageInstaller::progressDialogCanceled()
{
m_progressDialog->deleteLater();
m_progressDialog = 0;
if (m_installerProcess) {
if (m_installerProcess->state() == QProcess::Running) {
disconnect(m_installerProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(processFinished(int,QProcess::ExitStatus)));
m_installerProcess->kill();
disconnect(m_installerProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
m_installerProcess, SLOT(deleteLater()));
}
m_installerProcess = 0;
}
emit canceled();
}
void DebugPackageInstaller::processFinished(int exitCode, QProcess::ExitStatus)
{
switch(exitCode) {
case ResultInstalled:
{
emit packagesInstalled();
break;
}
case ResultSymbolsNotFound:
{
emit error(i18nc("@info", "Could not find debug symbol packages for this application."));
break;
}
case ResultCanceled:
{
emit canceled();
break;
}
case ResultError:
default:
{
emit error(i18nc("@info", "An error was encountered during the installation "
"of the debug symbol packages."));
break;
}
}
m_progressDialog->reject();
delete m_progressDialog;
m_progressDialog = 0;
delete m_installerProcess;
m_installerProcess = 0;
}

View file

@ -1,56 +0,0 @@
/*******************************************************************
* debugpackageinstaller.h
* Copyright 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************/
#ifndef DEBUGPACKAGEINSTALLER__H
#define DEBUGPACKAGEINSTALLER__H
#include <QtCore/QObject>
#include <QtCore/QProcess>
class KProgressDialog;
class DebugPackageInstaller: public QObject
{
Q_OBJECT
enum Results { ResultInstalled = 0, ResultError = 1,
ResultSymbolsNotFound = 2, ResultCanceled = 3 };
public:
explicit DebugPackageInstaller(QObject *parent = 0);
bool canInstallDebugPackages() const;
void setMissingLibraries(const QStringList &);
void installDebugPackages();
private Q_SLOTS:
void processFinished(int, QProcess::ExitStatus);
void progressDialogCanceled();
Q_SIGNALS:
void packagesInstalled();
void error(const QString &);
void canceled();
private:
QProcess * m_installerProcess;
KProgressDialog * m_progressDialog;
QString m_executablePath;
QStringList m_missingLibraries;
};
#endif