added basic user info popup

This commit is contained in:
fourtf
2018-06-06 13:35:06 +02:00
parent 86e4a669ad
commit c308883a2a
13 changed files with 453 additions and 241 deletions
+3 -4
View File
@@ -12,9 +12,9 @@
#include "ui_accountpopupform.h"
#include "util/benchmark.hpp"
#include "util/distancebetweenpoints.hpp"
#include "widgets/accountpopup2.hpp"
#include "widgets/split.hpp"
#include "widgets/tooltipwidget.hpp"
#include "widgets/userinfopopup.hpp"
#include <QClipboard>
#include <QDebug>
@@ -1105,9 +1105,8 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const messages::Link &link
switch (link.type) {
case messages::Link::UserInfo: {
auto user = link.value;
auto *userPopup = new AccountPopup2;
userPopup->setChannel(this->channel);
userPopup->setName(user);
auto *userPopup = new UserInfoPopup;
userPopup->setData(user, this->channel);
userPopup->setAttribute(Qt::WA_DeleteOnClose);
userPopup->show();
+42
View File
@@ -0,0 +1,42 @@
#pragma once
#include "widgets/basewidget.hpp"
#include <QPainter>
namespace chatterino {
namespace widgets {
class Line : public BaseWidget
{
public:
Line(bool vertical)
: BaseWidget(nullptr)
, vertical_(vertical)
{
if (this->vertical_) {
this->setScaleIndependantWidth(8);
} else {
this->setScaleIndependantHeight(8);
}
}
virtual void paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.setPen(QColor("#999"));
if (this->vertical_) {
painter.drawLine(this->width() / 2, 0, this->width() / 2, this->height());
} else {
painter.drawLine(0, this->height() / 2, this->width(), this->height() / 2);
}
}
private:
bool vertical_;
};
} // namespace widgets
} // namespace chatterino
+9 -5
View File
@@ -15,6 +15,8 @@ RippleEffectButton::RippleEffectButton(BaseWidget *parent)
this->effectTimer_.setInterval(20);
this->effectTimer_.start();
this->setMouseTracking(true);
}
void RippleEffectButton::setMouseEffectColor(boost::optional<QColor> color)
@@ -83,12 +85,12 @@ void RippleEffectButton::fancyPaint(QPainter &painter)
}
if (this->hoverMultiplier_ > 0) {
QRadialGradient gradient(mousePos_.x(), mousePos_.y(), 50, mousePos_.x(), mousePos_.y());
QRadialGradient gradient(QPointF(mousePos_), this->width() / 2);
gradient.setColorAt(0,
QColor(c.red(), c.green(), c.blue(), int(24 * this->hoverMultiplier_)));
QColor(c.red(), c.green(), c.blue(), int(60 * this->hoverMultiplier_)));
gradient.setColorAt(1,
QColor(c.red(), c.green(), c.blue(), int(12 * this->hoverMultiplier_)));
QColor(c.red(), c.green(), c.blue(), int(40 * this->hoverMultiplier_)));
painter.fillRect(this->rect(), gradient);
}
@@ -145,6 +147,8 @@ void RippleEffectButton::mouseReleaseEvent(QMouseEvent *event)
void RippleEffectButton::mouseMoveEvent(QMouseEvent *event)
{
this->mousePos_ = event->pos();
this->update();
}
void RippleEffectButton::onMouseEffectTimeout()
@@ -172,9 +176,9 @@ void RippleEffectButton::onMouseEffectTimeout()
performUpdate = true;
for (auto it = this->clickEffects_.begin(); it != this->clickEffects_.end();) {
(*it).progress += mouseDown_ ? 0.02 : 0.07;
it->progress += mouseDown_ ? 0.02 : 0.07;
if ((*it).progress >= 1.0) {
if (it->progress >= 1.0) {
it = this->clickEffects_.erase(it);
} else {
it++;
+4
View File
@@ -326,6 +326,10 @@ void SplitInput::paintEvent(QPaintEvent *)
painter.setPen(QColor("#333"));
painter.drawRect(rect);
}
// int offset = 2;
// painter.fillRect(offset, this->height() - offset, this->width() - 2 * offset, 1,
// getApp()->themes->splits.input.focusedLine);
}
void SplitInput::resizeEvent(QResizeEvent *)