Remove a bunch of hardcoded colors

- Try to start using standard Qt themes instead of hardcoded colors
- This revision looks really ugly, but it technically follows your
Qt theme
This commit is contained in:
vurpo 2017-09-30 00:50:33 +03:00 committed by Max Sandholm
parent 4166a863b4
commit b1beb323d2
12 changed files with 73 additions and 67 deletions

View File

@ -49,7 +49,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent)
: QWidget(parent)
, client_(client)
{
setStyleSheet("background-color: #fff;");
// setStyleSheet("background-color: #fff;");
topLayout_ = new QHBoxLayout(this);
topLayout_->setSpacing(0);
@ -544,7 +544,7 @@ ChatPage::showQuickSwitcher()
new OverlayModal(MainWindow::instance(), quickSwitcher_.data()),
[=](OverlayModal *modal) { modal->deleteLater(); });
quickSwitcherModal_->setDuration(0);
quickSwitcherModal_->setColor(QColor(30, 30, 30, 170));
// quickSwitcherModal_->setColor(QColor(30, 30, 30, 170));
}
QMap<QString, QString> rooms;

View File

@ -32,13 +32,18 @@ EmojiPanel::EmojiPanel(QWidget *parent)
, animationDuration_{100}
, categoryIconSize_{20}
{
setStyleSheet("QWidget {background: #fff; color: #e8e8e8; border: none;}"
"QScrollBar:vertical { background-color: #fff; width: 8px; margin: 0px "
"2px 0 2px; }"
"QScrollBar::handle:vertical { background-color: #d6dde3; min-height: "
"20px; }"
"QScrollBar::add-line:vertical { border: none; background: none; }"
"QScrollBar::sub-line:vertical { border: none; background: none; }");
// setStyleSheet(
// "QWidget {background: #fff; color: #e8e8e8; border: none;}"
// "QScrollBar:vertical { background-color: #fff; width: 8px; margin: 0px 2px 0 2px; }"
// "QScrollBar::handle:vertical { background-color: #d6dde3; min-height: 20px; }"
// "QScrollBar::add-line:vertical { border: none; background: none; }"
// "QScrollBar::sub-line:vertical { border: none; background: none; }");
setStyleSheet(
"QWidget {border: none;}"
"QScrollBar:vertical { width: 8px; margin: 0px 2px 0 2px; }"
"QScrollBar::handle:vertical { min-height: 20px; }"
"QScrollBar::add-line:vertical { border: none; background: none; }"
"QScrollBar::sub-line:vertical { border: none; background: none; }");
setAttribute(Qt::WA_TranslucentBackground, true);
setAttribute(Qt::WA_ShowWithoutActivating, true);
@ -55,7 +60,7 @@ EmojiPanel::EmojiPanel(QWidget *parent)
contentLayout->setMargin(0);
auto emojiCategories = new QFrame(mainWidget);
emojiCategories->setStyleSheet("background-color: #f2f2f2");
//emojiCategories->setStyleSheet("background-color: #f2f2f2");
auto categoriesLayout = new QHBoxLayout(emojiCategories);
categoriesLayout->setSpacing(6);

View File

@ -30,7 +30,7 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent)
, inferredServerAddress_()
, client_{client}
{
setStyleSheet("background-color: #fff");
// setStyleSheet("background-color: #fff");
top_layout_ = new QVBoxLayout();
@ -40,7 +40,7 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent)
back_button_ = new FlatButton(this);
back_button_->setMinimumSize(QSize(30, 30));
back_button_->setForegroundColor("#333333");
//back_button_->setForegroundColor("#333333");
top_bar_layout_->addWidget(back_button_, 0, Qt::AlignLeft | Qt::AlignVCenter);
top_bar_layout_->addStretch(1);
@ -75,10 +75,10 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent)
form_wrapper_->addStretch(1);
matrixid_input_ = new TextField(this);
matrixid_input_->setTextColor("#333333");
// matrixid_input_->setTextColor("#333333");
matrixid_input_->setLabel(tr("Matrix ID"));
matrixid_input_->setInkColor("#555459");
matrixid_input_->setBackgroundColor("#fff");
// matrixid_input_->setInkColor("#555459");
// matrixid_input_->setBackgroundColor("#fff");
matrixid_input_->setPlaceholderText(tr("e.g @joe:matrix.org"));
spinner_ = new LoadingIndicator(this);
@ -95,17 +95,17 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent)
matrixidLayout_->addWidget(matrixid_input_, 0, Qt::AlignVCenter);
password_input_ = new TextField(this);
password_input_->setTextColor("#333333");
// password_input_->setTextColor("#333333");
password_input_->setLabel(tr("Password"));
password_input_->setInkColor("#555459");
password_input_->setBackgroundColor("#fff");
// password_input_->setInkColor("#555459");
// password_input_->setBackgroundColor("#fff");
password_input_->setEchoMode(QLineEdit::Password);
serverInput_ = new TextField(this);
serverInput_->setTextColor("#333333");
// serverInput_->setTextColor("#333333");
serverInput_->setLabel("Homeserver address");
serverInput_->setInkColor("#555459");
serverInput_->setBackgroundColor("#fff");
// serverInput_->setInkColor("#555459");
// serverInput_->setBackgroundColor("#fff");
serverInput_->setPlaceholderText("matrix.org");
serverInput_->hide();
@ -121,8 +121,8 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent)
button_layout_->setContentsMargins(0, 0, 0, 30);
login_button_ = new RaisedButton(tr("LOGIN"), this);
login_button_->setBackgroundColor(QColor("#333333"));
login_button_->setForegroundColor(QColor("white"));
// login_button_->setBackgroundColor(QColor("#333333"));
// login_button_->setForegroundColor(QColor("white"));
login_button_->setMinimumSize(350, 65);
login_button_->setFontSize(20);
login_button_->setCornerRadius(3);
@ -136,7 +136,7 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent)
error_label_ = new QLabel(this);
error_label_->setFont(font);
error_label_->setStyleSheet("color: #E22826");
// error_label_->setStyleSheet("color: #E22826");
top_layout_->addLayout(top_bar_layout_);
top_layout_->addStretch(1);

View File

@ -27,7 +27,7 @@ LogoutDialog::LogoutDialog(QWidget *parent)
: QFrame(parent)
{
setMaximumSize(400, 400);
setStyleSheet("background-color: #fff");
// setStyleSheet("background-color: #fff");
auto layout = new QVBoxLayout(this);
layout->setSpacing(30);
@ -52,7 +52,7 @@ LogoutDialog::LogoutDialog(QWidget *parent)
auto label = new QLabel(tr("Logout. Are you sure?"), this);
label->setFont(font);
label->setStyleSheet("color: #333333");
// label->setStyleSheet("color: #333333");
layout->addWidget(label);
layout->addLayout(buttonLayout);

View File

@ -43,7 +43,7 @@ MainWindow::MainWindow(QWidget *parent)
{
setWindowTitle("nheko");
setObjectName("MainWindow");
setStyleSheet("QWidget#MainWindow {background-color: #fff}");
// setStyleSheet("QWidget#MainWindow {background-color: #fff}");
restoreWindowSize();
@ -204,7 +204,7 @@ MainWindow::showChatPage(QString userid, QString homeserver, QString token)
spinner_ = QSharedPointer<LoadingIndicator>(
new LoadingIndicator(this),
[=](LoadingIndicator *indicator) { indicator->deleteLater(); });
spinner_->setColor("#acc7dc");
// spinner_->setColor("#acc7dc");
spinner_->setFixedHeight(100);
spinner_->setFixedWidth(100);
spinner_->start();

View File

@ -28,7 +28,7 @@ RegisterPage::RegisterPage(QSharedPointer<MatrixClient> client, QWidget *parent)
: QWidget(parent)
, client_(client)
{
setStyleSheet("background-color: #fff");
// setStyleSheet("background-color: #fff");
top_layout_ = new QVBoxLayout();
@ -73,30 +73,30 @@ RegisterPage::RegisterPage(QSharedPointer<MatrixClient> client, QWidget *parent)
form_wrapper_->addStretch(1);
username_input_ = new TextField();
username_input_->setTextColor("#333333");
// username_input_->setTextColor("#333333");
username_input_->setLabel(tr("Username"));
username_input_->setInkColor("#555459");
username_input_->setBackgroundColor("#fff");
// username_input_->setInkColor("#555459");
// username_input_->setBackgroundColor("#fff");
password_input_ = new TextField();
password_input_->setTextColor("#333333");
// password_input_->setTextColor("#333333");
password_input_->setLabel(tr("Password"));
password_input_->setInkColor("#555459");
password_input_->setBackgroundColor("#fff");
// password_input_->setInkColor("#555459");
// password_input_->setBackgroundColor("#fff");
password_input_->setEchoMode(QLineEdit::Password);
password_confirmation_ = new TextField();
password_confirmation_->setTextColor("#333333");
// password_confirmation_->setTextColor("#333333");
password_confirmation_->setLabel(tr("Password confirmation"));
password_confirmation_->setInkColor("#555459");
password_confirmation_->setBackgroundColor("#fff");
// password_confirmation_->setInkColor("#555459");
// password_confirmation_->setBackgroundColor("#fff");
password_confirmation_->setEchoMode(QLineEdit::Password);
server_input_ = new TextField();
server_input_->setTextColor("#333333");
// server_input_->setTextColor("#333333");
server_input_->setLabel(tr("Home Server"));
server_input_->setInkColor("#555459");
server_input_->setBackgroundColor("#fff");
// server_input_->setInkColor("#555459");
// server_input_->setBackgroundColor("#fff");
form_layout_->addWidget(username_input_, Qt::AlignHCenter, 0);
form_layout_->addWidget(password_input_, Qt::AlignHCenter, 0);
@ -112,11 +112,11 @@ RegisterPage::RegisterPage(QSharedPointer<MatrixClient> client, QWidget *parent)
error_label_ = new QLabel(this);
error_label_->setFont(font);
error_label_->setStyleSheet("color: #E22826");
// error_label_->setStyleSheet("color: #E22826");
register_button_ = new RaisedButton(tr("REGISTER"), this);
register_button_->setBackgroundColor(QColor("#333333"));
register_button_->setForegroundColor(QColor("white"));
// register_button_->setBackgroundColor(QColor("#333333"));
// register_button_->setForegroundColor(QColor("white"));
register_button_->setMinimumSize(350, 65);
register_button_->setFontSize(conf::btn::fontSize);
register_button_->setCornerRadius(conf::btn::cornerRadius);

View File

@ -95,12 +95,12 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.setRenderHint(QPainter::Antialiasing);
if (isPressed_)
p.fillRect(rect(), QColor("#38A3D8"));
else if (underMouse())
p.fillRect(rect(), QColor(200, 200, 200, 128));
else
p.fillRect(rect(), QColor("#FFF"));
// if (isPressed_)
// p.fillRect(rect(), QColor("#38A3D8"));
// else if (underMouse())
// p.fillRect(rect(), QColor(200, 200, 200, 128));
// else
// p.fillRect(rect(), QColor("#FFF"));
QFont font;
font.setPixelSize(conf::fontSize);

View File

@ -173,7 +173,6 @@ TextInputWidget::TextInputWidget(QWidget *parent)
setFixedHeight(conf::textInput::height);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
setCursor(Qt::ArrowCursor);
setStyleSheet("background-color: #fff;");
topLayout_ = new QHBoxLayout();
topLayout_->setSpacing(0);
@ -199,9 +198,13 @@ TextInputWidget::TextInputWidget(QWidget *parent)
input_->setFont(font);
input_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
input_->setPlaceholderText(tr("Write a message..."));
input_->setStyleSheet("color: #333333; border: none; padding-top: 5px; margin: 0 5px");
input_->setStyleSheet("border: none; padding-top: 5px; margin: 0 5px");
sendMessageBtn_ = new FlatButton(this);
<<<<<<< HEAD
=======
// sendMessageBtn_->setForegroundColor(QColor("#acc7dc"));
>>>>>>> Remove a bunch of hardcoded colors
QIcon send_message_icon;
send_message_icon.addFile(":/icons/icons/ui/cursor.png");

View File

@ -30,7 +30,7 @@
#include "TimelineViewManager.h"
static const QRegExp URL_REGEX("((?:https?|ftp)://\\S+)");
static const QString URL_HTML = "<a href=\"\\1\" style=\"color: #333333\">\\1</a>";
static const QString URL_HTML = "<a href=\"\\1\">\\1</a>";
namespace events = matrix::events;
namespace msgs = matrix::events::messages;
@ -205,7 +205,7 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Notice> &event,
body.replace(URL_REGEX, URL_HTML);
body.replace("\n", "<br/>");
body = "<i style=\"color: #565E5E\">" + body + "</i>";
body = "<i>" + body + "</i>";
if (with_sender) {
auto displayName = TimelineViewManager::displayName(event.sender());
@ -308,7 +308,7 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Text> &event,
void
TimelineItem::generateBody(const QString &body)
{
QString content("<span style=\"color: black;\"> %1 </span>");
QString content("<span> %1 </span>");
body_ = new QLabel(this);
body_->setFont(font_);
@ -332,8 +332,8 @@ TimelineItem::generateBody(const QString &userid, const QString &body)
sender = userid.split(":")[0].split("@")[1];
}
QString userContent("<span style=\"color: #171717\"> %1 </span>");
QString bodyContent("<span style=\"color: #171717;\"> %1 </span>");
QString userContent("<span> %1 </span>");
QString bodyContent("<span> %1 </span>");
QFont usernameFont = font_;
usernameFont.setBold(true);
@ -357,7 +357,7 @@ TimelineItem::generateBody(const QString &userid, const QString &body)
void
TimelineItem::generateTimestamp(const QDateTime &time)
{
QString msg("<span style=\"color: #5d6565;\"> %1 </span>");
QString msg("<span> %1 </span>");
QFont timestampFont;
timestampFont.setPixelSize(conf::timeline::fonts::timestamp);
@ -399,8 +399,8 @@ TimelineItem::setupAvatarLayout(const QString &userName)
userAvatar_ = new Avatar(this);
userAvatar_->setLetter(QChar(userName[0]).toUpper());
userAvatar_->setBackgroundColor(QColor("#eee"));
userAvatar_->setTextColor(QColor("black"));
// userAvatar_->setBackgroundColor(QColor("#eee"));
// userAvatar_->setTextColor(QColor("black"));
userAvatar_->setSize(conf::timeline::avatarSize);
// TODO: The provided user name should be a UserId class

View File

@ -41,8 +41,6 @@ TopRoomBar::TopRoomBar(QWidget *parent)
avatar_ = new Avatar(this);
avatar_->setLetter(QChar('?'));
avatar_->setBackgroundColor(QColor("#d6dde3"));
avatar_->setTextColor(QColor("#555459"));
avatar_->setSize(35);
textLayout_ = new QVBoxLayout();

View File

@ -45,15 +45,15 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
userAvatar_ = new Avatar(this);
userAvatar_->setLetter(QChar('?'));
userAvatar_->setSize(55);
userAvatar_->setBackgroundColor("#fff");
userAvatar_->setTextColor("#333333");
// userAvatar_->setBackgroundColor("#fff");
// userAvatar_->setTextColor("#333333");
QFont nameFont("Open Sans SemiBold");
nameFont.setPixelSize(conf::userInfoWidget::fonts::displayName);
displayNameLabel_ = new QLabel(this);
displayNameLabel_->setFont(nameFont);
displayNameLabel_->setStyleSheet("padding: 0 9px; color: #171919; margin-bottom: -10px;");
displayNameLabel_->setStyleSheet("padding: 0 9px; margin-bottom: -10px;");
displayNameLabel_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop);
QFont useridFont("Open Sans");
@ -61,7 +61,7 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
userIdLabel_ = new QLabel(this);
userIdLabel_->setFont(useridFont);
userIdLabel_->setStyleSheet("padding: 0 8px 8px 8px; color: #555459;");
userIdLabel_->setStyleSheet("padding: 0 8px 8px 8px;");
userIdLabel_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
avatarLayout_->addWidget(userAvatar_);

View File

@ -176,7 +176,7 @@ Badge::paintEvent(QPaintEvent *)
QBrush brush;
brush.setStyle(Qt::SolidPattern);
brush.setColor(isEnabled() ? backgroundColor() : QColor("#cccccc"));
// brush.setColor(isEnabled() ? backgroundColor() : QColor("#cccccc"));
painter.setBrush(brush);
painter.setPen(Qt::NoPen);