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 \ ...@@ -102,7 +102,8 @@ HEADERS += mainwindow.h \
mainwindowtoolbar.h \ mainwindowtoolbar.h \
ringcontactlineedit.h \ ringcontactlineedit.h \
pixbufmanipulator.h \ pixbufmanipulator.h \
qualitydialog.h qualitydialog.h \
ringthemeutils.h
FORMS += mainwindow.ui \ FORMS += mainwindow.ui \
callwidget.ui \ callwidget.ui \
......
...@@ -18,10 +18,12 @@ ...@@ -18,10 +18,12 @@
#include "imdelegate.h" #include "imdelegate.h"
#include <QApplication>
#include "media/text.h" #include "media/text.h"
#include "media/textrecording.h" #include "media/textrecording.h"
#include <QApplication> #include "ringthemeutils.h"
ImDelegate::ImDelegate(QObject *parent) ImDelegate::ImDelegate(QObject *parent)
: QStyledItemDelegate(parent), showDate_(false), showAuthor_(false) : QStyledItemDelegate(parent), showDate_(false), showAuthor_(false)
...@@ -93,7 +95,7 @@ ImDelegate::paint(QPainter* painter, ...@@ -93,7 +95,7 @@ ImDelegate::paint(QPainter* painter,
path.addRoundedRect(bubbleRect, padding_, padding_); path.addRoundedRect(bubbleRect, padding_, padding_);
if (dir == Qt::AlignRight) { if (dir == Qt::AlignRight) {
painter->fillPath(path, blue_); painter->fillPath(path, RingTheme::blue_);
painter->setPen(Qt::white); painter->setPen(Qt::white);
} }
else { else {
......
...@@ -43,7 +43,6 @@ private: ...@@ -43,7 +43,6 @@ private:
QRect getBoundingRect(const Qt::AlignmentFlag& dir, const QString& msg, const QStyleOptionViewItem &option) const; QRect getBoundingRect(const Qt::AlignmentFlag& dir, const QString& msg, const QStyleOptionViewItem &option) const;
const QFont fontMsg_ = QFont("Arial", 10); const QFont fontMsg_ = QFont("Arial", 10);
const QColor blue_ {"#3AC0D2"};
const QSize iconSize_ {38,38}; const QSize iconSize_ {38,38};
constexpr static int padding_ = 5; 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 @@ ...@@ -28,6 +28,8 @@
#include "recentmodel.h" #include "recentmodel.h"
#include "call.h" #include "call.h"
#include "ringthemeutils.h"
SmartListDelegate::SmartListDelegate(QObject* parent) : SmartListDelegate::SmartListDelegate(QObject* parent) :
QItemDelegate(parent) QItemDelegate(parent)
{ {
...@@ -85,9 +87,9 @@ SmartListDelegate::paint(QPainter* painter ...@@ -85,9 +87,9 @@ SmartListDelegate::paint(QPainter* painter
QPainterPath path; QPainterPath path;
path.addRoundedRect(bubbleRect, 3, 3); path.addRoundedRect(bubbleRect, 3, 3);
QPen pen(red_, 5); QPen pen(RingTheme::red_, 5);
painter->setPen(pen); painter->setPen(pen);
painter->fillPath(path, red_); painter->fillPath(path, RingTheme::red_);
painter->drawPath(path); painter->drawPath(path);
painter->setPen(Qt::white); painter->setPen(Qt::white);
...@@ -104,7 +106,7 @@ SmartListDelegate::paint(QPainter* painter ...@@ -104,7 +106,7 @@ SmartListDelegate::paint(QPainter* painter
emit rowSelected(opt.rect); emit rowSelected(opt.rect);
if (not (opt.state & QStyle::State_Selected)) { if (not (opt.state & QStyle::State_Selected)) {
pen.setColor(lightGrey_); pen.setColor(RingTheme::lightGrey_);
painter->setPen(pen); painter->setPen(pen);
painter->drawLine(rect.left() + 20, rect.bottom(), painter->drawLine(rect.left() + 20, rect.bottom(),
rect.right() - 20, rect.right() - 20,
...@@ -117,7 +119,7 @@ SmartListDelegate::paint(QPainter* painter ...@@ -117,7 +119,7 @@ SmartListDelegate::paint(QPainter* painter
QVariant name = index.data(static_cast<int>(Ring::Role::Name)); QVariant name = index.data(static_cast<int>(Ring::Role::Name));
if (name.isValid()) if (name.isValid())
{ {
pen.setColor(lightBlack_); pen.setColor(RingTheme::lightBlack_);
painter->setPen(pen); painter->setPen(pen);
font.setBold(true); font.setBold(true);
painter->setFont(font); painter->setFont(font);
...@@ -134,7 +136,7 @@ SmartListDelegate::paint(QPainter* painter ...@@ -134,7 +136,7 @@ SmartListDelegate::paint(QPainter* painter
} }
QVariant state = index.data(static_cast<int>(Ring::Role::FormattedState)); QVariant state = index.data(static_cast<int>(Ring::Role::FormattedState));
pen.setColor(grey_); pen.setColor(RingTheme::grey_);
painter->setPen(pen); painter->setPen(pen);
font.setBold(false); font.setBold(false);
painter->setFont(font); painter->setFont(font);
......
...@@ -43,11 +43,6 @@ private: ...@@ -43,11 +43,6 @@ private:
constexpr static int pinSize_ = 12; constexpr static int pinSize_ = 12;
int rowHighlighted_ = -1; 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: signals:
void rowSelected(const QRect& rect) const; 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