added basic last run crash dialog
This commit is contained in:
+4
-2
@@ -180,7 +180,8 @@ SOURCES += \
|
|||||||
src/singletons/helper/pubsubhelpers.cpp \
|
src/singletons/helper/pubsubhelpers.cpp \
|
||||||
src/singletons/helper/pubsubactions.cpp \
|
src/singletons/helper/pubsubactions.cpp \
|
||||||
src/widgets/selectchanneldialog.cpp \
|
src/widgets/selectchanneldialog.cpp \
|
||||||
src/singletons/updatemanager.cpp
|
src/singletons/updatemanager.cpp \
|
||||||
|
src/widgets/lastruncrashdialog.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/precompiled_header.hpp \
|
src/precompiled_header.hpp \
|
||||||
@@ -303,7 +304,8 @@ HEADERS += \
|
|||||||
src/singletons/helper/pubsubhelpers.hpp \
|
src/singletons/helper/pubsubhelpers.hpp \
|
||||||
src/singletons/helper/pubsubactions.hpp \
|
src/singletons/helper/pubsubactions.hpp \
|
||||||
src/widgets/selectchanneldialog.hpp \
|
src/widgets/selectchanneldialog.hpp \
|
||||||
src/singletons/updatemanager.hpp
|
src/singletons/updatemanager.hpp \
|
||||||
|
src/widgets/lastruncrashdialog.hpp
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources/resources.qrc
|
resources/resources.qrc
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "singletons/emotemanager.hpp"
|
#include "singletons/emotemanager.hpp"
|
||||||
#include "singletons/loggingmanager.hpp"
|
#include "singletons/loggingmanager.hpp"
|
||||||
#include "singletons/nativemessagingmanager.hpp"
|
#include "singletons/nativemessagingmanager.hpp"
|
||||||
|
#include "singletons/pathmanager.hpp"
|
||||||
#include "singletons/pubsubmanager.hpp"
|
#include "singletons/pubsubmanager.hpp"
|
||||||
#include "singletons/settingsmanager.hpp"
|
#include "singletons/settingsmanager.hpp"
|
||||||
#include "singletons/thememanager.hpp"
|
#include "singletons/thememanager.hpp"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "singletons/nativemessagingmanager.hpp"
|
#include "singletons/nativemessagingmanager.hpp"
|
||||||
#include "singletons/pathmanager.hpp"
|
#include "singletons/pathmanager.hpp"
|
||||||
#include "util/networkmanager.hpp"
|
#include "util/networkmanager.hpp"
|
||||||
|
#include "widgets/lastruncrashdialog.hpp"
|
||||||
|
|
||||||
#include <QAbstractNativeEventFilter>
|
#include <QAbstractNativeEventFilter>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -76,6 +77,22 @@ int runGui(int argc, char *argv[])
|
|||||||
// Initialize NetworkManager
|
// Initialize NetworkManager
|
||||||
chatterino::util::NetworkManager::init();
|
chatterino::util::NetworkManager::init();
|
||||||
|
|
||||||
|
// Running file
|
||||||
|
auto &pathMan = chatterino::singletons::PathManager::getInstance();
|
||||||
|
auto runningPath = pathMan.settingsFolderPath + "/running_" + pathMan.appPathHash;
|
||||||
|
|
||||||
|
if (QFile::exists(runningPath)) {
|
||||||
|
chatterino::widgets::LastRunCrashDialog dialog;
|
||||||
|
dialog.exec();
|
||||||
|
} else {
|
||||||
|
QFile runningFile(runningPath);
|
||||||
|
|
||||||
|
runningFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
|
||||||
|
runningFile.flush();
|
||||||
|
runningFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Application
|
||||||
{
|
{
|
||||||
// Initialize application
|
// Initialize application
|
||||||
chatterino::Application app;
|
chatterino::Application app;
|
||||||
@@ -86,6 +103,9 @@ int runGui(int argc, char *argv[])
|
|||||||
// Application will go out of scope here and deinitialize itself
|
// Application will go out of scope here and deinitialize itself
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Running file
|
||||||
|
QFile::remove(runningPath);
|
||||||
|
|
||||||
// Save settings
|
// Save settings
|
||||||
pajlada::Settings::SettingManager::save();
|
pajlada::Settings::SettingManager::save();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "singletons/pathmanager.hpp"
|
#include "singletons/pathmanager.hpp"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QCryptographicHash>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
@@ -15,6 +16,14 @@ PathManager &PathManager::getInstance()
|
|||||||
|
|
||||||
bool PathManager::init(int argc, char **argv)
|
bool PathManager::init(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
// hash of app path
|
||||||
|
this->appPathHash = QCryptographicHash::hash(QCoreApplication::applicationFilePath().toUtf8(),
|
||||||
|
QCryptographicHash::Sha224)
|
||||||
|
.toBase64()
|
||||||
|
.mid(0, 32)
|
||||||
|
.replace("+", "-")
|
||||||
|
.replace("/", "x");
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
bool portable = false;
|
bool portable = false;
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public:
|
|||||||
QString whispersLogsFolderPath;
|
QString whispersLogsFolderPath;
|
||||||
QString mentionsLogsFolderPath;
|
QString mentionsLogsFolderPath;
|
||||||
|
|
||||||
|
QString appPathHash;
|
||||||
|
|
||||||
bool createFolder(const QString &folderPath);
|
bool createFolder(const QString &folderPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -33,13 +33,8 @@ void UpdateManager::checkForUpdates()
|
|||||||
|
|
||||||
util::NetworkRequest req(url);
|
util::NetworkRequest req(url);
|
||||||
req.setTimeout(20000);
|
req.setTimeout(20000);
|
||||||
req.getJSON([this](QJsonDocument &document) {
|
req.getJSON([this](QJsonObject &object) {
|
||||||
if (document.isEmpty()) {
|
QJsonValue version_val = object.value("version");
|
||||||
qDebug() << "error updating";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonValue version_val = document.object().value("version");
|
|
||||||
if (!version_val.isString()) {
|
if (!version_val.isString()) {
|
||||||
qDebug() << "error updating";
|
qDebug() << "error updating";
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
const QString &getCurrentVersion() const;
|
const QString &getCurrentVersion() const;
|
||||||
const QString &getOnlineVersion() const;
|
const QString &getOnlineVersion() const;
|
||||||
|
|
||||||
pajlada::Signals::Signal onlineVersionUpdated;
|
pajlada::Signals::NoArgSignal onlineVersionUpdated;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString currentVersion;
|
QString currentVersion;
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#include "lastruncrashdialog.hpp"
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
|
LastRunCrashDialog::LastRunCrashDialog()
|
||||||
|
{
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
|
layout->addWidget(
|
||||||
|
new QLabel("The application wasn't terminated properly last time it was executed."));
|
||||||
|
|
||||||
|
this->setLayout(layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace widgets
|
||||||
|
} // namespace chatterino
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
|
class LastRunCrashDialog : public QDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LastRunCrashDialog();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace widgets
|
||||||
|
} // namespace chatterino
|
||||||
@@ -51,6 +51,7 @@ AboutPage::AboutPage()
|
|||||||
github->setOpenExternalLinks(true);
|
github->setOpenExternalLinks(true);
|
||||||
// github->setPalette(palette);
|
// github->setPalette(palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->addStretch(1);
|
layout->addStretch(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user