2018-01-14 21:55:36 +01:00
|
|
|
#include "basewindow.hpp"
|
|
|
|
|
|
|
|
#include "singletons/settingsmanager.hpp"
|
|
|
|
#include "util/nativeeventhelper.hpp"
|
2018-02-05 23:32:38 +01:00
|
|
|
#include "widgets/helper/rippleeffectlabel.hpp"
|
2018-01-14 21:55:36 +01:00
|
|
|
#include "widgets/tooltipwidget.hpp"
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
#include <QApplication>
|
2018-01-14 21:55:36 +01:00
|
|
|
#include <QDebug>
|
2018-01-22 20:52:32 +01:00
|
|
|
#include <QDesktopWidget>
|
2018-01-14 21:55:36 +01:00
|
|
|
#include <QIcon>
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
#ifdef USEWINSDK
|
|
|
|
#include <dwmapi.h>
|
|
|
|
#include <gdiplus.h>
|
|
|
|
#include <objidl.h>
|
2018-01-14 21:59:45 +01:00
|
|
|
#include <windows.h>
|
2018-01-15 01:35:35 +01:00
|
|
|
#include <windowsx.h>
|
|
|
|
#pragma comment(lib, "Dwmapi.lib")
|
|
|
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
|
|
#define WM_DPICHANGED 0x02E0
|
|
|
|
#endif
|
2018-01-14 21:59:45 +01:00
|
|
|
|
2018-01-24 20:27:56 +01:00
|
|
|
#include "widgets/helper/titlebarbutton.hpp"
|
2018-01-15 04:08:48 +01:00
|
|
|
|
2018-01-14 21:55:36 +01:00
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
BaseWindow::BaseWindow(singletons::ThemeManager &_themeManager, QWidget *parent,
|
|
|
|
bool _enableCustomFrame)
|
|
|
|
: BaseWidget(_themeManager, parent, Qt::Window)
|
|
|
|
, enableCustomFrame(_enableCustomFrame)
|
2018-01-14 21:55:36 +01:00
|
|
|
{
|
|
|
|
this->init();
|
|
|
|
}
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
BaseWindow::BaseWindow(BaseWidget *parent, bool _enableCustomFrame)
|
|
|
|
: BaseWidget(parent, Qt::Window)
|
|
|
|
, enableCustomFrame(_enableCustomFrame)
|
2018-01-14 21:55:36 +01:00
|
|
|
{
|
|
|
|
this->init();
|
|
|
|
}
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
BaseWindow::BaseWindow(QWidget *parent, bool _enableCustomFrame)
|
2018-01-25 20:49:49 +01:00
|
|
|
: BaseWidget(singletons::ThemeManager::getInstance(), parent, Qt::Window)
|
2018-01-15 01:35:35 +01:00
|
|
|
, enableCustomFrame(_enableCustomFrame)
|
2018-01-14 21:55:36 +01:00
|
|
|
{
|
|
|
|
this->init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::init()
|
|
|
|
{
|
|
|
|
this->setWindowIcon(QIcon(":/images/icon.png"));
|
|
|
|
|
|
|
|
#ifdef USEWINSDK
|
2018-01-15 01:35:35 +01:00
|
|
|
if (this->hasCustomWindowFrame()) {
|
|
|
|
// CUSTOM WINDOW FRAME
|
2018-01-25 20:49:49 +01:00
|
|
|
QVBoxLayout *layout = new QVBoxLayout();
|
2018-01-15 01:35:35 +01:00
|
|
|
layout->setMargin(1);
|
2018-01-24 15:08:22 +01:00
|
|
|
layout->setSpacing(0);
|
2018-01-15 01:35:35 +01:00
|
|
|
this->setLayout(layout);
|
|
|
|
{
|
2018-01-25 20:49:49 +01:00
|
|
|
QHBoxLayout *buttonLayout = this->titlebarBox = new QHBoxLayout();
|
2018-01-24 15:08:22 +01:00
|
|
|
buttonLayout->setMargin(0);
|
|
|
|
layout->addLayout(buttonLayout);
|
2018-01-15 01:35:35 +01:00
|
|
|
|
|
|
|
// title
|
2018-01-24 15:08:22 +01:00
|
|
|
QLabel *title = new QLabel(" Chatterino");
|
|
|
|
buttonLayout->addWidget(title);
|
|
|
|
this->titleLabel = title;
|
2018-01-15 01:35:35 +01:00
|
|
|
|
|
|
|
// buttons
|
2018-01-24 20:27:56 +01:00
|
|
|
TitleBarButton *_minButton = new TitleBarButton;
|
2018-01-25 21:11:14 +01:00
|
|
|
_minButton->setScaleIndependantSize(46, 30);
|
2018-01-24 20:27:56 +01:00
|
|
|
_minButton->setButtonStyle(TitleBarButton::Minimize);
|
|
|
|
TitleBarButton *_maxButton = new TitleBarButton;
|
2018-01-25 21:11:14 +01:00
|
|
|
_maxButton->setScaleIndependantSize(46, 30);
|
2018-01-24 20:27:56 +01:00
|
|
|
_maxButton->setButtonStyle(TitleBarButton::Maximize);
|
|
|
|
TitleBarButton *_exitButton = new TitleBarButton;
|
2018-01-25 21:11:14 +01:00
|
|
|
_exitButton->setScaleIndependantSize(46, 30);
|
2018-01-24 20:27:56 +01:00
|
|
|
_exitButton->setButtonStyle(TitleBarButton::Close);
|
|
|
|
|
|
|
|
QObject::connect(_minButton, &TitleBarButton::clicked, this, [this] {
|
2018-01-24 15:08:22 +01:00
|
|
|
this->setWindowState(Qt::WindowMinimized | this->windowState());
|
|
|
|
});
|
2018-01-24 20:27:56 +01:00
|
|
|
QObject::connect(_maxButton, &TitleBarButton::clicked, this, [this] {
|
2018-01-24 15:08:22 +01:00
|
|
|
this->setWindowState(this->windowState() == Qt::WindowMaximized
|
|
|
|
? Qt::WindowActive
|
|
|
|
: Qt::WindowMaximized);
|
|
|
|
});
|
2018-01-24 20:27:56 +01:00
|
|
|
QObject::connect(_exitButton, &TitleBarButton::clicked, this,
|
|
|
|
[this] { this->close(); });
|
2018-01-24 15:08:22 +01:00
|
|
|
|
2018-01-24 20:27:56 +01:00
|
|
|
this->minButton = _minButton;
|
|
|
|
this->maxButton = _maxButton;
|
|
|
|
this->exitButton = _exitButton;
|
2018-01-15 01:35:35 +01:00
|
|
|
|
2018-01-24 20:27:56 +01:00
|
|
|
this->buttons.push_back(_minButton);
|
|
|
|
this->buttons.push_back(_maxButton);
|
|
|
|
this->buttons.push_back(_exitButton);
|
2018-01-15 01:35:35 +01:00
|
|
|
|
2018-01-24 15:08:22 +01:00
|
|
|
buttonLayout->addStretch(1);
|
2018-01-24 20:27:56 +01:00
|
|
|
buttonLayout->addWidget(_minButton);
|
|
|
|
buttonLayout->addWidget(_maxButton);
|
|
|
|
buttonLayout->addWidget(_exitButton);
|
2018-01-24 15:08:22 +01:00
|
|
|
buttonLayout->setSpacing(0);
|
2018-01-15 01:35:35 +01:00
|
|
|
}
|
2018-01-25 20:49:49 +01:00
|
|
|
this->layoutBase = new BaseWidget(this);
|
2018-01-15 01:35:35 +01:00
|
|
|
layout->addWidget(this->layoutBase);
|
|
|
|
}
|
|
|
|
|
|
|
|
// DPI
|
2018-01-14 21:55:36 +01:00
|
|
|
auto dpi = util::getWindowDpi(this->winId());
|
|
|
|
|
|
|
|
if (dpi) {
|
2018-01-25 20:49:49 +01:00
|
|
|
this->scale = dpi.value() / 96.f;
|
2018-01-14 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
this->scaleChangedEvent(this->scale);
|
2018-01-14 21:55:36 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (singletons::SettingManager::getInstance().windowTopMost.getValue()) {
|
|
|
|
this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-22 20:52:32 +01:00
|
|
|
void BaseWindow::setStayInScreenRect(bool value)
|
|
|
|
{
|
|
|
|
this->stayInScreenRect = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::getStayInScreenRect() const
|
|
|
|
{
|
|
|
|
return this->stayInScreenRect;
|
|
|
|
}
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
QWidget *BaseWindow::getLayoutContainer()
|
|
|
|
{
|
2018-01-15 04:08:48 +01:00
|
|
|
if (this->hasCustomWindowFrame()) {
|
2018-01-15 01:35:35 +01:00
|
|
|
return this->layoutBase;
|
|
|
|
} else {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::hasCustomWindowFrame()
|
|
|
|
{
|
2018-04-02 11:46:56 +02:00
|
|
|
#ifdef USEWINSDK
|
2018-01-24 15:08:22 +01:00
|
|
|
return this->enableCustomFrame;
|
2018-01-15 01:35:35 +01:00
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
void BaseWindow::themeRefreshEvent()
|
2018-01-15 01:35:35 +01:00
|
|
|
{
|
2018-02-05 21:33:22 +01:00
|
|
|
if (this->enableCustomFrame) {
|
|
|
|
QPalette palette;
|
|
|
|
palette.setColor(QPalette::Background, this->themeManager.windowBg);
|
|
|
|
palette.setColor(QPalette::Foreground, this->themeManager.windowText);
|
|
|
|
this->setPalette(palette);
|
|
|
|
|
|
|
|
for (RippleEffectButton *button : this->buttons) {
|
|
|
|
button->setMouseEffectColor(this->themeManager.windowText);
|
|
|
|
}
|
2018-01-24 15:08:22 +01:00
|
|
|
}
|
2018-01-15 01:35:35 +01:00
|
|
|
}
|
|
|
|
|
2018-01-24 20:27:56 +01:00
|
|
|
void BaseWindow::addTitleBarButton(const TitleBarButton::Style &style,
|
|
|
|
std::function<void()> onClicked)
|
2018-01-15 01:35:35 +01:00
|
|
|
{
|
2018-01-24 20:27:56 +01:00
|
|
|
TitleBarButton *button = new TitleBarButton;
|
2018-01-25 21:11:14 +01:00
|
|
|
button->setScaleIndependantSize(30, 30);
|
2018-01-24 20:27:56 +01:00
|
|
|
|
|
|
|
this->buttons.push_back(button);
|
|
|
|
this->titlebarBox->insertWidget(2, button);
|
|
|
|
button->setButtonStyle(style);
|
|
|
|
|
|
|
|
QObject::connect(button, &TitleBarButton::clicked, this, [onClicked] { onClicked(); });
|
2018-01-15 01:35:35 +01:00
|
|
|
}
|
|
|
|
|
2018-02-05 23:32:38 +01:00
|
|
|
RippleEffectLabel *BaseWindow::addTitleBarLabel(std::function<void()> onClicked)
|
|
|
|
{
|
|
|
|
RippleEffectLabel *button = new RippleEffectLabel;
|
|
|
|
button->setScaleIndependantHeight(30);
|
|
|
|
|
|
|
|
this->buttons.push_back(button);
|
|
|
|
this->titlebarBox->insertWidget(2, button);
|
|
|
|
|
|
|
|
QObject::connect(button, &RippleEffectLabel::clicked, this, [onClicked] { onClicked(); });
|
|
|
|
|
|
|
|
return button;
|
|
|
|
}
|
|
|
|
|
2018-01-14 21:55:36 +01:00
|
|
|
void BaseWindow::changeEvent(QEvent *)
|
|
|
|
{
|
2018-01-22 20:52:32 +01:00
|
|
|
TooltipWidget::getInstance()->hide();
|
2018-01-24 20:27:56 +01:00
|
|
|
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
if (this->hasCustomWindowFrame()) {
|
|
|
|
this->maxButton->setButtonStyle(this->windowState() & Qt::WindowMaximized
|
|
|
|
? TitleBarButton::Unmaximize
|
|
|
|
: TitleBarButton::Maximize);
|
|
|
|
}
|
|
|
|
#endif
|
2018-01-14 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::leaveEvent(QEvent *)
|
|
|
|
{
|
2018-01-22 20:52:32 +01:00
|
|
|
TooltipWidget::getInstance()->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::moveTo(QWidget *parent, QPoint point)
|
|
|
|
{
|
|
|
|
point.rx() += 16;
|
|
|
|
point.ry() += 16;
|
|
|
|
|
|
|
|
this->move(point);
|
|
|
|
this->moveIntoDesktopRect(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::resizeEvent(QResizeEvent *)
|
|
|
|
{
|
|
|
|
this->moveIntoDesktopRect(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::moveIntoDesktopRect(QWidget *parent)
|
|
|
|
{
|
|
|
|
if (!this->stayInScreenRect)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// move the widget into the screen geometry if it's not already in there
|
|
|
|
QDesktopWidget *desktop = QApplication::desktop();
|
|
|
|
|
|
|
|
QRect s = desktop->screenGeometry(parent);
|
|
|
|
QPoint p = this->pos();
|
|
|
|
|
|
|
|
if (p.x() < s.left()) {
|
|
|
|
p.setX(s.left());
|
|
|
|
}
|
|
|
|
if (p.y() < s.top()) {
|
|
|
|
p.setY(s.top());
|
|
|
|
}
|
|
|
|
if (p.x() + this->width() > s.right()) {
|
|
|
|
p.setX(s.right() - this->width());
|
|
|
|
}
|
|
|
|
if (p.y() + this->height() > s.bottom()) {
|
|
|
|
p.setY(s.bottom() - this->height());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p != this->pos())
|
|
|
|
this->move(p);
|
2018-01-14 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
bool BaseWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
|
|
|
{
|
2018-01-14 21:59:45 +01:00
|
|
|
MSG *msg = reinterpret_cast<MSG *>(message);
|
2018-01-14 21:55:36 +01:00
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
switch (msg->message) {
|
|
|
|
case WM_DPICHANGED: {
|
|
|
|
int dpi = HIWORD(msg->wParam);
|
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
float oldScale = this->scale;
|
|
|
|
float _scale = dpi / 96.f;
|
|
|
|
float resizeScale = _scale / oldScale;
|
2018-01-15 01:35:35 +01:00
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
this->resize(static_cast<int>(this->width() * resizeScale),
|
|
|
|
static_cast<int>(this->height() * resizeScale));
|
2018-01-15 01:35:35 +01:00
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
this->setScale(_scale);
|
2018-01-15 01:35:35 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case WM_NCCALCSIZE: {
|
|
|
|
if (this->hasCustomWindowFrame()) {
|
|
|
|
// this kills the window frame and title bar we added with
|
|
|
|
// WS_THICKFRAME and WS_CAPTION
|
|
|
|
*result = 0;
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return QWidget::nativeEvent(eventType, message, result);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case WM_NCHITTEST: {
|
|
|
|
if (this->hasCustomWindowFrame()) {
|
|
|
|
*result = 0;
|
|
|
|
const LONG border_width = 8; // in pixels
|
|
|
|
RECT winrect;
|
|
|
|
GetWindowRect((HWND)winId(), &winrect);
|
2018-01-14 21:55:36 +01:00
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
long x = GET_X_LPARAM(msg->lParam);
|
|
|
|
long y = GET_Y_LPARAM(msg->lParam);
|
2018-01-14 21:55:36 +01:00
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
bool resizeWidth = minimumWidth() != maximumWidth();
|
|
|
|
bool resizeHeight = minimumHeight() != maximumHeight();
|
2018-01-14 21:55:36 +01:00
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
if (resizeWidth) {
|
|
|
|
// left border
|
|
|
|
if (x >= winrect.left && x < winrect.left + border_width) {
|
|
|
|
*result = HTLEFT;
|
|
|
|
}
|
|
|
|
// right border
|
|
|
|
if (x < winrect.right && x >= winrect.right - border_width) {
|
|
|
|
*result = HTRIGHT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (resizeHeight) {
|
|
|
|
// bottom border
|
|
|
|
if (y < winrect.bottom && y >= winrect.bottom - border_width) {
|
|
|
|
*result = HTBOTTOM;
|
|
|
|
}
|
|
|
|
// top border
|
|
|
|
if (y >= winrect.top && y < winrect.top + border_width) {
|
|
|
|
*result = HTTOP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (resizeWidth && resizeHeight) {
|
|
|
|
// bottom left corner
|
|
|
|
if (x >= winrect.left && x < winrect.left + border_width &&
|
|
|
|
y < winrect.bottom && y >= winrect.bottom - border_width) {
|
|
|
|
*result = HTBOTTOMLEFT;
|
|
|
|
}
|
|
|
|
// bottom right corner
|
|
|
|
if (x < winrect.right && x >= winrect.right - border_width &&
|
|
|
|
y < winrect.bottom && y >= winrect.bottom - border_width) {
|
|
|
|
*result = HTBOTTOMRIGHT;
|
|
|
|
}
|
|
|
|
// top left corner
|
|
|
|
if (x >= winrect.left && x < winrect.left + border_width && y >= winrect.top &&
|
|
|
|
y < winrect.top + border_width) {
|
|
|
|
*result = HTTOPLEFT;
|
|
|
|
}
|
|
|
|
// top right corner
|
|
|
|
if (x < winrect.right && x >= winrect.right - border_width &&
|
|
|
|
y >= winrect.top && y < winrect.top + border_width) {
|
|
|
|
*result = HTTOPRIGHT;
|
|
|
|
}
|
|
|
|
}
|
2018-01-14 21:59:45 +01:00
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
if (*result == 0) {
|
|
|
|
bool client = false;
|
|
|
|
|
|
|
|
QPoint point(x - winrect.left, y - winrect.top);
|
2018-01-24 15:08:22 +01:00
|
|
|
for (QWidget *widget : this->buttons) {
|
2018-01-15 01:35:35 +01:00
|
|
|
if (widget->geometry().contains(point)) {
|
|
|
|
client = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-24 15:08:22 +01:00
|
|
|
if (this->layoutBase->geometry().contains(point)) {
|
|
|
|
client = true;
|
|
|
|
}
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
if (client) {
|
|
|
|
*result = HTCLIENT;
|
|
|
|
} else {
|
|
|
|
*result = HTCAPTION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return QWidget::nativeEvent(eventType, message, result);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
} // end case WM_NCHITTEST
|
|
|
|
case WM_CLOSE: {
|
2018-01-24 15:08:22 +01:00
|
|
|
// if (this->enableCustomFrame) {
|
|
|
|
// this->close();
|
|
|
|
// }
|
|
|
|
return QWidget::nativeEvent(eventType, message, result);
|
2018-01-15 01:35:35 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return QWidget::nativeEvent(eventType, message, result);
|
2018-01-14 21:55:36 +01:00
|
|
|
}
|
2018-01-15 01:35:35 +01:00
|
|
|
}
|
2018-01-14 21:55:36 +01:00
|
|
|
|
2018-01-24 15:08:22 +01:00
|
|
|
void BaseWindow::showEvent(QShowEvent *event)
|
2018-01-15 01:35:35 +01:00
|
|
|
{
|
2018-01-24 15:08:22 +01:00
|
|
|
if (!this->shown && this->isVisible() && this->hasCustomWindowFrame()) {
|
|
|
|
this->shown = true;
|
2018-01-15 01:35:35 +01:00
|
|
|
SetWindowLongPtr((HWND)this->winId(), GWL_STYLE,
|
|
|
|
WS_POPUP | WS_CAPTION | WS_THICKFRAME | WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
|
|
|
|
|
|
|
|
const MARGINS shadow = {1, 1, 1, 1};
|
|
|
|
DwmExtendFrameIntoClientArea((HWND)this->winId(), &shadow);
|
|
|
|
|
|
|
|
SetWindowPos((HWND)this->winId(), 0, 0, 0, 0, 0,
|
|
|
|
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
|
|
|
}
|
2018-01-24 15:08:22 +01:00
|
|
|
|
|
|
|
BaseWidget::showEvent(event);
|
2018-01-15 01:35:35 +01:00
|
|
|
}
|
2018-01-14 21:59:45 +01:00
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
void BaseWindow::paintEvent(QPaintEvent *event)
|
|
|
|
{
|
|
|
|
if (this->hasCustomWindowFrame()) {
|
2018-01-24 21:44:31 +01:00
|
|
|
BaseWidget::paintEvent(event);
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
QPainter painter(this);
|
|
|
|
|
|
|
|
bool windowFocused = this->window() == QApplication::activeWindow();
|
|
|
|
|
2018-01-24 15:08:22 +01:00
|
|
|
QLinearGradient gradient(0, 0, 10, 250);
|
|
|
|
gradient.setColorAt(1, this->themeManager.tabs.selected.backgrounds.unfocused.color());
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
if (windowFocused) {
|
2018-01-24 15:08:22 +01:00
|
|
|
gradient.setColorAt(.4, this->themeManager.tabs.selected.backgrounds.regular.color());
|
2018-01-15 01:35:35 +01:00
|
|
|
} else {
|
2018-01-24 15:08:22 +01:00
|
|
|
gradient.setColorAt(.4, this->themeManager.tabs.selected.backgrounds.unfocused.color());
|
2018-01-15 01:35:35 +01:00
|
|
|
}
|
2018-01-24 15:08:22 +01:00
|
|
|
painter.setPen(QPen(QBrush(gradient), 1));
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
painter.drawRect(0, 0, this->width() - 1, this->height() - 1);
|
|
|
|
}
|
|
|
|
}
|
2018-01-14 21:55:36 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|