added updating mechanic

This commit is contained in:
fourtf
2018-06-21 22:02:35 +02:00
parent 2f91e3097a
commit e204dfdb17
10 changed files with 117 additions and 10 deletions
+11 -1
View File
@@ -59,10 +59,20 @@ LastRunCrashDialog::LastRunCrashDialog()
case singletons::UpdateManager::NoUpdateAvailable: {
update->setText("No update abailable.");
} break;
case singletons::UpdateManager::Error: {
case singletons::UpdateManager::SearchFailed: {
update->setText("Error while searching for update.\nEither the update service is "
"temporarily down or there is an issue with your installation.");
} break;
case singletons::UpdateManager::Downloading: {
update->setText(
"Downloading the update. Chatterino will close once the download is done.");
} break;
case singletons::UpdateManager::DownloadFailed: {
update->setText("Download failed.");
} break;
case singletons::UpdateManager::WriteFileFailed: {
update->setText("Writing the update file to the hard drive failed.");
} break;
}
};
+6 -3
View File
@@ -56,6 +56,8 @@ void LogInWithCredentials(const std::string &userID, const std::string &username
getApp()->accounts->twitch.reloadUsers();
// messageBox.exec();
getApp()->accounts->twitch.currentUsername = username;
}
} // namespace
@@ -77,7 +79,7 @@ BasicLoginWidget::BasicLoginWidget()
QDesktopServices::openUrl(QUrl("https://chatterino.com/client_login"));
});
connect(&this->ui.pasteCodeButton, &QPushButton::clicked, []() {
connect(&this->ui.pasteCodeButton, &QPushButton::clicked, [this]() {
QClipboard *clipboard = QGuiApplication::clipboard();
QString clipboardString = clipboard->text();
QStringList parameters = clipboardString.split(';');
@@ -108,6 +110,7 @@ BasicLoginWidget::BasicLoginWidget()
LogInWithCredentials(userID, username, clientID, oauthToken);
clipboard->clear();
this->window()->close();
});
}
@@ -191,7 +194,7 @@ void AdvancedLoginWidget::refreshButtons()
LoginWidget::LoginWidget()
{
#ifdef USEWINSDK
::SetWindowPos((HWND)this->winId(), HWND_TOPMOST, 0, 0, 0, 0,
::SetWindowPos(HWND(this->winId()), HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
#endif
@@ -205,7 +208,7 @@ LoginWidget::LoginWidget()
this->ui.buttonBox.setStandardButtons(QDialogButtonBox::Close);
connect(&this->ui.buttonBox, &QDialogButtonBox::rejected, [this]() {
QObject::connect(&this->ui.buttonBox, &QDialogButtonBox::rejected, [this]() {
this->close(); //
});
+1 -1
View File
@@ -8,11 +8,11 @@
#include "widgets/helper/editablemodelview.hpp"
#include "widgets/logindialog.hpp"
#include <algorithm>
#include <QDialogButtonBox>
#include <QHeaderView>
#include <QTableView>
#include <QVBoxLayout>
#include <algorithm>
namespace chatterino {
namespace widgets {
+2 -1
View File
@@ -37,7 +37,8 @@ CommandPage::CommandPage()
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
auto warning = layout.emplace<QLabel>("The command system will be reworked in the "
"future!\nYour saved commands will get discarded then.");
"future!\nYour saved commands will get discarded then. "
"Deleting commands crashes chatterino right now.");
warning.getElement()->setStyleSheet("color: #f00");
helper::EditableModelView *view =
+16
View File
@@ -235,6 +235,22 @@ bool Window::event(QEvent *event)
return BaseWindow::event(event);
}
void Window::showEvent(QShowEvent *event)
{
if (getApp()->settings->startUpNotification.getValue() < 1) {
getApp()->settings->startUpNotification = 1;
auto box =
new QMessageBox(QMessageBox::Information, "Chatterino 2 Beta",
"Please note that this software is not stable yet. Things are rough "
"around the edges and everything is subject to change.");
box->setAttribute(Qt::WA_DeleteOnClose);
box->show();
}
BaseWindow::showEvent(event);
}
void Window::closeEvent(QCloseEvent *)
{
if (this->type == Window::Main) {
+1
View File
@@ -38,6 +38,7 @@ public:
WindowType getType();
protected:
void showEvent(QShowEvent *) override;
void closeEvent(QCloseEvent *event) override;
bool event(QEvent *event) override;