aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTapani Mattila <[email protected]>2022-05-23 10:35:18 +0300
committerTapani Mattila <[email protected]>2022-05-25 09:18:09 +0000
commitf55fc5276b901c96517c4dbedbc6717df240db9a (patch)
tree4d9b13ffd7514e482fb44933df245f1d23961e74 /src
parent5ae128f6347f712507924086ef7a21ba9ce40882 (diff)
QmlProjectManager: Add theming support to QDS landing page
Task-number: QDS-6897 Change-Id: I2e1cea556d906d59664cb72612ea1d67ef495f4f Reviewed-by: Alessandro Portale <[email protected]> Reviewed-by: <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmlprojectmanager/CMakeLists.txt1
-rw-r--r--src/plugins/qmlprojectmanager/qdslandingpage.cpp3
-rw-r--r--src/plugins/qmlprojectmanager/qdslandingpagetheme.cpp56
-rw-r--r--src/plugins/qmlprojectmanager/qdslandingpagetheme.h46
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectmanager.qbs1
5 files changed, 107 insertions, 0 deletions
diff --git a/src/plugins/qmlprojectmanager/CMakeLists.txt b/src/plugins/qmlprojectmanager/CMakeLists.txt
index 7011ab67d97..827ddf9f16e 100644
--- a/src/plugins/qmlprojectmanager/CMakeLists.txt
+++ b/src/plugins/qmlprojectmanager/CMakeLists.txt
@@ -17,6 +17,7 @@ add_qtc_plugin(QmlProjectManager
cmakegen/boilerplate.qrc
projectfilecontenttools.cpp projectfilecontenttools.h
qdslandingpage.cpp qdslandingpage.h
+ qdslandingpagetheme.cpp qdslandingpagetheme.h
qmlmainfileaspect.cpp qmlmainfileaspect.h
qmlmultilanguageaspect.cpp qmlmultilanguageaspect.h
qmlproject.cpp qmlproject.h
diff --git a/src/plugins/qmlprojectmanager/qdslandingpage.cpp b/src/plugins/qmlprojectmanager/qdslandingpage.cpp
index f56d60e627d..b44584ea093 100644
--- a/src/plugins/qmlprojectmanager/qdslandingpage.cpp
+++ b/src/plugins/qmlprojectmanager/qdslandingpage.cpp
@@ -24,6 +24,7 @@
****************************************************************************/
#include "qdslandingpage.h"
+#include "qdslandingpagetheme.h"
#include "utils/algorithm.h"
#include <coreplugin/icore.h>
@@ -46,6 +47,8 @@ QdsLandingPage::QdsLandingPage(QWidget *parent)
const QString landingPath = Core::ICore::resourcePath(LANDINGPAGEPATH).toString();
qmlRegisterSingletonInstance<QdsLandingPage>("LandingPageApi", 1, 0, "LandingPageApi", this);
+ QdsLandingPageTheme::setupTheme(m_dialog->engine());
+
m_dialog->setResizeMode(QQuickWidget::SizeRootObjectToView);
m_dialog->engine()->addImportPath(landingPath + "/imports");
m_dialog->engine()->addImportPath(resourcePath);
diff --git a/src/plugins/qmlprojectmanager/qdslandingpagetheme.cpp b/src/plugins/qmlprojectmanager/qdslandingpagetheme.cpp
new file mode 100644
index 00000000000..8d7d5dd2558
--- /dev/null
+++ b/src/plugins/qmlprojectmanager/qdslandingpagetheme.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt 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 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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.
+**
+****************************************************************************/
+
+#include "qdslandingpagetheme.h"
+
+#include <qmlprojectplugin.h>
+
+#include <coreplugin/icore.h>
+
+#include <QQmlEngine>
+#include <QQmlComponent>
+
+namespace QmlProjectManager {
+
+QdsLandingPageTheme::QdsLandingPageTheme(Utils::Theme *originTheme, QObject *parent)
+ : Utils::Theme(originTheme, parent)
+{
+
+}
+
+void QdsLandingPageTheme::setupTheme(QQmlEngine *engine)
+{
+ Q_UNUSED(engine)
+
+ static const int typeIndex = qmlRegisterSingletonType<QdsLandingPageTheme>(
+ "LandingPageTheme", 1, 0, "Theme", [](QQmlEngine *, QJSEngine *) {
+ return new QdsLandingPageTheme(Utils::creatorTheme(), nullptr);
+ });
+ QScopedPointer<QdsLandingPageTheme> theme(new QdsLandingPageTheme(Utils::creatorTheme(), nullptr));
+
+ Q_UNUSED(typeIndex)
+}
+
+} //QmlProjectManager
diff --git a/src/plugins/qmlprojectmanager/qdslandingpagetheme.h b/src/plugins/qmlprojectmanager/qdslandingpagetheme.h
new file mode 100644
index 00000000000..0befcdf89e7
--- /dev/null
+++ b/src/plugins/qmlprojectmanager/qdslandingpagetheme.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt 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 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <qqmlengine.h>
+
+#include <utils/theme/theme.h>
+
+namespace QmlProjectManager {
+
+class QdsLandingPageTheme : public Utils::Theme
+{
+ Q_OBJECT
+ QML_SINGLETON
+
+public:
+ static void setupTheme(QQmlEngine *engine);
+
+private:
+ QdsLandingPageTheme(Utils::Theme *originTheme, QObject *parent);
+};
+
+} //QmlProjectManager
diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs b/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
index 14ef1bd6e62..292017e9fe7 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
+++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
@@ -16,6 +16,7 @@ QtcPlugin {
name: "General"
files: [
"projectfilecontenttools.cpp", "projectfilecontenttools.h",
+ "qdslandingpagetheme.cpp", "qdslandingpagetheme.h",
"qdslandingpage.cpp", "qdslandingpage.h",
"qmlmainfileaspect.cpp", "qmlmainfileaspect.h",
"qmlmultilanguageaspect.cpp", "qmlmultilanguageaspect.h",