mirror of
https://github.com/vicr123/theshell.git
synced 2025-01-23 12:12:06 -05:00
Fix Gateway scrolling, new error box
This commit is contained in:
parent
993b7ea17d
commit
43d02892dd
5 changed files with 119 additions and 22 deletions
60
main.cpp
60
main.cpp
|
@ -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;
|
||||
|
|
2
menu.cpp
2
menu.cpp
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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><html><head/><body><p>Something unexpected happened and now you need to log out.</p><p><span style=" font-weight:600;">Save all open work and then click &quot;Log Out&quot; to log out.</span></p><p>If this keeps happening, then theShell (or one of its dependencies) is experiencing very bad errors. Try reinstalling or rebuilding theShell.</p></body></html></string>
|
||||
<string><html><head/><body><p>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.</p><p><span style=" font-weight:600;">Save all open work and then click &quot;Log Out&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 &quot;Log Out.&quot;</span></p></body></html></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><html><head/><body><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Try resetting theShell. This will reset all of your settings.</li><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Try reinstalling (or rebuilding) theShell.</li></ul></body></html></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">
|
||||
|
|
Loading…
Add table
Reference in a new issue