Commit 9123ccf8 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Exclusively rely on the Kirigami.Units

Don't use QFontDatabase as well, once source keeps sizes sane
parent f4dd16fe
......@@ -13,7 +13,6 @@ add_executable(plasma-discover ${plasma_discover_SRCS}
FeaturedModel.cpp
PaginateModel.cpp
SystemFonts.cpp
UnityLauncher.cpp
)
add_executable(Plasma::Discover ALIAS plasma-discover)
......
......@@ -19,7 +19,6 @@
#include "DiscoverMainWindow.h"
#include "PaginateModel.h"
#include "SystemFonts.h"
#include "UnityLauncher.h"
#include "FeaturedModel.h"
#include "CachedNetworkAccessManager.h"
......@@ -90,7 +89,6 @@ DiscoverMainWindow::DiscoverMainWindow(CompactMode mode)
qmlRegisterType<FeaturedModel>("org.kde.discover.app", 1, 0, "FeaturedModel");
qmlRegisterType<QSortFilterProxyModel>("org.kde.discover.app", 1, 0, "QSortFilterProxyModel");
qmlRegisterSingletonType<SystemFonts>("org.kde.discover.app", 1, 0, "SystemFonts", ([](QQmlEngine*, QJSEngine*) -> QObject* { return new SystemFonts; }));
qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/qml/DiscoverSystemPalette.qml")), "org.kde.discover.app", 1, 0, "DiscoverSystemPalette");
qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/qml/Helpers.qml")), "org.kde.discover.app", 1, 0, "Helpers");
qmlRegisterType<QQuickView>();
......
/*
* Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library/Lesser General Public License
* version 2, or (at your option) any later version, as published by the
* Free Software Foundation
*
* 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 Library/Lesser 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.
*/
#include "SystemFonts.h"
#include <QFontDatabase>
#include <QGuiApplication>
SystemFonts::SystemFonts(QObject* parent)
: QObject(parent)
{
QGuiApplication::instance()->installEventFilter(this);
}
QFont SystemFonts::fixedFont() const
{
return QFontDatabase::systemFont(QFontDatabase::FixedFont);
}
QFont SystemFonts::generalFont() const
{
return QFontDatabase::systemFont(QFontDatabase::GeneralFont);
}
QFont SystemFonts::smallestReadableFont() const
{
return QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
}
QFont SystemFonts::titleFont() const
{
return QFontDatabase::systemFont(QFontDatabase::TitleFont);
}
bool SystemFonts::eventFilter(QObject* obj, QEvent* ev)
{
if(ev->type() == QEvent::ApplicationFontChange) {
emit fontsChanged();
}
return QObject::eventFilter(obj, ev);
}
/*
* Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library/Lesser General Public License
* version 2, or (at your option) any later version, as published by the
* Free Software Foundation
*
* 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 Library/Lesser 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.
*/
#ifndef SYSTEMFONTS_H
#define SYSTEMFONTS_H
#include <QObject>
#include <QFont>
class SystemFonts : public QObject
{
Q_OBJECT
Q_PROPERTY(QFont generalFont READ generalFont NOTIFY fontsChanged)
Q_PROPERTY(QFont fixedFont READ fixedFont NOTIFY fontsChanged)
Q_PROPERTY(QFont titleFont READ titleFont NOTIFY fontsChanged)
Q_PROPERTY(QFont smallestReadableFont READ smallestReadableFont NOTIFY fontsChanged)
public:
explicit SystemFonts(QObject* parent = nullptr);
QFont generalFont() const;
QFont fixedFont() const;
QFont titleFont() const;
QFont smallestReadableFont() const;
bool eventFilter(QObject* obj, QEvent* ev) override;
Q_SIGNALS:
void fontsChanged();
};
#endif // SYSTEMFONTS_H
......@@ -22,7 +22,6 @@ import QtQuick.Controls 1.1
import QtQuick.Controls 2.1 as QQC2
import QtQuick.Layouts 1.1
import org.kde.kquickcontrolsaddons 2.0
import org.kde.discover.app 1.0
import QtQuick.Window 2.1
import org.kde.kcoreaddons 1.0
import "navigation.js" as Navigation
......@@ -100,7 +99,6 @@ Kirigami.AbstractListItem
elide: Text.ElideRight
text: delegateArea.application.comment
maximumLineCount: 1
font: SystemFonts.titleFont
}
QQC2.Label {
......
......@@ -20,7 +20,6 @@
import QtQuick 2.1
import QtQuick.Layouts 1.1
import org.kde.kquickcontrolsaddons 2.0
import org.kde.discover.app 1.0
import org.kde.kirigami 2.0 as Kirigami
RowLayout
......@@ -29,7 +28,7 @@ RowLayout
property bool editable: false
property int max: 10
property int rating: 2
property real starSize: SystemFonts.generalFont.pointSize*2
property real starSize: Kirigami.Units.gridUnit
clip: true
spacing: 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