A lot of changes

Remove unused constructor of messages::Message
Fixed LimitedQueueSnapshot _-prefixes
Changed LimitedQueueSnapshot's usage of int to std::size_t
ColorScheme is no longer a singleton
Created a "BaseWidget" class which is pretty much a QWidget except it
has a reference of ColorScheme since most widgets will need a reference
to the style they should use.
BaseWidget can be implemented either with a BaseWidget parent (which
will copy the ColorScheme reference from the parent) or with a
normal QWidget parent and an explicit ColorScheme reference.
Save main window geometry on close
Fix font changing in the Settings Dialog
Update settings library version
This commit is contained in:
Rasmus Karlsson
2017-06-26 16:41:20 +02:00
parent c2e67e4b90
commit 7df7da70cb
56 changed files with 933 additions and 650 deletions
+24 -24
View File
@@ -1,5 +1,6 @@
#include "widgets/chatwidgetheaderbutton.hpp"
#include "colorscheme.hpp"
#include "widgets/chatwidgetheader.hpp"
#include <QBrush>
#include <QPainter>
@@ -7,24 +8,23 @@
namespace chatterino {
namespace widgets {
ChatWidgetHeaderButton::ChatWidgetHeaderButton(int spacing)
: QWidget()
, _hbox()
, _label()
, _mouseOver(false)
, _mouseDown(false)
ChatWidgetHeaderButton::ChatWidgetHeaderButton(BaseWidget *parent, int spacing)
: BaseWidget(parent)
, mouseOver(false)
, mouseDown(false)
{
setLayout(&_hbox);
setLayout(&this->ui.hbox);
_label.setAlignment(Qt::AlignCenter);
this->ui.label.setAlignment(Qt::AlignCenter);
_hbox.setMargin(0);
_hbox.addSpacing(spacing);
_hbox.addWidget(&_label);
_hbox.addSpacing(spacing);
this->ui.hbox.setMargin(0);
this->ui.hbox.addSpacing(spacing);
this->ui.hbox.addWidget(&this->ui.label);
this->ui.hbox.addSpacing(spacing);
QObject::connect(&_label, &SignalLabel::mouseUp, this, &ChatWidgetHeaderButton::labelMouseUp);
QObject::connect(&_label, &SignalLabel::mouseDown, this,
QObject::connect(&this->ui.label, &SignalLabel::mouseUp, this,
&ChatWidgetHeaderButton::labelMouseUp);
QObject::connect(&this->ui.label, &SignalLabel::mouseDown, this,
&ChatWidgetHeaderButton::labelMouseDown);
}
@@ -32,14 +32,14 @@ void ChatWidgetHeaderButton::paintEvent(QPaintEvent *)
{
QPainter painter(this);
QBrush brush(ColorScheme::getInstance().IsLightTheme ? QColor(0, 0, 0, 32)
: QColor(255, 255, 255, 32));
QBrush brush(this->colorScheme.isLightTheme() ? QColor(0, 0, 0, 32)
: QColor(255, 255, 255, 32));
if (_mouseDown) {
if (mouseDown) {
painter.fillRect(rect(), brush);
}
if (_mouseOver) {
if (mouseOver) {
painter.fillRect(rect(), brush);
}
}
@@ -47,7 +47,7 @@ void ChatWidgetHeaderButton::paintEvent(QPaintEvent *)
void ChatWidgetHeaderButton::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
_mouseDown = true;
mouseDown = true;
update();
}
@@ -56,7 +56,7 @@ void ChatWidgetHeaderButton::mousePressEvent(QMouseEvent *event)
void ChatWidgetHeaderButton::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
_mouseDown = false;
mouseDown = false;
update();
@@ -66,21 +66,21 @@ void ChatWidgetHeaderButton::mouseReleaseEvent(QMouseEvent *event)
void ChatWidgetHeaderButton::enterEvent(QEvent *)
{
_mouseOver = true;
mouseOver = true;
update();
}
void ChatWidgetHeaderButton::leaveEvent(QEvent *)
{
_mouseOver = false;
mouseOver = false;
update();
}
void ChatWidgetHeaderButton::labelMouseUp()
{
_mouseDown = false;
mouseDown = false;
update();
@@ -89,7 +89,7 @@ void ChatWidgetHeaderButton::labelMouseUp()
void ChatWidgetHeaderButton::labelMouseDown()
{
_mouseDown = true;
mouseDown = true;
update();
}