Merge branch 'blueprint' of ssh://github.com/vicr123/theshell into blueprint

This commit is contained in:
Victor Tran 2018-09-08 15:52:13 +10:00
commit 591ea8e0d8
4 changed files with 49 additions and 13 deletions

View file

@ -1,7 +1,7 @@
#include "errordialog.h"
#include "ui_errordialog.h"
ErrorDialog::ErrorDialog(bool started, int errorCount, QWidget *parent) :
ErrorDialog::ErrorDialog(bool started, int errorCount, QString output, QWidget *parent) :
QDialog(parent),
ui(new Ui::ErrorDialog)
{
@ -12,14 +12,18 @@ ErrorDialog::ErrorDialog(bool started, int errorCount, QWidget *parent) :
QFile backtrace(QDir::homePath() + "/.tsbacktrace");
if (backtrace.exists()) {
backtrace.open(QFile::ReadOnly);
this->backtrace = backtrace.readAll();
this->backtrace.append(backtrace.readAll());
backtrace.close();
backtrace.remove();
}
this->backtrace.append("\n\nStandard Output from the main process follows:\n" + output);
if (this->backtrace == "") {
ui->debugButton->setVisible(false);
} else {
ui->backtrace->setPlainText(this->backtrace);
ui->backtrace->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
} else {
ui->debugButton->setVisible(false);
}
ui->errorIcon->setPixmap(QIcon(":/icons/error.svg").pixmap(128, 128));

View file

@ -23,7 +23,7 @@ class ErrorDialog : public QDialog
Q_OBJECT
public:
explicit ErrorDialog(bool started, int errorCount, QWidget *parent = 0);
explicit ErrorDialog(bool started, int errorCount, QString output, QWidget *parent = 0);
~ErrorDialog();
private slots:

View file

@ -172,7 +172,8 @@
<string>Reset theShell</string>
</property>
<property name="icon">
<iconset theme="view-refresh"/>
<iconset theme="view-refresh">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
@ -300,7 +301,8 @@
<string>View Debugging Information</string>
</property>
<property name="icon">
<iconset theme="go-next"/>
<iconset theme="go-next">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
@ -342,7 +344,8 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-previous"/>
<iconset theme="go-previous">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
@ -374,6 +377,12 @@
</item>
<item>
<widget class="Line" name="line">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>1</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -384,7 +393,9 @@
<property name="text">
<string>This debugging information can help the developer fix issues in theShell. You can save this debugging information to a file for later reference, or to attach it to a bug report.
When reporting a bug, if any debugging information is available, please attach it to the bug report.</string>
When reporting a bug, if any debugging information is available, please attach it to the bug report.
It's a good idea to check through the contents of the available debugging information here for any personal information and redact it before you attach it to a bug report.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@ -396,6 +407,12 @@ When reporting a bug, if any debugging information is available, please attach i
</item>
<item>
<widget class="Line" name="line_3">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>1</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -413,6 +430,12 @@ When reporting a bug, if any debugging information is available, please attach i
</item>
<item>
<widget class="Line" name="line_2">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>1</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -439,7 +462,8 @@ When reporting a bug, if any debugging information is available, please attach i
<string>Save to file</string>
</property>
<property name="icon">
<iconset theme="document-save"/>
<iconset theme="document-save">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>

View file

@ -65,6 +65,7 @@ void startupDesktopFile(QString path, QSettings::Format format) {
QProcess* tsProcess;
int errorCount = 0;
bool started = false;
QString theShellStdOut;
int main(int argc, char *argv[])
{
@ -108,9 +109,10 @@ int main(int argc, char *argv[])
monitor->HideSplash();
errorCount++;
ErrorDialog* d = new ErrorDialog(monitor->started(), errorCount);
ErrorDialog* d = new ErrorDialog(monitor->started(), errorCount, theShellStdOut);
ErrorDialog::connect(d, &ErrorDialog::restart, [=] {
d->deleteLater();
monitor->MarkNotStarted();
monitor->ShowSplash();
@ -125,10 +127,11 @@ int main(int argc, char *argv[])
QCoreApplication::exit(0);
});
d->showFullScreen();
theShellStdOut.clear();
}
});
QObject::connect(tsProcess, &QProcess::readyRead, [=] {
QString all = tsProcess->readAll();
QObject::connect(tsProcess, &QProcess::readyReadStandardOutput, [=] {
QString all = tsProcess->readAllStandardOutput();
for (QString line : all.split("\n")) {
if (!monitor->started()) {
if (line.startsWith("QUESTION:")) {
@ -144,6 +147,11 @@ int main(int argc, char *argv[])
}
}
}
theShellStdOut.append(all);
});
QObject::connect(tsProcess, &QProcess::readyReadStandardError, [=] {
QString out = tsProcess->readAllStandardError();
theShellStdOut.append(out);
});
QObject::connect(monitor, &StartMonitor::questionResponse, [=](QString response) {
tsProcess->write(response.toLocal8Bit());