changes for light mode

This commit is contained in:
fourtf
2018-06-07 17:43:21 +02:00
parent 698814a21f
commit 9b26fce781
16 changed files with 590 additions and 495 deletions
+19 -5
View File
@@ -108,11 +108,7 @@ void SplitInput::initLayout()
void SplitInput::scaleChangedEvent(float scale)
{
// update the icon size of the emote button
QString text = "<img src=':/images/emote.svg' width='xD' height='xD' />";
text.replace("xD", QString::number(int(12 * scale)));
this->ui_.emoteButton->getLabel().setText(text);
this->ui_.emoteButton->setFixedHeight(int(18 * scale));
this->updateEmoteButton();
// set maximum height
this->setMaximumHeight(int(150 * this->getScale()));
@@ -124,11 +120,29 @@ void SplitInput::themeRefreshEvent()
palette.setColor(QPalette::Foreground, this->themeManager->splits.input.text);
this->updateEmoteButton();
this->ui_.textEditLength->setPalette(palette);
this->ui_.textEdit->setStyleSheet(this->themeManager->splits.input.styleSheet);
this->ui_.hbox->setMargin(int((this->themeManager->isLightTheme() ? 4 : 2) * this->getScale()));
this->ui_.emoteButton->getLabel().setStyleSheet("color: #000");
}
void SplitInput::updateEmoteButton()
{
float scale = this->getScale();
QString text = "<img src=':/images/emote.svg' width='xD' height='xD' />";
text.replace("xD", QString::number(int(12 * scale)));
if (this->themeManager->isLightTheme()) {
text.replace("emote", "emote_dark");
}
this->ui_.emoteButton->getLabel().setText(text);
this->ui_.emoteButton->setFixedHeight(int(18 * scale));
}
void SplitInput::installKeyPressedEvent()
+3 -1
View File
@@ -33,6 +33,7 @@ public:
protected:
virtual void scaleChangedEvent(float scale) override;
virtual void themeRefreshEvent() override;
virtual void paintEvent(QPaintEvent *) override;
virtual void resizeEvent(QResizeEvent *) override;
@@ -58,7 +59,8 @@ private:
void initLayout();
void installKeyPressedEvent();
virtual void themeRefreshEvent() override;
void updateEmoteButton();
private slots:
void editTextChanged();
+7 -1
View File
@@ -1,6 +1,8 @@
#include "splitoverlay.hpp"
#include <QEvent>
#include <QGraphicsBlurEffect>
#include <QGraphicsEffect>
#include <QGraphicsOpacityEffect>
#include <QGridLayout>
#include <QPainter>
@@ -90,7 +92,11 @@ SplitOverlay::SplitOverlay(Split *parent)
void SplitOverlay::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.fillRect(this->rect(), QColor(0, 0, 0, 150));
if (this->themeManager->isLightTheme()) {
painter.fillRect(this->rect(), QColor(255, 255, 255, 200));
} else {
painter.fillRect(this->rect(), QColor(0, 0, 0, 150));
}
QRect rect;
switch (this->hoveredElement) {
+10 -2
View File
@@ -418,7 +418,11 @@ void SplitContainer::paintEvent(QPaintEvent *)
painter.drawText(rect(), text, QTextOption(Qt::AlignCenter));
} else {
painter.fillRect(rect(), QColor("#555"));
if (getApp()->themes->isLightTheme()) {
painter.fillRect(rect(), QColor("#999"));
} else {
painter.fillRect(rect(), QColor("#555"));
}
}
for (DropRect &dropRect : this->dropRects) {
@@ -442,7 +446,11 @@ void SplitContainer::paintEvent(QPaintEvent *)
int s = std::min<int>(dropRect.rect.width(), dropRect.rect.height()) - 12;
painter.setPen(QColor(255, 255, 255));
if (this->themeManager->isLightTheme()) {
painter.setPen(QColor(0, 0, 0));
} else {
painter.setPen(QColor(255, 255, 255));
}
painter.drawLine(rect.left() + rect.width() / 2 - (s / 2), rect.top() + rect.height() / 2,
rect.left() + rect.width() / 2 + (s / 2), rect.top() + rect.height() / 2);
painter.drawLine(rect.left() + rect.width() / 2, rect.top() + rect.height() / 2 - (s / 2),
+11 -8
View File
@@ -140,6 +140,13 @@ UserInfoPopup::UserInfoPopup()
this->installEvents();
}
void UserInfoPopup::themeRefreshEvent()
{
BaseWindow::themeRefreshEvent();
this->setStyleSheet("background: #333");
}
void UserInfoPopup::installEvents()
{
std::weak_ptr<bool> hack = this->hack_;
@@ -346,7 +353,7 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
// connect
QObject::connect(
*a, &RippleEffectLabel::clicked, [this, timeout = std::get<1>(item)] {
*a, &RippleEffectLabel::clicked, [ this, timeout = std::get<1>(item) ] {
this->buttonClicked.invoke(std::make_pair(Action::Timeout, timeout));
});
}
@@ -357,17 +364,13 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
addTimeouts("sec", {{"1", 1}});
addTimeouts("min", {
{"1", 1 * 60},
{"5", 5 * 60},
{"10", 10 * 60},
{"1", 1 * 60}, {"5", 5 * 60}, {"10", 10 * 60},
});
addTimeouts("hour", {
{"1", 1 * 60 * 60},
{"4", 4 * 60 * 60},
{"1", 1 * 60 * 60}, {"4", 4 * 60 * 60},
});
addTimeouts("weeks", {
{"1", 1 * 60 * 60 * 30},
{"2", 2 * 60 * 60 * 30},
{"1", 1 * 60 * 60 * 30}, {"2", 2 * 60 * 60 * 30},
});
addButton(Ban, "ban", getApp()->resources->buttons.ban);
+3
View File
@@ -20,6 +20,9 @@ public:
void setData(const QString &name, const ChannelPtr &channel);
protected:
virtual void themeRefreshEvent() override;
private:
bool isMod_;
bool isBroadcaster_;
+13
View File
@@ -0,0 +1,13 @@
#include "welcomedialog.hpp"
namespace chatterino {
namespace widgets {
WelcomeDialog::WelcomeDialog()
: BaseWindow(nullptr, BaseWindow::EnableCustomFrame)
{
this->setWindowTitle("Chatterino quick setup");
}
} // namespace widgets
} // namespace chatterino
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include "widgets/basewindow.hpp"
namespace chatterino {
namespace widgets {
class WelcomeDialog : public BaseWindow
{
public:
WelcomeDialog();
};
} // namespace widgets
} // namespace chatterino
+7
View File
@@ -13,6 +13,7 @@
#include "widgets/notebook.hpp"
#include "widgets/settingsdialog.hpp"
#include "widgets/split.hpp"
#include "widgets/welcomedialog.hpp"
#include <QApplication>
#include <QHeaderView>
@@ -146,6 +147,12 @@ Window::Window(WindowType _type)
const auto &msg = messages[index++ % messages.size()];
app->twitch.server->addFakeMessage(msg);
});
CreateWindowShortcut(this, "F9", [=] {
auto *dialog = new WelcomeDialog();
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
});
#endif
this->refreshWindowTitle("");