Skip to content

Commit a1bb3a0

Browse files
authored
Merge pull request #1997 from RubioJr9/bug_report
Closes #1989
2 parents 58c8b00 + 74f84cc commit a1bb3a0

File tree

6 files changed

+88
-25
lines changed

6 files changed

+88
-25
lines changed

Diff for: src/Interface/Modules/Render/Screenshot.cc

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ void Screenshot::takeScreenshot()
5252
screenshot_ = viewport_->grabFramebuffer();
5353
}
5454

55+
QImage Screenshot::getScreenshot() {
56+
return viewport_->grabFramebuffer();
57+
}
58+
5559
void Screenshot::saveScreenshot()
5660
{
5761
index_++;

Diff for: src/Interface/Modules/Render/Screenshot.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ namespace SCIRun
4646
public:
4747
explicit Screenshot(QOpenGLWidget *glwidget, QObject *parent = nullptr);
4848
void takeScreenshot();
49+
QImage getScreenshot();
4950
void saveScreenshot();
5051
QString screenshotFile() const;
51-
52-
5352
Modules::Render::RGBMatrices toMatrix() const;
53+
5454
private:
5555
QOpenGLWidget* viewport_;
5656
QImage screenshot_;

Diff for: src/Interface/Modules/Render/ViewScene.cc

+57-7
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,18 @@ DEALINGS IN THE SOFTWARE.
2929
#include <es-log/trace-log.h>
3030
#include <gl-platform/GLPlatform.hpp>
3131

32-
#include <Interface/Modules/Render/ViewScenePlatformCompatibility.h>
33-
#include <Interface/Modules/Render/ES/SRInterface.h>
34-
#include <Interface/Modules/Render/GLWidget.h>
3532
#include <Core/Application/Application.h>
3633
#include <Core/Application/Preferences/Preferences.h>
34+
#include <Core/Application/Version.h>
35+
#include <Core/GeometryPrimitives/Transform.h>
3736
#include <Core/Logging/Log.h>
38-
#include <Modules/Render/ViewScene.h>
39-
#include <Interface/Modules/Render/Screenshot.h>
40-
#include <Graphics/Glyphs/GlyphGeom.h>
4137
#include <Graphics/Datatypes/GeometryImpl.h>
42-
#include <Core/GeometryPrimitives/Transform.h>
38+
#include <Graphics/Glyphs/GlyphGeom.h>
39+
#include <Interface/Modules/Render/ES/SRInterface.h>
40+
#include <Interface/Modules/Render/GLWidget.h>
41+
#include <Interface/Modules/Render/Screenshot.h>
42+
#include <Interface/Modules/Render/ViewScenePlatformCompatibility.h>
43+
#include <Modules/Render/ViewScene.h>
4344
#include <boost/timer.hpp>
4445

4546
using namespace SCIRun::Gui;
@@ -2139,6 +2140,55 @@ void ViewSceneDialog::screenshotClicked()
21392140
screenshotTaker_->saveScreenshot();
21402141
}
21412142

2143+
//--------------------------------------------------------------------------------------------------
2144+
void ViewSceneDialog::sendBugReport()
2145+
{
2146+
QString glVersion = reinterpret_cast<const char*>(glGetString(GL_VERSION));
2147+
QString gpuVersion = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
2148+
2149+
// Temporarily save screenshot so that it can be sent over email
2150+
takeScreenshot();
2151+
QImage image = screenshotTaker_->getScreenshot();
2152+
QString location = QDir::homePath() % QLatin1String("/scirun5screenshots/scirun_bug.png");
2153+
image.save(location);
2154+
2155+
// Generate email template
2156+
QString askForScreenshot = "\nIMPORTANT: Make sure to attach the screenshot of the ViewScene located at "
2157+
% location % "\n\n\n";
2158+
static QString instructions = "## For bugs, follow the template below: fill out all pertinent sections,"
2159+
"then delete the rest of the template to reduce clutter."
2160+
"\n### If the prerequisite is met, just delete that text as well. "
2161+
"If they're not all met, the issue will be closed or assigned back to you.\n\n";
2162+
static QString prereqs = "**Prerequisite**\n* [ ] Did you [perform a cursory search](https://github.com/SCIInstitute/SCIRun/issues)"
2163+
"to see if your bug or enhancement is already reported?\n\n";
2164+
static QString reportGuide = "For more information on how to write a good "
2165+
"[bug report](https://github.com/atom/atom/blob/master/CONTRIBUTING.md#how-do-i-submit-a-good-bug-report) or"
2166+
"[enhancement request](https://github.com/atom/atom/blob/master/CONTRIBUTING.md#how-do-i-submit-a-good-enhancement-suggestion),"
2167+
"see the `CONTRIBUTING` guide. These links point to another project, but most of the advice holds in general.\n\n";
2168+
static QString describe = "**Describe the bug**\nA clear and concise description of what the bug is.\n\n";
2169+
static QString askForData = "**Providing sample network(s) along with input data is useful to solving your issue.**\n\n";
2170+
static QString reproduction = "**To Reproduce**\nSteps to reproduce the behavior:"
2171+
"\n1. Go to '...'\n2. Click on '....'\n3. Scroll down to '....'\n4. See error\n\n";
2172+
2173+
static QString expectedBehavior = "**Expected behavior**\nA clear and concise description of what you expected to happen.\n\n";
2174+
static QString additional = "**Additional context**\nAdd any other context about the problem here.\n\n";
2175+
QString desktopInfo = "Desktop: " % QSysInfo::prettyProductName() % "\n";
2176+
QString kernelInfo = "Kernel: " % QSysInfo::kernelVersion() % "\n";
2177+
QString gpuInfo = "GPU: " % gpuVersion % "\n";
2178+
QString qtInfo = "QT Version: " % QLibraryInfo::version().toString() % "\n";
2179+
QString glInfo = "GL Version: " % glVersion % "\n";
2180+
QString scirunVersionInfo = "SCIRun Version: " % QString::fromStdString(VersionInfo::GIT_VERSION_TAG) % "\n";
2181+
QString machineIdInfo = "Machine ID: " % QString(QSysInfo::machineUniqueId()) % "\n";
2182+
2183+
static QString recipient = "[email protected]";
2184+
static QString subject = "View%20Scene%20Bug%20Report";
2185+
QDesktopServices::openUrl(QUrl(QString("mailto:" % recipient % "?subject=" % subject % "&body=" %
2186+
askForScreenshot % instructions % prereqs % reportGuide %
2187+
describe % askForData % reproduction % expectedBehavior %
2188+
additional % desktopInfo % kernelInfo % gpuInfo %
2189+
qtInfo % glInfo % scirunVersionInfo % machineIdInfo)));
2190+
}
2191+
21422192
//--------------------------------------------------------------------------------------------------
21432193
void ViewSceneDialog::takeScreenshot()
21442194
{

Diff for: src/Interface/Modules/Render/ViewScene.h

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ namespace SCIRun {
7777

7878
protected Q_SLOTS:
7979
void printToString() const {std::cout << toString("");}
80+
void sendBugReport();
8081

8182
//---------------- New Geometry --------------------------------------------------------------
8283
void updateModifiedGeometries();

Diff for: src/Interface/Modules/Render/ViewSceneControls.ui

+23-16
Original file line numberDiff line numberDiff line change
@@ -2341,6 +2341,19 @@
23412341
<string>Developer</string>
23422342
</attribute>
23432343
<layout class="QGridLayout" name="gridLayout_8">
2344+
<item row="0" column="0">
2345+
<spacer name="horizontalSpacer_17">
2346+
<property name="orientation">
2347+
<enum>Qt::Horizontal</enum>
2348+
</property>
2349+
<property name="sizeHint" stdset="0">
2350+
<size>
2351+
<width>40</width>
2352+
<height>20</height>
2353+
</size>
2354+
</property>
2355+
</spacer>
2356+
</item>
23442357
<item row="0" column="1">
23452358
<widget class="QPushButton" name="toStringButton_">
23462359
<property name="sizePolicy">
@@ -2363,15 +2376,15 @@
23632376
</property>
23642377
</widget>
23652378
</item>
2366-
<item row="0" column="0">
2367-
<spacer name="horizontalSpacer_17">
2379+
<item row="2" column="1">
2380+
<spacer name="verticalSpacer_2">
23682381
<property name="orientation">
2369-
<enum>Qt::Horizontal</enum>
2382+
<enum>Qt::Vertical</enum>
23702383
</property>
23712384
<property name="sizeHint" stdset="0">
23722385
<size>
2373-
<width>40</width>
2374-
<height>20</height>
2386+
<width>20</width>
2387+
<height>40</height>
23752388
</size>
23762389
</property>
23772390
</spacer>
@@ -2390,17 +2403,11 @@
23902403
</spacer>
23912404
</item>
23922405
<item row="1" column="1">
2393-
<spacer name="verticalSpacer_2">
2394-
<property name="orientation">
2395-
<enum>Qt::Vertical</enum>
2396-
</property>
2397-
<property name="sizeHint" stdset="0">
2398-
<size>
2399-
<width>20</width>
2400-
<height>40</height>
2401-
</size>
2406+
<widget class="QPushButton" name="bugReportButton_">
2407+
<property name="text">
2408+
<string>Send Bug Report</string>
24022409
</property>
2403-
</spacer>
2410+
</widget>
24042411
</item>
24052412
</layout>
24062413
</widget>
@@ -2429,7 +2436,7 @@
24292436
</connection>
24302437
</connections>
24312438
<buttongroups>
2432-
<buttongroup name="shadingButtonGroup_"/>
24332439
<buttongroup name="planeButtonGroup_"/>
2440+
<buttongroup name="shadingButtonGroup_"/>
24342441
</buttongroups>
24352442
</ui>

Diff for: src/Interface/Modules/Render/ViewSceneControlsDock.cc

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ ViewSceneControlsDock::ViewSceneControlsDock(const QString& name, ViewSceneDialo
7373

7474
//----------- Developer Tab--------------//
7575
connect(toStringButton_, SIGNAL(clicked()), parent, SLOT(printToString()));
76+
connect(bugReportButton_, SIGNAL(clicked()), parent, SLOT(sendBugReport()));
7677

7778
//-----------Objects Tab-----------------//
7879
visibleItems_.reset(new VisibleItemManager(objectListWidget_));

0 commit comments

Comments
 (0)