removed functions from SettingsManager that shouldn't be there

This commit is contained in:
fourtf
2018-06-28 19:38:57 +02:00
parent b667183ca5
commit 5604ae6a67
75 changed files with 600 additions and 507 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ protected:
void setScale(float value);
chatterino::ThemeManager *themeManager;
ThemeManager *themeManager;
private:
void init();
+2 -2
View File
@@ -249,10 +249,10 @@ void BaseWindow::wheelEvent(QWheelEvent *event)
if (event->modifiers() & Qt::ControlModifier) {
if (event->delta() > 0) {
getApp()->settings->uiScale.setValue(chatterino::WindowManager::clampUiScale(
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale(
getApp()->settings->uiScale.getValue() + 1));
} else {
getApp()->settings->uiScale.setValue(chatterino::WindowManager::clampUiScale(
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale(
getApp()->settings->uiScale.getValue() - 1));
}
}
+1 -1
View File
@@ -52,7 +52,7 @@ void Scrollbar::unpauseHighlights()
this->highlightsPaused_ = false;
}
chatterino::LimitedQueueSnapshot<ScrollbarHighlight> Scrollbar::getHighlightSnapshot()
LimitedQueueSnapshot<ScrollbarHighlight> Scrollbar::getHighlightSnapshot()
{
if (!this->highlightsPaused_) {
this->highlightSnapshot_ = this->highlights_.getSnapshot();
+3 -3
View File
@@ -68,10 +68,10 @@ private:
QPropertyAnimation currentValueAnimation_;
chatterino::LimitedQueue<ScrollbarHighlight> highlights_;
LimitedQueue<ScrollbarHighlight> highlights_;
bool highlightsPaused_{false};
chatterino::LimitedQueueSnapshot<ScrollbarHighlight> highlightSnapshot_;
chatterino::LimitedQueueSnapshot<ScrollbarHighlight> getHighlightSnapshot();
LimitedQueueSnapshot<ScrollbarHighlight> highlightSnapshot_;
LimitedQueueSnapshot<ScrollbarHighlight> getHighlightSnapshot();
bool atBottom_{false};
+1 -1
View File
@@ -77,7 +77,7 @@ void TooltipWidget::updateFont()
auto app = getApp();
this->setFont(
app->fonts->getFont(chatterino::FontManager::Type::ChatMediumSmall, this->getScale()));
app->fonts->getFont(FontManager::Type::ChatMediumSmall, this->getScale()));
}
void TooltipWidget::setText(QString text)
+2 -2
View File
@@ -100,7 +100,7 @@ Window::Window(WindowType _type)
auto s = new QShortcut(QKeySequence::ZoomIn, this);
s->setContext(Qt::WindowShortcut);
QObject::connect(s, &QShortcut::activated, this, [] {
getApp()->settings->uiScale.setValue(chatterino::WindowManager::clampUiScale(
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale(
getApp()->settings->uiScale.getValue() + 1));
});
}
@@ -108,7 +108,7 @@ Window::Window(WindowType _type)
auto s = new QShortcut(QKeySequence::ZoomOut, this);
s->setContext(Qt::WindowShortcut);
QObject::connect(s, &QShortcut::activated, this, [] {
getApp()->settings->uiScale.setValue(chatterino::WindowManager::clampUiScale(
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale(
getApp()->settings->uiScale.getValue() - 1));
});
}
+6 -6
View File
@@ -58,7 +58,7 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
auto addEmotes = [&](EmoteMap &map, const QString &title, const QString &emoteDesc) {
// TITLE
chatterino::MessageBuilder builder1;
MessageBuilder builder1;
builder1.append(new TextElement(title, MessageElement::Text));
@@ -66,7 +66,7 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
emoteChannel->addMessage(builder1.getMessage());
// EMOTES
chatterino::MessageBuilder builder2;
MessageBuilder builder2;
builder2.getMessage()->flags |= Message::Centered;
builder2.getMessage()->flags |= Message::DisableCompactEmotes;
@@ -86,7 +86,7 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
// fix this pile of garbage
for (const auto &set : app->emotes->twitch.emotes[userID].emoteSets) {
// TITLE
chatterino::MessageBuilder builder1;
MessageBuilder builder1;
QString setText;
if (set->text.isEmpty()) {
@@ -105,7 +105,7 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
emoteChannel->addMessage(builder1.getMessage());
// EMOTES
chatterino::MessageBuilder builder2;
MessageBuilder builder2;
builder2.getMessage()->flags |= Message::Centered;
builder2.getMessage()->flags |= Message::DisableCompactEmotes;
@@ -137,14 +137,14 @@ void EmotePopup::loadEmojis()
ChannelPtr emojiChannel(new Channel("", Channel::None));
// title
chatterino::MessageBuilder builder1;
MessageBuilder builder1;
builder1.append(new TextElement("emojis", MessageElement::Text));
builder1.getMessage()->flags |= Message::Centered;
emojiChannel->addMessage(builder1.getMessage());
// emojis
chatterino::MessageBuilder builder;
MessageBuilder builder;
builder.getMessage()->flags |= Message::Centered;
builder.getMessage()->flags |= Message::DisableCompactEmotes;
+1 -1
View File
@@ -16,7 +16,7 @@ public:
void loadChannel(ChannelPtr channel);
void loadEmojis();
pajlada::Signals::Signal<chatterino::Link> linkClicked;
pajlada::Signals::Signal<Link> linkClicked;
private:
ChannelView *viewEmotes;
+11 -11
View File
@@ -16,7 +16,7 @@ LastRunCrashDialog::LastRunCrashDialog()
this->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
this->setWindowTitle("Chatterino");
auto &updateManager = chatterino::UpdateManager::getInstance();
auto &updateManager = UpdateManager::getInstance();
auto layout = LayoutCreator<LastRunCrashDialog>(this).setLayoutType<QVBoxLayout>();
@@ -31,7 +31,7 @@ LastRunCrashDialog::LastRunCrashDialog()
// auto *installUpdateButton = buttons->addButton("Install Update",
// QDialogButtonBox::NoRole); installUpdateButton->setEnabled(false);
// QObject::connect(installUpdateButton, &QPushButton::clicked, [this, update]() mutable {
// auto &updateManager = chatterino::UpdateManager::getInstance();
// auto &updateManager = UpdateManager::getInstance();
// updateManager.installUpdates();
// this->setEnabled(false);
@@ -43,36 +43,36 @@ LastRunCrashDialog::LastRunCrashDialog()
// Updates
// auto updateUpdateLabel = [update]() mutable {
// auto &updateManager = chatterino::UpdateManager::getInstance();
// auto &updateManager = UpdateManager::getInstance();
// switch (updateManager.getStatus()) {
// case chatterino::UpdateManager::None: {
// case UpdateManager::None: {
// update->setText("Not checking for updates.");
// } break;
// case chatterino::UpdateManager::Searching: {
// case UpdateManager::Searching: {
// update->setText("Checking for updates...");
// } break;
// case chatterino::UpdateManager::UpdateAvailable: {
// case UpdateManager::UpdateAvailable: {
// update->setText("Update available.");
// } break;
// case chatterino::UpdateManager::NoUpdateAvailable: {
// case UpdateManager::NoUpdateAvailable: {
// update->setText("No update abailable.");
// } break;
// case chatterino::UpdateManager::SearchFailed: {
// case UpdateManager::SearchFailed: {
// update->setText("Error while searching for update.\nEither the update service
// is "
// "temporarily down or there is an issue with your
// installation.");
// } break;
// case chatterino::UpdateManager::Downloading: {
// case UpdateManager::Downloading: {
// update->setText(
// "Downloading the update. Chatterino will close once the download is
// done.");
// } break;
// case chatterino::UpdateManager::DownloadFailed: {
// case UpdateManager::DownloadFailed: {
// update->setText("Download failed.");
// } break;
// case chatterino::UpdateManager::WriteFileFailed: {
// case UpdateManager::WriteFileFailed: {
// update->setText("Writing the update file to the hard drive failed.");
// } break;
// }
+1 -1
View File
@@ -38,7 +38,7 @@ void NotificationPopup::updatePosition()
}
}
void NotificationPopup::addMessage(chatterino::MessagePtr msg)
void NotificationPopup::addMessage(MessagePtr msg)
{
this->channel->addMessage(msg);
+1 -1
View File
@@ -14,7 +14,7 @@ public:
enum Location { TopLeft, TopRight, BottomLeft, BottomRight };
NotificationPopup();
void addMessage(chatterino::MessagePtr msg);
void addMessage(MessagePtr msg);
void updatePosition();
private:
+1 -1
View File
@@ -218,7 +218,7 @@ void SettingsDialog::cancelButtonClicked()
tab->getSettingsPage()->cancel();
}
getApp()->settings->recallSnapshot();
getApp()->settings->restoreSnapshot();
this->close();
}
+28 -32
View File
@@ -41,7 +41,7 @@ ChannelView::ChannelView(BaseWidget *parent)
this->setMouseTracking(true);
this->connections_.push_back(app->settings->wordFlagsChanged.connect([this] {
this->connections_.push_back(app->windows->wordFlagsChanged.connect([this] {
this->layoutMessages();
this->update();
}));
@@ -271,8 +271,7 @@ QString ChannelView::getSelectedText()
{
QString result = "";
chatterino::LimitedQueueSnapshot<MessageLayoutPtr> messagesSnapshot =
this->getMessagesSnapshot();
LimitedQueueSnapshot<MessageLayoutPtr> messagesSnapshot = this->getMessagesSnapshot();
Selection _selection = this->selection_;
@@ -318,17 +317,17 @@ bool ChannelView::getEnableScrollingToBottom() const
return this->enableScrollingToBottom_;
}
void ChannelView::setOverrideFlags(boost::optional<chatterino::MessageElement::Flags> value)
void ChannelView::setOverrideFlags(boost::optional<MessageElement::Flags> value)
{
this->overrideFlags_ = value;
}
const boost::optional<chatterino::MessageElement::Flags> &ChannelView::getOverrideFlags() const
const boost::optional<MessageElement::Flags> &ChannelView::getOverrideFlags() const
{
return this->overrideFlags_;
}
chatterino::LimitedQueueSnapshot<MessageLayoutPtr> ChannelView::getMessagesSnapshot()
LimitedQueueSnapshot<MessageLayoutPtr> ChannelView::getMessagesSnapshot()
{
if (!this->isPaused() /*|| this->scrollBar_.isVisible()*/) {
this->snapshot_ = this->messages.getSnapshot();
@@ -531,7 +530,7 @@ void ChannelView::setSelection(const SelectionItem &start, const SelectionItem &
this->selectionChanged.invoke();
}
chatterino::MessageElement::Flags ChannelView::getFlags() const
MessageElement::Flags ChannelView::getFlags() const
{
auto app = getApp();
@@ -539,7 +538,7 @@ chatterino::MessageElement::Flags ChannelView::getFlags() const
return this->overrideFlags_.get();
}
MessageElement::Flags flags = app->settings->getWordFlags();
MessageElement::Flags flags = app->windows->getWordFlags();
Split *split = dynamic_cast<Split *>(this->parentWidget());
@@ -599,11 +598,11 @@ void ChannelView::drawMessages(QPainter &painter)
int y = int(-(messagesSnapshot[start].get()->getHeight() *
(fmod(this->scrollBar_.getCurrentValue(), 1))));
chatterino::MessageLayout *end = nullptr;
MessageLayout *end = nullptr;
bool windowFocused = this->window() == QApplication::activeWindow();
for (size_t i = start; i < messagesSnapshot.getLength(); ++i) {
chatterino::MessageLayout *layout = messagesSnapshot[i].get();
MessageLayout *layout = messagesSnapshot[i].get();
bool isLastMessage = false;
if (app->settings->showLastMessageIndicator) {
@@ -634,7 +633,7 @@ void ChannelView::drawMessages(QPainter &painter)
}
// delete the message buffers that aren't on screen
for (const std::shared_ptr<chatterino::MessageLayout> &item : this->messagesOnScreen_) {
for (const std::shared_ptr<MessageLayout> &item : this->messagesOnScreen_) {
item->deleteBuffer();
}
@@ -642,7 +641,7 @@ void ChannelView::drawMessages(QPainter &painter)
// add all messages on screen to the map
for (size_t i = start; i < messagesSnapshot.getLength(); ++i) {
std::shared_ptr<chatterino::MessageLayout> layout = messagesSnapshot[i];
std::shared_ptr<MessageLayout> layout = messagesSnapshot[i];
this->messagesOnScreen_.insert(layout);
@@ -759,7 +758,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
}
auto tooltipWidget = TooltipWidget::getInstance();
std::shared_ptr<chatterino::MessageLayout> layout;
std::shared_ptr<MessageLayout> layout;
QPoint relativePos;
int messageIndex;
@@ -788,7 +787,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
}
// check if word underneath cursor
const chatterino::MessageLayoutElement *hoverLayoutElement = layout->getElementAt(relativePos);
const MessageLayoutElement *hoverLayoutElement = layout->getElementAt(relativePos);
if (hoverLayoutElement == nullptr) {
this->setCursor(Qt::ArrowCursor);
@@ -821,7 +820,7 @@ void ChannelView::mousePressEvent(QMouseEvent *event)
this->mouseDown.invoke(event);
std::shared_ptr<chatterino::MessageLayout> layout;
std::shared_ptr<MessageLayout> layout;
QPoint relativePos;
int messageIndex;
@@ -908,7 +907,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
// find message
this->layoutMessages();
std::shared_ptr<chatterino::MessageLayout> layout;
std::shared_ptr<MessageLayout> layout;
QPoint relativePos;
int messageIndex;
@@ -927,7 +926,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
return;
}
const chatterino::MessageLayoutElement *hoverLayoutElement = layout->getElementAt(relativePos);
const MessageLayoutElement *hoverLayoutElement = layout->getElementAt(relativePos);
if (hoverLayoutElement == nullptr) {
return;
@@ -937,9 +936,8 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
this->handleMouseClick(event, hoverLayoutElement, layout.get());
}
void ChannelView::handleMouseClick(QMouseEvent *event,
const chatterino::MessageLayoutElement *hoveredElement,
chatterino::MessageLayout *layout)
void ChannelView::handleMouseClick(QMouseEvent *event, const MessageLayoutElement *hoveredElement,
MessageLayout *layout)
{
switch (event->button()) {
case Qt::LeftButton: {
@@ -971,8 +969,8 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
}
}
void ChannelView::addContextMenuItems(const chatterino::MessageLayoutElement *hoveredElement,
chatterino::MessageLayout *layout)
void ChannelView::addContextMenuItems(const MessageLayoutElement *hoveredElement,
MessageLayout *layout)
{
const auto &creator = hoveredElement->getCreator();
auto creatorFlags = creator.getFlags();
@@ -982,7 +980,7 @@ void ChannelView::addContextMenuItems(const chatterino::MessageLayoutElement *ho
// Emote actions
if (creatorFlags & (MessageElement::Flags::EmoteImages | MessageElement::Flags::EmojiImage)) {
const auto &emoteElement = static_cast<const chatterino::EmoteElement &>(creator);
const auto &emoteElement = static_cast<const EmoteElement &>(creator);
// TODO: We might want to add direct "Open image" variants alongside the Copy
// actions
@@ -1099,7 +1097,7 @@ void ChannelView::mouseDoubleClickEvent(QMouseEvent *event)
auto app = getApp();
if (app->settings->linksDoubleClickOnly) {
std::shared_ptr<chatterino::MessageLayout> layout;
std::shared_ptr<MessageLayout> layout;
QPoint relativePos;
int messageIndex;
@@ -1112,8 +1110,7 @@ void ChannelView::mouseDoubleClickEvent(QMouseEvent *event)
return;
}
const chatterino::MessageLayoutElement *hoverLayoutElement =
layout->getElementAt(relativePos);
const MessageLayoutElement *hoverLayoutElement = layout->getElementAt(relativePos);
if (hoverLayoutElement == nullptr) {
return;
@@ -1133,15 +1130,14 @@ void ChannelView::hideEvent(QHideEvent *)
this->messagesOnScreen_.clear();
}
void ChannelView::handleLinkClick(QMouseEvent *event, const chatterino::Link &link,
chatterino::MessageLayout *layout)
void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link, MessageLayout *layout)
{
if (event->button() != Qt::LeftButton) {
return;
}
switch (link.type) {
case chatterino::Link::UserInfo: {
case Link::UserInfo: {
auto user = link.value;
auto *userPopup = new UserInfoPopup;
@@ -1155,12 +1151,12 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const chatterino::Link &li
break;
}
case chatterino::Link::Url: {
case Link::Url: {
QDesktopServices::openUrl(QUrl(link.value));
break;
}
case chatterino::Link::UserAction: {
case Link::UserAction: {
QString value = link.value;
value.replace("{user}", layout->getMessage()->loginName);
this->channel_->sendMessage(value);
@@ -1170,7 +1166,7 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const chatterino::Link &li
}
}
bool ChannelView::tryGetMessageAt(QPoint p, std::shared_ptr<chatterino::MessageLayout> &_message,
bool ChannelView::tryGetMessageAt(QPoint p, std::shared_ptr<MessageLayout> &_message,
QPoint &relativePos, int &index)
{
auto messagesSnapshot = this->getMessagesSnapshot();
+19 -19
View File
@@ -36,13 +36,13 @@ public:
void clearSelection();
void setEnableScrollingToBottom(bool);
bool getEnableScrollingToBottom() const;
void setOverrideFlags(boost::optional<chatterino::MessageElement::Flags> value);
const boost::optional<chatterino::MessageElement::Flags> &getOverrideFlags() const;
void setOverrideFlags(boost::optional<MessageElement::Flags> value);
const boost::optional<MessageElement::Flags> &getOverrideFlags() const;
void pause(int msecTimeout);
void updateLastReadMessage();
void setChannel(ChannelPtr channel_);
chatterino::LimitedQueueSnapshot<chatterino::MessageLayoutPtr> getMessagesSnapshot();
LimitedQueueSnapshot<MessageLayoutPtr> getMessagesSnapshot();
void layoutMessages();
void clearMessages();
@@ -50,7 +50,7 @@ public:
pajlada::Signals::Signal<QMouseEvent *> mouseDown;
pajlada::Signals::NoArgSignal selectionChanged;
pajlada::Signals::Signal<HighlightState> tabHighlightRequested;
pajlada::Signals::Signal<const chatterino::Link &> linkClicked;
pajlada::Signals::Signal<const Link &> linkClicked;
protected:
void themeRefreshEvent() override;
@@ -70,10 +70,10 @@ protected:
void hideEvent(QHideEvent *) override;
void handleLinkClick(QMouseEvent *event, const chatterino::Link &link,
chatterino::MessageLayout *layout);
void handleLinkClick(QMouseEvent *event, const Link &link,
MessageLayout *layout);
bool tryGetMessageAt(QPoint p, std::shared_ptr<chatterino::MessageLayout> &message,
bool tryGetMessageAt(QPoint p, std::shared_ptr<MessageLayout> &message,
QPoint &relativePos, int &index);
private:
@@ -92,24 +92,24 @@ private:
int messagesAddedSinceSelectionPause_ = 0;
QTimer pauseTimeout_;
boost::optional<chatterino::MessageElement::Flags> overrideFlags_;
chatterino::MessageLayoutPtr lastReadMessage_;
boost::optional<MessageElement::Flags> overrideFlags_;
MessageLayoutPtr lastReadMessage_;
chatterino::LimitedQueueSnapshot<chatterino::MessageLayoutPtr> snapshot_;
LimitedQueueSnapshot<MessageLayoutPtr> snapshot_;
void detachChannel();
void actuallyLayoutMessages(bool causedByScollbar = false);
void drawMessages(QPainter &painter);
void setSelection(const chatterino::SelectionItem &start, const chatterino::SelectionItem &end);
chatterino::MessageElement::Flags getFlags() const;
void setSelection(const SelectionItem &start, const SelectionItem &end);
MessageElement::Flags getFlags() const;
bool isPaused();
void handleMouseClick(QMouseEvent *event,
const chatterino::MessageLayoutElement *hoverLayoutElement,
chatterino::MessageLayout *layout);
void addContextMenuItems(const chatterino::MessageLayoutElement *hoveredElement,
chatterino::MessageLayout *layout);
const MessageLayoutElement *hoverLayoutElement,
MessageLayout *layout);
void addContextMenuItems(const MessageLayoutElement *hoveredElement,
MessageLayout *layout);
// void beginPause();
// void endPause();
@@ -132,10 +132,10 @@ private:
QPointF lastPressPosition_;
QPointF lastRightPressPosition_;
chatterino::Selection selection_;
Selection selection_;
bool selecting_ = false;
chatterino::LimitedQueue<chatterino::MessageLayoutPtr> messages;
LimitedQueue<MessageLayoutPtr> messages;
pajlada::Signals::Connection messageAppendedConnection_;
pajlada::Signals::Connection messageAddedAtStartConnection_;
@@ -147,7 +147,7 @@ private:
std::vector<pajlada::Signals::ScopedConnection> connections_;
std::vector<pajlada::Signals::ScopedConnection> channelConnections_;
std::unordered_set<std::shared_ptr<chatterino::MessageLayout>> messagesOnScreen_;
std::unordered_set<std::shared_ptr<MessageLayout>> messagesOnScreen_;
int getLayoutWidth() const;
+2 -2
View File
@@ -221,8 +221,8 @@ void NotebookTab::paintEvent(QPaintEvent *)
// int fullHeight = (int)(scale * 48);
// select the right tab colors
chatterino::ThemeManager::TabColors colors;
chatterino::ThemeManager::TabColors regular = this->themeManager->tabs.regular;
ThemeManager::TabColors colors;
ThemeManager::TabColors regular = this->themeManager->tabs.regular;
if (this->selected_) {
colors = this->themeManager->tabs.selected;
+1 -1
View File
@@ -94,7 +94,7 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
}
auto *completionModel =
static_cast<chatterino::CompletionModel *>(this->completer->model());
static_cast<CompletionModel *>(this->completer->model());
if (!this->completionInProgress) {
// First type pressing tab after modifying a message, we refresh our completion model
+1 -1
View File
@@ -73,7 +73,7 @@ void SearchPopup::performSearch()
ChannelPtr channel(new Channel("search", Channel::None));
for (size_t i = 0; i < this->snapshot.getLength(); i++) {
chatterino::MessagePtr message = this->snapshot[i];
MessagePtr message = this->snapshot[i];
if (text.isEmpty() ||
message->searchText.indexOf(this->searchInput->text(), 0, Qt::CaseInsensitive) != -1) {
+1 -1
View File
@@ -21,7 +21,7 @@ public:
void setChannel(std::shared_ptr<Channel> channel);
private:
chatterino::LimitedQueueSnapshot<chatterino::MessagePtr> snapshot;
LimitedQueueSnapshot<MessagePtr> snapshot;
QLineEdit *searchInput;
ChannelView *channelView;
+5 -5
View File
@@ -226,7 +226,7 @@ QLayout *AppearancePage::createFontChanger()
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Policy::Fixed);
QObject::connect(button, &QPushButton::clicked, [=]() {
QFontDialog dialog(app->fonts->getFont(chatterino::FontManager::ChatMedium, 1.));
QFontDialog dialog(app->fonts->getFont(FontManager::ChatMedium, 1.));
dialog.setWindowFlag(Qt::WindowStaysOnTopHint);
@@ -250,10 +250,10 @@ QLayout *AppearancePage::createUiScaleSlider()
layout->addWidget(slider);
layout->addWidget(label);
slider->setMinimum(chatterino::WindowManager::uiScaleMin);
slider->setMaximum(chatterino::WindowManager::uiScaleMax);
slider->setMinimum(WindowManager::uiScaleMin);
slider->setMaximum(WindowManager::uiScaleMax);
slider->setValue(
chatterino::WindowManager::clampUiScale(getApp()->settings->uiScale.getValue()));
WindowManager::clampUiScale(getApp()->settings->uiScale.getValue()));
label->setMinimumWidth(100);
@@ -262,7 +262,7 @@ QLayout *AppearancePage::createUiScaleSlider()
getApp()->settings->uiScale.connect(
[label](auto, auto) {
label->setText(QString::number(chatterino::WindowManager::getUiScaleValue()));
label->setText(QString::number(WindowManager::getUiScaleValue()));
},
this->connections_);
+1 -1
View File
@@ -7,7 +7,7 @@ namespace chatterino {
EmotesPage::EmotesPage()
: SettingsPage("Emotes", ":/images/emote.svg")
{
// chatterino::SettingManager &settings = chatterino::SettingManager::getInstance();
// SettingManager &settings = SettingManager::getInstance();
// LayoutCreator<EmotesPage> layoutCreator(this);
// auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
+16 -15
View File
@@ -97,25 +97,26 @@ ModerationPage::ModerationPage()
// app->settings->timeoutAction));
// }
auto modButtons =
modMode.emplace<QGroupBox>("Custom moderator buttons").setLayoutType<QVBoxLayout>();
{
auto label2 =
modButtons.emplace<QLabel>("One action per line. {user} will be replaced with the "
"username.<br>Example `/timeout {user} 120`<br>");
label2->setWordWrap(true);
// auto modButtons =
// modMode.emplace<QGroupBox>("Custom moderator buttons").setLayoutType<QVBoxLayout>();
// {
// auto label2 =
// modButtons.emplace<QLabel>("One action per line. {user} will be replaced with the
// "
// "username.<br>Example `/timeout {user} 120`<br>");
// label2->setWordWrap(true);
auto text = modButtons.emplace<QTextEdit>().getElement();
// auto text = modButtons.emplace<QTextEdit>().getElement();
text->setPlainText(app->settings->moderationActions);
// text->setPlainText(app->moderationActions->items);
QObject::connect(text, &QTextEdit::textChanged, this,
[this] { this->itemsChangedTimer.start(200); });
// QObject::connect(text, &QTextEdit::textChanged, this,
// [this] { this->itemsChangedTimer.start(200); });
QObject::connect(&this->itemsChangedTimer, &QTimer::timeout, this, [text, app]() {
app->settings->moderationActions = text->toPlainText();
});
}
// QObject::connect(&this->itemsChangedTimer, &QTimer::timeout, this, [text, app]() {
// app->windows->moderationActions = text->toPlainText();
// });
// }
/*auto taggedUsers = tabs.appendTab(new QVBoxLayout, "Tagged users");
{
+3 -3
View File
@@ -565,7 +565,7 @@ void SplitContainer::decodeNodeRecusively(QJsonObject &obj, Node *node)
if (type == "split") {
auto *split = new Split(this);
split->setChannel(chatterino::WindowManager::decodeChannel(obj.value("data").toObject()));
split->setChannel(WindowManager::decodeChannel(obj.value("data").toObject()));
this->appendSplit(split);
} else if (type == "horizontal" || type == "vertical") {
@@ -582,7 +582,7 @@ void SplitContainer::decodeNodeRecusively(QJsonObject &obj, Node *node)
if (_type == "split") {
auto *split = new Split(this);
split->setChannel(
chatterino::WindowManager::decodeChannel(_obj.value("data").toObject()));
WindowManager::decodeChannel(_obj.value("data").toObject()));
Node *_node = new Node();
_node->parent = node;
@@ -606,7 +606,7 @@ void SplitContainer::decodeNodeRecusively(QJsonObject &obj, Node *node)
if (node->getChildren().size() < 2) {
auto *split = new Split(this);
split->setChannel(
chatterino::WindowManager::decodeChannel(obj.value("data").toObject()));
WindowManager::decodeChannel(obj.value("data").toObject()));
this->insertSplit(split, direction, node);
}
+1 -1
View File
@@ -234,7 +234,7 @@ void SplitHeader::scaleChangedEvent(float scale)
this->dropdownButton->setFixedWidth(w);
this->moderationButton->setFixedWidth(w);
// this->titleLabel->setFont(
// chatterino::FontManager::getInstance().getFont(FontStyle::Medium, scale));
// FontManager::getInstance().getFont(FontStyle::Medium, scale));
}
void SplitHeader::updateChannelText()
+4 -4
View File
@@ -67,19 +67,19 @@ void SplitInput::initLayout()
// set edit font
this->ui_.textEdit->setFont(
app->fonts->getFont(chatterino::FontManager::Type::ChatMedium, this->getScale()));
app->fonts->getFont(FontManager::Type::ChatMedium, this->getScale()));
this->managedConnections_.push_back(app->fonts->fontChanged.connect([=]() {
this->ui_.textEdit->setFont(
app->fonts->getFont(chatterino::FontManager::Type::ChatMedium, this->getScale()));
app->fonts->getFont(FontManager::Type::ChatMedium, this->getScale()));
}));
// open emote popup
QObject::connect(this->ui_.emoteButton, &RippleEffectLabel::clicked, [this] {
if (!this->emotePopup_) {
this->emotePopup_ = std::make_unique<EmotePopup>();
this->emotePopup_->linkClicked.connect([this](const chatterino::Link &link) {
if (link.type == chatterino::Link::InsertText) {
this->emotePopup_->linkClicked.connect([this](const Link &link) {
if (link.type == Link::InsertText) {
this->insertText(link.value + " ");
}
});