diff --git a/chatterino.pro b/chatterino.pro
index 7ea3c72ce..b70038ee4 100644
--- a/chatterino.pro
+++ b/chatterino.pro
@@ -216,7 +216,8 @@ SOURCES += \
src/controllers/taggedusers/taggeduser.cpp \
src/controllers/taggedusers/taggedusersmodel.cpp \
src/util/emotemap.cpp \
- src/providers/irc/ircconnection2.cpp
+ src/providers/irc/ircconnection2.cpp \
+ src/widgets/accountpopup2.cpp
HEADERS += \
src/precompiled_header.hpp \
@@ -374,7 +375,8 @@ HEADERS += \
src/controllers/taggedusers/taggedusersmodel.hpp \
src/util/qstringhash.hpp \
src/util/mutexvalue.hpp \
- src/providers/irc/ircconnection2.hpp
+ src/providers/irc/ircconnection2.hpp \
+ src/widgets/accountpopup2.hpp
RESOURCES += \
resources/resources.qrc
diff --git a/resources/images/buttons/ban.png b/resources/images/buttons/ban.png
new file mode 100644
index 000000000..af6b1ac6a
Binary files /dev/null and b/resources/images/buttons/ban.png differ
diff --git a/resources/images/buttons/mod.png b/resources/images/buttons/mod.png
new file mode 100644
index 000000000..6d92034b7
Binary files /dev/null and b/resources/images/buttons/mod.png differ
diff --git a/resources/images/buttons/unban.png b/resources/images/buttons/unban.png
new file mode 100644
index 000000000..6ef6453e6
Binary files /dev/null and b/resources/images/buttons/unban.png differ
diff --git a/resources/images/buttons/unmod.png b/resources/images/buttons/unmod.png
new file mode 100644
index 000000000..a45ee6f26
Binary files /dev/null and b/resources/images/buttons/unmod.png differ
diff --git a/resources/resources.qrc b/resources/resources.qrc
index 19383a849..56f593835 100644
--- a/resources/resources.qrc
+++ b/resources/resources.qrc
@@ -61,6 +61,10 @@
licenses/rapidjson.txt
licenses/websocketpp.txt
emoji.json
+ images/buttons/ban.png
+ images/buttons/mod.png
+ images/buttons/unban.png
+ images/buttons/unmod.png
qt.conf
diff --git a/src/singletons/resourcemanager.cpp b/src/singletons/resourcemanager.cpp
index b989261c7..c37504ab2 100644
--- a/src/singletons/resourcemanager.cpp
+++ b/src/singletons/resourcemanager.cpp
@@ -294,6 +294,12 @@ ResourceManager::ResourceManager()
this->split.up = QIcon(":/images/split/splitup.png");
this->split.down = QIcon(":/images/split/splitdown.png");
this->split.move = QIcon(":/images/split/splitmove.png");
+
+ this->buttons.ban = QPixmap(":/images/buttons/ban.png");
+ this->buttons.unban = QPixmap(":/images/buttons/unban.png");
+ this->buttons.mod = QPixmap(":/images/buttons/mod.png");
+ this->buttons.unmod = QPixmap(":/images/buttons/unmod.png");
+
qDebug() << "init ResourceManager";
}
diff --git a/src/singletons/resourcemanager.hpp b/src/singletons/resourcemanager.hpp
index 487b0f410..240aa4ae3 100644
--- a/src/singletons/resourcemanager.hpp
+++ b/src/singletons/resourcemanager.hpp
@@ -29,6 +29,13 @@ public:
QIcon move;
} split;
+ struct {
+ QPixmap ban;
+ QPixmap unban;
+ QPixmap mod;
+ QPixmap unmod;
+ } buttons;
+
messages::Image *badgeStaff;
messages::Image *badgeAdmin;
messages::Image *badgeGlobalModerator;
diff --git a/src/util/signalvectormodel.hpp b/src/util/signalvectormodel.hpp
index 3ab94a26a..7c5c72f08 100644
--- a/src/util/signalvectormodel.hpp
+++ b/src/util/signalvectormodel.hpp
@@ -28,6 +28,9 @@ public:
this->vector = vec;
auto insert = [this](const SignalVectorItemArgs &args) {
+ if (args.caller == this) {
+ return;
+ }
// get row index
int index = this->getModelIndexFromVectorIndex(args.index);
assert(index >= 0 && index <= this->rows.size());
@@ -54,6 +57,10 @@ public:
this->managedConnect(vec->itemInserted, insert);
this->managedConnect(vec->itemRemoved, [this](auto args) {
+ if (args.caller == this) {
+ return;
+ }
+
int row = this->getModelIndexFromVectorIndex(args.index);
assert(row >= 0 && row <= this->rows.size());
diff --git a/src/widgets/accountpopup2.cpp b/src/widgets/accountpopup2.cpp
new file mode 100644
index 000000000..1f67344eb
--- /dev/null
+++ b/src/widgets/accountpopup2.cpp
@@ -0,0 +1,172 @@
+#include "accountpopup2.hpp"
+
+#include "application.hpp"
+#include "singletons/resourcemanager.hpp"
+#include "util/layoutcreator.hpp"
+#include "widgets/helper/rippleeffectlabel.hpp"
+
+#include
+
+namespace chatterino {
+namespace widgets {
+
+AccountPopup2::AccountPopup2()
+ : BaseWindow(nullptr, BaseWindow::Frameless)
+{
+ auto app = getApp();
+
+ auto layout = util::LayoutCreator(this).setLayoutType();
+
+ // first line
+ auto head = layout.emplace();
+ {
+ // avatar
+ auto avatar = head.emplace("Avatar").assign(&this->ui.label);
+ avatar->setFixedSize(100, 100);
+
+ // items on the right
+ auto vbox = head.emplace();
+ {
+ vbox.emplace("Name");
+ vbox.emplace("Views");
+ vbox.emplace("Followers");
+ vbox.emplace("Create date");
+ }
+ }
+
+ // second line
+ auto user = layout.emplace();
+ {
+ user->addStretch(1);
+
+ auto ignore = user.emplace();
+ ignore->getLabel().setText("Ignore");
+ ignore->setScaleIndependantHeight(24);
+
+ auto ignoreHighlights = user.emplace();
+ ignoreHighlights->getLabel().setText("Ignore highlights");
+ ignoreHighlights->setScaleIndependantHeight(24);
+
+ user->addStretch(1);
+ }
+
+ // third line
+ auto moderation = layout.emplace();
+ moderation->setSpacing(0);
+ {
+ auto unban = moderation.emplace();
+ unban->setPixmap(app->resources->buttons.unban);
+ unban->setScaleIndependantSize(32, 32);
+ unban->setBorderColor(QColor(255, 255, 255, 127));
+
+ moderation.emplace();
+
+ auto ban = moderation.emplace();
+ ban->setPixmap(app->resources->buttons.ban);
+ ban->setScaleIndependantSize(32, 32);
+ ban->setBorderColor(QColor(255, 255, 255, 127));
+
+ // auto mod = moderation.emplace(this);
+ // mod->setPixmap(app->resources->buttons.mod);
+ // mod->setScaleIndependantSize(30, 30);
+ // auto unmod = moderation.emplace();
+ // unmod->setPixmap(app->resources->buttons.unmod);
+ // unmod->setScaleIndependantSize(30, 30);
+
+ this->userStateChanged.connect([=]() mutable {
+ // mod->setVisible(this->isBroadcaster_);
+ // unmod->setVisible(this->isBroadcaster_);
+
+ ban->setVisible(this->isMod_);
+ unban->setVisible(this->isMod_);
+ });
+ }
+
+ this->setStyleSheet("font-size: 12pt");
+}
+
+// void AccountPopup2::scaleChangedEvent(float newScale)
+//{
+//}
+
+void AccountPopup2::setName(const QString &name)
+{
+}
+
+void AccountPopup2::setChannel(const ChannelPtr &_channel)
+{
+}
+
+//
+// TimeoutWidget
+//
+AccountPopup2::TimeoutWidget::TimeoutWidget()
+ : BaseWidget(nullptr)
+{
+ auto layout = util::LayoutCreator(this).setLayoutType();
+
+ QColor color1(255, 255, 255, 127);
+ QColor color2(255, 255, 255, 80);
+
+ int buttonWidth = 40;
+ int buttonWidth2 = 20;
+ int buttonHeight = 32;
+
+ layout->setSpacing(1);
+
+ auto a = layout.emplace();
+ a->getLabel().setText("1s");
+ a->setScaleIndependantSize(buttonWidth, buttonHeight);
+ a->setBorderColor(color1);
+ auto a1 = layout.emplace(nullptr);
+ // a1->getLabel().setText("1m");
+ a1->setScaleIndependantSize(buttonWidth2, buttonHeight);
+ a1->setBorderColor(color2);
+ auto a2 = layout.emplace(nullptr);
+ // a2->getLabel().setText("5m");
+ a2->setScaleIndependantSize(buttonWidth2, buttonHeight);
+ a2->setBorderColor(color2);
+
+ auto b = layout.emplace();
+ b->getLabel().setText("10m");
+ b->setScaleIndependantSize(buttonWidth, buttonHeight);
+ b->setBorderColor(color1);
+ auto b1 = layout.emplace(nullptr);
+ b1->setScaleIndependantSize(buttonWidth2, buttonHeight);
+ b1->setBorderColor(color2);
+ // b1->getLabel().setText("1h");
+ auto b2 = layout.emplace(nullptr);
+ b2->setScaleIndependantSize(buttonWidth2, buttonHeight);
+ b2->setBorderColor(color2);
+ // b2->getLabel().setText("4h");
+
+ auto c = layout.emplace();
+ c->getLabel().setText("1d");
+ c->setScaleIndependantSize(buttonWidth, buttonHeight);
+ c->setBorderColor(color1);
+ auto c1 = layout.emplace(nullptr);
+ // c1->getLabel().setText("3d");
+ c1->setScaleIndependantSize(buttonWidth2, buttonHeight);
+ c1->setBorderColor(color2);
+ auto c2 = layout.emplace(nullptr);
+ // c2->getLabel().setText("1w");
+ c2->setScaleIndependantSize(buttonWidth2, buttonHeight);
+ c2->setBorderColor(color2);
+
+ auto d = layout.emplace();
+ d->getLabel().setText("2w");
+ d->setScaleIndependantSize(buttonWidth, buttonHeight);
+ d->setBorderColor(color1);
+}
+
+void AccountPopup2::TimeoutWidget::paintEvent(QPaintEvent *)
+{
+ // QPainter painter(this);
+
+ // painter.setPen(QColor(255, 255, 255, 63));
+
+ // painter.drawLine(0, this->height() / 2, this->width(), this->height() / 2);
+}
+
+} // namespace widgets
+} // namespace chatterino
diff --git a/src/widgets/accountpopup2.hpp b/src/widgets/accountpopup2.hpp
new file mode 100644
index 000000000..7b68c9762
--- /dev/null
+++ b/src/widgets/accountpopup2.hpp
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "channel.hpp"
+#include "widgets/basewindow.hpp"
+
+#include
+
+class QLabel;
+
+namespace chatterino {
+namespace widgets {
+
+class AccountPopup2 final : public BaseWindow
+{
+public:
+ AccountPopup2();
+
+ void setName(const QString &name);
+ void setChannel(const ChannelPtr &_channel);
+
+ struct {
+ QLabel *label = nullptr;
+ } ui;
+
+protected:
+ // virtual void scaleChangedEvent(float newScale) override;
+
+private:
+ bool isMod_;
+ bool isBroadcaster_;
+
+ pajlada::Signals::NoArgSignal userStateChanged;
+
+ class TimeoutWidget : public BaseWidget
+ {
+ public:
+ TimeoutWidget();
+
+ protected:
+ void paintEvent(QPaintEvent *event) override;
+ };
+};
+
+} // namespace widgets
+} // namespace chatterino
diff --git a/src/widgets/basewindow.cpp b/src/widgets/basewindow.cpp
index 5e533357b..1bda125f8 100644
--- a/src/widgets/basewindow.cpp
+++ b/src/widgets/basewindow.cpp
@@ -36,7 +36,7 @@ BaseWindow::BaseWindow(QWidget *parent, Flags _flags)
: BaseWidget(parent,
Qt::Window | ((_flags & TopMost) ? Qt::WindowStaysOnTopHint : Qt::WindowFlags(0)))
, enableCustomFrame(_flags & EnableCustomFrame)
- , frameless(_flags & FrameLess)
+ , frameless(_flags & Frameless)
, flags(_flags)
{
if (this->frameless) {
@@ -447,8 +447,22 @@ void BaseWindow::showEvent(QShowEvent *event)
BaseWidget::showEvent(event);
}
+void BaseWindow::scaleChangedEvent(float)
+{
+ this->calcButtonsSizes();
+}
+#endif
+
void BaseWindow::paintEvent(QPaintEvent *)
{
+ if (this->frameless) {
+ QPainter painter(this);
+
+ painter.setPen(QColor("#999"));
+ painter.drawRect(0, 0, this->width() - 1, this->height() - 1);
+ }
+
+#ifdef USEWINSDK
if (this->hasCustomWindowFrame()) {
QPainter painter(this);
@@ -457,13 +471,8 @@ void BaseWindow::paintEvent(QPaintEvent *)
painter.fillRect(QRect(0, 1, this->width() - 0, this->height() - 0),
this->themeManager->window.background);
}
-}
-
-void BaseWindow::scaleChangedEvent(float)
-{
- this->calcButtonsSizes();
-}
#endif
+}
void BaseWindow::calcButtonsSizes()
{
diff --git a/src/widgets/basewindow.hpp b/src/widgets/basewindow.hpp
index ec5776b6c..ccd06f39b 100644
--- a/src/widgets/basewindow.hpp
+++ b/src/widgets/basewindow.hpp
@@ -19,7 +19,7 @@ class BaseWindow : public BaseWidget
Q_OBJECT
public:
- enum Flags { None = 0, EnableCustomFrame = 1, FrameLess = 2, TopMost = 4 };
+ enum Flags { None = 0, EnableCustomFrame = 1, Frameless = 2, TopMost = 4 };
explicit BaseWindow(QWidget *parent = nullptr, Flags flags = None);
@@ -39,10 +39,11 @@ protected:
#ifdef USEWINSDK
void showEvent(QShowEvent *) override;
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
- void paintEvent(QPaintEvent *) override;
void scaleChangedEvent(float) override;
#endif
+ void paintEvent(QPaintEvent *) override;
+
void changeEvent(QEvent *) override;
void leaveEvent(QEvent *) override;
void resizeEvent(QResizeEvent *) override;
diff --git a/src/widgets/helper/channelview.cpp b/src/widgets/helper/channelview.cpp
index 9c0482ca6..57be91e71 100644
--- a/src/widgets/helper/channelview.cpp
+++ b/src/widgets/helper/channelview.cpp
@@ -12,6 +12,7 @@
#include "ui_accountpopupform.h"
#include "util/benchmark.hpp"
#include "util/distancebetweenpoints.hpp"
+#include "widgets/accountpopup2.hpp"
#include "widgets/split.hpp"
#include "widgets/tooltipwidget.hpp"
@@ -1104,10 +1105,16 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const messages::Link &link
switch (link.type) {
case messages::Link::UserInfo: {
auto user = link.value;
- this->userPopupWidget.setName(user);
- this->userPopupWidget.moveTo(this, event->screenPos().toPoint());
- this->userPopupWidget.show();
- this->userPopupWidget.setFocus();
+ auto *userPopup = new AccountPopup2;
+ userPopup->setChannel(this->channel);
+ userPopup->setName(user);
+ userPopup->setAttribute(Qt::WA_DeleteOnClose);
+ userPopup->show();
+
+ // this->userPopupWidget.setName(user);
+ // this->userPopupWidget.moveTo(this, event->screenPos().toPoint());
+ // this->userPopupWidget.show();
+ // this->userPopupWidget.setFocus();
qDebug() << "Clicked " << user << "s message";
break;
diff --git a/src/widgets/helper/notebookbutton.cpp b/src/widgets/helper/notebookbutton.cpp
index 5a3b651b8..05ebb273d 100644
--- a/src/widgets/helper/notebookbutton.cpp
+++ b/src/widgets/helper/notebookbutton.cpp
@@ -32,7 +32,7 @@ void NotebookButton::paintEvent(QPaintEvent *)
QColor background;
QColor foreground;
- if (mouseDown || mouseOver) {
+ if (mouseDown_ || mouseOver_) {
background = this->themeManager->tabs.regular.backgrounds.hover.color();
foreground = this->themeManager->tabs.regular.text;
} else {
@@ -47,7 +47,7 @@ void NotebookButton::paintEvent(QPaintEvent *)
if (icon == IconPlus) {
painter.setPen([&] {
QColor tmp = foreground;
- if (!this->mouseOver) {
+ if (!this->mouseOver_) {
tmp.setAlpha(180);
}
return tmp;
@@ -103,7 +103,7 @@ void NotebookButton::paintEvent(QPaintEvent *)
void NotebookButton::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
- mouseDown = false;
+ mouseDown_ = false;
update();
@@ -129,7 +129,7 @@ void NotebookButton::dragEnterEvent(QDragEnterEvent *event)
void NotebookButton::dragLeaveEvent(QDragLeaveEvent *)
{
- this->mouseDown = true;
+ this->mouseDown_ = true;
this->update();
auto e = new QMouseEvent(QMouseEvent::MouseButtonRelease,
diff --git a/src/widgets/helper/notebookbutton.hpp b/src/widgets/helper/notebookbutton.hpp
index 3a53af514..ddd86c4f5 100644
--- a/src/widgets/helper/notebookbutton.hpp
+++ b/src/widgets/helper/notebookbutton.hpp
@@ -32,7 +32,7 @@ signals:
void clicked();
private:
- QPoint mousePos;
+ QPoint mousePos_;
};
} // namespace widgets
diff --git a/src/widgets/helper/rippleeffectbutton.cpp b/src/widgets/helper/rippleeffectbutton.cpp
index 78f80a4c1..232a01d33 100644
--- a/src/widgets/helper/rippleeffectbutton.cpp
+++ b/src/widgets/helper/rippleeffectbutton.cpp
@@ -10,28 +10,37 @@ namespace widgets {
RippleEffectButton::RippleEffectButton(BaseWidget *parent)
: BaseWidget(parent)
- , pixmap(nullptr)
{
- connect(&effectTimer, &QTimer::timeout, this, &RippleEffectButton::onMouseEffectTimeout);
+ connect(&effectTimer_, &QTimer::timeout, this, &RippleEffectButton::onMouseEffectTimeout);
- this->effectTimer.setInterval(20);
- this->effectTimer.start();
+ this->effectTimer_.setInterval(20);
+ this->effectTimer_.start();
}
void RippleEffectButton::setMouseEffectColor(boost::optional color)
{
- this->mouseEffectColor = color;
+ this->mouseEffectColor_ = color;
}
-void RippleEffectButton::setPixmap(const QPixmap *_pixmap)
+void RippleEffectButton::setPixmap(const QPixmap &_pixmap)
{
- this->pixmap = const_cast(_pixmap);
+ this->pixmap_ = _pixmap;
this->update();
}
-const QPixmap *RippleEffectButton::getPixmap() const
+const QPixmap &RippleEffectButton::getPixmap() const
{
- return this->pixmap;
+ return this->pixmap_;
+}
+
+void RippleEffectButton::setBorderColor(const QColor &color)
+{
+ this->borderColor_ = color;
+}
+
+const QColor &RippleEffectButton::getBorderColor() const
+{
+ return this->borderColor_;
}
void RippleEffectButton::paintEvent(QPaintEvent *)
@@ -42,16 +51,22 @@ void RippleEffectButton::paintEvent(QPaintEvent *)
this->fancyPaint(painter);
- if (this->pixmap != nullptr) {
+ if (!this->pixmap_.isNull()) {
QRect rect = this->rect();
- int xD = 6 * this->getScale();
+ int s = int(6 * this->getScale());
- rect.moveLeft(xD);
- rect.setRight(rect.right() - xD - xD);
- rect.moveTop(xD);
- rect.setBottom(rect.bottom() - xD - xD);
+ rect.moveLeft(s);
+ rect.setRight(rect.right() - s - s);
+ rect.moveTop(s);
+ rect.setBottom(rect.bottom() - s - s);
- painter.drawPixmap(rect, *this->pixmap);
+ painter.drawPixmap(rect, this->pixmap_);
+ }
+
+ if (this->borderColor_.isValid()) {
+ painter.setRenderHint(QPainter::Antialiasing, false);
+ painter.setPen(this->borderColor_);
+ painter.drawRect(0, 0, this->width() - 1, this->height() - 1);
}
}
@@ -61,33 +76,33 @@ void RippleEffectButton::fancyPaint(QPainter &painter)
painter.setRenderHint(QPainter::Antialiasing);
QColor c;
- if (this->mouseEffectColor) {
- c = this->mouseEffectColor.get();
+ if (this->mouseEffectColor_) {
+ c = this->mouseEffectColor_.get();
} else {
c = this->themeManager->isLightTheme() ? QColor(0, 0, 0) : QColor(255, 255, 255);
}
- if (this->hoverMultiplier > 0) {
- QRadialGradient gradient(mousePos.x(), mousePos.y(), 50, mousePos.x(), mousePos.y());
+ if (this->hoverMultiplier_ > 0) {
+ QRadialGradient gradient(mousePos_.x(), mousePos_.y(), 50, mousePos_.x(), mousePos_.y());
- gradient.setColorAt(
- 0, QColor(c.red(), c.green(), c.blue(), (int)(24 * this->hoverMultiplier)));
- gradient.setColorAt(
- 1, QColor(c.red(), c.green(), c.blue(), (int)(12 * this->hoverMultiplier)));
+ gradient.setColorAt(0,
+ QColor(c.red(), c.green(), c.blue(), int(24 * this->hoverMultiplier_)));
+ gradient.setColorAt(1,
+ QColor(c.red(), c.green(), c.blue(), int(12 * this->hoverMultiplier_)));
painter.fillRect(this->rect(), gradient);
}
- for (auto effect : this->clickEffects) {
+ for (auto effect : this->clickEffects_) {
QRadialGradient gradient(effect.position.x(), effect.position.y(),
- effect.progress * (float)width() * 2, effect.position.x(),
+ effect.progress * float(width()) * 2, effect.position.x(),
effect.position.y());
- gradient.setColorAt(
- 0, QColor(c.red(), c.green(), c.blue(), (int)((1 - effect.progress) * 95)));
- gradient.setColorAt(
- 0.9999, QColor(c.red(), c.green(), c.blue(), (int)((1 - effect.progress) * 95)));
- gradient.setColorAt(1, QColor(c.red(), c.green(), c.blue(), (int)(0)));
+ gradient.setColorAt(0,
+ QColor(c.red(), c.green(), c.blue(), int((1 - effect.progress) * 95)));
+ gradient.setColorAt(0.9999,
+ QColor(c.red(), c.green(), c.blue(), int((1 - effect.progress) * 95)));
+ gradient.setColorAt(1, QColor(c.red(), c.green(), c.blue(), int(0)));
painter.fillRect(this->rect(), gradient);
}
@@ -95,12 +110,12 @@ void RippleEffectButton::fancyPaint(QPainter &painter)
void RippleEffectButton::enterEvent(QEvent *)
{
- this->mouseOver = true;
+ this->mouseOver_ = true;
}
void RippleEffectButton::leaveEvent(QEvent *)
{
- this->mouseOver = false;
+ this->mouseOver_ = false;
}
void RippleEffectButton::mousePressEvent(QMouseEvent *event)
@@ -109,9 +124,9 @@ void RippleEffectButton::mousePressEvent(QMouseEvent *event)
return;
}
- this->clickEffects.push_back(ClickEffect(event->pos()));
+ this->clickEffects_.push_back(ClickEffect(event->pos()));
- this->mouseDown = true;
+ this->mouseDown_ = true;
}
void RippleEffectButton::mouseReleaseEvent(QMouseEvent *event)
@@ -120,7 +135,7 @@ void RippleEffectButton::mouseReleaseEvent(QMouseEvent *event)
return;
}
- this->mouseDown = false;
+ this->mouseDown_ = false;
if (this->rect().contains(event->pos())) {
emit clicked();
@@ -129,38 +144,38 @@ void RippleEffectButton::mouseReleaseEvent(QMouseEvent *event)
void RippleEffectButton::mouseMoveEvent(QMouseEvent *event)
{
- this->mousePos = event->pos();
+ this->mousePos_ = event->pos();
}
void RippleEffectButton::onMouseEffectTimeout()
{
bool performUpdate = false;
- if (selected) {
- if (this->hoverMultiplier != 0) {
- this->hoverMultiplier = std::max(0.0, this->hoverMultiplier - 0.1);
+ if (selected_) {
+ if (this->hoverMultiplier_ != 0) {
+ this->hoverMultiplier_ = std::max(0.0, this->hoverMultiplier_ - 0.1);
performUpdate = true;
}
- } else if (mouseOver) {
- if (this->hoverMultiplier != 1) {
- this->hoverMultiplier = std::min(1.0, this->hoverMultiplier + 0.5);
+ } else if (mouseOver_) {
+ if (this->hoverMultiplier_ != 1) {
+ this->hoverMultiplier_ = std::min(1.0, this->hoverMultiplier_ + 0.5);
performUpdate = true;
}
} else {
- if (this->hoverMultiplier != 0) {
- this->hoverMultiplier = std::max(0.0, this->hoverMultiplier - 0.3);
+ if (this->hoverMultiplier_ != 0) {
+ this->hoverMultiplier_ = std::max(0.0, this->hoverMultiplier_ - 0.3);
performUpdate = true;
}
}
- if (this->clickEffects.size() != 0) {
+ if (this->clickEffects_.size() != 0) {
performUpdate = true;
- for (auto it = this->clickEffects.begin(); it != this->clickEffects.end();) {
- (*it).progress += mouseDown ? 0.02 : 0.07;
+ for (auto it = this->clickEffects_.begin(); it != this->clickEffects_.end();) {
+ (*it).progress += mouseDown_ ? 0.02 : 0.07;
if ((*it).progress >= 1.0) {
- it = this->clickEffects.erase(it);
+ it = this->clickEffects_.erase(it);
} else {
it++;
}
diff --git a/src/widgets/helper/rippleeffectbutton.hpp b/src/widgets/helper/rippleeffectbutton.hpp
index 5806ff4a4..67ac71093 100644
--- a/src/widgets/helper/rippleeffectbutton.hpp
+++ b/src/widgets/helper/rippleeffectbutton.hpp
@@ -31,16 +31,19 @@ public:
RippleEffectButton(BaseWidget *parent);
void setMouseEffectColor(boost::optional color);
- void setPixmap(const QPixmap *pixmap);
- const QPixmap *getPixmap() const;
+ void setPixmap(const QPixmap &pixmap_);
+ const QPixmap &getPixmap() const;
+
+ void setBorderColor(const QColor &color);
+ const QColor &getBorderColor() const;
signals:
void clicked();
protected:
- bool selected = false;
- bool mouseOver = false;
- bool mouseDown = false;
+ bool selected_ = false;
+ bool mouseOver_ = false;
+ bool mouseDown_ = false;
virtual void paintEvent(QPaintEvent *) override;
virtual void enterEvent(QEvent *) override;
@@ -52,12 +55,13 @@ protected:
void fancyPaint(QPainter &painter);
private:
- QPixmap *pixmap;
- QPoint mousePos;
- double hoverMultiplier = 0.0;
- QTimer effectTimer;
- std::vector clickEffects;
- boost::optional mouseEffectColor = boost::none;
+ QColor borderColor_;
+ QPixmap pixmap_;
+ QPoint mousePos_;
+ double hoverMultiplier_ = 0.0;
+ QTimer effectTimer_;
+ std::vector clickEffects_;
+ boost::optional mouseEffectColor_ = boost::none;
void onMouseEffectTimeout();
};
diff --git a/src/widgets/helper/splitheader.cpp b/src/widgets/helper/splitheader.cpp
index 389c7af1f..7c178cf24 100644
--- a/src/widgets/helper/splitheader.cpp
+++ b/src/widgets/helper/splitheader.cpp
@@ -38,7 +38,7 @@ SplitHeader::SplitHeader(Split *_split)
// dropdown label
auto dropdown = layout.emplace(this).assign(&this->dropdownButton);
dropdown->setMouseTracking(true);
- dropdown->setPixmap(app->resources->splitHeaderContext->getPixmap());
+ dropdown->setPixmap(*app->resources->splitHeaderContext->getPixmap());
this->addDropdownItems(dropdown.getElement());
QObject::connect(dropdown.getElement(), &RippleEffectButton::clicked, this, [this] {
QTimer::singleShot(80, [&] {
@@ -219,8 +219,8 @@ void SplitHeader::updateModerationModeIcon()
auto app = getApp();
this->moderationButton->setPixmap(this->split->getModerationMode()
- ? app->resources->moderationmode_enabled->getPixmap()
- : app->resources->moderationmode_disabled->getPixmap());
+ ? *app->resources->moderationmode_enabled->getPixmap()
+ : *app->resources->moderationmode_disabled->getPixmap());
bool modButtonVisible = false;
ChannelPtr channel = this->split->getChannel();
diff --git a/src/widgets/helper/splitinput.cpp b/src/widgets/helper/splitinput.cpp
index 803c36086..c8ac8c89b 100644
--- a/src/widgets/helper/splitinput.cpp
+++ b/src/widgets/helper/splitinput.cpp
@@ -276,7 +276,8 @@ void SplitInput::editTextChanged()
// set textLengthLabel value
QString text = this->ui.textEdit->toPlainText();
- if (text.startsWith("/r ") && this->split->getChannel()->isTwitchChannel()) //
+ if (text.startsWith("/r ", Qt::CaseInsensitive) &&
+ this->split->getChannel()->isTwitchChannel()) //
{
QString lastUser = app->twitch.server->lastUserThatWhisperedMe.get();
if (!lastUser.isEmpty()) {
diff --git a/src/widgets/notificationpopup.cpp b/src/widgets/notificationpopup.cpp
index aa21c5ec5..31c1deb63 100644
--- a/src/widgets/notificationpopup.cpp
+++ b/src/widgets/notificationpopup.cpp
@@ -10,7 +10,7 @@ namespace chatterino {
namespace widgets {
NotificationPopup::NotificationPopup()
- : BaseWindow((QWidget *)nullptr, BaseWindow::FrameLess)
+ : BaseWindow((QWidget *)nullptr, BaseWindow::Frameless)
, channel(std::make_shared("notifications", Channel::None))
{