aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2018-06-07 11:32:01 +0200
committerBramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>2018-06-07 12:46:56 +0000
commitb102dee4faeef5b713cbba4e4775c88f1f8edf75 (patch)
tree592d3c5c0428005fdb314c30002bfe67c7cbebec
parent4d3be1f1ce803ec5e1f47baa99ed84aa8ae27284 (diff)
Use the iconTheme config options from applicationmanager
Previously a ProxyTheme class was used in the neptunestyleplugin, where a path was returned which was hardcoded to the INSTALL_PREFIX. This doesn't work when neptune is run from the build-folder and wasn't installed previously or when installed from the online installer as the theme directory needed to be known at build-time. The new solution is to use the iconThemeName and iconThemeSearchPaths configuration options of application-manager and get rid of the ProxyTheme completely. This also makes sure neptune3 will compile with QQC2 from the dev branch, which doesn't offer the ProxyTheme anymore. Task-number: QTAUTO-1072 Change-Id: I2d9c4f888c6430613d4a56480b37a364517c44e9 Reviewed-by: Lukáš Tinkl <ltinkl@luxoft.com> Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
-rw-r--r--am-config.yaml2
-rw-r--r--plugins/styles/neptune/neptune.pro2
-rw-r--r--plugins/styles/neptune/neptunestyle.cpp11
-rw-r--r--plugins/styles/neptune/neptunestyleplugin.cpp7
-rw-r--r--plugins/styles/neptune/neptunestyleplugin.h2
-rw-r--r--plugins/styles/neptune/neptunetheme.cpp74
-rw-r--r--plugins/styles/neptune/neptunetheme.h51
7 files changed, 11 insertions, 138 deletions
diff --git a/am-config.yaml b/am-config.yaml
index 55e2cb1f..86d101dd 100644
--- a/am-config.yaml
+++ b/am-config.yaml
@@ -29,6 +29,8 @@ runtimes:
ui:
fullscreen: no
style: "${CONFIG_PWD}/styles/neptune"
+ iconThemeName: "neptune"
+ iconThemeSearchPaths: [ "${CONFIG_PWD}/imports/assets/icons" ]
mainQml: "${CONFIG_PWD}/Main.qml"
importPaths: [ "${CONFIG_PWD}/imports/shared", "${CONFIG_PWD}/imports/system", "${CONFIG_PWD}/sysui" ]
windowIcon: "${CONFIG_PWD}/imports/assets/icons/neptune/sysui/ic-menu-home.png"
diff --git a/plugins/styles/neptune/neptune.pro b/plugins/styles/neptune/neptune.pro
index 373787b5..a0d57dbf 100644
--- a/plugins/styles/neptune/neptune.pro
+++ b/plugins/styles/neptune/neptune.pro
@@ -12,7 +12,6 @@ DEFINES += "NEPTUNE_ICONS_PATH=$$clean_path($$INSTALL_PREFIX/neptune3/imports/as
SOURCES += \
neptunestyle.cpp \
neptunestyleplugin.cpp \
- neptunetheme.cpp \
qquickiconlabel.cpp \
qquickicon.cpp \
qquickdefaultprogressbar.cpp
@@ -20,7 +19,6 @@ SOURCES += \
HEADERS += \
neptunestyle.h \
neptunestyleplugin.h \
- neptunetheme.h \
qquickiconlabel_p.h \
qquickiconlabel_p_p.h \
qquickicon_p.h \
diff --git a/plugins/styles/neptune/neptunestyle.cpp b/plugins/styles/neptune/neptunestyle.cpp
index 730cb0b9..24906af8 100644
--- a/plugins/styles/neptune/neptunestyle.cpp
+++ b/plugins/styles/neptune/neptunestyle.cpp
@@ -34,6 +34,7 @@
#include <QtQuick/QQuickItem>
#include <QtQuick/QQuickWindow>
#include <QtGui/QGuiApplication>
+#include <QtGui/QFontInfo>
#include <QtCore/QSettings>
#include <QQmlEngine>
@@ -98,11 +99,17 @@ static ThemeData& neptunestyle_theme_data(NeptuneStyle::Theme theme)
class StyleData {
public:
StyleData()
- : font(QGuiApplication::font())
- , fontFactor(1.0)
+ : fontFactor(1.0)
, theme(NeptuneStyle::Light)
, scale(1.0)
{
+ const QFont sansFont(QLatin1String("Open Sans"));
+
+ if (QFontInfo(sansFont).family() == QLatin1String("Open Sans"))
+ font.setFamily(font.family());
+
+ font.setPixelSize(15);
+ QGuiApplication::setFont(font);
compute();
}
StyleData(const StyleData &data)
diff --git a/plugins/styles/neptune/neptunestyleplugin.cpp b/plugins/styles/neptune/neptunestyleplugin.cpp
index 054455ad..1ed8d4cc 100644
--- a/plugins/styles/neptune/neptunestyleplugin.cpp
+++ b/plugins/styles/neptune/neptunestyleplugin.cpp
@@ -33,7 +33,6 @@
#include <QtQml>
#include "neptunestyle.h"
-#include "neptunetheme.h"
#include "qquickiconlabel_p.h"
#include "qquickdefaultprogressbar_p.h"
@@ -60,9 +59,3 @@ QString NeptuneStylePlugin::name() const
{
return QStringLiteral("neptune");
}
-
-QQuickProxyTheme *NeptuneStylePlugin::createTheme() const
-{
- qCDebug(neptuneStyle) << "Created a NeptuneTheme instance";
- return new NeptuneTheme;
-}
diff --git a/plugins/styles/neptune/neptunestyleplugin.h b/plugins/styles/neptune/neptunestyleplugin.h
index 6e4835c5..26a3f3e0 100644
--- a/plugins/styles/neptune/neptunestyleplugin.h
+++ b/plugins/styles/neptune/neptunestyleplugin.h
@@ -48,8 +48,6 @@ public:
void registerTypes(const char *uri) override;
void initializeEngine(QQmlEngine *engine, const char *uri) override;
QString name() const override;
- QQuickProxyTheme *createTheme() const override;
-
};
#endif // NEPTUNESTYLEPLUGIN_H
diff --git a/plugins/styles/neptune/neptunetheme.cpp b/plugins/styles/neptune/neptunetheme.cpp
deleted file mode 100644
index 20a256e4..00000000
--- a/plugins/styles/neptune/neptunetheme.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pelagicore AG
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Neptune 3 IVI UI.
-**
-** $QT_BEGIN_LICENSE:GPL-QTAS$
-** Commercial License Usage
-** Licensees holding valid commercial Qt Automotive Suite licenses may use
-** this file in accordance with the commercial license agreement provided
-** with the Software or, alternatively, in accordance with the terms
-** contained in a written agreement between you and The Qt Company. For
-** licensing terms and conditions see https://www.qt.io/terms-conditions.
-** For further information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-** SPDX-License-Identifier: GPL-3.0
-**
-****************************************************************************/
-
-#include "neptunetheme.h"
-
-#include <QDebug>
-#include <QtGui/QFont>
-#include <QtGui/QFontInfo>
-#include <QtGui/QIcon>
-
-// code to transform a macro into a string literal
-#define QUOTE(name) #name
-#define STR(macro) QUOTE(macro)
-
-Q_LOGGING_CATEGORY(neptuneTheme, "neptune.theme")
-
-NeptuneTheme::NeptuneTheme(QPlatformTheme *theme)
-{
- Q_UNUSED(theme)
- const QFont font(QLatin1String("Open Sans"));
-
- if (QFontInfo(font).family() == QLatin1String("Open Sans")) {
- const QString family = font.family();
- m_systemFont.setFamily(family);
- }
-
- m_systemFont.setPixelSize(15);
-}
-
-const QFont *NeptuneTheme::font(QPlatformTheme::Font type) const
-{
- switch (type) {
- default:
- return &m_systemFont;
- }
-}
-
-QVariant NeptuneTheme::themeHint(QPlatformTheme::ThemeHint hint) const
-{
- if (hint == SystemIconThemeName || hint == StyleNames) {
- return QStringLiteral("neptune");
- } else if (hint == IconThemeSearchPaths) {
- return STR(NEPTUNE_ICONS_PATH);
- }
- return QQuickProxyTheme::themeHint(hint);
-}
diff --git a/plugins/styles/neptune/neptunetheme.h b/plugins/styles/neptune/neptunetheme.h
deleted file mode 100644
index 0890697d..00000000
--- a/plugins/styles/neptune/neptunetheme.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pelagicore AG
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Neptune 3 IVI UI.
-**
-** $QT_BEGIN_LICENSE:GPL-QTAS$
-** Commercial License Usage
-** Licensees holding valid commercial Qt Automotive Suite licenses may use
-** this file in accordance with the commercial license agreement provided
-** with the Software or, alternatively, in accordance with the terms
-** contained in a written agreement between you and The Qt Company. For
-** licensing terms and conditions see https://www.qt.io/terms-conditions.
-** For further information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-** SPDX-License-Identifier: GPL-3.0
-**
-****************************************************************************/
-
-#ifndef NEPTUNETHEME_H
-#define NEPTUNETHEME_H
-
-#include <QtGui/QFont>
-#include <QtQuickControls2/private/qquickproxytheme_p.h>
-#include <QLoggingCategory>
-
-
-class NeptuneTheme : public QQuickProxyTheme
-{
-public:
- NeptuneTheme(QPlatformTheme *theme = nullptr);
-
- const QFont *font(QPlatformTheme::Font type = SystemFont) const override;
- QVariant themeHint(QPlatformTheme::ThemeHint hint) const override;
-private:
- QFont m_systemFont;
-};
-
-#endif // NEPTUNETHEME_H