File indexing completed on 2024-05-19 05:47:31

0001 /*
0002  * This file is part of KQuickCharts
0003  * Copyright 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2.1 of the License, or (at your option) version 3, or any
0009  * later version accepted by the membership of KDE e.V. (or its
0010  * successor approved by the membership of KDE e.V.), which shall
0011  * act as a proxy defined in Section 6 of version 3 of the license.
0012  *
0013  * This library is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Lesser General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Lesser General Public
0019  * License along with this library. If not, see <https://www.gnu.org/licenses/>.
0020  */
0021 
0022 #include "ChartsPlugin.h"
0023 
0024 #include "BarChart.h"
0025 #include "Chart.h"
0026 #include "LineChart.h"
0027 #include "PieChart.h"
0028 #include "RangeGroup.h"
0029 #include "XYChart.h"
0030 
0031 #include "decorations/AxisLabels.h"
0032 #include "decorations/GridLines.h"
0033 #include "decorations/LegendModel.h"
0034 
0035 #include "datasource/ArraySource.h"
0036 #include "datasource/ChartAxisSource.h"
0037 #include "datasource/ColorGradientSource.h"
0038 #include "datasource/ModelHistorySource.h"
0039 #include "datasource/ModelSource.h"
0040 #include "datasource/SingleValueSource.h"
0041 #include "datasource/ValueHistorySource.h"
0042 
0043 QuickChartsPlugin::QuickChartsPlugin(QObject *parent)
0044     : QQmlExtensionPlugin(parent)
0045 {
0046 }
0047 
0048 void QuickChartsPlugin::registerTypes(const char *uri)
0049 {
0050     Q_ASSERT(QString::fromLatin1(uri) == QLatin1String("org.kde.quickcharts"));
0051 
0052     Q_INIT_RESOURCE(shaders);
0053 
0054     qmlRegisterType<PieChart>(uri, 1, 0, "PieChart");
0055     qmlRegisterType<LineChart>(uri, 1, 0, "LineChart");
0056     qmlRegisterType<BarChart>(uri, 1, 0, "BarChart");
0057     qmlRegisterUncreatableType<XYChart>(uri, 1, 0, "XYChart", QStringLiteral("Just a base class"));
0058     qmlRegisterUncreatableType<Chart>(uri, 1, 0, "Chart", QStringLiteral("Just a base class"));
0059 
0060     qmlRegisterUncreatableType<ChartDataSource>(uri, 1, 0, "ChartDataSource", QStringLiteral("Just a base class"));
0061     qmlRegisterType<ModelSource>(uri, 1, 0, "ModelSource");
0062     qmlRegisterType<SingleValueSource>(uri, 1, 0, "SingleValueSource");
0063     qmlRegisterType<ArraySource>(uri, 1, 0, "ArraySource");
0064     qmlRegisterType<ModelHistorySource>(uri, 1, 0, "ModelHistorySource");
0065     qmlRegisterType<ChartAxisSource>(uri, 1, 0, "ChartAxisSource");
0066     qmlRegisterType<ValueHistorySource>(uri, 1, 0, "ValueHistorySource");
0067     qmlRegisterType<ColorGradientSource>(uri, 1, 0, "ColorGradientSource");
0068 
0069     qmlRegisterUncreatableType<RangeGroup>(uri, 1, 0, "Range", QStringLiteral("Used as a grouped property"));
0070 
0071     qmlRegisterType<GridLines>(uri, 1, 0, "GridLines");
0072     qmlRegisterUncreatableType<LinePropertiesGroup>(uri, 1, 0, "LinePropertiesGroup", QStringLiteral("Used as a grouped property"));
0073     qmlRegisterType<AxisLabels>(uri, 1, 0, "AxisLabels");
0074     qmlRegisterUncreatableType<AxisLabelsAttached>(uri, 1, 0, "AxisLabelsAttached", QStringLiteral("Attached property"));
0075     qmlRegisterType<LegendModel>(uri, 1, 0, "LegendModel");
0076 }