Fix Gateway scrolling, new error box

This commit is contained in:
Victor Tran 2016-09-13 14:07:51 +10:00
parent 993b7ea17d
commit 43d02892dd
5 changed files with 119 additions and 22 deletions

View file

@ -4,6 +4,7 @@
#include "segfaultdialog.h"
#include "globalfilter.h"
#include "dbusevents.h"
#include <iostream>
//#include "dbusmenuregistrar.h"
#include <nativeeventfilter.h>
#include <QApplication>
@ -22,27 +23,54 @@ MainWindow* MainWin = NULL;
NativeEventFilter* NativeFilter = NULL;
DbusEvents* DBusEvents = NULL;
void catch_signal(int signal) {
SegfaultDialog* dialog;
if (signal == SIGSEGV) {
qDebug() << "SEGFAULT! Quitting now!";
dialog = new SegfaultDialog("SIGSEGV");
} else if (signal == SIGBUS) {
qDebug() << "SIGBUS! Quitting now!";
dialog = new SegfaultDialog("SIGBUS");
} else if (signal == SIGABRT) {
qDebug() << "SIGABRT! Quitting now!";
dialog = new SegfaultDialog("SIGABRT");
} else if (signal == SIGILL) {
qDebug() << "SIGILL! Quitting now!";
dialog = new SegfaultDialog("SIGILL");
void raise_signal(QString message) {
//Clean up required stuff
//Delete the Native Event Filter so that keyboard bindings are cleared
if (NativeFilter != NULL) {
delete NativeFilter;
NativeFilter = NULL;
}
SegfaultDialog* dialog;
dialog = new SegfaultDialog(message);
if (MainWin != NULL) {
MainWin->close();
delete MainWin;
}
dialog->exec();
std::terminate();
raise(SIGKILL);
}
void catch_signal(int signal) {
if (signal == SIGSEGV) {
qDebug() << "SEGFAULT! Quitting now!";
raise_signal("Signal: SIGSEGV (Segmentation Fault)");
} else if (signal == SIGBUS) {
qDebug() << "SIGBUS! Quitting now!";
raise_signal("Signal: SIGBUS (Bus Error)");
} else if (signal == SIGABRT) {
qDebug() << "SIGABRT! Quitting now!";
raise_signal("Signal: SIGABRT (Abort)");
} else if (signal == SIGILL) {
qDebug() << "SIGILL! Quitting now!";
raise_signal("Signal: SIGILL (Illegal Operation)");
}
}
void QtHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) {
switch (type) {
case QtDebugMsg:
case QtInfoMsg:
case QtWarningMsg:
case QtCriticalMsg:
std::cout << msg.toStdString();
break;
case QtFatalMsg:
std::cout << msg.toStdString();
raise_signal(msg);
}
}
int main(int argc, char *argv[])
@ -52,6 +80,8 @@ int main(int argc, char *argv[])
signal(SIGABRT, *catch_signal); //Catch SIGABRT
signal(SIGILL, *catch_signal); //Catch SIGILL
qInstallMessageHandler(QtHandler);
QApplication a(argc, argv);
bool showSplash = true;

View file

@ -803,7 +803,7 @@ bool Menu::eventFilter(QObject *object, QEvent *event) {
}
if (e->key() == Qt::Key_Down) {
if (currentRow == pinnedAppsCount - 1 && pinnedAppsCount != 0) {
if (currentRow == pinnedAppsCount - 1 && pinnedAppsCount != 0 && ui->lineEdit->text() == "") {
ui->listWidget->item(pinnedAppsCount + 1)->setSelected(true);
ui->listWidget->scrollToItem(ui->listWidget->item(pinnedAppsCount + 1));
} else if (currentRow == -1) {

View file

@ -9,7 +9,7 @@ SegfaultDialog::SegfaultDialog(QString signal, QWidget *parent) :
this->setFixedSize(this->size());
ui->label_3->setText("To debug, attach a debugger to PID " + QString::number(QApplication::applicationPid()));
ui->signal->setText("Signal: " + signal);
ui->signal->setText(signal);
}
SegfaultDialog::~SegfaultDialog()
@ -33,3 +33,11 @@ void SegfaultDialog::on_pushButton_2_clicked()
}
QMessageBox::information(this, "Backtrace", trace, QMessageBox::Ok, QMessageBox::Ok);
}
void SegfaultDialog::on_pushButton_3_clicked()
{
if (QMessageBox::warning(this, "Reset theShell?", "You're about to reset theShell. Are you sure?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
QSettings().clear();
this->close();
}
}

View file

@ -4,6 +4,7 @@
#include <QDialog>
#include <execinfo.h>
#include <QMessageBox>
#include <QSettings>
namespace Ui {
class SegfaultDialog;
@ -22,6 +23,8 @@ private slots:
void on_pushButton_2_clicked();
void on_pushButton_3_clicked();
private:
Ui::SegfaultDialog *ui;
};

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>530</width>
<height>259</height>
<height>365</height>
</rect>
</property>
<property name="minimumSize">
@ -16,6 +16,12 @@
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>530</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>theShell Error</string>
</property>
@ -25,7 +31,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QLabel" name="label">
@ -35,20 +41,59 @@
</font>
</property>
<property name="text">
<string>theShell Error</string>
<string>Well, this is bad.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Something unexpected happened and now you need to log out.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Save all open work and then click &amp;quot;Log Out&amp;quot; to log out.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;If this keeps happening, then theShell (or one of its dependencies) is experiencing very bad errors. Try reinstalling or rebuilding theShell.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;theShell seems to have done something it shouldn't have. Because theShell has crashed, you'll need to log out and then log back in to fix it.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Save all open work and then click &amp;quot;Log Out&amp;quot; to log out. If you don't save your work, it will be lost. All other apps will be forcibly closed once you click &amp;quot;Log Out.&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>15</pointsize>
</font>
</property>
<property name="text">
<string>Does this keep happening?</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Try resetting theShell. This will reset all of your settings.&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Try reinstalling (or rebuilding) theShell.&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
@ -71,7 +116,8 @@
<string>Generate Backtrace</string>
</property>
<property name="icon">
<iconset theme="emblem-warning"/>
<iconset theme="emblem-warning">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
@ -88,6 +134,16 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>Reset theShell and Log Out</string>
</property>
<property name="icon">
<iconset theme="view-refresh"/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">