added browserextensionpage

This commit is contained in:
fourtf 2018-06-23 22:49:07 +02:00
parent 89d9076715
commit f728a1fbd7
5 changed files with 73 additions and 2 deletions

View file

@ -217,7 +217,8 @@ SOURCES += \
src/providers/irc/ircconnection2.cpp \
src/widgets/userinfopopup.cpp \
src/widgets/welcomedialog.cpp \
src/widgets/label.cpp
src/widgets/label.cpp \
src/widgets/settingspages/browserextensionpage.cpp
HEADERS += \
src/precompiled_header.hpp \
@ -379,7 +380,8 @@ HEADERS += \
src/widgets/welcomedialog.hpp \
src/util/clamp.hpp \
src/widgets/label.hpp \
src/util/combine_path.hpp
src/util/combine_path.hpp \
src/widgets/settingspages/browserextensionpage.hpp
RESOURCES += \
resources/resources.qrc

View file

@ -7,6 +7,7 @@
#include "widgets/settingspages/accountspage.hpp"
#include "widgets/settingspages/appearancepage.hpp"
#include "widgets/settingspages/behaviourpage.hpp"
#include "widgets/settingspages/browserextensionpage.hpp"
#include "widgets/settingspages/commandpage.hpp"
#include "widgets/settingspages/emotespage.hpp"
#include "widgets/settingspages/externaltoolspage.hpp"
@ -96,6 +97,7 @@ void SettingsDialog::addTabs()
// this->addTab(new settingspages::LogsPage);
this->addTab(new settingspages::ModerationPage);
// this->addTab(new settingspages::SpecialChannelsPage);
this->addTab(new settingspages::BrowserExtensionPage);
this->addTab(new settingspages::ExternalToolsPage);
this->ui_.tabContainer->addStretch(1);

View file

@ -0,0 +1,37 @@
#include "browserextensionpage.hpp"
#include "util/layoutcreator.hpp"
#include <QLabel>
#define CHROME_EXTENSION_LINK \
"https://chrome.google.com/webstore/detail/chatterino-native-host/" \
"glknmaideaikkmemifbfkhnomoknepka"
#define FIREFOX_EXTENSION_LINK "https://addons.mozilla.org/de/firefox/addon/chatterino-native-host/"
namespace chatterino {
namespace widgets {
namespace settingspages {
BrowserExtensionPage::BrowserExtensionPage()
: SettingsPage("Browser Extension", "")
{
auto layout = util::LayoutCreator<BrowserExtensionPage>(this).setLayoutType<QVBoxLayout>();
auto label =
layout.emplace<QLabel>("The browser extension will replace the default Twitch.tv chat with "
"chatterino while chatterino is running.");
label->setWordWrap(true);
auto chrome = layout.emplace<QLabel>("<a href=\"" CHROME_EXTENSION_LINK
"\">Download for Google Chrome</a>");
chrome->setOpenExternalLinks(true);
auto firefox = layout.emplace<QLabel>("<a href=\"" FIREFOX_EXTENSION_LINK
"\">Download for Mozilla Firefox</a>");
firefox->setOpenExternalLinks(true);
layout->addStretch(1);
}
} // namespace settingspages
} // namespace widgets
} // namespace chatterino

View file

@ -0,0 +1,17 @@
#pragma once
#include "widgets/settingspages/settingspage.hpp"
namespace chatterino {
namespace widgets {
namespace settingspages {
class BrowserExtensionPage : public SettingsPage
{
public:
BrowserExtensionPage();
};
} // namespace settingspages
} // namespace widgets
} // namespace chatterino

View file

@ -16,6 +16,7 @@
#include "widgets/welcomedialog.hpp"
#include <QApplication>
#include <QDesktopServices>
#include <QHeaderView>
#include <QPalette>
#include <QShortcut>
@ -248,6 +249,18 @@ void Window::showEvent(QShowEvent *event)
box->show();
}
if (getApp()->settings->currentVersion.getValue() != "" &&
getApp()->settings->currentVersion.getValue() != CHATTERINO_VERSION) {
auto box = new QMessageBox(QMessageBox::Information, "Chatterino 2 Beta", "Show changelog?",
QMessageBox::Yes | QMessageBox::No);
box->setAttribute(Qt::WA_DeleteOnClose);
if (box->exec() == QMessageBox::Yes) {
QDesktopServices::openUrl(QUrl("https://fourtf.com/chatterino-changelog/"));
}
getApp()->settings->currentVersion.setValue(CHATTERINO_VERSION);
}
BaseWindow::showEvent(event);
}