Commit 4e370996 authored by Edric Milaret's avatar Edric Milaret Committed by gerrit2

ui: move QColor to dedicated header/namespace

Change-Id: I32555bd2b031e87ab743f010dc2a60614b001beb
Tuleap: #148
parent 691b2ec6
......@@ -102,7 +102,8 @@ HEADERS += mainwindow.h \
mainwindowtoolbar.h \
ringcontactlineedit.h \
pixbufmanipulator.h \
qualitydialog.h
qualitydialog.h \
ringthemeutils.h
FORMS += mainwindow.ui \
callwidget.ui \
......
......@@ -18,10 +18,12 @@
#include "imdelegate.h"
#include <QApplication>
#include "media/text.h"
#include "media/textrecording.h"
#include <QApplication>
#include "ringthemeutils.h"
ImDelegate::ImDelegate(QObject *parent)
: QStyledItemDelegate(parent), showDate_(false), showAuthor_(false)
......@@ -93,7 +95,7 @@ ImDelegate::paint(QPainter* painter,
path.addRoundedRect(bubbleRect, padding_, padding_);
if (dir == Qt::AlignRight) {
painter->fillPath(path, blue_);
painter->fillPath(path, RingTheme::blue_);
painter->setPen(Qt::white);
}
else {
......
......@@ -43,7 +43,6 @@ private:
QRect getBoundingRect(const Qt::AlignmentFlag& dir, const QString& msg, const QStyleOptionViewItem &option) const;
const QFont fontMsg_ = QFont("Arial", 10);
const QColor blue_ {"#3AC0D2"};
const QSize iconSize_ {38,38};
constexpr static int padding_ = 5;
......
/***************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#pragma once
namespace RingTheme {
static const QColor blue_ {"#3AC0D2"};
static const QColor lightGrey_ {242, 242, 242};
static const QColor lightBlack_ {63, 63, 63};
static const QColor grey_ {192, 192, 192};
static const QColor red_ {251, 72, 71};
}
......@@ -28,6 +28,8 @@
#include "recentmodel.h"
#include "call.h"
#include "ringthemeutils.h"
SmartListDelegate::SmartListDelegate(QObject* parent) :
QItemDelegate(parent)
{
......@@ -85,9 +87,9 @@ SmartListDelegate::paint(QPainter* painter
QPainterPath path;
path.addRoundedRect(bubbleRect, 3, 3);
QPen pen(red_, 5);
QPen pen(RingTheme::red_, 5);
painter->setPen(pen);
painter->fillPath(path, red_);
painter->fillPath(path, RingTheme::red_);
painter->drawPath(path);
painter->setPen(Qt::white);
......@@ -104,7 +106,7 @@ SmartListDelegate::paint(QPainter* painter
emit rowSelected(opt.rect);
if (not (opt.state & QStyle::State_Selected)) {
pen.setColor(lightGrey_);
pen.setColor(RingTheme::lightGrey_);
painter->setPen(pen);
painter->drawLine(rect.left() + 20, rect.bottom(),
rect.right() - 20,
......@@ -117,7 +119,7 @@ SmartListDelegate::paint(QPainter* painter
QVariant name = index.data(static_cast<int>(Ring::Role::Name));
if (name.isValid())
{
pen.setColor(lightBlack_);
pen.setColor(RingTheme::lightBlack_);
painter->setPen(pen);
font.setBold(true);
painter->setFont(font);
......@@ -134,7 +136,7 @@ SmartListDelegate::paint(QPainter* painter
}
QVariant state = index.data(static_cast<int>(Ring::Role::FormattedState));
pen.setColor(grey_);
pen.setColor(RingTheme::grey_);
painter->setPen(pen);
font.setBold(false);
painter->setFont(font);
......
......@@ -43,11 +43,6 @@ private:
constexpr static int pinSize_ = 12;
int rowHighlighted_ = -1;
const QColor lightGrey_ {242, 242, 242};
const QColor lightBlack_ {63, 63, 63};
const QColor grey_ {192, 192, 192};
const QColor red_ {251, 72, 71};
signals:
void rowSelected(const QRect& rect) const;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment