Commit 54ed78cb authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add a simple dialog that shows system information for bug reports

parent 9e02d3cd
......@@ -98,20 +98,20 @@ xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0 http://www.kde.org
<Action name="showStatusBar" />
<Separator/>
<Action name="view_grid"/>
<Separator/>
<Menu name="SnapTo">
<text>&amp;Snap To</text>
<Action name="view_snap_to_guides"/>
<Action name="view_snap_to_grid"/>
<Action name="view_snap_orthogonal" />
<Action name="view_snap_node" />
<Action name="view_snap_extension" />
<Action name="view_snap_intersection" />
<Action name="view_snap_bounding_box" />
<Action name="view_snap_image_bounds" />
<Action name="view_snap_image_center" />
<Action name="view_snap_to_grid"/>
<Action name="view_snap_orthogonal" />
<Action name="view_snap_node" />
<Action name="view_snap_extension" />
<Action name="view_snap_intersection" />
<Action name="view_snap_bounding_box" />
<Action name="view_snap_image_bounds" />
<Action name="view_snap_image_center" />
</Menu>
<Separator/>
......@@ -210,29 +210,29 @@ xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0 http://www.kde.org
</Menu>
<Menu name="LayerTransform">
<text>&amp;Transform</text>
<Action name="mirrorNodeX"/>
<Action name="mirrorNodeY"/>
<Action name="layersize"/>
<Menu name="Rotate">
<text>&amp;Rotate</text>
<Action name="rotatelayer"/>
<Separator/>
<Action name="rotateLayerCW90"/>
<Action name="rotateLayerCCW90"/>
<Action name="rotateLayer180"/>
</Menu>
<Action name="mirrorNodeX"/>
<Action name="mirrorNodeY"/>
<Action name="layersize"/>
<Menu name="Rotate">
<text>&amp;Rotate</text>
<Action name="rotatelayer"/>
<Separator/>
<Action name="rotateLayerCW90"/>
<Action name="rotateLayerCCW90"/>
<Action name="rotateLayer180"/>
</Menu>
<Action name="shearlayer"/>
<Action name="offsetlayer"/>
</Menu>
<Action name="offsetlayer"/>
</Menu>
<Menu name="LayerSplitAlpha">
<text>S&amp;plit</text>
<Menu name="LayerSplitAlpha">
<text>S&amp;plit Alpha</text>
<Action name="split_alpha_into_mask"/>
<Action name="split_alpha_write"/>
<Action name="split_alpha_save_merged"/>
</Menu>
<Action name="layersplit"/>
<Menu name="LayerSplitAlpha">
<text>S&amp;plit Alpha</text>
<Action name="split_alpha_into_mask"/>
<Action name="split_alpha_write"/>
<Action name="split_alpha_save_merged"/>
</Menu>
<Action name="layersplit"/>
<Action name="clones_array"/>
</Menu>
......@@ -342,6 +342,7 @@ xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0 http://www.kde.org
<Action name="help_show_tip"/>
<Separator/>
<Action name="help_report_bug"/>
<Action name="buginfo"/>
<Separator/>
<Action name="help_about_app"/>
<Action name="help_about_kde"/>
......
......@@ -26,3 +26,4 @@ endif()
endif()
add_subdirectory( pykrita )
add_subdirectory( buginfo )
set(kritabuginfo_SOURCES
buginfo.cpp
dlg_buginfo.cpp
)
ki18n_wrap_ui(kritabuginfo_SOURCES wdg_buginfo.ui )
add_library(kritabuginfo MODULE ${kritabuginfo_SOURCES})
target_link_libraries(kritabuginfo kritaui)
install(TARGETS kritabuginfo DESTINATION ${KRITA_PLUGIN_INSTALL_DIR})
install( FILES buginfo.xmlgui DESTINATION ${DATA_INSTALL_DIR}/kritaplugins)
/*
* Copyright (c) 2017 Boudewijn Rempt <boud@valdyas.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "buginfo.h"
#include <cmath>
#include <klocalizedstring.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <kis_icon.h>
#include <KisViewManager.h>
#include <kis_action.h>
#include "dlg_buginfo.h"
K_PLUGIN_FACTORY_WITH_JSON(BugInfoFactory, "kritabuginfo.json", registerPlugin<BugInfo>();)
BugInfo::BugInfo(QObject *parent, const QVariantList &)
: KisViewPlugin(parent)
{
KisAction *action = createAction("buginfo");
action->setText(i18n("Show system information for bug reports."));
connect(action, SIGNAL(triggered()), this, SLOT(slotBugInfo()));
}
BugInfo::~BugInfo()
{
}
void BugInfo::slotBugInfo()
{
DlgBugInfo dlgBugInfo(m_view->mainWindow());
dlgBugInfo.exec();
}
#include "buginfo.moc"
/*
* Copyright (c) 2017 Boudewijn Rempt <boud@valdyas.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef BUGINFO_H
#define BUGINFO_H
#include <QVariant>
#include <kis_view_plugin.h>
class KUndo2MagicString;
class BugInfo : public KisViewPlugin
{
Q_OBJECT
public:
BugInfo(QObject *parent, const QVariantList &);
~BugInfo() override;
public Q_SLOTS:
void slotBugInfo();
};
#endif // BUGINFO_H
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritabuginfo" version="8" translationDomain="krita">
<MenuBar>
<Menu name="Help">
<Action name="buginfo"/>
</Menu>
</MenuBar>
</kpartgui>
/*
* Copyright (c) 2017 Boudewijn Rempt <boud@valdyas.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "dlg_buginfo.h"
#include <klocalizedstring.h>
#include <kis_debug.h>
#include <QSysInfo>
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#include <QWindow>
#include "kis_document_aware_spin_box_unit_manager.h"
DlgBugInfo::DlgBugInfo(QWidget *parent)
: KoDialog(parent)
{
setCaption(i18n("Please paste this information in your bug report"));
setButtons(Ok);
setDefaultButton(Ok);
m_page = new WdgBugInfo(this);
Q_CHECK_PTR(m_page);
setMainWidget(m_page);
resize(m_page->sizeHint());
// OS information
QString info;
info.append("OS Information");
info.append(" Build ABI: ").append(QSysInfo::buildAbi());
info.append("\n Build CPU: ").append(QSysInfo::buildCpuArchitecture());
info.append("\n CPU: ").append(QSysInfo::currentCpuArchitecture());
info.append("\n Kernel Type: ").append(QSysInfo::kernelType());
info.append("\n Kernel Version: ").append(QSysInfo::kernelVersion());
info.append("\n Hostname: ").append(QSysInfo::machineHostName());
info.append("\n Pretty Productname: ").append(QSysInfo::prettyProductName());
info.append("\n Product Type: ").append(QSysInfo::productType());
info.append("\n Product Version: ").append(QSysInfo::productVersion());
info.append("\n\n");
// OpenGL information
// we need a QSurface active to get our GL functions from the context
QWindow surface;
surface.setSurfaceType( QSurface::OpenGLSurface );
surface.create();
QOpenGLContext context;
context.create();
if (!context.isValid()) return;
context.makeCurrent( &surface );
QOpenGLFunctions *funcs = context.functions();
funcs->initializeOpenGLFunctions();
#ifndef GL_RENDERER
# define GL_RENDERER 0x1F01
#endif
QString Renderer = QString((const char*)funcs->glGetString(GL_RENDERER));
info.append("\nOpenGL Info");
info.append("\n Vendor: ").append(reinterpret_cast<const char *>(funcs->glGetString(GL_VENDOR)));
info.append("\n Renderer: ").append(Renderer);
info.append("\n Version: ").append(reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION)));
info.append("\n Shading language: ").append(reinterpret_cast<const char *>(funcs->glGetString(GL_SHADING_LANGUAGE_VERSION)));
int glMajorVersion = context.format().majorVersion();
int glMinorVersion = context.format().minorVersion();
bool supportsDeprecatedFunctions = (context.format().options() & QSurfaceFormat::DeprecatedFunctions);
info.append(QString("\n Version: %1.%2").arg(glMajorVersion).arg(glMinorVersion));
info.append(QString("\n Supports deprecated functions: %1").arg(supportsDeprecatedFunctions ? "true" : "false"));
// Installation information
m_page->txtBugInfo->setText(info);
}
DlgBugInfo::~DlgBugInfo()
{
delete m_page;
}
/*
* Copyright (c) 2017 Boudewijn Rempt <boud@valdyas.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_BUGINFO
#define DLG_BUGINFO
#include <KoDialog.h>
#include "ui_wdg_buginfo.h"
class WdgBugInfo : public QWidget, public Ui::WdgBugInfo
{
Q_OBJECT
public:
WdgBugInfo(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class DlgBugInfo: public KoDialog
{
Q_OBJECT
public:
DlgBugInfo(QWidget * parent = 0);
~DlgBugInfo() override;
private:
WdgBugInfo *m_page;
};
#endif // DLG_BUGINFO
{
"Id": "Buginfo Plugin",
"Type": "Service",
"X-KDE-Library": "kritabuginfo",
"X-KDE-ServiceTypes": [
"Krita/ViewPlugin"
],
"X-Krita-Version": "28"
}
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WdgBugInfo</class>
<widget class="QWidget" name="WdgBugInfo">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>367</width>
<height>439</height>
</rect>
</property>
<property name="windowTitle">
<string>Rotate Image</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Please add this information to a bug report:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QTextBrowser" name="txtBugInfo"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment