2018-06-26 14:09:39 +02:00
|
|
|
#include "LastRunCrashDialog.hpp"
|
2019-09-08 22:27:57 +02:00
|
|
|
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include "singletons/Updates.hpp"
|
|
|
|
#include "util/LayoutCreator.hpp"
|
|
|
|
#include "util/PostToThread.hpp"
|
|
|
|
|
2018-06-01 14:20:46 +02:00
|
|
|
#include <QDialogButtonBox>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
2018-04-20 00:15:57 +02:00
|
|
|
#include <QVBoxLayout>
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-20 00:15:57 +02:00
|
|
|
namespace chatterino {
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-20 00:15:57 +02:00
|
|
|
LastRunCrashDialog::LastRunCrashDialog()
|
|
|
|
{
|
2018-06-01 14:20:46 +02:00
|
|
|
this->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
|
|
|
this->setWindowTitle("Chatterino");
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-26 17:06:17 +02:00
|
|
|
auto layout =
|
|
|
|
LayoutCreator<LastRunCrashDialog>(this).setLayoutType<QVBoxLayout>();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-01 14:20:46 +02:00
|
|
|
layout.emplace<QLabel>("The application wasn't terminated properly the "
|
|
|
|
"last time it was executed.");
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-01 14:20:46 +02:00
|
|
|
layout->addSpacing(16);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-21 22:44:48 +02:00
|
|
|
// auto update = layout.emplace<QLabel>();
|
2018-06-01 14:20:46 +02:00
|
|
|
auto buttons = layout.emplace<QDialogButtonBox>();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-21 22:44:48 +02:00
|
|
|
// auto *installUpdateButton = buttons->addButton("Install Update",
|
|
|
|
// QDialogButtonBox::NoRole); installUpdateButton->setEnabled(false);
|
|
|
|
// QObject::connect(installUpdateButton, &QPushButton::clicked, [this,
|
|
|
|
// update]() mutable {
|
2019-10-07 22:42:34 +02:00
|
|
|
// auto &updateManager = UpdateManager::instance();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-21 22:44:48 +02:00
|
|
|
// updateManager.installUpdates();
|
|
|
|
// this->setEnabled(false);
|
|
|
|
// update->setText("Downloading updates...");
|
|
|
|
// });
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-01 14:20:46 +02:00
|
|
|
auto *okButton =
|
|
|
|
buttons->addButton("Ignore", QDialogButtonBox::ButtonRole::NoRole);
|
2020-11-08 12:02:19 +01:00
|
|
|
QObject::connect(okButton, &QPushButton::clicked, [this] {
|
|
|
|
this->accept();
|
|
|
|
});
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-01 14:20:46 +02:00
|
|
|
// Updates
|
2018-06-21 22:44:48 +02:00
|
|
|
// auto updateUpdateLabel = [update]() mutable {
|
2019-10-07 22:42:34 +02:00
|
|
|
// auto &updateManager = UpdateManager::instance();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-21 22:44:48 +02:00
|
|
|
// switch (updateManager.getStatus()) {
|
2018-06-28 19:38:57 +02:00
|
|
|
// case UpdateManager::None: {
|
2018-06-21 22:44:48 +02:00
|
|
|
// update->setText("Not checking for updates.");
|
|
|
|
// } break;
|
2018-06-28 19:38:57 +02:00
|
|
|
// case UpdateManager::Searching: {
|
2018-06-21 22:44:48 +02:00
|
|
|
// update->setText("Checking for updates...");
|
|
|
|
// } break;
|
2018-06-28 19:38:57 +02:00
|
|
|
// case UpdateManager::UpdateAvailable: {
|
2018-06-21 22:44:48 +02:00
|
|
|
// update->setText("Update available.");
|
|
|
|
// } break;
|
2018-06-28 19:38:57 +02:00
|
|
|
// case UpdateManager::NoUpdateAvailable: {
|
2018-06-21 22:44:48 +02:00
|
|
|
// update->setText("No update abailable.");
|
|
|
|
// } break;
|
2018-06-28 19:38:57 +02:00
|
|
|
// case UpdateManager::SearchFailed: {
|
2018-06-21 22:44:48 +02:00
|
|
|
// update->setText("Error while searching for update.\nEither
|
|
|
|
// the update service is "
|
|
|
|
// "temporarily down or there is an issue
|
|
|
|
// with your installation.");
|
|
|
|
// } break;
|
2018-06-28 19:38:57 +02:00
|
|
|
// case UpdateManager::Downloading: {
|
2018-06-21 22:44:48 +02:00
|
|
|
// update->setText(
|
|
|
|
// "Downloading the update. Chatterino will close once
|
|
|
|
// the download is done.");
|
|
|
|
// } break;
|
2018-06-28 19:38:57 +02:00
|
|
|
// case UpdateManager::DownloadFailed: {
|
2018-06-21 22:44:48 +02:00
|
|
|
// update->setText("Download failed.");
|
|
|
|
// } break;
|
2018-06-28 19:38:57 +02:00
|
|
|
// case UpdateManager::WriteFileFailed: {
|
2018-06-21 22:44:48 +02:00
|
|
|
// update->setText("Writing the update file to the hard drive
|
|
|
|
// failed.");
|
|
|
|
// } break;
|
|
|
|
// }
|
|
|
|
// };
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-21 22:44:48 +02:00
|
|
|
// updateUpdateLabel();
|
2021-12-19 15:57:56 +01:00
|
|
|
// this->signalHolder_.managedConnect(updateManager.statusUpdated,
|
2018-06-21 22:44:48 +02:00
|
|
|
// [updateUpdateLabel](auto) mutable {
|
2018-06-26 17:06:17 +02:00
|
|
|
// postToThread([updateUpdateLabel]() mutable { updateUpdateLabel();
|
|
|
|
// });
|
2018-06-21 22:44:48 +02:00
|
|
|
// });
|
2018-04-20 00:15:57 +02:00
|
|
|
}
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-20 00:15:57 +02:00
|
|
|
} // namespace chatterino
|