Merge branch 'master' into logging
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
#include "aboutpage.hpp"
|
||||
|
||||
#include "util/layoutcreator.hpp"
|
||||
#include "widgets/helper/signallabel.hpp"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#define PIXMAP_WIDTH 500
|
||||
@@ -32,29 +36,78 @@ AboutPage::AboutPage()
|
||||
// palette.setColor(QPalette::Link, "#a5cdff");
|
||||
// palette.setColor(QPalette::LinkVisited, "#a5cdff");
|
||||
|
||||
auto created = layout.emplace<QLabel>();
|
||||
created->setText(
|
||||
"Twitch Chat Client created by <a href=\"https://github.com/fourtf\">fourtf</a>");
|
||||
created->setTextFormat(Qt::RichText);
|
||||
created->setTextInteractionFlags(Qt::TextBrowserInteraction |
|
||||
Qt::LinksAccessibleByKeyboard |
|
||||
Qt::LinksAccessibleByKeyboard);
|
||||
created->setOpenExternalLinks(true);
|
||||
// created->setPalette(palette);
|
||||
/*auto xd = layout.emplace<QGroupBox>("Created by...");
|
||||
{
|
||||
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->setTextInteractionFlags(Qt::TextBrowserInteraction |
|
||||
Qt::LinksAccessibleByKeyboard |
|
||||
Qt::LinksAccessibleByKeyboard);
|
||||
created->setOpenExternalLinks(true);
|
||||
// created->setPalette(palette);
|
||||
}
|
||||
|
||||
auto github = layout.emplace<QLabel>();
|
||||
github->setText(
|
||||
"<a href=\"https://github.com/fourtf/chatterino2\">Chatterino on Github</a>");
|
||||
github->setTextFormat(Qt::RichText);
|
||||
github->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::LinksAccessibleByKeyboard |
|
||||
Qt::LinksAccessibleByKeyboard);
|
||||
github->setOpenExternalLinks(true);
|
||||
// github->setPalette(palette);
|
||||
// auto github = xd.emplace<QLabel>();
|
||||
// {
|
||||
// github->setText(
|
||||
// "<a href=\"https://github.com/fourtf/chatterino2\">Chatterino on
|
||||
// Github</a>");
|
||||
// github->setTextFormat(Qt::RichText);
|
||||
// github->setTextInteractionFlags(Qt::TextBrowserInteraction |
|
||||
// Qt::LinksAccessibleByKeyboard |
|
||||
// Qt::LinksAccessibleByKeyboard);
|
||||
// github->setOpenExternalLinks(true);
|
||||
// // github->setPalette(palette);
|
||||
// }
|
||||
}*/
|
||||
|
||||
auto licenses = layout.emplace<QGroupBox>("Open source software used...");
|
||||
{
|
||||
auto form = licenses.emplace<QFormLayout>();
|
||||
|
||||
addLicense(*form, "Qt Framework", "https://www.qt.io", ":/licenses/qt_lgpl-3.0.txt");
|
||||
addLicense(*form, "Boost", "https://www.boost.org/", ":/licenses/boost_boost.txt");
|
||||
addLicense(*form, "Fmt", "http://fmtlib.net/", ":/licenses/fmt_bsd2.txt");
|
||||
addLicense(*form, "LibCommuni", "https://github.com/communi/libcommuni",
|
||||
":/licenses/libcommuni_BSD3.txt");
|
||||
addLicense(*form, "OpenSSL", "https://www.openssl.org/", ":/licenses/openssl.txt");
|
||||
addLicense(*form, "RapidJson", "http://rapidjson.org/", ":/licenses/rapidjson.txt");
|
||||
addLicense(*form, "Pajlada/Settings", "https://github.com/pajlada/settings",
|
||||
":/licenses/pajlada_settings.txt");
|
||||
addLicense(*form, "Pajlada/Signals", "https://github.com/pajlada/signals",
|
||||
":/licenses/pajlada_signals.txt");
|
||||
addLicense(*form, "Websocketpp", "https://www.zaphoyd.com/websocketpp/",
|
||||
":/licenses/websocketpp.txt");
|
||||
}
|
||||
}
|
||||
|
||||
layout->addStretch(1);
|
||||
}
|
||||
|
||||
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);
|
||||
auto *b = new SignalLabel();
|
||||
b->setText("<a href=\"" + licenseLink + "\">show license</a>");
|
||||
b->setCursor(Qt::PointingHandCursor);
|
||||
QObject::connect(b, &SignalLabel::mouseUp, [licenseLink] {
|
||||
auto *edit = new QTextEdit;
|
||||
|
||||
QFile file(licenseLink);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
edit->setText(file.readAll());
|
||||
edit->setReadOnly(true);
|
||||
edit->show();
|
||||
});
|
||||
|
||||
form->addRow(a, b);
|
||||
}
|
||||
|
||||
} // namespace settingspages
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "widgets/settingspages/settingspage.hpp"
|
||||
|
||||
class QLabel;
|
||||
class QFormLayout;
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
@@ -15,6 +16,9 @@ public:
|
||||
|
||||
private:
|
||||
QLabel *logo;
|
||||
|
||||
void addLicense(QFormLayout *form, const QString &name, const QString &website,
|
||||
const QString &licenseLink);
|
||||
};
|
||||
|
||||
} // namespace settingspages
|
||||
|
||||
@@ -2,11 +2,17 @@
|
||||
|
||||
#include "application.hpp"
|
||||
#include "const.hpp"
|
||||
#include "singletons/accountmanager.hpp"
|
||||
#include "controllers/accounts/accountcontroller.hpp"
|
||||
#include "controllers/accounts/accountmodel.hpp"
|
||||
#include "util/layoutcreator.hpp"
|
||||
#include "widgets/helper/editablemodelview.hpp"
|
||||
#include "widgets/logindialog.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QHeaderView>
|
||||
#include <QTableView>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace chatterino {
|
||||
@@ -16,32 +22,48 @@ namespace settingspages {
|
||||
AccountsPage::AccountsPage()
|
||||
: SettingsPage("Accounts", ":/images/accounts.svg")
|
||||
{
|
||||
auto *app = getApp();
|
||||
|
||||
util::LayoutCreator<AccountsPage> layoutCreator(this);
|
||||
|
||||
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
||||
auto buttons = layout.emplace<QDialogButtonBox>();
|
||||
{
|
||||
this->addButton = buttons->addButton("Add", QDialogButtonBox::YesRole);
|
||||
this->removeButton = buttons->addButton("Remove", QDialogButtonBox::NoRole);
|
||||
}
|
||||
|
||||
layout.emplace<AccountSwitchWidget>(this).assign(&this->accSwitchWidget);
|
||||
helper::EditableModelView *view =
|
||||
*layout.emplace<helper::EditableModelView>(app->accounts->createModel(nullptr));
|
||||
|
||||
// ----
|
||||
QObject::connect(this->addButton, &QPushButton::clicked, []() {
|
||||
view->getTableView()->horizontalHeader()->setVisible(false);
|
||||
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
view->addButtonPressed.connect([] {
|
||||
static auto loginWidget = new LoginWidget();
|
||||
|
||||
loginWidget->show();
|
||||
});
|
||||
|
||||
QObject::connect(this->removeButton, &QPushButton::clicked, [this] {
|
||||
auto selectedUser = this->accSwitchWidget->currentItem()->text();
|
||||
if (selectedUser == ANONYMOUS_USERNAME_LABEL) {
|
||||
// Do nothing
|
||||
return;
|
||||
}
|
||||
view->getTableView()->setStyleSheet("background: #333");
|
||||
|
||||
getApp()->accounts->Twitch.removeUser(selectedUser);
|
||||
});
|
||||
// auto buttons = layout.emplace<QDialogButtonBox>();
|
||||
// {
|
||||
// this->addButton = buttons->addButton("Add", QDialogButtonBox::YesRole);
|
||||
// this->removeButton = buttons->addButton("Remove", QDialogButtonBox::NoRole);
|
||||
// }
|
||||
|
||||
// layout.emplace<AccountSwitchWidget>(this).assign(&this->accSwitchWidget);
|
||||
|
||||
// ----
|
||||
// QObject::connect(this->addButton, &QPushButton::clicked, []() {
|
||||
// static auto loginWidget = new LoginWidget();
|
||||
// loginWidget->show();
|
||||
// });
|
||||
|
||||
// QObject::connect(this->removeButton, &QPushButton::clicked, [this] {
|
||||
// auto selectedUser = this->accSwitchWidget->currentItem()->text();
|
||||
// if (selectedUser == ANONYMOUS_USERNAME_LABEL) {
|
||||
// // Do nothing
|
||||
// return;
|
||||
// }
|
||||
|
||||
// getApp()->accounts->Twitch.removeUser(selectedUser);
|
||||
// });
|
||||
}
|
||||
|
||||
} // namespace settingspages
|
||||
|
||||
@@ -50,20 +50,24 @@ AppearancePage::AppearancePage()
|
||||
{
|
||||
auto form = application.emplace<QFormLayout>();
|
||||
|
||||
// clang-format off
|
||||
form->addRow("Theme:", this->createComboBox({THEME_ITEMS}, app->themes->themeName));
|
||||
form->addRow("Theme color:", this->createThemeColorChanger());
|
||||
form->addRow("Font:", this->createFontChanger());
|
||||
auto *theme = this->createComboBox({THEME_ITEMS}, app->themes->themeName);
|
||||
QObject::connect(theme, &QComboBox::currentTextChanged,
|
||||
[](const QString &) { getApp()->windows->forceLayoutChannelViews(); });
|
||||
|
||||
form->addRow("Tabs:", this->createCheckBox(TAB_X, app->settings->showTabCloseButton));
|
||||
#ifndef USEWINSDK
|
||||
form->addRow("", this->createCheckBox(TAB_PREF, app->settings->hidePreferencesButton));
|
||||
form->addRow("", this->createCheckBox(TAB_USER, app->settings->hideUserButton));
|
||||
#endif
|
||||
form->addRow("Theme:", theme);
|
||||
// form->addRow("Theme color:", this->createThemeColorChanger());
|
||||
form->addRow("Font:", this->createFontChanger());
|
||||
|
||||
form->addRow("Scrolling:", this->createCheckBox(SCROLL_SMOOTH, app->settings->enableSmoothScrolling));
|
||||
form->addRow("", this->createCheckBox(SCROLL_NEWMSG, app->settings->enableSmoothScrollingNewMessages));
|
||||
// clang-format on
|
||||
form->addRow("Tabs:", this->createCheckBox(TAB_X, app->settings->showTabCloseButton));
|
||||
#ifndef USEWINSDK
|
||||
form->addRow("", this->createCheckBox(TAB_PREF, app->settings->hidePreferencesButton));
|
||||
form->addRow("", this->createCheckBox(TAB_USER, app->settings->hideUserButton));
|
||||
#endif
|
||||
|
||||
form->addRow("Scrolling:",
|
||||
this->createCheckBox(SCROLL_SMOOTH, app->settings->enableSmoothScrolling));
|
||||
form->addRow("", this->createCheckBox(SCROLL_NEWMSG,
|
||||
app->settings->enableSmoothScrollingNewMessages));
|
||||
}
|
||||
|
||||
auto messages = layout.emplace<QGroupBox>("Messages").emplace<QVBoxLayout>();
|
||||
@@ -77,22 +81,25 @@ AppearancePage::AppearancePage()
|
||||
}
|
||||
|
||||
messages.append(this->createCheckBox("Show badges", app->settings->showBadges));
|
||||
|
||||
{
|
||||
auto checkbox =
|
||||
this->createCheckBox("Seperate messages", app->settings->seperateMessages);
|
||||
messages.append(checkbox);
|
||||
QObject::connect(checkbox, &QCheckBox::toggled,
|
||||
[](bool) { getApp()->windows->repaintVisibleChatWidgets(); });
|
||||
}
|
||||
{
|
||||
auto checkbox = this->createCheckBox("Alternate message background color",
|
||||
app->settings->alternateMessageBackground);
|
||||
messages.append(checkbox);
|
||||
QObject::connect(checkbox, &QCheckBox::toggled, [](bool) {
|
||||
getApp()->fonts->incGeneration(); // fourtf: hacky solution
|
||||
getApp()->windows->repaintVisibleChatWidgets();
|
||||
auto *combo = new QComboBox(this);
|
||||
combo->addItems({"Never", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
|
||||
"13", "14", "15"});
|
||||
|
||||
QObject::connect(combo, &QComboBox::currentTextChanged, [](const QString &str) {
|
||||
getApp()->settings->collpseMessagesMinLines = str.toInt();
|
||||
});
|
||||
|
||||
auto hbox = messages.emplace<QHBoxLayout>().withoutMargin();
|
||||
hbox.emplace<QLabel>("Collapse messages longer than");
|
||||
hbox.append(combo);
|
||||
hbox.emplace<QLabel>("lines");
|
||||
}
|
||||
|
||||
messages.append(this->createCheckBox("Seperate messages", app->settings->seperateMessages));
|
||||
messages.append(this->createCheckBox("Alternate message background color",
|
||||
app->settings->alternateMessageBackground));
|
||||
messages.append(this->createCheckBox("Show message length while typing",
|
||||
app->settings->showMessageLength));
|
||||
|
||||
@@ -101,6 +108,7 @@ AppearancePage::AppearancePage()
|
||||
|
||||
auto emotes = layout.emplace<QGroupBox>("Emotes").setLayoutType<QVBoxLayout>();
|
||||
{
|
||||
/*
|
||||
emotes.append(
|
||||
this->createCheckBox("Enable Twitch emotes", app->settings->enableTwitchEmotes));
|
||||
emotes.append(this->createCheckBox("Enable BetterTTV emotes for Twitch",
|
||||
@@ -108,12 +116,36 @@ AppearancePage::AppearancePage()
|
||||
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 animations", app->settings->enableGifAnimations));
|
||||
|
||||
auto scaleBox = emotes.emplace<QHBoxLayout>();
|
||||
{
|
||||
scaleBox.emplace<QLabel>("Emote scale:");
|
||||
|
||||
auto emoteScale = scaleBox.emplace<QSlider>(Qt::Horizontal);
|
||||
emoteScale->setMinimum(5);
|
||||
emoteScale->setMaximum(50);
|
||||
|
||||
auto scaleLabel = scaleBox.emplace<QLabel>("1.0");
|
||||
scaleLabel->setFixedWidth(100);
|
||||
QObject::connect(*emoteScale, &QSlider::valueChanged, [scaleLabel](int value) mutable {
|
||||
float f = (float)value / 10.f;
|
||||
scaleLabel->setText(QString::number(f));
|
||||
|
||||
getApp()->settings->emoteScale.setValue(f);
|
||||
});
|
||||
|
||||
emoteScale->setValue(std::max<int>(
|
||||
5, std::min<int>(50, (int)(app->settings->emoteScale.getValue() * 10.f))));
|
||||
|
||||
scaleLabel->setText(QString::number(app->settings->emoteScale.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
layout->addStretch(1);
|
||||
}
|
||||
} // namespace settingspages
|
||||
|
||||
QLayout *AppearancePage::createThemeColorChanger()
|
||||
{
|
||||
@@ -125,7 +157,7 @@ QLayout *AppearancePage::createThemeColorChanger()
|
||||
// SLIDER
|
||||
QSlider *slider = new QSlider(Qt::Horizontal);
|
||||
layout->addWidget(slider);
|
||||
slider->setValue(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;
|
||||
@@ -165,12 +197,12 @@ QLayout *AppearancePage::createFontChanger()
|
||||
layout->addWidget(label);
|
||||
|
||||
auto updateFontFamilyLabel = [=](auto) {
|
||||
label->setText(QString::fromStdString(app->fonts->currentFontFamily.getValue()) + ", " +
|
||||
QString::number(app->fonts->currentFontSize) + "pt");
|
||||
label->setText(QString::fromStdString(app->fonts->chatFontFamily.getValue()) + ", " +
|
||||
QString::number(app->fonts->chatFontSize) + "pt");
|
||||
};
|
||||
|
||||
app->fonts->currentFontFamily.connectSimple(updateFontFamilyLabel, this->managedConnections);
|
||||
app->fonts->currentFontSize.connectSimple(updateFontFamilyLabel, this->managedConnections);
|
||||
app->fonts->chatFontFamily.connectSimple(updateFontFamilyLabel, this->managedConnections);
|
||||
app->fonts->chatFontSize.connectSimple(updateFontFamilyLabel, this->managedConnections);
|
||||
|
||||
// BUTTON
|
||||
QPushButton *button = new QPushButton("Select");
|
||||
@@ -178,11 +210,11 @@ QLayout *AppearancePage::createFontChanger()
|
||||
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Policy::Fixed);
|
||||
|
||||
QObject::connect(button, &QPushButton::clicked, [=]() {
|
||||
QFontDialog dialog(app->fonts->getFont(singletons::FontManager::Medium, 1.));
|
||||
QFontDialog dialog(app->fonts->getFont(singletons::FontManager::ChatMedium, 1.));
|
||||
|
||||
dialog.connect(&dialog, &QFontDialog::fontSelected, [=](const QFont &font) {
|
||||
app->fonts->currentFontFamily = font.family().toStdString();
|
||||
app->fonts->currentFontSize = font.pointSize();
|
||||
app->fonts->chatFontFamily = font.family().toStdString();
|
||||
app->fonts->chatFontSize = font.pointSize();
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#ifdef USEWINSDK
|
||||
#define WINDOW_TOPMOST "Window always on top"
|
||||
#else
|
||||
#define WINDOW_TOPMOST "Window always on top (requires restart)"
|
||||
#endif
|
||||
#define INPUT_EMPTY "Hide input box when empty"
|
||||
#define PAUSE_HOVERING "When hovering"
|
||||
|
||||
@@ -30,6 +34,12 @@ BehaviourPage::BehaviourPage()
|
||||
{
|
||||
form->addRow("Window:", this->createCheckBox(WINDOW_TOPMOST, app->settings->windowTopMost));
|
||||
form->addRow("Messages:", this->createCheckBox(INPUT_EMPTY, app->settings->hideEmptyInput));
|
||||
form->addRow(
|
||||
"", 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));
|
||||
form->addRow("Pause chat:",
|
||||
this->createCheckBox(PAUSE_HOVERING, app->settings->pauseChatHover));
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "ignoreuserspage.hpp"
|
||||
|
||||
#include "application.hpp"
|
||||
#include "controllers/accounts/accountcontroller.hpp"
|
||||
#include "controllers/ignores/ignorecontroller.hpp"
|
||||
#include "controllers/ignores/ignoremodel.hpp"
|
||||
#include "singletons/accountmanager.hpp"
|
||||
#include "singletons/settingsmanager.hpp"
|
||||
#include "util/layoutcreator.hpp"
|
||||
#include "widgets/helper/editablemodelview.hpp"
|
||||
@@ -34,7 +34,7 @@ IgnoreUsersPage::IgnoreUsersPage()
|
||||
|
||||
// auto group = layout.emplace<QGroupBox>("Ignored users").setLayoutType<QVBoxLayout>();
|
||||
auto tabs = layout.emplace<QTabWidget>();
|
||||
tabs->setStyleSheet("color: #000");
|
||||
// tabs->setStyleSheet("color: #000");
|
||||
|
||||
// users
|
||||
auto users = tabs.appendTab(new QVBoxLayout, "Users");
|
||||
@@ -91,7 +91,7 @@ void IgnoreUsersPage::onShow()
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
auto user = app->accounts->Twitch.getCurrent();
|
||||
auto user = app->accounts->twitch.getCurrent();
|
||||
|
||||
if (user->isAnon()) {
|
||||
return;
|
||||
|
||||
@@ -1,48 +1,49 @@
|
||||
#include "logspage.hpp"
|
||||
//#include "logspage.hpp"
|
||||
|
||||
#include "application.hpp"
|
||||
#include "singletons/pathmanager.hpp"
|
||||
//#include "application.hpp"
|
||||
//#include "singletons/pathmanager.hpp"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QVBoxLayout>
|
||||
//#include <QFormLayout>
|
||||
//#include <QVBoxLayout>
|
||||
|
||||
#include "util/layoutcreator.hpp"
|
||||
//#include "util/layoutcreator.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
namespace settingspages {
|
||||
// namespace chatterino {
|
||||
// namespace widgets {
|
||||
// namespace settingspages {
|
||||
|
||||
inline QString CreateLink(const QString &url, bool file = false)
|
||||
{
|
||||
if (file) {
|
||||
return QString("<a href=\"file:///" + url + "\"><span style=\"color: white;\">" + url +
|
||||
"</span></a>");
|
||||
}
|
||||
// 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>");
|
||||
}
|
||||
// return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" + url +
|
||||
// "</span></a>");
|
||||
//}
|
||||
|
||||
LogsPage::LogsPage()
|
||||
: SettingsPage("Logs", "")
|
||||
{
|
||||
auto app = getApp();
|
||||
// LogsPage::LogsPage()
|
||||
// : SettingsPage("Logs", "")
|
||||
//{
|
||||
// auto app = getApp();
|
||||
|
||||
util::LayoutCreator<LogsPage> layoutCreator(this);
|
||||
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
||||
// util::LayoutCreator<LogsPage> layoutCreator(this);
|
||||
// auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
||||
|
||||
auto logPath = app->paths->logsFolderPath;
|
||||
// auto logPath = app->paths->logsFolderPath;
|
||||
|
||||
auto created = layout.emplace<QLabel>();
|
||||
created->setText("Logs are saved to " + CreateLink(logPath, true));
|
||||
created->setTextFormat(Qt::RichText);
|
||||
created->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::LinksAccessibleByKeyboard |
|
||||
Qt::LinksAccessibleByKeyboard);
|
||||
created->setOpenExternalLinks(true);
|
||||
layout.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
|
||||
// auto created = layout.emplace<QLabel>();
|
||||
// created->setText("Logs are saved to " + CreateLink(logPath, true));
|
||||
// created->setTextFormat(Qt::RichText);
|
||||
// created->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::LinksAccessibleByKeyboard |
|
||||
// Qt::LinksAccessibleByKeyboard);
|
||||
// created->setOpenExternalLinks(true);
|
||||
// layout.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
|
||||
|
||||
layout->addStretch(1);
|
||||
}
|
||||
// layout->addStretch(1);
|
||||
//}
|
||||
|
||||
} // namespace settingspages
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
//} // namespace settingspages
|
||||
//} // namespace widgets
|
||||
//} // namespace chatterino
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#pragma once
|
||||
//#pragma once
|
||||
|
||||
#include "widgets/settingspages/settingspage.hpp"
|
||||
//#include "widgets/settingspages/settingspage.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
namespace settingspages {
|
||||
// namespace chatterino {
|
||||
// namespace widgets {
|
||||
// namespace settingspages {
|
||||
|
||||
class LogsPage : public SettingsPage
|
||||
{
|
||||
public:
|
||||
LogsPage();
|
||||
};
|
||||
// class LogsPage : public SettingsPage
|
||||
//{
|
||||
// public:
|
||||
// LogsPage();
|
||||
//};
|
||||
|
||||
} // namespace settingspages
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
//} // namespace settingspages
|
||||
//} // namespace widgets
|
||||
//} // namespace chatterino
|
||||
|
||||
@@ -2,14 +2,20 @@
|
||||
|
||||
#include "application.hpp"
|
||||
#include "singletons/loggingmanager.hpp"
|
||||
#include "controllers/taggedusers/taggeduserscontroller.hpp"
|
||||
#include "controllers/taggedusers/taggedusersmodel.hpp"
|
||||
#include "singletons/pathmanager.hpp"
|
||||
#include "util/layoutcreator.hpp"
|
||||
#include "widgets/helper/editablemodelview.hpp"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QLabel>
|
||||
#include <QListView>
|
||||
#include <QPushButton>
|
||||
#include <QTableView>
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@@ -33,11 +39,13 @@ ModerationPage::ModerationPage()
|
||||
auto app = getApp();
|
||||
util::LayoutCreator<ModerationPage> layoutCreator(this);
|
||||
|
||||
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
||||
auto tabs = layoutCreator.emplace<QTabWidget>();
|
||||
|
||||
auto logs = tabs.appendTab(new QVBoxLayout, "Logs");
|
||||
{
|
||||
// Logs (copied from LoggingMananger)
|
||||
|
||||
auto created = layout.emplace<QLabel>();
|
||||
auto created = logs.emplace<QLabel>();
|
||||
if (app->settings->logPath == "") {
|
||||
created->setText("Logs are saved to " +
|
||||
CreateLink(QCoreApplication::applicationDirPath(), true));
|
||||
@@ -49,9 +57,10 @@ ModerationPage::ModerationPage()
|
||||
Qt::LinksAccessibleByKeyboard |
|
||||
Qt::LinksAccessibleByKeyboard);
|
||||
created->setOpenExternalLinks(true);
|
||||
layout.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
|
||||
logs.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
|
||||
|
||||
layout->addStretch(1);
|
||||
<
|
||||
logs->addStretch(1);
|
||||
|
||||
auto selectDir = layout.emplace<QPushButton>("Set custom logpath");
|
||||
|
||||
@@ -90,21 +99,25 @@ ModerationPage::ModerationPage()
|
||||
});
|
||||
|
||||
// Logs end
|
||||
}
|
||||
|
||||
auto modMode = tabs.appendTab(new QVBoxLayout, "Moderation mode");
|
||||
{
|
||||
// clang-format off
|
||||
auto label = layout.emplace<QLabel>("Click the moderation mod button (<img width='18' height='18' src=':/images/moderatormode_disabled.png'>) in a channel that you moderate to enable moderator mode.<br>");
|
||||
auto label = modMode.emplace<QLabel>("Click the moderation mod button (<img width='18' height='18' src=':/images/moderatormode_disabled.png'>) in a channel that you moderate to enable moderator mode.<br>");
|
||||
label->setWordWrap(true);
|
||||
label->setStyleSheet("color: #bbb");
|
||||
// clang-format on
|
||||
|
||||
auto form = layout.emplace<QFormLayout>();
|
||||
{
|
||||
form->addRow("Action on timed out messages (unimplemented):",
|
||||
this->createComboBox({"Disable", "Hide"}, app->settings->timeoutAction));
|
||||
}
|
||||
// auto form = modMode.emplace<QFormLayout>();
|
||||
// {
|
||||
// form->addRow("Action on timed out messages (unimplemented):",
|
||||
// this->createComboBox({"Disable", "Hide"},
|
||||
// app->settings->timeoutAction));
|
||||
// }
|
||||
|
||||
auto modButtons =
|
||||
layout.emplace<QGroupBox>("Custom moderator buttons").setLayoutType<QVBoxLayout>();
|
||||
modMode.emplace<QGroupBox>("Custom moderator buttons").setLayoutType<QVBoxLayout>();
|
||||
{
|
||||
auto label2 =
|
||||
modButtons.emplace<QLabel>("One action per line. {user} will be replaced with the "
|
||||
@@ -122,6 +135,20 @@ ModerationPage::ModerationPage()
|
||||
app->settings->moderationActions = text->toPlainText();
|
||||
});
|
||||
}
|
||||
|
||||
/*auto taggedUsers = tabs.appendTab(new QVBoxLayout, "Tagged users");
|
||||
{
|
||||
helper::EditableModelView *view = *taggedUsers.emplace<helper::EditableModelView>(
|
||||
app->taggedUsers->createModel(nullptr));
|
||||
|
||||
view->setTitles({"Name"});
|
||||
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
view->addButtonPressed.connect([] {
|
||||
getApp()->taggedUsers->users.appendItem(
|
||||
controllers::taggedusers::TaggedUser(ProviderId::Twitch, "example", "xD"));
|
||||
});
|
||||
}*/
|
||||
}
|
||||
|
||||
// ---- misc
|
||||
|
||||
Reference in New Issue
Block a user