Commit 84287a2f authored by Marco Martin's avatar Marco Martin

port the intro page to QML

parent cd21808d
......@@ -36,6 +36,7 @@
#include <KStandardAction>
#include <KLocalizedString>
#include <KIconLoader>
#include <KLocalizedContext>
#include <KServiceTypeTrader>
#include <KXmlGuiWindow>
#include <KActionCollection>
......@@ -104,7 +105,7 @@ public:
KPackage::Package package;
SubcategoryModel * subCategoryModel;
QWidget * mainWidget;
QWidget * placeHolderWidget;
QQuickWidget * placeHolderWidget;
QHBoxLayout * mainLayout;
KDeclarative::KDeclarative kdeclarative;
MenuProxyModel * proxyModel;
......@@ -322,20 +323,11 @@ void SidebarMode::initWidget()
d->toolTipManager = new ToolTipManager(d->proxyModel, d->quickWidget);
d->placeHolderWidget = new QWidget(d->mainWidget);
QGraphicsOpacityEffect *opacity = new QGraphicsOpacityEffect(d->placeHolderWidget);
opacity->setOpacity(0.5);
d->placeHolderWidget->setGraphicsEffect(opacity);
QGridLayout *placeHolderLayout = new QGridLayout(d->placeHolderWidget);
QLabel *pictureLabel = new QLabel(d->placeHolderWidget);
pictureLabel->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
pictureLabel->setPixmap(QIcon::fromTheme(QStringLiteral("systemsettings")).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous));
QLabel *introLabel = new QLabel(d->placeHolderWidget);
introLabel->setText(i18n("Select an item from the list to see the available options"));
placeHolderLayout->addItem(new QSpacerItem(-1,-1, QSizePolicy::Minimum, QSizePolicy::Expanding), 0, 0);
placeHolderLayout->addWidget(pictureLabel, 1, 0, Qt::AlignCenter);
placeHolderLayout->addWidget(introLabel, 2, 0, Qt::AlignCenter);
placeHolderLayout->addItem(new QSpacerItem(-1,-1, QSizePolicy::Minimum, QSizePolicy::Expanding), 3, 0);
d->placeHolderWidget = new QQuickWidget(d->mainWidget);
d->placeHolderWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
d->placeHolderWidget->engine()->rootContext()->setContextObject(new KLocalizedContext(d->placeHolderWidget));
d->placeHolderWidget->engine()->rootContext()->setContextProperty("systemsettings", this);
d->placeHolderWidget->setSource(d->package.filePath("ui", "introPage.qml"));
d->mainLayout->addWidget( d->quickWidget );
d->moduleView->hide();
......
/*
Copyright (c) 2017 Marco Martin <mart@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
import QtQuick 2.1
import QtQuick.Layouts 1.1
import org.kde.kirigami 2.1 as Kirigami
Rectangle {
color: Kirigami.Theme.backgroundColor
ColumnLayout {
anchors {
top: parent.top
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
Item {
Layout.fillHeight: true
}
Kirigami.Icon {
Layout.alignment: Qt.AlignHCenter
source: "systemsettings"
width: Kirigami.Units.iconSizes.enormous
height: width
opacity: 0.3
}
Kirigami.Label {
Layout.alignment: Qt.AlignHCenter
text: i18n("Select an item from the list to see the available options")
}
Item {
Layout.fillHeight: true
}
}
}
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