Commit 40ccb20a authored by Chupligin Sergey's avatar Chupligin Sergey

[CalendarModel] Move DateListModel to CalendarModel

parent 847eb1fb
...@@ -63,6 +63,7 @@ desktop-file-install --delete-original \ ...@@ -63,6 +63,7 @@ desktop-file-install --delete-original \
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_libdir}/qt5/qml/org/nemomobile/models/
%{_libdir}/qt5/qml/QtQuick/Controls/Nemo %{_libdir}/qt5/qml/QtQuick/Controls/Nemo
%{_libdir}/qt5/qml/QtQuick/Controls/Styles/Nemo %{_libdir}/qt5/qml/QtQuick/Controls/Styles/Nemo
......
...@@ -39,8 +39,7 @@ HEADERS += \ ...@@ -39,8 +39,7 @@ HEADERS += \
themedaemon/mlocalthemedaemonclient.h \ themedaemon/mlocalthemedaemonclient.h \
themedaemon/mabstractthemedaemonclient.h \ themedaemon/mabstractthemedaemonclient.h \
sizing.h \ sizing.h \
theme.h \ theme.h
datelistmodel.h
SOURCES += \ SOURCES += \
qquicknemocontrolsextensionplugin.cpp \ qquicknemocontrolsextensionplugin.cpp \
...@@ -52,8 +51,7 @@ SOURCES += \ ...@@ -52,8 +51,7 @@ SOURCES += \
themedaemon/mlocalthemedaemonclient.cpp \ themedaemon/mlocalthemedaemonclient.cpp \
themedaemon/mabstractthemedaemonclient.cpp \ themedaemon/mabstractthemedaemonclient.cpp \
sizing.cpp \ sizing.cpp \
theme.cpp \ theme.cpp
datelistmodel.cpp
target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "nemoimageprovider.h" #include "nemoimageprovider.h"
#include "sizing.h" #include "sizing.h"
#include "theme.h" #include "theme.h"
#include "datelistmodel.h"
QQuickNemoControlsExtensionPlugin::QQuickNemoControlsExtensionPlugin(QObject *parent) : QQuickNemoControlsExtensionPlugin::QQuickNemoControlsExtensionPlugin(QObject *parent) :
QQmlExtensionPlugin(parent) QQmlExtensionPlugin(parent)
...@@ -47,7 +46,6 @@ void QQuickNemoControlsExtensionPlugin::registerTypes(const char *uri) ...@@ -47,7 +46,6 @@ void QQuickNemoControlsExtensionPlugin::registerTypes(const char *uri)
qmlRegisterType<NemoWindow>(uri, 1, 0, "NemoWindow"); qmlRegisterType<NemoWindow>(uri, 1, 0, "NemoWindow");
qmlRegisterType<NemoPage>(uri, 1, 0, "NemoPage"); qmlRegisterType<NemoPage>(uri, 1, 0, "NemoPage");
qmlRegisterType<QQuickFilteringMouseArea>(uri, 1, 0, "FilteringMouseArea"); qmlRegisterType<QQuickFilteringMouseArea>(uri, 1, 0, "FilteringMouseArea");
qmlRegisterType<DateListModel>(uri, 1, 0, "NemoDateListModel");
} }
void QQuickNemoControlsExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri) void QQuickNemoControlsExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
** **
****************************************************************************************/ ****************************************************************************************/
#include "datelistmodel.h" #include "calendarmodel.h"
DateListModel::DateListModel(QObject *parent) : CalendarModel::CalendarModel(QObject *parent) :
QAbstractListModel(parent) QAbstractListModel(parent)
{ {
...@@ -49,13 +49,13 @@ DateListModel::DateListModel(QObject *parent) : ...@@ -49,13 +49,13 @@ DateListModel::DateListModel(QObject *parent) :
fill(); fill();
} }
int DateListModel::rowCount(const QModelIndex &parent) const int CalendarModel::rowCount(const QModelIndex &parent) const
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
return m_dateList.count(); return m_dateList.count();
} }
QVariant DateListModel::data(const QModelIndex &index, int role) const QVariant CalendarModel::data(const QModelIndex &index, int role) const
{ {
Q_UNUSED(role); Q_UNUSED(role);
if(!index.isValid()) if(!index.isValid())
...@@ -86,7 +86,7 @@ QVariant DateListModel::data(const QModelIndex &index, int role) const ...@@ -86,7 +86,7 @@ QVariant DateListModel::data(const QModelIndex &index, int role) const
} }
} }
QVariant DateListModel::get(const int idx) QVariant CalendarModel::get(const int idx)
{ {
if(idx >= m_dateList.size()) if(idx >= m_dateList.size())
{ {
...@@ -105,7 +105,7 @@ QVariant DateListModel::get(const int idx) ...@@ -105,7 +105,7 @@ QVariant DateListModel::get(const int idx)
return QVariant(itemData); return QVariant(itemData);
} }
void DateListModel::setSelectedDate(QDate date) void CalendarModel::setSelectedDate(QDate date)
{ {
if(m_selectedDate != date) if(m_selectedDate != date)
{ {
...@@ -114,7 +114,7 @@ void DateListModel::setSelectedDate(QDate date) ...@@ -114,7 +114,7 @@ void DateListModel::setSelectedDate(QDate date)
} }
} }
void DateListModel::setMonth(int month) void CalendarModel::setMonth(int month)
{ {
if(m_month != month && month > 0 && month < 13) if(m_month != month && month > 0 && month < 13)
{ {
...@@ -124,7 +124,7 @@ void DateListModel::setMonth(int month) ...@@ -124,7 +124,7 @@ void DateListModel::setMonth(int month)
} }
} }
void DateListModel::setYear(int year) void CalendarModel::setYear(int year)
{ {
if(m_year != year) if(m_year != year)
{ {
...@@ -134,7 +134,7 @@ void DateListModel::setYear(int year) ...@@ -134,7 +134,7 @@ void DateListModel::setYear(int year)
} }
} }
void DateListModel::fill() void CalendarModel::fill()
{ {
} }
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QDate> #include <QDate>
class DateListModel : public QAbstractListModel class CalendarModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
struct dateItem{ struct dateItem{
...@@ -52,7 +52,7 @@ class DateListModel : public QAbstractListModel ...@@ -52,7 +52,7 @@ class DateListModel : public QAbstractListModel
Q_PROPERTY(QDate selectedDate READ selectedDate WRITE setSelectedDate NOTIFY selectedDateChanged) Q_PROPERTY(QDate selectedDate READ selectedDate WRITE setSelectedDate NOTIFY selectedDateChanged)
public: public:
explicit DateListModel(QObject *parent = 0); explicit CalendarModel(QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const;
QHash<int, QByteArray> roleNames() const {return m_hash;} QHash<int, QByteArray> roleNames() const {return m_hash;}
......
TEMPLATE = lib
TARGET = nemomodelsplugin
QT += qml
CONFIG += qt plugin hide_symbols
SOURCES += \
calendarmodel.cpp \
plugin.cpp
HEADERS += \
calendarmodel.h
target.path = /usr/lib/qt5/qml/org/nemomobile/models/
INSTALLS += target
DISTFILES += \
qmldir
/*
* Copyright (C) 2017 Chupligin Sergey <neochapay@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* 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.
*/
#include "calendarmodel.h"
#include <QtQml>
#include <QtGlobal>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
class Q_DECL_EXPORT NemoSettingsPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.nemomobile.models")
public:
virtual ~NemoSettingsPlugin() { }
void initializeEngine(QQmlEngine *, const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.nemomobile.models"));
}
void registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.nemomobile.models"));
qmlRegisterType<CalendarModel>(uri, 1, 0, "CalendarModel");
}
};
#include "plugin.moc"
module org.nemomobile.models
plugin nemomodels
...@@ -2,3 +2,4 @@ TEMPLATE = subdirs ...@@ -2,3 +2,4 @@ TEMPLATE = subdirs
SUBDIRS += controls SUBDIRS += controls
SUBDIRS += styles SUBDIRS += styles
SUBDIRS += models
\ No newline at end of file
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