Merge branch 'master' into apa-notification-on-live

This commit is contained in:
apa420
2018-08-28 23:23:46 +02:00
committed by GitHub
214 changed files with 4368 additions and 4428 deletions
+16 -3
View File
@@ -17,7 +17,7 @@
namespace chatterino {
AboutPage::AboutPage()
: SettingsPage("About", ":/images/about.svg")
: SettingsPage("About", ":/settings/about.svg")
{
LayoutCreator<AboutPage> layoutCreator(this);
@@ -111,7 +111,8 @@ AboutPage::AboutPage()
l.emplace<QLabel>("Apple emojis provided by <a href=\"https://apple.com\">Apple</a>")->setOpenExternalLinks(true);
l.emplace<QLabel>("Google emojis provided by <a href=\"https://google.com\">Google</a>")->setOpenExternalLinks(true);
l.emplace<QLabel>("Messenger emojis provided by <a href=\"https://facebook.com\">Facebook</a>")->setOpenExternalLinks(true);
l.emplace<QLabel>("Emoji datasource provided by <a href=\"https://www.iamcal.com/\">Cal Henderson</a>")->setOpenExternalLinks(true);
l.emplace<QLabel>("Emoji datasource provided by <a href=\"https://www.iamcal.com/\">Cal Henderson</a>"
"(<a href=\"https://github.com/iamcal/emoji-data/blob/master/LICENSE\">show license</a>)")->setOpenExternalLinks(true);
// clang-format on
}
@@ -136,7 +137,7 @@ AboutPage::AboutPage()
QStringList contributorParts = line.split("|");
if (contributorParts.size() != 4) {
Log("Missing parts in line '{}'", line);
log("Missing parts in line '{}'", line);
continue;
}
@@ -179,6 +180,18 @@ AboutPage::AboutPage()
}
}
auto buildInfo = QStringList();
buildInfo += "Qt " QT_VERSION_STR;
#ifdef USEWINSDK
buildInfo += "Windows SDK";
#endif
#ifdef _MSC_FULL_VER
buildInfo += "MSVC " + QString::number(_MSC_FULL_VER, 10);
#endif
auto buildText = QString("Built with " + buildInfo.join(", "));
layout.emplace<QLabel>(buildText);
layout->addStretch(1);
}
+1 -1
View File
@@ -17,7 +17,7 @@
namespace chatterino {
AccountsPage::AccountsPage()
: SettingsPage("Accounts", ":/images/accounts.svg")
: SettingsPage("Accounts", ":/settings/accounts.svg")
{
auto *app = getApp();
@@ -0,0 +1,79 @@
#include "AdvancedPage.hpp"
#include "Application.hpp"
#include "controllers/taggedusers/TaggedUsersController.hpp"
#include "controllers/taggedusers/TaggedUsersModel.hpp"
#include "singletons/Logging.hpp"
#include "singletons/Paths.hpp"
#include "util/Helpers.hpp"
#include "util/LayoutCreator.hpp"
#include <QFileDialog>
#include <QFormLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QLabel>
#include <QListView>
#include <QPushButton>
#include <QTableView>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QtConcurrent/QtConcurrent>
namespace chatterino {
AdvancedPage::AdvancedPage()
: SettingsPage("Advanced", "")
{
auto app = getApp();
LayoutCreator<AdvancedPage> layoutCreator(this);
auto tabs = layoutCreator.emplace<QTabWidget>();
{
auto layout = tabs.appendTab(new QVBoxLayout, "Cache");
auto folderLabel = layout.emplace<QLabel>();
folderLabel->setTextFormat(Qt::RichText);
folderLabel->setTextInteractionFlags(Qt::TextBrowserInteraction |
Qt::LinksAccessibleByKeyboard |
Qt::LinksAccessibleByKeyboard);
folderLabel->setOpenExternalLinks(true);
getSettings()->cachePath.connect([folderLabel](const auto &,
auto) mutable {
QString newPath = getPaths()->cacheDirectory();
QString pathShortened = "Cache saved at <a href=\"file:///" +
newPath +
"\"><span style=\"color: white;\">" +
shortenString(newPath, 50) + "</span></a>";
folderLabel->setText(pathShortened);
folderLabel->setToolTip(newPath);
});
layout->addStretch(1);
auto selectDir = layout.emplace<QPushButton>("Set custom cache folder");
QObject::connect(
selectDir.getElement(), &QPushButton::clicked, this, [this] {
auto dirName = QFileDialog::getExistingDirectory(this);
getSettings()->cachePath = dirName;
});
auto resetDir =
layout.emplace<QPushButton>("Reset custom cache folder");
QObject::connect(resetDir.getElement(), &QPushButton::clicked, this,
[]() mutable {
getSettings()->cachePath = ""; //
});
// Logs end
}
}
} // namespace chatterino
@@ -0,0 +1,13 @@
#pragma once
#include "widgets/settingspages/SettingsPage.hpp"
namespace chatterino {
class AdvancedPage : public SettingsPage
{
public:
AdvancedPage();
};
} // namespace chatterino
+2 -2
View File
@@ -27,7 +27,7 @@
namespace chatterino {
CommandPage::CommandPage()
: SettingsPage("Commands", ":/images/commands.svg")
: SettingsPage("Commands", ":/settings/commands.svg")
{
auto app = getApp();
@@ -47,7 +47,7 @@ CommandPage::CommandPage()
layout.append(
this->createCheckBox("Also match the trigger at the end of the message",
app->settings->allowCommandsAtEnd));
getSettings()->allowCommandsAtEnd));
QLabel *text = layout.emplace<QLabel>(TEXT).getElement();
text->setWordWrap(true);
+1 -1
View File
@@ -5,7 +5,7 @@
namespace chatterino {
EmotesPage::EmotesPage()
: SettingsPage("Emotes", ":/images/emote.svg")
: SettingsPage("Emotes", ":/settings/emote.svg")
{
// SettingManager &settings = SettingManager::getInstance();
// LayoutCreator<EmotesPage> layoutCreator(this);
@@ -1,6 +1,7 @@
#include "ExternalToolsPage.hpp"
#include "Application.hpp"
#include "util/Helpers.hpp"
#include "util/LayoutCreator.hpp"
#include <QGroupBox>
@@ -10,16 +11,6 @@
namespace chatterino {
namespace {
QString CreateLink(const QString &url, const QString &name)
{
return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" +
name + "</span></a>");
}
} // namespace
ExternalToolsPage::ExternalToolsPage()
: SettingsPage("External tools", "")
{
@@ -41,8 +32,8 @@ ExternalToolsPage::ExternalToolsPage()
description->setStyleSheet("color: #bbb");
auto links = new QLabel(
CreateLink("https://streamlink.github.io/", "Website") + " " +
CreateLink(
createNamedLink("https://streamlink.github.io/", "Website") + " " +
createNamedLink(
"https://github.com/streamlink/streamlink/releases/latest",
"Download"));
links->setTextFormat(Qt::RichText);
@@ -57,22 +48,22 @@ ExternalToolsPage::ExternalToolsPage()
auto customPathCb =
this->createCheckBox("Use custom path (Enable if using "
"non-standard streamlink installation path)",
app->settings->streamlinkUseCustomPath);
getSettings()->streamlinkUseCustomPath);
groupLayout->setWidget(2, QFormLayout::SpanningRole, customPathCb);
auto customPath = this->createLineEdit(app->settings->streamlinkPath);
auto customPath = this->createLineEdit(getSettings()->streamlinkPath);
customPath->setPlaceholderText(
"Path to folder where Streamlink executable can be found");
groupLayout->addRow("Custom streamlink path:", customPath);
groupLayout->addRow(
"Preferred quality:",
this->createComboBox({STREAMLINK_QUALITY},
app->settings->preferredQuality));
getSettings()->preferredQuality));
groupLayout->addRow(
"Additional options:",
this->createLineEdit(app->settings->streamlinkOpts));
this->createLineEdit(getSettings()->streamlinkOpts));
app->settings->streamlinkUseCustomPath.connect(
getSettings()->streamlinkUseCustomPath.connect(
[=](const auto &value, auto) {
customPath->setEnabled(value); //
},
+10 -12
View File
@@ -18,9 +18,8 @@
namespace chatterino {
FeelPage::FeelPage()
: SettingsPage("Feel", ":/images/behave.svg")
: SettingsPage("Feel", ":/settings/behave.svg")
{
auto app = getApp();
LayoutCreator<FeelPage> layoutCreator(this);
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
@@ -37,20 +36,20 @@ FeelPage::FeelPage()
form->addRow(
"", this->createCheckBox(
"Show which users joined the channel (up to 1000 chatters)",
app->settings->showJoins));
getSettings()->showJoins));
form->addRow(
"", this->createCheckBox(
"Show which users parted the channel (up to 1000 chatters)",
app->settings->showParts));
getSettings()->showParts));
form->addRow("Pause chat:",
this->createCheckBox(PAUSE_HOVERING,
app->settings->pauseChatHover));
getSettings()->pauseChatHover));
form->addRow("Mouse scroll speed:", this->createMouseScrollSlider());
form->addRow("Links:",
this->createCheckBox("Open links only on double click",
app->settings->linksDoubleClickOnly));
getSettings()->linksDoubleClickOnly));
}
layout->addSpacing(16);
@@ -61,11 +60,11 @@ FeelPage::FeelPage()
groupLayout->addRow(
LIMIT_CHATTERS_FOR_SMALLER_STREAMERS,
this->createCheckBox(
"", app->settings->onlyFetchChattersForSmallerStreamers));
"", getSettings()->onlyFetchChattersForSmallerStreamers));
groupLayout->addRow(
"What viewer count counts as a \"smaller streamer\"",
this->createSpinBox(app->settings->smallStreamerLimit, 10, 50000));
this->createSpinBox(getSettings()->smallStreamerLimit, 10, 50000));
}
{
@@ -73,7 +72,7 @@ FeelPage::FeelPage()
auto groupLayout = group.setLayoutType<QVBoxLayout>();
groupLayout.append(this->createCheckBox("Show whispers inline",
app->settings->inlineWhispers));
getSettings()->inlineWhispers));
}
layout->addStretch(1);
@@ -81,17 +80,16 @@ FeelPage::FeelPage()
QSlider *FeelPage::createMouseScrollSlider()
{
auto app = getApp();
auto slider = new QSlider(Qt::Horizontal);
float currentValue = app->settings->mouseScrollMultiplier;
float currentValue = getSettings()->mouseScrollMultiplier;
int sliderValue = int(((currentValue - 0.1f) / 2.f) * 99.f);
slider->setValue(sliderValue);
QObject::connect(slider, &QSlider::valueChanged, [=](int newValue) {
float mul = static_cast<float>(newValue) / 99.f;
float newSliderValue = (mul * 2.1f) + 0.1f;
app->settings->mouseScrollMultiplier = newSliderValue;
getSettings()->mouseScrollMultiplier = newSliderValue;
});
return slider;
@@ -30,7 +30,7 @@
namespace chatterino {
HighlightingPage::HighlightingPage()
: SettingsPage("Highlights", ":/images/notifications.svg")
: SettingsPage("Highlights", ":/settings/notifications.svg")
{
auto app = getApp();
LayoutCreator<HighlightingPage> layoutCreator(this);
@@ -39,7 +39,7 @@ HighlightingPage::HighlightingPage()
{
// GENERAL
// layout.append(this->createCheckBox(ENABLE_HIGHLIGHTS,
// app->settings->enableHighlights));
// getSettings()->enableHighlights));
// TABS
auto tabs = layout.emplace<QTabWidget>();
@@ -135,7 +135,7 @@ HighlightingPage::HighlightingPage()
auto customSound = layout.emplace<QHBoxLayout>().withoutMargin();
{
customSound.append(this->createCheckBox(
"Custom sound", app->settings->customHighlightSound));
"Custom sound", getSettings()->customHighlightSound));
auto selectFile =
customSound.emplace<QPushButton>("Select custom sound file");
QObject::connect(selectFile.getElement(), &QPushButton::clicked,
@@ -143,12 +143,12 @@ HighlightingPage::HighlightingPage()
auto fileName = QFileDialog::getOpenFileName(
this, tr("Open Sound"), "",
tr("Audio Files (*.mp3 *.wav)"));
app->settings->pathHighlightSound = fileName;
getSettings()->pathHighlightSound = fileName;
});
}
layout.append(createCheckBox(ALWAYS_PLAY,
app->settings->highlightAlwaysPlaySound));
getSettings()->highlightAlwaysPlaySound));
}
// ---- misc
+3 -3
View File
@@ -4,6 +4,7 @@
#include "controllers/accounts/AccountController.hpp"
#include "controllers/ignores/IgnoreController.hpp"
#include "controllers/ignores/IgnoreModel.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "singletons/Settings.hpp"
#include "util/LayoutCreator.hpp"
#include "widgets/helper/EditableModelView.hpp"
@@ -68,9 +69,8 @@ void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users,
QStringListModel &userModel)
{
users.append(
page.createCheckBox("Enable twitch ignored users",
getApp()->settings->enableTwitchIgnoredUsers));
users.append(page.createCheckBox("Enable twitch ignored users",
getSettings()->enableTwitchIgnoredUsers));
auto anyways = users.emplace<QHBoxLayout>().withoutMargin();
{
+2 -2
View File
@@ -33,7 +33,7 @@
// LayoutCreator<LogsPage> layoutCreator(this);
// auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
// auto logPath = app->paths->logsFolderPath;
// auto logPath = getPaths()->logsFolderPath;
// auto created = layout.emplace<QLabel>();
// created->setText("Logs are saved to " + CreateLink(logPath, true));
@@ -43,7 +43,7 @@
// Qt::LinksAccessibleByKeyboard);
// created->setOpenExternalLinks(true);
// layout.append(this->createCheckBox("Enable logging",
// app->settings->enableLogging));
// getSettings()->enableLogging));
// layout->addStretch(1);
//}
+20 -13
View File
@@ -1,10 +1,14 @@
#include "LookPage.hpp"
#include "Application.hpp"
#include "messages/Image.hpp"
#include "messages/MessageBuilder.hpp"
#include "singletons/Resources.hpp"
#include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp"
#include "util/LayoutCreator.hpp"
#include "util/RemoveScrollAreaBackground.hpp"
#include "widgets/helper/ChannelView.hpp"
#include "widgets/helper/Line.hpp"
#include <QFontDialog>
@@ -27,9 +31,9 @@
// clang-format on
#ifdef USEWINSDK
#define WINDOW_TOPMOST "Window always on top"
# define WINDOW_TOPMOST "Window always on top"
#else
#define WINDOW_TOPMOST "Window always on top (requires restart)"
# define WINDOW_TOPMOST "Window always on top (requires restart)"
#endif
#define INPUT_EMPTY "Show input box when empty"
#define LAST_MSG "Mark the last message you read"
@@ -37,7 +41,7 @@
namespace chatterino {
LookPage::LookPage()
: SettingsPage("Look", ":/images/theme.svg")
: SettingsPage("Look", ":/settings/theme.svg")
{
this->initializeUi();
}
@@ -204,16 +208,19 @@ void LookPage::addEmoteTab(LayoutCreator<QVBoxLayout> layout)
/*
emotes.append(
this->createCheckBox("Enable Twitch emotes",
app->settings->enableTwitchEmotes));
getSettings()->enableTwitchEmotes));
emotes.append(this->createCheckBox("Enable BetterTTV emotes for Twitch",
app->settings->enableBttvEmotes));
getSettings()->enableBttvEmotes));
emotes.append(this->createCheckBox("Enable FrankerFaceZ emotes for Twitch",
app->settings->enableFfzEmotes));
getSettings()->enableFfzEmotes));
emotes.append(this->createCheckBox("Enable emojis",
app->settings->enableEmojis));
getSettings()->enableEmojis));
*/
layout.append(
this->createCheckBox("Animations", getSettings()->enableGifAnimations));
layout.append(
this->createCheckBox("Animations only when chatterino has focus",
getSettings()->enableAnimationsWhenFocused));
auto scaleBox = layout.emplace<QHBoxLayout>().withoutMargin();
{
@@ -281,7 +288,7 @@ void LookPage::addLastReadMessageIndicatorPatternSelector(
combo->addItems({"Dotted line", "Solid line"});
const auto currentIndex = []() -> int {
switch (getApp()->settings->lastMessagePattern.getValue()) {
switch (getSettings()->lastMessagePattern.getValue()) {
case Qt::SolidLine:
return 1;
case Qt::VerPattern:
@@ -322,11 +329,11 @@ ChannelPtr LookPage::createPreviewChannel()
{
MessageBuilder builder;
builder.emplace<TimestampElement>(QTime(8, 13, 42));
builder.emplace<ImageElement>(Image::fromNonOwningPixmap(&getApp()->resources->twitch.moderator), MessageElementFlag::BadgeChannelAuthority);
builder.emplace<ImageElement>(Image::fromNonOwningPixmap(&getApp()->resources->twitch.subscriber), MessageElementFlag::BadgeSubscription);
builder.emplace<ImageElement>(Image::fromPixmap(getApp()->resources->twitch.moderator), MessageElementFlag::BadgeChannelAuthority);
builder.emplace<ImageElement>(Image::fromPixmap(getApp()->resources->twitch.subscriber, 0.25), MessageElementFlag::BadgeSubscription);
builder.emplace<TextElement>("username1:", MessageElementFlag::Username, QColor("#0094FF"), FontStyle::ChatMediumBold);
builder.emplace<TextElement>("This is a preview message", MessageElementFlag::Text);
builder.emplace<ImageElement>(Image::fromNonOwningPixmap(&getApp()->resources->pajaDank), MessageElementFlag::AlwaysShow);
builder.emplace<ImageElement>(Image::fromPixmap(getApp()->resources->pajaDank, 0.25), MessageElementFlag::AlwaysShow);
builder.emplace<TextElement>("@fourtf", MessageElementFlag::BoldUsername, MessageColor::Text, FontStyle::ChatMediumBold);
builder.emplace<TextElement>("@fourtf", MessageElementFlag::NonBoldUsername);
channel->addMessage(builder.release());
@@ -334,7 +341,7 @@ ChannelPtr LookPage::createPreviewChannel()
{
MessageBuilder message;
message.emplace<TimestampElement>(QTime(8, 15, 21));
message.emplace<ImageElement>(Image::fromNonOwningPixmap(&getApp()->resources->twitch.broadcaster), MessageElementFlag::BadgeChannelAuthority);
message.emplace<ImageElement>(Image::fromPixmap(getApp()->resources->twitch.broadcaster), MessageElementFlag::BadgeChannelAuthority);
message.emplace<TextElement>("username2:", MessageElementFlag::Username, QColor("#FF6A00"), FontStyle::ChatMediumBold);
message.emplace<TextElement>("This is another one", MessageElementFlag::Text);
// message.emplace<ImageElement>(Image::fromNonOwningPixmap(&getApp()->resources->ppHop), MessageElementFlag::BttvEmote);
@@ -416,7 +423,7 @@ QLayout *LookPage::createFontChanger()
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Policy::Fixed);
QObject::connect(button, &QPushButton::clicked, [=]() {
QFontDialog dialog(app->fonts->getFont(Fonts::ChatMedium, 1.));
QFontDialog dialog(app->fonts->getFont(FontStyle::ChatMedium, 1.));
dialog.setWindowFlag(Qt::WindowStaysOnTopHint);
+14 -38
View File
@@ -7,6 +7,7 @@
#include "controllers/taggedusers/TaggedUsersModel.hpp"
#include "singletons/Logging.hpp"
#include "singletons/Paths.hpp"
#include "util/Helpers.hpp"
#include "util/LayoutCreator.hpp"
#include "widgets/helper/EditableModelView.hpp"
@@ -25,18 +26,6 @@
namespace chatterino {
inline QString CreateLink(const QString &url, bool file = false)
{
if (file) {
return QString("<a href=\"file:///" + url +
"\"><span style=\"color: white;\">" + url +
"</span></a>");
}
return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" +
url + "</span></a>");
}
qint64 dirSize(QString dirPath)
{
qint64 size = 0;
@@ -69,12 +58,11 @@ QString formatSize(qint64 size)
QString fetchLogDirectorySize()
{
auto app = getApp();
QString logPathDirectory;
if (app->settings->logPath == "") {
logPathDirectory = app->paths->messageLogDirectory;
if (getSettings()->logPath == "") {
logPathDirectory = getPaths()->messageLogDirectory;
} else {
logPathDirectory = app->settings->logPath;
logPathDirectory = getSettings()->logPath;
}
qint64 logsSize = dirSize(logPathDirectory);
QString logsSizeLabel = "Your logs currently take up ";
@@ -101,30 +89,20 @@ ModerationPage::ModerationPage()
QtConcurrent::run([] { return fetchLogDirectorySize(); }));
// Logs (copied from LoggingMananger)
app->settings->logPath.connect(
getSettings()->logPath.connect(
[app, logsPathLabel](const QString &logPath, auto) mutable {
QString pathOriginal;
if (logPath == "") {
pathOriginal = app->paths->messageLogDirectory;
pathOriginal = getPaths()->messageLogDirectory;
} else {
pathOriginal = logPath;
}
QString pathShortened;
if (pathOriginal.size() > 50) {
pathShortened = pathOriginal;
pathShortened.resize(50);
pathShortened += "...";
} else {
pathShortened = pathOriginal;
}
pathShortened = "Logs saved at <a href=\"file:///" +
pathOriginal +
"\"><span style=\"color: white;\">" +
pathShortened + "</span></a>";
QString pathShortened =
"Logs saved at <a href=\"file:///" + pathOriginal +
"\"><span style=\"color: white;\">" +
shortenString(pathOriginal, 50) + "</span></a>";
logsPathLabel->setText(pathShortened);
logsPathLabel->setToolTip(pathOriginal);
@@ -136,7 +114,7 @@ ModerationPage::ModerationPage()
Qt::LinksAccessibleByKeyboard);
logsPathLabel->setOpenExternalLinks(true);
logs.append(this->createCheckBox("Enable logging",
app->settings->enableLogging));
getSettings()->enableLogging));
logs->addStretch(1);
auto selectDir = logs.emplace<QPushButton>("Set custom logpath");
@@ -145,10 +123,9 @@ ModerationPage::ModerationPage()
QObject::connect(
selectDir.getElement(), &QPushButton::clicked, this,
[this, logsPathSizeLabel]() mutable {
auto app = getApp();
auto dirName = QFileDialog::getExistingDirectory(this);
app->settings->logPath = dirName;
getSettings()->logPath = dirName;
// Refresh: Show how big (size-wise) the logs are
logsPathSizeLabel->setText(
@@ -159,8 +136,7 @@ ModerationPage::ModerationPage()
auto resetDir = logs.emplace<QPushButton>("Reset logpath");
QObject::connect(resetDir.getElement(), &QPushButton::clicked, this,
[logsPathSizeLabel]() mutable {
auto app = getApp();
app->settings->logPath = "";
getSettings()->logPath = "";
// Refresh: Show how big (size-wise) the logs are
logsPathSizeLabel->setText(QtConcurrent::run(
@@ -183,7 +159,7 @@ ModerationPage::ModerationPage()
// form->addRow("Action on timed out messages
// (unimplemented):",
// this->createComboBox({"Disable", "Hide"},
// app->settings->timeoutAction));
// getSettings()->timeoutAction));
// }
EditableModelView *view =
@@ -13,8 +13,6 @@ namespace chatterino {
SpecialChannelsPage::SpecialChannelsPage()
: SettingsPage("Special channels", "")
{
auto app = getApp();
LayoutCreator<SpecialChannelsPage> layoutCreator(this);
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();