changed to 80 max column

This commit is contained in:
fourtf
2018-08-06 21:17:03 +02:00
parent defa7e41fa
commit f71ff08e68
203 changed files with 3792 additions and 2405 deletions
+28 -18
View File
@@ -32,7 +32,8 @@ AboutPage::AboutPage()
auto logo = layout.emplace<QLabel>().assign(&this->logo_);
logo->setPixmap(pixmap);
logo->setFixedSize(PIXMAP_WIDTH, PIXMAP_WIDTH * pixmap.height() / pixmap.width());
logo->setFixedSize(PIXMAP_WIDTH,
PIXMAP_WIDTH * pixmap.height() / pixmap.width());
logo->setScaledContents(true);
// this does nothing
@@ -45,9 +46,9 @@ AboutPage::AboutPage()
{
auto created = xd.emplace<QLabel>();
{
created->setText("Created by <a href=\"https://github.com/fourtf\">fourtf</a><br>"
"with big help from pajlada.");
created->setTextFormat(Qt::RichText);
created->setText("Created by <a
href=\"https://github.com/fourtf\">fourtf</a><br>" "with big help from
pajlada."); created->setTextFormat(Qt::RichText);
created->setTextInteractionFlags(Qt::TextBrowserInteraction |
Qt::LinksAccessibleByKeyboard |
Qt::LinksAccessibleByKeyboard);
@@ -58,18 +59,20 @@ AboutPage::AboutPage()
// auto github = xd.emplace<QLabel>();
// {
// github->setText(
// "<a href=\"https://github.com/fourtf/chatterino2\">Chatterino on
// "<a
href=\"https://github.com/fourtf/chatterino2\">Chatterino on
// Github</a>");
// github->setTextFormat(Qt::RichText);
// github->setTextInteractionFlags(Qt::TextBrowserInteraction |
// Qt::LinksAccessibleByKeyboard |
// Qt::LinksAccessibleByKeyboard);
// github->setTextInteractionFlags(Qt::TextBrowserInteraction |
// Qt::LinksAccessibleByKeyboard |
// Qt::LinksAccessibleByKeyboard);
// github->setOpenExternalLinks(true);
// // github->setPalette(palette);
// }
}*/
auto licenses = layout.emplace<QGroupBox>("Open source software used...");
auto licenses =
layout.emplace<QGroupBox>("Open source software used...");
{
auto form = licenses.emplace<QFormLayout>();
@@ -77,18 +80,23 @@ AboutPage::AboutPage()
":/licenses/qt_lgpl-3.0.txt");
addLicense(form.getElement(), "Boost", "https://www.boost.org/",
":/licenses/boost_boost.txt");
addLicense(form.getElement(), "Fmt", "http://fmtlib.net/", ":/licenses/fmt_bsd2.txt");
addLicense(form.getElement(), "LibCommuni", "https://github.com/communi/libcommuni",
addLicense(form.getElement(), "Fmt", "http://fmtlib.net/",
":/licenses/fmt_bsd2.txt");
addLicense(form.getElement(), "LibCommuni",
"https://github.com/communi/libcommuni",
":/licenses/libcommuni_BSD3.txt");
addLicense(form.getElement(), "OpenSSL", "https://www.openssl.org/",
":/licenses/openssl.txt");
addLicense(form.getElement(), "RapidJson", "http://rapidjson.org/",
":/licenses/rapidjson.txt");
addLicense(form.getElement(), "Pajlada/Settings", "https://github.com/pajlada/settings",
addLicense(form.getElement(), "Pajlada/Settings",
"https://github.com/pajlada/settings",
":/licenses/pajlada_settings.txt");
addLicense(form.getElement(), "Pajlada/Signals", "https://github.com/pajlada/signals",
addLicense(form.getElement(), "Pajlada/Signals",
"https://github.com/pajlada/signals",
":/licenses/pajlada_signals.txt");
addLicense(form.getElement(), "Websocketpp", "https://www.zaphoyd.com/websocketpp/",
addLicense(form.getElement(), "Websocketpp",
"https://www.zaphoyd.com/websocketpp/",
":/licenses/websocketpp.txt");
}
@@ -137,7 +145,8 @@ AboutPage::AboutPage()
QString avatarUrl = contributorParts[2].trimmed();
QString role = contributorParts[3].trimmed();
auto *usernameLabel = new QLabel("<a href=\"" + url + "\">" + username + "</a>");
auto *usernameLabel =
new QLabel("<a href=\"" + url + "\">" + username + "</a>");
usernameLabel->setOpenExternalLinks(true);
auto *roleLabel = new QLabel(role);
@@ -155,7 +164,8 @@ AboutPage::AboutPage()
}
};
const auto addLabels = [&contributorBox2, &usernameLabel, &roleLabel] {
const auto addLabels = [&contributorBox2, &usernameLabel,
&roleLabel] {
auto labelBox = new QVBoxLayout();
contributorBox2->addLayout(labelBox);
@@ -172,8 +182,8 @@ AboutPage::AboutPage()
layout->addStretch(1);
}
void AboutPage::addLicense(QFormLayout *form, const QString &name, const QString &website,
const QString &licenseLink)
void AboutPage::addLicense(QFormLayout *form, const QString &name,
const QString &website, const QString &licenseLink)
{
auto *a = new QLabel("<a href=\"" + website + "\">" + name + "</a>");
a->setOpenExternalLinks(true);
+2 -2
View File
@@ -13,8 +13,8 @@ public:
AboutPage();
private:
void addLicense(QFormLayout *form, const QString &name_, const QString &website,
const QString &licenseLink);
void addLicense(QFormLayout *form, const QString &name_,
const QString &website, const QString &licenseLink);
QLabel *logo_;
};
+5 -3
View File
@@ -25,7 +25,8 @@ AccountsPage::AccountsPage()
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
EditableModelView *view =
layout.emplace<EditableModelView>(app->accounts->createModel(nullptr)).getElement();
layout.emplace<EditableModelView>(app->accounts->createModel(nullptr))
.getElement();
view->getTableView()->horizontalHeader()->setVisible(false);
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
@@ -41,8 +42,9 @@ AccountsPage::AccountsPage()
// auto buttons = layout.emplace<QDialogButtonBox>();
// {
// this->addButton = buttons->addButton("Add", QDialogButtonBox::YesRole);
// this->removeButton = buttons->addButton("Remove", QDialogButtonBox::NoRole);
// this->addButton = buttons->addButton("Add",
// QDialogButtonBox::YesRole); this->removeButton =
// buttons->addButton("Remove", QDialogButtonBox::NoRole);
// }
// layout.emplace<AccountSwitchWidget>(this).assign(&this->accSwitchWidget);
@@ -15,18 +15,20 @@ namespace chatterino {
BrowserExtensionPage::BrowserExtensionPage()
: SettingsPage("Browser integration", "")
{
auto layout = LayoutCreator<BrowserExtensionPage>(this).setLayoutType<QVBoxLayout>();
auto layout =
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.");
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>");
auto firefox =
layout.emplace<QLabel>("<a href=\"" FIREFOX_EXTENSION_LINK
"\">Download for Mozilla Firefox</a>");
firefox->setOpenExternalLinks(true);
layout->addStretch(1);
}
+7 -4
View File
@@ -35,16 +35,19 @@ CommandPage::CommandPage()
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
EditableModelView *view =
layout.emplace<EditableModelView>(app->commands->createModel(nullptr)).getElement();
layout.emplace<EditableModelView>(app->commands->createModel(nullptr))
.getElement();
view->setTitles({"Trigger", "Command"});
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
view->addButtonPressed.connect([] {
getApp()->commands->items.appendItem(Command{"/command", "I made a new command HeyGuys"});
getApp()->commands->items.appendItem(
Command{"/command", "I made a new command HeyGuys"});
});
layout.append(this->createCheckBox("Also match the trigger at the end of the message",
app->settings->allowCommandsAtEnd));
layout.append(
this->createCheckBox("Also match the trigger at the end of the message",
app->settings->allowCommandsAtEnd));
QLabel *text = layout.emplace<QLabel>(TEXT).getElement();
text->setWordWrap(true);
+7 -4
View File
@@ -12,11 +12,14 @@ EmotesPage::EmotesPage()
// auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
// // clang-format off
// layout.append(this->createCheckBox("Enable Twitch emotes", settings.enableTwitchEmotes));
// layout.append(this->createCheckBox("Enable BetterTTV emotes", settings.enableBttvEmotes));
// layout.append(this->createCheckBox("Enable Twitch emotes",
// settings.enableTwitchEmotes));
// layout.append(this->createCheckBox("Enable BetterTTV emotes",
// settings.enableBttvEmotes));
// layout.append(this->createCheckBox("Enable FrankerFaceZ emotes",
// settings.enableFfzEmotes)); layout.append(this->createCheckBox("Enable emojis",
// settings.enableEmojis)); layout.append(this->createCheckBox("Enable gif animations",
// settings.enableFfzEmotes)); layout.append(this->createCheckBox("Enable
// emojis", settings.enableEmojis));
// layout.append(this->createCheckBox("Enable gif animations",
// settings.enableGifAnimations));
// // clang-format on
+25 -15
View File
@@ -5,7 +5,8 @@
#include <QGroupBox>
#define STREAMLINK_QUALITY "Choose", "Source", "High", "Medium", "Low", "Audio only"
#define STREAMLINK_QUALITY \
"Choose", "Source", "High", "Medium", "Low", "Audio only"
namespace chatterino {
@@ -13,7 +14,8 @@ namespace {
QString CreateLink(const QString &url, const QString &name)
{
return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" + name + "</span></a>");
return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" +
name + "</span></a>");
}
} // namespace
@@ -30,37 +32,45 @@ ExternalToolsPage::ExternalToolsPage()
auto group = layout.emplace<QGroupBox>("Streamlink");
auto groupLayout = group.setLayoutType<QFormLayout>();
auto description =
new QLabel("Streamlink is a command-line utility that pipes video streams from various "
"services into a video player, such as VLC. Make sure to edit the "
"configuration file before you use it!");
auto description = new QLabel(
"Streamlink is a command-line utility that pipes video streams "
"from various "
"services into a video player, such as VLC. Make sure to edit the "
"configuration file before you use it!");
description->setWordWrap(true);
description->setStyleSheet("color: #bbb");
auto links = new QLabel(
CreateLink("https://streamlink.github.io/", "Website") + " " +
CreateLink("https://github.com/streamlink/streamlink/releases/latest", "Download"));
CreateLink(
"https://github.com/streamlink/streamlink/releases/latest",
"Download"));
links->setTextFormat(Qt::RichText);
links->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::LinksAccessibleByKeyboard |
links->setTextInteractionFlags(Qt::TextBrowserInteraction |
Qt::LinksAccessibleByKeyboard |
Qt::LinksAccessibleByKeyboard);
links->setOpenExternalLinks(true);
groupLayout->setWidget(0, QFormLayout::SpanningRole, description);
groupLayout->setWidget(1, QFormLayout::SpanningRole, links);
auto customPathCb = this->createCheckBox(
"Use custom path (Enable if using non-standard streamlink installation path)",
app->settings->streamlinkUseCustomPath);
auto customPathCb =
this->createCheckBox("Use custom path (Enable if using "
"non-standard streamlink installation path)",
app->settings->streamlinkUseCustomPath);
groupLayout->setWidget(2, QFormLayout::SpanningRole, customPathCb);
auto customPath = this->createLineEdit(app->settings->streamlinkPath);
customPath->setPlaceholderText("Path to folder where Streamlink executable can be found");
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));
groupLayout->addRow("Additional options:",
this->createLineEdit(app->settings->streamlinkOpts));
this->createComboBox({STREAMLINK_QUALITY},
app->settings->preferredQuality));
groupLayout->addRow(
"Additional options:",
this->createLineEdit(app->settings->streamlinkOpts));
app->settings->streamlinkUseCustomPath.connect(
[=](const auto &value, auto) {
+24 -16
View File
@@ -12,7 +12,8 @@
#define SCROLL_SMOOTH "Smooth scrolling"
#define SCROLL_NEWMSG "Smooth scrolling for new messages"
#define LIMIT_CHATTERS_FOR_SMALLER_STREAMERS "Only fetch chatters list for viewers under X viewers"
#define LIMIT_CHATTERS_FOR_SMALLER_STREAMERS \
"Only fetch chatters list for viewers under X viewers"
namespace chatterino {
@@ -26,25 +27,30 @@ FeelPage::FeelPage()
// layout.append(this->createCheckBox("Use a seperate write connection.",
// getSettings()->twitchSeperateWriteConnection));
layout.append(this->createCheckBox(SCROLL_SMOOTH, getSettings()->enableSmoothScrolling));
layout.append(
this->createCheckBox(SCROLL_NEWMSG, getSettings()->enableSmoothScrollingNewMessages));
layout.append(this->createCheckBox(SCROLL_SMOOTH,
getSettings()->enableSmoothScrolling));
layout.append(this->createCheckBox(
SCROLL_NEWMSG, getSettings()->enableSmoothScrollingNewMessages));
auto form = layout.emplace<QFormLayout>().withoutMargin();
{
form->addRow(
"", this->createCheckBox("Show which users joined the channel (up to 1000 chatters)",
app->settings->showJoins));
"", this->createCheckBox(
"Show which users joined the channel (up to 1000 chatters)",
app->settings->showJoins));
form->addRow(
"", this->createCheckBox("Show which users parted the channel (up to 1000 chatters)",
app->settings->showParts));
"", this->createCheckBox(
"Show which users parted the channel (up to 1000 chatters)",
app->settings->showParts));
form->addRow("Pause chat:",
this->createCheckBox(PAUSE_HOVERING, app->settings->pauseChatHover));
this->createCheckBox(PAUSE_HOVERING,
app->settings->pauseChatHover));
form->addRow("Mouse scroll speed:", this->createMouseScrollSlider());
form->addRow("Links:", this->createCheckBox("Open links only on double click",
app->settings->linksDoubleClickOnly));
form->addRow("Links:",
this->createCheckBox("Open links only on double click",
app->settings->linksDoubleClickOnly));
}
layout->addSpacing(16);
@@ -54,18 +60,20 @@ FeelPage::FeelPage()
auto groupLayout = group.setLayoutType<QFormLayout>();
groupLayout->addRow(
LIMIT_CHATTERS_FOR_SMALLER_STREAMERS,
this->createCheckBox("", app->settings->onlyFetchChattersForSmallerStreamers));
this->createCheckBox(
"", app->settings->onlyFetchChattersForSmallerStreamers));
groupLayout->addRow("What viewer count counts as a \"smaller streamer\"",
this->createSpinBox(app->settings->smallStreamerLimit, 10, 50000));
groupLayout->addRow(
"What viewer count counts as a \"smaller streamer\"",
this->createSpinBox(app->settings->smallStreamerLimit, 10, 50000));
}
{
auto group = layout.emplace<QGroupBox>("Misc");
auto groupLayout = group.setLayoutType<QVBoxLayout>();
groupLayout.append(
this->createCheckBox("Show whispers inline", app->settings->inlineWhispers));
groupLayout.append(this->createCheckBox("Show whispers inline",
app->settings->inlineWhispers));
}
layout->addStretch(1);
+45 -24
View File
@@ -24,7 +24,8 @@
#define HIGHLIGHT_MSG "Highlight messages containing your name"
#define PLAY_SOUND "Play sound when your name is mentioned"
#define FLASH_TASKBAR "Flash taskbar when your name is mentioned"
#define ALWAYS_PLAY "Always play highlight sound (Even if Chatterino is focused)"
#define ALWAYS_PLAY \
"Always play highlight sound (Even if Chatterino is focused)"
namespace chatterino {
@@ -37,7 +38,8 @@ HighlightingPage::HighlightingPage()
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
{
// GENERAL
// layout.append(this->createCheckBox(ENABLE_HIGHLIGHTS, app->settings->enableHighlights));
// layout.append(this->createCheckBox(ENABLE_HIGHLIGHTS,
// app->settings->enableHighlights));
// TABS
auto tabs = layout.emplace<QTabWidget>();
@@ -46,15 +48,20 @@ HighlightingPage::HighlightingPage()
auto highlights = tabs.appendTab(new QVBoxLayout, "Phrases");
{
EditableModelView *view =
highlights.emplace<EditableModelView>(app->highlights->createModel(nullptr))
highlights
.emplace<EditableModelView>(
app->highlights->createModel(nullptr))
.getElement();
view->setTitles({"Pattern", "Flash\ntaskbar", "Play\nsound", "Enable\nregex"});
view->getTableView()->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
view->setTitles({"Pattern", "Flash\ntaskbar", "Play\nsound",
"Enable\nregex"});
view->getTableView()->horizontalHeader()->setSectionResizeMode(
QHeaderView::Fixed);
view->getTableView()->horizontalHeader()->setSectionResizeMode(
0, QHeaderView::Stretch);
// fourtf: make class extrend BaseWidget and add this to dpiChanged
// fourtf: make class extrend BaseWidget and add this to
// dpiChanged
QTimer::singleShot(1, [view] {
view->getTableView()->resizeColumnsToContents();
view->getTableView()->setColumnWidth(0, 200);
@@ -69,15 +76,20 @@ HighlightingPage::HighlightingPage()
auto pingUsers = tabs.appendTab(new QVBoxLayout, "Users");
{
EditableModelView *view =
pingUsers.emplace<EditableModelView>(app->highlights->createUserModel(nullptr))
pingUsers
.emplace<EditableModelView>(
app->highlights->createUserModel(nullptr))
.getElement();
view->setTitles({"Username", "Flash\ntaskbar", "Play\nsound", "Enable\nregex"});
view->getTableView()->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
view->setTitles({"Username", "Flash\ntaskbar", "Play\nsound",
"Enable\nregex"});
view->getTableView()->horizontalHeader()->setSectionResizeMode(
QHeaderView::Fixed);
view->getTableView()->horizontalHeader()->setSectionResizeMode(
0, QHeaderView::Stretch);
// fourtf: make class extrend BaseWidget and add this to dpiChanged
// fourtf: make class extrend BaseWidget and add this to
// dpiChanged
QTimer::singleShot(1, [view] {
view->getTableView()->resizeColumnsToContents();
view->getTableView()->setColumnWidth(0, 200);
@@ -85,23 +97,28 @@ HighlightingPage::HighlightingPage()
view->addButtonPressed.connect([] {
getApp()->highlights->highlightedUsers.appendItem(
HighlightPhrase{"highlighted user", true, false, false});
HighlightPhrase{"highlighted user", true, false,
false});
});
}
auto disabledUsers = tabs.appendTab(new QVBoxLayout, "Excluded Users");
auto disabledUsers =
tabs.appendTab(new QVBoxLayout, "Excluded Users");
{
EditableModelView *view =
disabledUsers
.emplace<EditableModelView>(app->highlights->createBlacklistModel(nullptr))
.emplace<EditableModelView>(
app->highlights->createBlacklistModel(nullptr))
.getElement();
view->setTitles({"Pattern", "Enable\nregex"});
view->getTableView()->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
view->getTableView()->horizontalHeader()->setSectionResizeMode(
QHeaderView::Fixed);
view->getTableView()->horizontalHeader()->setSectionResizeMode(
0, QHeaderView::Stretch);
// fourtf: make class extrend BaseWidget and add this to dpiChanged
// fourtf: make class extrend BaseWidget and add this to
// dpiChanged
QTimer::singleShot(1, [view] {
view->getTableView()->resizeColumnsToContents();
view->getTableView()->setColumnWidth(0, 200);
@@ -117,17 +134,21 @@ HighlightingPage::HighlightingPage()
// MISC
auto customSound = layout.emplace<QHBoxLayout>().withoutMargin();
{
customSound.append(
this->createCheckBox("Custom sound", app->settings->customHighlightSound));
auto selectFile = customSound.emplace<QPushButton>("Select custom sound file");
QObject::connect(selectFile.getElement(), &QPushButton::clicked, this, [this, app] {
auto fileName = QFileDialog::getOpenFileName(this, tr("Open Sound"), "",
tr("Audio Files (*.mp3 *.wav)"));
app->settings->pathHighlightSound = fileName;
});
customSound.append(this->createCheckBox(
"Custom sound", app->settings->customHighlightSound));
auto selectFile =
customSound.emplace<QPushButton>("Select custom sound file");
QObject::connect(selectFile.getElement(), &QPushButton::clicked,
this, [this, app] {
auto fileName = QFileDialog::getOpenFileName(
this, tr("Open Sound"), "",
tr("Audio Files (*.mp3 *.wav)"));
app->settings->pathHighlightSound = fileName;
});
}
layout.append(createCheckBox(ALWAYS_PLAY, app->settings->highlightAlwaysPlaySound));
layout.append(createCheckBox(ALWAYS_PLAY,
app->settings->highlightAlwaysPlaySound));
}
// ---- misc
+16 -8
View File
@@ -24,7 +24,8 @@
namespace chatterino {
static void addPhrasesTab(LayoutCreator<QVBoxLayout> box);
static void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> box, QStringListModel &model);
static void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> box,
QStringListModel &model);
IgnoresPage::IgnoresPage()
: SettingsPage("Ignores", "")
@@ -34,7 +35,8 @@ IgnoresPage::IgnoresPage()
auto tabs = layout.emplace<QTabWidget>();
addPhrasesTab(tabs.appendTab(new QVBoxLayout, "Phrases"));
addUsersTab(*this, tabs.appendTab(new QVBoxLayout, "Users"), this->userListModel_);
addUsersTab(*this, tabs.appendTab(new QVBoxLayout, "Users"),
this->userListModel_);
auto label = layout.emplace<QLabel>(INFO);
label->setWordWrap(true);
@@ -44,10 +46,14 @@ IgnoresPage::IgnoresPage()
void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
{
EditableModelView *view =
layout.emplace<EditableModelView>(getApp()->ignores->createModel(nullptr)).getElement();
layout
.emplace<EditableModelView>(getApp()->ignores->createModel(nullptr))
.getElement();
view->setTitles({"Pattern", "Regex"});
view->getTableView()->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
view->getTableView()->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
view->getTableView()->horizontalHeader()->setSectionResizeMode(
QHeaderView::Fixed);
view->getTableView()->horizontalHeader()->setSectionResizeMode(
0, QHeaderView::Stretch);
QTimer::singleShot(1, [view] {
view->getTableView()->resizeColumnsToContents();
@@ -59,10 +65,12 @@ void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
});
}
void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users, QStringListModel &userModel)
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",
getApp()->settings->enableTwitchIgnoredUsers));
auto anyways = users.emplace<QHBoxLayout>().withoutMargin();
{
@@ -10,31 +10,37 @@ namespace chatterino {
KeyboardSettingsPage::KeyboardSettingsPage()
: SettingsPage("Keybindings", "")
{
auto layout = LayoutCreator<KeyboardSettingsPage>(this).setLayoutType<QVBoxLayout>();
auto layout =
LayoutCreator<KeyboardSettingsPage>(this).setLayoutType<QVBoxLayout>();
auto form = layout.emplace<QFormLayout>();
form->addRow(new QLabel("Hold Ctrl"), new QLabel("Show resize handles"));
form->addRow(new QLabel("Hold Ctrl + Alt"), new QLabel("Show split overlay"));
form->addRow(new QLabel("Hold Ctrl + Alt"),
new QLabel("Show split overlay"));
form->addItem(new QSpacerItem(16, 16));
form->addRow(new QLabel("Ctrl + T"), new QLabel("Create new split"));
form->addRow(new QLabel("Ctrl + W"), new QLabel("Close current split"));
form->addRow(new QLabel("Ctrl + Shift + T"), new QLabel("Create new tab"));
form->addRow(new QLabel("Ctrl + Shift + W"), new QLabel("Close current tab"));
form->addRow(new QLabel("Ctrl + Shift + W"),
new QLabel("Close current tab"));
form->addItem(new QSpacerItem(16, 16));
form->addRow(new QLabel("Ctrl + 1/2/3/..."), new QLabel("Select tab 1/2/3/..."));
form->addRow(new QLabel("Ctrl + 1/2/3/..."),
new QLabel("Select tab 1/2/3/..."));
form->addRow(new QLabel("Ctrl + Tab"), new QLabel("Select next tab"));
form->addRow(new QLabel("Ctrl + Shift + Tab"), new QLabel("Select previous tab"));
form->addRow(new QLabel("Ctrl + Shift + Tab"),
new QLabel("Select previous tab"));
form->addRow(new QLabel("Alt + Left/Up/Right/Down"),
new QLabel("Select split left/up/right/down"));
form->addItem(new QSpacerItem(16, 16));
form->addRow(new QLabel("Ctrl + R"), new QLabel("Change channel"));
form->addRow(new QLabel("Ctrl + F"), new QLabel("Search in current channel"));
form->addRow(new QLabel("Ctrl + F"),
new QLabel("Search in current channel"));
}
} // namespace chatterino
+8 -4
View File
@@ -15,11 +15,13 @@
// inline QString CreateLink(const QString &url, bool file = false)
//{
// if (file) {
// return QString("<a href=\"file:///" + url + "\"><span style=\"color: white;\">" + url +
// return QString("<a href=\"file:///" + url + "\"><span style=\"color:
// white;\">" + url +
// "</span></a>");
// }
// return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" + url +
// return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" +
// url +
// "</span></a>");
//}
@@ -36,10 +38,12 @@
// auto created = layout.emplace<QLabel>();
// created->setText("Logs are saved to " + CreateLink(logPath, true));
// created->setTextFormat(Qt::RichText);
// created->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::LinksAccessibleByKeyboard |
// created->setTextInteractionFlags(Qt::TextBrowserInteraction |
// Qt::LinksAccessibleByKeyboard |
// Qt::LinksAccessibleByKeyboard);
// created->setOpenExternalLinks(true);
// layout.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
// layout.append(this->createCheckBox("Enable logging",
// app->settings->enableLogging));
// layout->addStretch(1);
//}
+131 -83
View File
@@ -70,9 +70,12 @@ void LookPage::addInterfaceTab(LayoutCreator<QVBoxLayout> layout)
{
// theme
{
auto *theme = this->createComboBox({THEME_ITEMS}, getApp()->themes->themeName);
auto *theme =
this->createComboBox({THEME_ITEMS}, getApp()->themes->themeName);
QObject::connect(theme, &QComboBox::currentTextChanged,
[](const QString &) { getApp()->windows->forceLayoutChannelViews(); });
[](const QString &) {
getApp()->windows->forceLayoutChannelViews();
});
auto box = layout.emplace<QHBoxLayout>().withoutMargin();
box.emplace<QLabel>("Theme: ");
@@ -87,24 +90,29 @@ void LookPage::addInterfaceTab(LayoutCreator<QVBoxLayout> layout)
box.append(this->createUiScaleSlider());
}
layout.append(this->createCheckBox(WINDOW_TOPMOST, getSettings()->windowTopMost));
layout.append(
this->createCheckBox(WINDOW_TOPMOST, getSettings()->windowTopMost));
// --
layout.emplace<Line>(false);
// tab x
layout.append(this->createCheckBox(TAB_X, getSettings()->showTabCloseButton));
layout.append(
this->createCheckBox(TAB_X, getSettings()->showTabCloseButton));
// show buttons
#ifndef USEWINSDK
layout.append(this->createCheckBox(TAB_PREF, getSettings()->hidePreferencesButton));
layout.append(this->createCheckBox(TAB_USER, getSettings()->hideUserButton));
layout.append(
this->createCheckBox(TAB_PREF, getSettings()->hidePreferencesButton));
layout.append(
this->createCheckBox(TAB_USER, getSettings()->hideUserButton));
#endif
// empty input
layout.append(this->createCheckBox(INPUT_EMPTY, getSettings()->showEmptyInput));
layout.append(
this->createCheckBox("Show message length while typing", getSettings()->showMessageLength));
this->createCheckBox(INPUT_EMPTY, getSettings()->showEmptyInput));
layout.append(this->createCheckBox("Show message length while typing",
getSettings()->showMessageLength));
layout->addStretch(1);
}
@@ -125,37 +133,43 @@ void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
// timestamps
{
auto box = layout.emplace<QHBoxLayout>().withoutMargin();
box.append(this->createCheckBox("Show timestamps", getSettings()->showTimestamps));
box.append(this->createComboBox({TIMESTAMP_FORMATS}, getSettings()->timestampFormat));
box.append(this->createCheckBox("Show timestamps",
getSettings()->showTimestamps));
box.append(this->createComboBox({TIMESTAMP_FORMATS},
getSettings()->timestampFormat));
box->addStretch(1);
}
// badges
layout.append(this->createCheckBox("Show badges", getSettings()->showBadges));
layout.append(
this->createCheckBox("Show badges", getSettings()->showBadges));
// --
layout.emplace<Line>(false);
// seperate
layout.append(this->createCheckBox("Seperate lines", getSettings()->separateMessages));
layout.append(this->createCheckBox("Seperate lines",
getSettings()->separateMessages));
// alternate
layout.append(
this->createCheckBox("Alternate background", getSettings()->alternateMessageBackground));
layout.append(this->createCheckBox(
"Alternate background", getSettings()->alternateMessageBackground));
// --
layout.emplace<Line>(false);
// lowercase links
layout.append(this->createCheckBox("Lowercase domains", getSettings()->enableLowercaseLink));
layout.append(this->createCheckBox("Lowercase domains",
getSettings()->enableLowercaseLink));
// bold usernames
layout.append(this->createCheckBox("Bold @usernames", getSettings()->enableUsernameBold));
layout.append(this->createCheckBox("Bold @usernames",
getSettings()->enableUsernameBold));
// collapsing
{
auto *combo = new QComboBox(this);
combo->addItems(
{"Never", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"});
combo->addItems({"Never", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15"});
const auto currentIndex = []() -> int {
auto val = getSettings()->collpseMessagesMinLines.getValue();
@@ -166,9 +180,10 @@ void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
}();
combo->setCurrentIndex(currentIndex);
QObject::connect(combo, &QComboBox::currentTextChanged, [](const QString &str) {
getSettings()->collpseMessagesMinLines = str.toInt();
});
QObject::connect(
combo, &QComboBox::currentTextChanged, [](const QString &str) {
getSettings()->collpseMessagesMinLines = str.toInt();
});
auto hbox = layout.emplace<QHBoxLayout>().withoutMargin();
hbox.emplace<QLabel>("Collapse messages longer than");
@@ -187,14 +202,17 @@ void LookPage::addEmoteTab(LayoutCreator<QVBoxLayout> layout)
{
/*
emotes.append(
this->createCheckBox("Enable Twitch emotes", app->settings->enableTwitchEmotes));
this->createCheckBox("Enable Twitch emotes",
app->settings->enableTwitchEmotes));
emotes.append(this->createCheckBox("Enable BetterTTV emotes for Twitch",
app->settings->enableBttvEmotes));
emotes.append(this->createCheckBox("Enable FrankerFaceZ emotes for Twitch",
app->settings->enableFfzEmotes));
emotes.append(this->createCheckBox("Enable emojis", app->settings->enableEmojis));
emotes.append(this->createCheckBox("Enable emojis",
app->settings->enableEmojis));
*/
layout.append(this->createCheckBox("Animations", getSettings()->enableGifAnimations));
layout.append(
this->createCheckBox("Animations", getSettings()->enableGifAnimations));
auto scaleBox = layout.emplace<QHBoxLayout>().withoutMargin();
{
@@ -214,22 +232,25 @@ void LookPage::addEmoteTab(LayoutCreator<QVBoxLayout> layout)
getSettings()->emoteScale.setValue(f);
});
emoteScale->setValue(
std::max<int>(5, std::min<int>(50, int(getSettings()->emoteScale.getValue() * 10.f))));
emoteScale->setValue(std::max<int>(
5, std::min<int>(
50, int(getSettings()->emoteScale.getValue() * 10.f))));
scaleLabel->setText(QString::number(getSettings()->emoteScale.getValue()));
scaleLabel->setText(
QString::number(getSettings()->emoteScale.getValue()));
}
{
auto *combo = new QComboBox(this);
combo->addItems(
{"EmojiOne 2", "EmojiOne 3", "Twitter", "Facebook", "Apple", "Google", "Messenger"});
combo->addItems({"EmojiOne 2", "EmojiOne 3", "Twitter", "Facebook",
"Apple", "Google", "Messenger"});
combo->setCurrentText(getSettings()->emojiSet);
QObject::connect(combo, &QComboBox::currentTextChanged, [](const QString &str) {
getSettings()->emojiSet = str; //
});
QObject::connect(combo, &QComboBox::currentTextChanged,
[](const QString &str) {
getSettings()->emojiSet = str; //
});
auto hbox = layout.emplace<QHBoxLayout>().withoutMargin();
hbox.emplace<QLabel>("Emoji set:");
@@ -241,15 +262,18 @@ void LookPage::addEmoteTab(LayoutCreator<QVBoxLayout> layout)
void LookPage::addSplitHeaderTab(LayoutCreator<QVBoxLayout> layout)
{
layout.append(this->createCheckBox("Show viewer count", getSettings()->showViewerCount));
layout.append(this->createCheckBox("Show viewer count",
getSettings()->showViewerCount));
layout.append(this->createCheckBox("Show title", getSettings()->showTitle));
layout.append(this->createCheckBox("Show game", getSettings()->showGame));
layout.append(this->createCheckBox("Show uptime", getSettings()->showUptime));
layout.append(
this->createCheckBox("Show uptime", getSettings()->showUptime));
layout->addStretch(1);
}
void LookPage::addLastReadMessageIndicatorPatternSelector(LayoutCreator<QVBoxLayout> layout)
void LookPage::addLastReadMessageIndicatorPatternSelector(
LayoutCreator<QVBoxLayout> layout)
{
// combo
auto *combo = new QComboBox(this);
@@ -266,22 +290,25 @@ void LookPage::addLastReadMessageIndicatorPatternSelector(LayoutCreator<QVBoxLay
}();
combo->setCurrentIndex(currentIndex);
QObject::connect(combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[](int index) {
getSettings()->lastMessagePattern = [&] {
switch (index) {
case 1:
return Qt::SolidPattern;
case 0:
default:
return Qt::VerPattern;
}
}();
});
QObject::connect(
combo,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[](int index) {
getSettings()->lastMessagePattern = [&] {
switch (index) {
case 1:
return Qt::SolidPattern;
case 0:
default:
return Qt::VerPattern;
}
}();
});
// layout
auto hbox = layout.emplace<QHBoxLayout>().withoutMargin();
hbox.append(this->createCheckBox(LAST_MSG, getSettings()->showLastMessageIndicator));
hbox.append(this->createCheckBox(LAST_MSG,
getSettings()->showLastMessageIndicator));
hbox.append(combo);
hbox->addStretch(1);
}
@@ -293,39 +320,49 @@ ChannelPtr LookPage::createPreviewChannel()
{
auto message = MessagePtr(new Message());
message->addElement(new TimestampElement(QTime(8, 13, 42)));
message->addElement(new ImageElement(
Image::fromNonOwningPixmap(&getApp()->resources->twitch.moderator),
MessageElement::BadgeChannelAuthority));
message->addElement(new ImageElement(
Image::fromNonOwningPixmap(&getApp()->resources->twitch.subscriber),
MessageElement::BadgeSubscription));
message->addElement(
new ImageElement(Image::fromNonOwningPixmap(&getApp()->resources->twitch.moderator),
MessageElement::BadgeChannelAuthority));
new TextElement("username1:", MessageElement::Username,
QColor("#0094FF"), FontStyle::ChatMediumBold));
message->addElement(
new ImageElement(Image::fromNonOwningPixmap(&getApp()->resources->twitch.subscriber),
MessageElement::BadgeSubscription));
message->addElement(new TextElement("username1:", MessageElement::Username,
QColor("#0094FF"), FontStyle::ChatMediumBold));
message->addElement(new TextElement("This is a preview message", MessageElement::Text));
new TextElement("This is a preview message", MessageElement::Text));
message->addElement(new ImageElement(
Image::fromNonOwningPixmap(&getApp()->resources->pajaDank),
MessageElement::Flags::AlwaysShow));
message->addElement(
new ImageElement(Image::fromNonOwningPixmap(&getApp()->resources->pajaDank),
MessageElement::Flags::AlwaysShow));
message->addElement(new TextElement("@fourtf", TextElement::BoldUsername,
MessageColor::Text, FontStyle::ChatMediumBold));
message->addElement(new TextElement("@fourtf", TextElement::NonBoldUsername));
new TextElement("@fourtf", TextElement::BoldUsername,
MessageColor::Text, FontStyle::ChatMediumBold));
message->addElement(
new TextElement("@fourtf", TextElement::NonBoldUsername));
channel->addMessage(message);
}
{
auto message = MessagePtr(new Message());
message->addElement(new TimestampElement(QTime(8, 15, 21)));
message->addElement(
new ImageElement(Image::fromNonOwningPixmap(&getApp()->resources->twitch.broadcaster),
new ImageElement(Image::fromNonOwningPixmap(
&getApp()->resources->twitch.broadcaster),
MessageElement::BadgeChannelAuthority));
message->addElement(new TextElement("username2:", MessageElement::Username,
QColor("#FF6A00"), FontStyle::ChatMediumBold));
message->addElement(new TextElement("This is another one", MessageElement::Text));
// message->addElement(new ImageElement(
// Image::fromNonOwningPixmap(&getApp()->resources->ppHop), MessageElement::BttvEmote));
message->addElement(
(new TextElement("www.fourtf.com", MessageElement::LowercaseLink, MessageColor::Link))
new TextElement("username2:", MessageElement::Username,
QColor("#FF6A00"), FontStyle::ChatMediumBold));
message->addElement(
new TextElement("This is another one", MessageElement::Text));
// message->addElement(new ImageElement(
// Image::fromNonOwningPixmap(&getApp()->resources->ppHop),
// MessageElement::BttvEmote));
message->addElement(
(new TextElement("www.fourtf.com", MessageElement::LowercaseLink,
MessageColor::Link))
->setLink(Link(Link::Url, "https://www.fourtf.com")));
message->addElement(
(new TextElement("wWw.FoUrTf.CoM", MessageElement::OriginalLink, MessageColor::Link))
(new TextElement("wWw.FoUrTf.CoM", MessageElement::OriginalLink,
MessageColor::Link))
->setLink(Link(Link::Url, "https://www.fourtf.com")));
channel->addMessage(message);
}
@@ -343,7 +380,8 @@ QLayout *LookPage::createThemeColorChanger()
// SLIDER
QSlider *slider = new QSlider(Qt::Horizontal);
layout->addWidget(slider);
slider->setValue(int(std::min(std::max(themeHue.getValue(), 0.0), 1.0) * 100));
slider->setValue(
int(std::min(std::max(themeHue.getValue(), 0.0), 1.0) * 100));
// BUTTON
QPushButton *button = new QPushButton;
@@ -384,12 +422,16 @@ QLayout *LookPage::createFontChanger()
layout->addWidget(label);
auto updateFontFamilyLabel = [=](auto) {
label->setText("Font (" + QString::fromStdString(app->fonts->chatFontFamily.getValue()) +
", " + QString::number(app->fonts->chatFontSize) + "pt)");
label->setText(
"Font (" +
QString::fromStdString(app->fonts->chatFontFamily.getValue()) +
", " + QString::number(app->fonts->chatFontSize) + "pt)");
};
app->fonts->chatFontFamily.connectSimple(updateFontFamilyLabel, this->managedConnections_);
app->fonts->chatFontSize.connectSimple(updateFontFamilyLabel, this->managedConnections_);
app->fonts->chatFontFamily.connectSimple(updateFontFamilyLabel,
this->managedConnections_);
app->fonts->chatFontSize.connectSimple(updateFontFamilyLabel,
this->managedConnections_);
// BUTTON
QPushButton *button = new QPushButton("Select");
@@ -401,10 +443,11 @@ QLayout *LookPage::createFontChanger()
dialog.setWindowFlag(Qt::WindowStaysOnTopHint);
dialog.connect(&dialog, &QFontDialog::fontSelected, [=](const QFont &font) {
app->fonts->chatFontFamily = font.family().toStdString();
app->fonts->chatFontSize = font.pointSize();
});
dialog.connect(
&dialog, &QFontDialog::fontSelected, [=](const QFont &font) {
app->fonts->chatFontFamily = font.family().toStdString();
app->fonts->chatFontSize = font.pointSize();
});
dialog.show();
dialog.exec();
@@ -425,15 +468,19 @@ QLayout *LookPage::createUiScaleSlider()
slider->setMinimum(WindowManager::uiScaleMin);
slider->setMaximum(WindowManager::uiScaleMax);
slider->setValue(WindowManager::clampUiScale(getSettings()->uiScale.getValue()));
slider->setValue(
WindowManager::clampUiScale(getSettings()->uiScale.getValue()));
label->setMinimumWidth(100);
QObject::connect(slider, &QSlider::valueChanged,
[](auto value) { getSettings()->uiScale.setValue(value); });
QObject::connect(slider, &QSlider::valueChanged, [](auto value) {
getSettings()->uiScale.setValue(value);
});
getSettings()->uiScale.connect(
[label](auto, auto) { label->setText(QString::number(WindowManager::getUiScaleValue())); },
[label](auto, auto) {
label->setText(QString::number(WindowManager::getUiScaleValue()));
},
this->connections_);
return layout;
@@ -454,8 +501,9 @@ QLayout *LookPage::createBoldScaleSlider()
label->setMinimumWidth(100);
QObject::connect(slider, &QSlider::valueChanged,
[](auto value) { getSettings()->boldScale.setValue(value); });
QObject::connect(slider, &QSlider::valueChanged, [](auto value) {
getSettings()->boldScale.setValue(value);
});
// show value
// getSettings()->boldScale.connect(
// [label](auto, auto) {
+2 -1
View File
@@ -24,7 +24,8 @@ private:
void addEmoteTab(LayoutCreator<QVBoxLayout> layout);
void addSplitHeaderTab(LayoutCreator<QVBoxLayout> layout);
void addLastReadMessageIndicatorPatternSelector(LayoutCreator<QVBoxLayout> layout);
void addLastReadMessageIndicatorPatternSelector(
LayoutCreator<QVBoxLayout> layout);
QLayout *createThemeColorChanger();
QLayout *createFontChanger();
+57 -43
View File
@@ -28,11 +28,13 @@ namespace chatterino {
inline QString CreateLink(const QString &url, bool file = false)
{
if (file) {
return QString("<a href=\"file:///" + url + "\"><span style=\"color: white;\">" + url +
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>");
return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" +
url + "</span></a>");
}
qint64 dirSize(QString dirPath)
@@ -46,7 +48,8 @@ qint64 dirSize(QString dirPath)
size += fi.size();
}
// add size of child directories recursively
QDir::Filters dirFilters = QDir::Dirs | QDir::NoDotAndDotDot | QDir::System | QDir::Hidden;
QDir::Filters dirFilters =
QDir::Dirs | QDir::NoDotAndDotDot | QDir::System | QDir::Hidden;
for (QString childDirPath : dir.entryList(dirFilters))
size += dirSize(dirPath + QDir::separator() + childDirPath);
return size;
@@ -58,8 +61,7 @@ QString formatSize(qint64 size)
int i;
double outputSize = size;
for (i = 0; i < units.size() - 1; i++) {
if (outputSize < 1024)
break;
if (outputSize < 1024) break;
outputSize = outputSize / 1024;
}
return QString("%0 %1").arg(outputSize, 0, 'f', 2).arg(units[i]);
@@ -95,57 +97,63 @@ ModerationPage::ModerationPage()
// Show how big (size-wise) the logs are
auto logsPathSizeLabel = logs.emplace<QLabel>();
logsPathSizeLabel->setText(QtConcurrent::run([] { return fetchLogDirectorySize(); }));
logsPathSizeLabel->setText(
QtConcurrent::run([] { return fetchLogDirectorySize(); }));
// Logs (copied from LoggingMananger)
app->settings->logPath.connect([app, logsPathLabel](const QString &logPath, auto) mutable {
QString pathOriginal;
app->settings->logPath.connect(
[app, logsPathLabel](const QString &logPath, auto) mutable {
QString pathOriginal;
if (logPath == "") {
pathOriginal = app->paths->messageLogDirectory;
} else {
pathOriginal = logPath;
}
if (logPath == "") {
pathOriginal = app->paths->messageLogDirectory;
} else {
pathOriginal = logPath;
}
QString pathShortened;
QString pathShortened;
if (pathOriginal.size() > 50) {
pathShortened = pathOriginal;
pathShortened.resize(50);
pathShortened += "...";
} else {
pathShortened = pathOriginal;
}
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>";
pathShortened = "Logs saved at <a href=\"file:///" +
pathOriginal +
"\"><span style=\"color: white;\">" +
pathShortened + "</span></a>";
logsPathLabel->setText(pathShortened);
logsPathLabel->setToolTip(pathOriginal);
});
logsPathLabel->setText(pathShortened);
logsPathLabel->setToolTip(pathOriginal);
});
logsPathLabel->setTextFormat(Qt::RichText);
logsPathLabel->setTextInteractionFlags(Qt::TextBrowserInteraction |
Qt::LinksAccessibleByKeyboard |
Qt::LinksAccessibleByKeyboard);
logsPathLabel->setOpenExternalLinks(true);
logs.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
logs.append(this->createCheckBox("Enable logging",
app->settings->enableLogging));
logs->addStretch(1);
auto selectDir = logs.emplace<QPushButton>("Set custom logpath");
// Setting custom logpath
QObject::connect(selectDir.getElement(), &QPushButton::clicked, this,
[this, logsPathSizeLabel]() mutable {
auto app = getApp();
auto dirName = QFileDialog::getExistingDirectory(this);
QObject::connect(
selectDir.getElement(), &QPushButton::clicked, this,
[this, logsPathSizeLabel]() mutable {
auto app = getApp();
auto dirName = QFileDialog::getExistingDirectory(this);
app->settings->logPath = dirName;
app->settings->logPath = dirName;
// Refresh: Show how big (size-wise) the logs are
logsPathSizeLabel->setText(
QtConcurrent::run([] { return fetchLogDirectorySize(); }));
});
// Refresh: Show how big (size-wise) the logs are
logsPathSizeLabel->setText(
QtConcurrent::run([] { return fetchLogDirectorySize(); }));
});
// Reset custom logpath
auto resetDir = logs.emplace<QPushButton>("Reset logpath");
@@ -155,8 +163,8 @@ ModerationPage::ModerationPage()
app->settings->logPath = "";
// Refresh: Show how big (size-wise) the logs are
logsPathSizeLabel->setText(
QtConcurrent::run([] { return fetchLogDirectorySize(); }));
logsPathSizeLabel->setText(QtConcurrent::run(
[] { return fetchLogDirectorySize(); }));
});
// Logs end
@@ -172,21 +180,27 @@ ModerationPage::ModerationPage()
// auto form = modMode.emplace<QFormLayout>();
// {
// form->addRow("Action on timed out messages (unimplemented):",
// form->addRow("Action on timed out messages
// (unimplemented):",
// this->createComboBox({"Disable", "Hide"},
// app->settings->timeoutAction));
// }
EditableModelView *view =
modMode.emplace<EditableModelView>(app->moderationActions->createModel(nullptr))
modMode
.emplace<EditableModelView>(
app->moderationActions->createModel(nullptr))
.getElement();
view->setTitles({"Actions"});
view->getTableView()->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
view->getTableView()->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
view->getTableView()->horizontalHeader()->setSectionResizeMode(
QHeaderView::Fixed);
view->getTableView()->horizontalHeader()->setSectionResizeMode(
0, QHeaderView::Stretch);
view->addButtonPressed.connect([] {
getApp()->moderationActions->items.appendItem(ModerationAction("/timeout {user} 300"));
getApp()->moderationActions->items.appendItem(
ModerationAction("/timeout {user} 300"));
});
/*auto taggedUsers = tabs.appendTab(new QVBoxLayout, "Tagged users");
+22 -16
View File
@@ -25,8 +25,8 @@ void SettingsPage::cancel()
this->onCancel_.invoke();
}
QCheckBox *SettingsPage::createCheckBox(const QString &text,
pajlada::Settings::Setting<bool> &setting)
QCheckBox *SettingsPage::createCheckBox(
const QString &text, pajlada::Settings::Setting<bool> &setting)
{
QCheckBox *checkbox = new QCheckBox(text);
@@ -38,16 +38,17 @@ QCheckBox *SettingsPage::createCheckBox(const QString &text,
this->managedConnections_);
// update setting on toggle
QObject::connect(checkbox, &QCheckBox::toggled, this, [&setting](bool state) {
qDebug() << "update checkbox value";
setting = state; //
});
QObject::connect(checkbox, &QCheckBox::toggled, this,
[&setting](bool state) {
qDebug() << "update checkbox value";
setting = state; //
});
return checkbox;
}
QComboBox *SettingsPage::createComboBox(const QStringList &items,
pajlada::Settings::Setting<QString> &setting)
QComboBox *SettingsPage::createComboBox(
const QStringList &items, pajlada::Settings::Setting<QString> &setting)
{
QComboBox *combo = new QComboBox();
@@ -55,29 +56,34 @@ QComboBox *SettingsPage::createComboBox(const QStringList &items,
combo->addItems(items);
// update when setting changes
setting.connect([combo](const QString &value, auto) { combo->setCurrentText(value); },
this->managedConnections_);
setting.connect(
[combo](const QString &value, auto) { combo->setCurrentText(value); },
this->managedConnections_);
QObject::connect(combo, &QComboBox::currentTextChanged,
[&setting](const QString &newValue) { setting = newValue; });
QObject::connect(
combo, &QComboBox::currentTextChanged,
[&setting](const QString &newValue) { setting = newValue; });
return combo;
}
QLineEdit *SettingsPage::createLineEdit(pajlada::Settings::Setting<QString> &setting)
QLineEdit *SettingsPage::createLineEdit(
pajlada::Settings::Setting<QString> &setting)
{
QLineEdit *edit = new QLineEdit();
edit->setText(setting);
// update when setting changes
QObject::connect(edit, &QLineEdit::textChanged,
[&setting](const QString &newValue) { setting = newValue; });
QObject::connect(
edit, &QLineEdit::textChanged,
[&setting](const QString &newValue) { setting = newValue; });
return edit;
}
QSpinBox *SettingsPage::createSpinBox(pajlada::Settings::Setting<int> &setting, int min, int max)
QSpinBox *SettingsPage::createSpinBox(pajlada::Settings::Setting<int> &setting,
int min, int max)
{
QSpinBox *w = new QSpinBox;
+4 -2
View File
@@ -20,11 +20,13 @@ public:
void cancel();
QCheckBox *createCheckBox(const QString &text, pajlada::Settings::Setting<bool> &setting);
QCheckBox *createCheckBox(const QString &text,
pajlada::Settings::Setting<bool> &setting);
QComboBox *createComboBox(const QStringList &items,
pajlada::Settings::Setting<QString> &setting);
QLineEdit *createLineEdit(pajlada::Settings::Setting<QString> &setting);
QSpinBox *createSpinBox(pajlada::Settings::Setting<int> &setting, int min = 0, int max = 2500);
QSpinBox *createSpinBox(pajlada::Settings::Setting<int> &setting,
int min = 0, int max = 2500);
virtual void onShow()
{
@@ -18,12 +18,14 @@ SpecialChannelsPage::SpecialChannelsPage()
LayoutCreator<SpecialChannelsPage> layoutCreator(this);
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
auto mentions = layout.emplace<QGroupBox>("Mentions channel").setLayoutType<QVBoxLayout>();
auto mentions = layout.emplace<QGroupBox>("Mentions channel")
.setLayoutType<QVBoxLayout>();
{
mentions.emplace<QLabel>("Join /mentions to view your mentions.");
}
auto whispers = layout.emplace<QGroupBox>("Whispers").setLayoutType<QVBoxLayout>();
auto whispers =
layout.emplace<QGroupBox>("Whispers").setLayoutType<QVBoxLayout>();
{
whispers.emplace<QLabel>("Join /whispers to view your mentions.");
}