mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
plasma: use QTextStream instead of QDebug for the support information
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
568b377ca8
commit
3fe4d8b021
4 changed files with 62 additions and 183 deletions
|
@ -14,7 +14,6 @@ set(plasma_SRCS
|
|||
desktoptracker.cpp
|
||||
interactiveconsole.cpp
|
||||
main.cpp
|
||||
supportinformation.cpp
|
||||
panelcontroller.cpp
|
||||
panelview.cpp
|
||||
panelapplethandle.cpp
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include <QElapsedTimer>
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
#include <QtCore/qsignalmapper.h>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <KAction>
|
||||
#include <KCrash>
|
||||
|
@ -65,6 +65,7 @@
|
|||
#include <Plasma/Theme>
|
||||
#include <Plasma/Wallpaper>
|
||||
#include <Plasma/WindowEffects>
|
||||
#include <Plasma/Package>
|
||||
|
||||
#include <plasmagenericshell/backgrounddialog.h>
|
||||
|
||||
|
@ -80,8 +81,6 @@
|
|||
#include "toolbutton.h"
|
||||
#include "klistconfirmationdialog.h"
|
||||
|
||||
#include "supportinformation.h"
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
@ -89,6 +88,37 @@
|
|||
|
||||
extern QString plasmaLocale;
|
||||
|
||||
static void addInformationForApplet(QTextStream &stream, Plasma::Applet *applet)
|
||||
{
|
||||
if (applet->isContainment()) {
|
||||
stream << "Containment - ";
|
||||
} else {
|
||||
stream << "Applet - ";
|
||||
}
|
||||
stream << applet->name() << ":\n";
|
||||
|
||||
stream << "Plugin Name: " << applet->pluginName() << '\n';
|
||||
stream << "Category: " << applet->category() << '\n';
|
||||
|
||||
|
||||
if (applet->package()) {
|
||||
stream << "API: " << applet->package()->metadata().implementationApi() << '\n';
|
||||
stream << "Type: " << applet->package()->metadata().type() << '\n';
|
||||
stream << "Version: " << applet->package()->metadata().version() << '\n';
|
||||
stream << "Author: " << applet->package()->metadata().author() << '\n';
|
||||
}
|
||||
|
||||
// runtime info
|
||||
stream << "Failed To Launch: " << applet->hasFailedToLaunch() << '\n';
|
||||
const QRect rect = applet->screenRect();
|
||||
stream << "ScreenRect: " << rect.x() << ',' << rect.y() << ' ' << rect.width() << 'x' << rect.height() << '\n';
|
||||
stream << "FormFactor: " << applet->formFactor() << '\n';
|
||||
|
||||
stream << "Config Group Name: " << applet->config().name() << '\n';
|
||||
|
||||
stream << '\n'; // insert a blank line
|
||||
}
|
||||
|
||||
PlasmaApp* PlasmaApp::self()
|
||||
{
|
||||
if (!kapp) {
|
||||
|
@ -1006,7 +1036,35 @@ void PlasmaApp::panelRemoved(QObject *panel)
|
|||
|
||||
QString PlasmaApp::supportInformation() const
|
||||
{
|
||||
return SupportInformation::generateSupportInformation(m_corona);
|
||||
QString streambuffer;
|
||||
QTextStream stream(&streambuffer);
|
||||
stream << "Plasma-desktop Support Information:\n"
|
||||
<< "The following information should be used when requesting support.\n"
|
||||
<< "It provides information about the currently running instance and which applets are used.\n"
|
||||
<< "Please include the information provided underneath this introductory text along with "
|
||||
<< "whatever you think may be relevant to the issue.\n\n";
|
||||
|
||||
stream << "Version\n";
|
||||
stream << "=======\n";
|
||||
stream << "KDE SC version (runtime):\n";
|
||||
stream << KDE::versionString() << '\n';
|
||||
stream << "KDE SC version (compile):\n";
|
||||
stream << KDE_VERSION_STRING << '\n';
|
||||
stream << "Katie Version:\n";
|
||||
stream << qVersion() << '\n';
|
||||
|
||||
stream << '\n' << "=========" << '\n';
|
||||
|
||||
foreach (Plasma::Containment *containment, m_corona->containments()) {
|
||||
// a containment is also an applet so print standard applet information out
|
||||
addInformationForApplet(stream, containment);
|
||||
|
||||
foreach (Plasma::Applet *applet, containment->applets()) {
|
||||
addInformationForApplet(stream, applet);
|
||||
}
|
||||
}
|
||||
|
||||
return streambuffer;
|
||||
}
|
||||
|
||||
void PlasmaApp::executeCommands(const QList < QVariant > & commands)
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
* Class to generate support information for plasma shells
|
||||
*
|
||||
* Copyright (C) 2013 David Edmundson <kde@davidedmundson.co.uk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "supportinformation.h"
|
||||
|
||||
#include <QBuffer>
|
||||
#include <Plasma/Applet>
|
||||
#include <Plasma/Containment>
|
||||
#include <Plasma/Corona>
|
||||
#include <Plasma/Package>
|
||||
#include <Plasma/PackageMetadata>
|
||||
|
||||
// this is deliberately _not_ in i18n, the information is for uploading to a bug report so should always be in
|
||||
// English so as to be useful for developers
|
||||
|
||||
QString SupportInformation::generateSupportInformation(Plasma::Corona *corona)
|
||||
{
|
||||
QBuffer infoBuffer;
|
||||
infoBuffer.open(QIODevice::WriteOnly);
|
||||
|
||||
{
|
||||
QDebug stream(&infoBuffer);
|
||||
SupportInformation info(stream);
|
||||
|
||||
info.addHeader();
|
||||
info.addInformationForCorona(corona);
|
||||
}
|
||||
|
||||
const QByteArray infoData = infoBuffer.data();
|
||||
return QString::fromAscii(infoData.constData(), infoData.size());
|
||||
}
|
||||
|
||||
SupportInformation::SupportInformation(const QDebug &outputStream) :
|
||||
m_stream(outputStream)
|
||||
{
|
||||
}
|
||||
|
||||
void SupportInformation::addHeader()
|
||||
{
|
||||
m_stream << "Plasma-desktop Support Information:\n"
|
||||
<< "The following information should be used when requesting support.\n"
|
||||
<< "It provides information about the currently running instance and which applets are used.\n"
|
||||
<< "Please include the information provided underneath this introductory text along with "
|
||||
<< "whatever you think may be relevant to the issue.\n\n";
|
||||
|
||||
m_stream << "Version\n";
|
||||
m_stream << "=======\n";
|
||||
m_stream << "KDE SC version (runtime):\n";
|
||||
m_stream << KDE::versionString() << '\n';
|
||||
m_stream << "KDE SC version (compile):\n";
|
||||
m_stream << KDE_VERSION_STRING << '\n';
|
||||
m_stream << "Katie Version:\n";
|
||||
m_stream << qVersion() << '\n';
|
||||
|
||||
addSeperator();
|
||||
}
|
||||
|
||||
void SupportInformation::addInformationForCorona(Plasma::Corona *corona)
|
||||
{
|
||||
foreach (Plasma::Containment *containment, corona->containments()) {
|
||||
addInformationForContainment(containment);
|
||||
}
|
||||
}
|
||||
|
||||
void SupportInformation::addInformationForContainment(Plasma::Containment *containment)
|
||||
{
|
||||
// a containment is also an applet so print standard applet information out
|
||||
addInformationForApplet(containment);
|
||||
|
||||
foreach (Plasma::Applet *applet, containment->applets()) {
|
||||
addInformationForApplet(applet);
|
||||
}
|
||||
}
|
||||
|
||||
void SupportInformation::addInformationForApplet(Plasma::Applet *applet)
|
||||
{
|
||||
if (applet->isContainment()) {
|
||||
m_stream << "Containment - ";
|
||||
} else {
|
||||
m_stream << "Applet - ";
|
||||
}
|
||||
m_stream << applet->name() << ":\n";
|
||||
|
||||
m_stream << "Plugin Name: " << applet->pluginName() << '\n';
|
||||
m_stream << "Category: " << applet->category() << '\n';
|
||||
|
||||
|
||||
if (applet->package()) {
|
||||
m_stream << "API: " << applet->package()->metadata().implementationApi() << '\n';
|
||||
m_stream << "Type: " << applet->package()->metadata().type() << '\n';
|
||||
m_stream << "Version: " << applet->package()->metadata().version() << '\n';
|
||||
m_stream << "Author: " << applet->package()->metadata().author() << '\n';
|
||||
}
|
||||
|
||||
// runtime info
|
||||
m_stream << "Failed To Launch: " << applet->hasFailedToLaunch() << '\n';
|
||||
m_stream << "ScreenRect: " << applet->screenRect() << '\n';
|
||||
m_stream << "FormFactor: " << applet->formFactor() << '\n';
|
||||
|
||||
m_stream << "Config Group Name: " << applet->config().name() << '\n';
|
||||
|
||||
m_stream << '\n'; // insert a blank line
|
||||
}
|
||||
|
||||
void SupportInformation::addSeperator()
|
||||
{
|
||||
m_stream << '\n' << "=========" << '\n';
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Class to generate support information for plasma shells
|
||||
*
|
||||
* Copyright (C) 2013 David Edmundson <kde@davidedmundson.co.uk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef SUPPORTINFORMATION_H
|
||||
#define SUPPORTINFORMATION_H
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
class Corona;
|
||||
class Containment;
|
||||
class Applet;
|
||||
}
|
||||
|
||||
class SupportInformation
|
||||
{
|
||||
public:
|
||||
static QString generateSupportInformation(Plasma::Corona *corona);
|
||||
|
||||
private:
|
||||
SupportInformation(const QDebug &outputStream);
|
||||
|
||||
void addHeader();
|
||||
|
||||
void addInformationForCorona(Plasma::Corona *corona);
|
||||
void addInformationForContainment(Plasma::Containment *containment);
|
||||
void addInformationForApplet(Plasma::Applet *applet);
|
||||
|
||||
void addSeperator();
|
||||
|
||||
QDebug m_stream;
|
||||
};
|
||||
|
||||
#endif // SUPPORTINFORMATION_H
|
Loading…
Add table
Reference in a new issue