diff --git a/src/widgets/basewindow.cpp b/src/widgets/basewindow.cpp index 1fc9e102b..7bfab6cf5 100644 --- a/src/widgets/basewindow.cpp +++ b/src/widgets/basewindow.cpp @@ -165,6 +165,8 @@ void BaseWindow::init() void BaseWindow::setStayInScreenRect(bool value) { this->stayInScreenRect_ = value; + + this->moveIntoDesktopRect(this); } bool BaseWindow::getStayInScreenRect() const @@ -231,6 +233,10 @@ bool BaseWindow::event(QEvent *event) void BaseWindow::wheelEvent(QWheelEvent *event) { + if (event->orientation() != Qt::Vertical) { + return; + } + if (event->modifiers() & Qt::ControlModifier) { if (event->delta() > 0) { getApp()->settings->uiScale.setValue(singletons::WindowManager::clampUiScale( @@ -316,7 +322,7 @@ void BaseWindow::moveIntoDesktopRect(QWidget *parent) // move the widget into the screen geometry if it's not already in there QDesktopWidget *desktop = QApplication::desktop(); - QRect s = desktop->screenGeometry(parent); + QRect s = desktop->availableGeometry(parent); QPoint p = this->pos(); if (p.x() < s.left()) { diff --git a/src/widgets/helper/channelview.cpp b/src/widgets/helper/channelview.cpp index 33b2e12af..c93909d5b 100644 --- a/src/widgets/helper/channelview.cpp +++ b/src/widgets/helper/channelview.cpp @@ -563,7 +563,8 @@ messages::MessageElement::Flags ChannelView::getFlags() const bool ChannelView::isPaused() { - return this->pausedTemporarily_ || this->pausedBySelection_ || this->pausedByScrollingUp_; + return false; + // return this->pausedTemporarily_ || this->pausedBySelection_ || this->pausedByScrollingUp_; } void ChannelView::updatePauseStatus() @@ -659,6 +660,10 @@ void ChannelView::drawMessages(QPainter &painter) void ChannelView::wheelEvent(QWheelEvent *event) { + if (event->orientation() != Qt::Vertical) { + return; + } + this->pausedBySelection_ = false; this->pausedTemporarily_ = false; this->updatePauseStatus(); diff --git a/src/widgets/helper/rippleeffectlabel.cpp b/src/widgets/helper/rippleeffectlabel.cpp index 47fbea8e7..90cf2eee2 100644 --- a/src/widgets/helper/rippleeffectlabel.cpp +++ b/src/widgets/helper/rippleeffectlabel.cpp @@ -22,5 +22,26 @@ RippleEffectLabel::RippleEffectLabel(BaseWidget *parent, int spacing) this->hbox.addSpacing(spacing); } +RippleEffectLabel2::RippleEffectLabel2(BaseWidget *parent, int padding) + : RippleEffectButton(parent) + , label_(this) +{ + auto *hbox = new QHBoxLayout(this); + this->setLayout(hbox); + + // this->label_.setAlignment(Qt::AlignCenter); + this->label_.setCentered(true); + + hbox->setMargin(0); + // hbox.addSpacing(spacing); + hbox->addWidget(&this->label_); + // hbox.addSpacing(spacing); +} + +Label &RippleEffectLabel2::getLabel() +{ + return this->label_; +} + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/helper/rippleeffectlabel.hpp b/src/widgets/helper/rippleeffectlabel.hpp index 4e1f47800..95a2500b4 100644 --- a/src/widgets/helper/rippleeffectlabel.hpp +++ b/src/widgets/helper/rippleeffectlabel.hpp @@ -3,6 +3,7 @@ #include "widgets/basewidget.hpp" #include "widgets/helper/rippleeffectbutton.hpp" #include "widgets/helper/signallabel.hpp" +#include "widgets/label.hpp" #include #include @@ -27,5 +28,16 @@ private: SignalLabel label; }; +class RippleEffectLabel2 : public RippleEffectButton +{ +public: + explicit RippleEffectLabel2(BaseWidget *parent = nullptr, int padding = 6); + + Label &getLabel(); + +private: + Label label_; +}; + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/label.cpp b/src/widgets/label.cpp index ba8e35f6b..c146e99af 100644 --- a/src/widgets/label.cpp +++ b/src/widgets/label.cpp @@ -104,6 +104,11 @@ void Label::paintEvent(QPaintEvent *) QTextOption option(alignment); option.setWrapMode(QTextOption::NoWrap); painter.drawText(textRect, this->text_, option); + +#if 0 + painter.setPen(QColor(255, 0, 0)); + painter.drawRect(0, 0, this->width() - 1, this->height() - 1); +#endif } void Label::updateSize() diff --git a/src/widgets/label.hpp b/src/widgets/label.hpp index 455b0f804..a4dc0b886 100644 --- a/src/widgets/label.hpp +++ b/src/widgets/label.hpp @@ -23,7 +23,7 @@ public: void setCentered(bool centered); bool getHasOffset() const; - void setHasOffset(bool centered); + void setHasOffset(bool hasOffset); protected: virtual void scaleChangedEvent(float scale) override; diff --git a/src/widgets/userinfopopup.cpp b/src/widgets/userinfopopup.cpp index 26bcb42d8..42910dad9 100644 --- a/src/widgets/userinfopopup.cpp +++ b/src/widgets/userinfopopup.cpp @@ -25,6 +25,8 @@ UserInfoPopup::UserInfoPopup() : BaseWindow(nullptr, BaseWindow::Flags(BaseWindow::Frameless | BaseWindow::DeleteOnFocusOut)) , hack_(new bool) { + this->setStayInScreenRect(true); + auto app = getApp(); auto layout = util::LayoutCreator(this).setLayoutType(); @@ -67,12 +69,17 @@ UserInfoPopup::UserInfoPopup() auto mod = user.emplace(this); mod->setPixmap(app->resources->buttons.mod); mod->setScaleIndependantSize(30, 30); - auto unmod = user.emplace(); + auto unmod = user.emplace(this); unmod->setPixmap(app->resources->buttons.unmod); unmod->setScaleIndependantSize(30, 30); user->addStretch(1); + QObject::connect(mod.getElement(), &RippleEffectButton::clicked, + [this] { this->channel_->sendMessage("/mod " + this->userName_); }); + QObject::connect(unmod.getElement(), &RippleEffectButton::clicked, + [this] { this->channel_->sendMessage("/unmod " + this->userName_); }); + // userstate this->userStateChanged.connect([this, mod, unmod]() mutable { providers::twitch::TwitchChannel *twitchChannel = @@ -301,7 +308,8 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget() QColor color1(255, 255, 255, 80); QColor color2(255, 255, 255, 0); - int buttonWidth = 32; + int buttonWidth = 24; + int buttonWidth2 = 32; int buttonHeight = 32; layout->setSpacing(16); @@ -312,6 +320,7 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget() auto title = vbox.emplace().withoutMargin(); title->addStretch(1); auto label = title.emplace