Commit c579092e authored by Wescoeur's avatar Wescoeur

feat(App): use a cpp class for Colors

parent a845693c
......@@ -122,6 +122,7 @@ set(SOURCES
src/components/core/CoreHandlers.cpp
src/components/core/CoreManager.cpp
src/components/notifier/Notifier.cpp
src/components/other/colors/Colors.cpp
src/components/other/clipboard/Clipboard.cpp
src/components/other/text-to-speech/TextToSpeech.cpp
src/components/other/units/Units.cpp
......@@ -174,7 +175,8 @@ set(HEADERS
src/components/core/CoreHandlers.hpp
src/components/core/CoreManager.hpp
src/components/notifier/Notifier.hpp
src/components/other/clipboard/Clipboard.cpp
src/components/other/colors/Colors.hpp
src/components/other/clipboard/Clipboard.hpp
src/components/other/text-to-speech/TextToSpeech.hpp
src/components/other/units/Units.hpp
src/components/presence/OwnPresenceModel.hpp
......
......@@ -191,7 +191,6 @@
<file>assets/images/video_call_normal.svg</file>
<file>assets/images/video_call_pressed.svg</file>
<file>ui/modules/Common/Animations/BusyIndicator.qml</file>
<file>ui/modules/Common/Constants/Colors.qml</file>
<file>ui/modules/Common/Constants/Constants.qml</file>
<file>ui/modules/Common/Dialog/ConfirmDialog.qml</file>
<file>ui/modules/Common/Dialog/DialogDescription.qml</file>
......
......@@ -385,6 +385,7 @@ void App::registerToolTypes () {
qInfo() << QStringLiteral("Registering tool types...");
registerToolType<Clipboard>("Clipboard");
registerToolType<Colors>("Colors");
registerToolType<TextToSpeech>("TextToSpeech");
registerToolType<Units>("Units");
}
......
......@@ -43,6 +43,7 @@
#include "timeline/TimelineModel.hpp"
#include "url-handlers/UrlHandlers.hpp"
#include "other/colors/Colors.hpp"
#include "other/clipboard/Clipboard.hpp"
#include "other/text-to-speech/TextToSpeech.hpp"
#include "other/units/Units.hpp"
......
/*
* Colors.cpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: June 18, 2017
* Author: Ronan Abhamon
*/
#include "Colors.hpp"
// =============================================================================
Colors::Colors (QObject *parent) : QObject(parent) {}
/*
* Colors.hpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: June 18, 2017
* Author: Ronan Abhamon
*/
#ifndef COLORS_H_
#define COLORS_H_
#include <QColor>
#include <QObject>
// =============================================================================
#define ADD_COLOR(COLOR, VALUE) \
signals: \
void COLOR ## Changed(const QColor &color); \
private: \
Q_PROPERTY(QColor COLOR MEMBER m ## COLOR WRITE set ## COLOR NOTIFY colorT ## COLOR ## Changed); \
void set ## COLOR(const QColor &color) { \
m ## COLOR = QColor(color.rgb()); \
emit colorT ## COLOR ## Changed(m ## COLOR); \
} \
QColor m ## COLOR = VALUE;
#define ADD_COLOR_WITH_ALPHA(COLOR, ALPHA) \
Q_PROPERTY(QColor COLOR ## ALPHA READ get ## COLOR ## ALPHA NOTIFY colorT ## COLOR ## Changed); \
QColor get ## COLOR ## ALPHA() { \
QColor color = m ## COLOR; \
color.setAlpha(ALPHA); \
return color; \
}
// -----------------------------------------------------------------------------
class Colors : public QObject {
Q_OBJECT;
ADD_COLOR(a, "transparent");
ADD_COLOR(b, "#5E5E5F");
ADD_COLOR(c, "#CBCBCB");
ADD_COLOR(d, "#5A585B");
ADD_COLOR(e, "#F3F3F3");
ADD_COLOR(f, "#E8E8E8");
ADD_COLOR(g, "#6B7A86");
ADD_COLOR(h, "#687680");
ADD_COLOR(i, "#FE5E00");
ADD_COLOR(j, "#4B5964");
ADD_COLOR(k, "#FFFFFF");
ADD_COLOR(l, "#000000");
ADD_COLOR(m, "#D1D1D1");
ADD_COLOR(n, "#C0C0C0");
ADD_COLOR(o, "#232323");
ADD_COLOR(p, "#E2E9EF");
ADD_COLOR(q, "#E6E6E6");
ADD_COLOR(r, "#595759");
ADD_COLOR(s, "#D64D00");
ADD_COLOR(t, "#FF8600");
ADD_COLOR(u, "#B1B1B1");
ADD_COLOR(v, "#E2E2E2");
ADD_COLOR(w, "#A1A1A1");
ADD_COLOR(x, "#96A5B1");
ADD_COLOR(y, "#D0D8DE");
ADD_COLOR(z, "#17A81A");
ADD_COLOR(error, "#FF0000");
ADD_COLOR_WITH_ALPHA(g, 10);
ADD_COLOR_WITH_ALPHA(g, 20);
ADD_COLOR_WITH_ALPHA(g, 90);
ADD_COLOR_WITH_ALPHA(i, 30);
ADD_COLOR_WITH_ALPHA(j, 75);
ADD_COLOR_WITH_ALPHA(k, 50);
ADD_COLOR_WITH_ALPHA(l, 50);
ADD_COLOR_WITH_ALPHA(l, 80);
public:
Colors (QObject *parent = Q_NULLPTR);
~Colors () = default;
signals:
void colorTaChanged (const QColor &color);
void colorTbChanged (const QColor &color);
void colorTcChanged (const QColor &color);
void colorTdChanged (const QColor &color);
void colorTeChanged (const QColor &color);
void colorTfChanged (const QColor &color);
void colorTgChanged (const QColor &color);
void colorTg10Changed (const QColor &color);
void colorTg20Changed (const QColor &color);
void colorTg90Changed (const QColor &color);
void colorThChanged (const QColor &color);
void colorTiChanged (const QColor &color);
void colorTi30Changed (const QColor &color);
void colorTjChanged (const QColor &color);
void colorTj75Changed (const QColor &color);
void colorTkChanged (const QColor &color);
void colorTk50Changed (const QColor &color);
void colorTlChanged (const QColor &color);
void colorTl50Changed (const QColor &color);
void colorTl80Changed (const QColor &color);
void colorTmChanged (const QColor &color);
void colorTnChanged (const QColor &color);
void colorToChanged (const QColor &color);
void colorTpChanged (const QColor &color);
void colorTqChanged (const QColor &color);
void colorTrChanged (const QColor &color);
void colorTsChanged (const QColor &color);
void colorTtChanged (const QColor &color);
void colorTuChanged (const QColor &color);
void colorTvChanged (const QColor &color);
void colorTwChanged (const QColor &color);
void colorTxChanged (const QColor &color);
void colorTyChanged (const QColor &color);
void colorTzChanged (const QColor &color);
void colorTerrorChanged (const QColor &color);
};
// -----------------------------------------------------------------------------
#undef ADD_COLOR_WITH_ALPHA
#undef ADD_COLOR
#endif // COLORS_H_
pragma Singleton
import QtQml 2.2
// =============================================================================
QtObject {
property color a: '#000000'
property color b: '#000000'
property color c: '#000000'
property color d: '#000000'
property color e: '#000000'
property color f: '#000000'
property color g: '#000000'
property color g10: '#000000'
property color g20: '#000000'
property color g90: '#000000'
property color h: '#000000'
property color i: '#000000'
property color i30: '#000000'
property color j: '#000000'
property color j75: '#000000'
property color k: '#000000'
property color k50: '#000000'
property color l: '#000000'
property color l50: '#000000'
property color l80: '#000000'
property color m: '#000000'
property color n: '#000000'
property color o: '#000000'
property color p: '#000000'
property color q: '#000000'
property color r: '#000000'
property color s: '#000000'
property color t: '#000000'
property color u: '#000000'
property color v: '#000000'
property color w: '#000000'
property color x: '#000000'
property color y: '#000000'
property color z: '#000000'
property color error: '#000000'
}
# ==============================================================================
# Colors component to export.
# ==============================================================================
module Colors
singleton Colors 1.0 Colors.qml
pragma Singleton
import QtQuick 2.7
// =============================================================================
QtObject {
property color a: 'transparent'
property color b: '#5E5E5F'
property color c: '#CBCBCB'
property color d: '#5A585B'
property color e: '#F3F3F3'
property color f: '#E8E8E8'
property color g: '#6B7A86'
property color g10: '#1A6B7A86'
property color g20: '#336B7A86'
property color g90: '#E66B7A86'
property color h: '#687680'
property color i: '#FE5E00'
property color i30: '#4DFE5E00'
property color j: '#4B5964'
property color j75: '#BF4B5964'
property color k: '#FFFFFF'
property color k50: '#32FFFFFF'
property color l: '#000000'
property color l50: '#32000000'
property color l80: '#80000000'
property color m: '#D1D1D1'
property color n: '#C0C0C0'
property color o: '#232323'
property color p: '#E2E9EF'
property color q: '#E6E6E6'
property color r: '#595759'
property color s: '#D64D00'
property color t: '#FF8600'
property color u: '#B1B1B1'
property color v: '#E2E2E2'
property color w: '#A1A1A1'
property color x: '#96A5B1'
property color y: '#D0D8DE'
property color z: '#17A81A'
property color error: '#FF0000'
}
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
......@@ -6,7 +6,6 @@ module Common
# Constants --------------------------------------------------------------------
singleton Colors 1.0 Constants/Colors.qml
singleton Constants 1.0 Constants/Constants.qml
# Components -------------------------------------------------------------------
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
import Units 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import QtQml 2.2
import Common 1.0
import Colors 1.0
// =============================================================================
......
pragma Singleton
import QtQuick 2.7
import Common 1.0
import Colors 1.0
import Linphone.Styles 1.0
import Units 1.0
......
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