Commit a9a12c79 authored by camilo higuita's avatar camilo higuita

fix issue with image provider for contacts

parent 49e86f2e
...@@ -5,7 +5,7 @@ project(dialer LANGUAGES CXX) ...@@ -5,7 +5,7 @@ project(dialer LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(ECM 1.7.0 REQUIRED NO_MODULE) find_package(ECM 1.7.0 REQUIRED NO_MODULE)
...@@ -20,9 +20,6 @@ include(ECMInstallIcons) ...@@ -20,9 +20,6 @@ include(ECMInstallIcons)
include(FeatureSummary) include(FeatureSummary)
include(ECMAddAppIcon) include(ECMAddAppIcon)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTORCC ON)
set(dialer_SRCS set(dialer_SRCS
src/main.cpp src/main.cpp
src/interfaces/synchroniser.cpp src/interfaces/synchroniser.cpp
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
#endif #endif
#include <QDebug> #include <QDebug>
ContactImage::ContactImage() : QQuickImageProvider(QQuickImageProvider::Image) ContactImage::ContactImage(ImageType type, Flags flags)
: QQuickImageProvider(type, flags), no_image(QImage(":/portrait.jpg"))
{ {
this->no_image = QImage(":/portrait.jpg"); // this->blockSignals(false);
this->blockSignals(false);
} }
QImage ContactImage::requestImage(const QString &id, QSize *size, const QSize &requestedSize) QImage ContactImage::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
......
...@@ -8,8 +8,7 @@ class ContactImage : public QObject, public QQuickImageProvider ...@@ -8,8 +8,7 @@ class ContactImage : public QObject, public QQuickImageProvider
{ {
Q_OBJECT Q_OBJECT
public: public:
ContactImage(); ContactImage(ImageType type, Flags flags = nullptr);
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override; QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
public slots: public slots:
......
...@@ -11,10 +11,6 @@ ...@@ -11,10 +11,6 @@
#include "./src/interfaces/kcontactsinterface.h" #include "./src/interfaces/kcontactsinterface.h"
#endif #endif
extern void test()
{
qDebug()<< "from anotehr thread";
}
Synchroniser::Synchroniser(QObject *parent) : QObject (parent) Synchroniser::Synchroniser(QObject *parent) : QObject (parent)
{ {
......
...@@ -25,8 +25,6 @@ public: ...@@ -25,8 +25,6 @@ public:
bool insertContact(const FMH::MODEL &contact, const FMH::MODEL &account = {{}}); bool insertContact(const FMH::MODEL &contact, const FMH::MODEL &account = {{}});
bool updateContact(const FMH::MODEL &contact); bool updateContact(const FMH::MODEL &contact);
bool removeContact(const FMH::MODEL &contact); bool removeContact(const FMH::MODEL &contact);
// FMH::MODEL_LIST getAccounts() const; // FMH::MODEL_LIST getAccounts() const;
private: private:
...@@ -34,7 +32,6 @@ private: ...@@ -34,7 +32,6 @@ private:
AndroidIntents *android; AndroidIntents *android;
#endif #endif
signals: signals:
void contactsReady(FMH::MODEL_LIST contacts); void contactsReady(FMH::MODEL_LIST contacts);
void callLogsReady(); void callLogsReady();
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <QApplication> #include <QApplication>
#endif #endif
#include <memory>
#include "src/union.h" #include "src/union.h"
#include "./src/models/basemodel.h" #include "./src/models/basemodel.h"
...@@ -66,8 +67,11 @@ if(parser.isSet("sync")) ...@@ -66,8 +67,11 @@ if(parser.isSet("sync"))
return 0; return 0;
} }
QScopedPointer<ContactImage> contactImageProvider(new ContactImage()); {
// std::unique_ptr<ContactImage> contactImageProvider( new ContactImage);
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
// engine->addImageProvider(QLatin1String("colors"), new ColorImageProvider);
// QQuickStyle::setStyle("Material"); // QQuickStyle::setStyle("Material");
#ifdef STATIC_KIRIGAMI #ifdef STATIC_KIRIGAMI
...@@ -79,7 +83,7 @@ if(parser.isSet("sync")) ...@@ -79,7 +83,7 @@ if(parser.isSet("sync"))
#endif #endif
engine.addImageProvider("contact", contactImageProvider.data()); engine.addImageProvider("contact", new ContactImage(QQuickImageProvider::ImageType::Image));
qmlRegisterUncreatableType<BaseList>("UnionModels", 1, 0, "BaseList", QStringLiteral("BaseList should not be created in QML")); qmlRegisterUncreatableType<BaseList>("UnionModels", 1, 0, "BaseList", QStringLiteral("BaseList should not be created in QML"));
qmlRegisterType<BaseModel>("UnionModels", 1, 0, "BaseModel"); qmlRegisterType<BaseModel>("UnionModels", 1, 0, "BaseModel");
qmlRegisterType<ContactsModel>("UnionModels", 1, 0, "ContactsList"); qmlRegisterType<ContactsModel>("UnionModels", 1, 0, "ContactsList");
...@@ -91,3 +95,4 @@ if(parser.isSet("sync")) ...@@ -91,3 +95,4 @@ if(parser.isSet("sync"))
return app.exec(); return app.exec();
} }
}
...@@ -11,25 +11,22 @@ ...@@ -11,25 +11,22 @@
#include <MauiKit/fm.h> #include <MauiKit/fm.h>
#endif #endif
ContactsModel::ContactsModel(QObject *parent) : BaseList(parent) ContactsModel::ContactsModel(QObject *parent) : BaseList(parent), syncer(new Synchroniser(this))
{ {
this->syncer = new Synchroniser(this); // connect(syncer, &Synchroniser::contactsReady, [this](FMH::MODEL_LIST contacts)
connect(syncer, &Synchroniser::contactsReady, [this](FMH::MODEL_LIST contacts) // {
{ // qDebug() << "CONATCTS READY AT MODEL 1" << contacts;
qDebug() << "CONATCTS READY AT MODEL 1" << contacts; // emit this->preListChanged();
// this->list = contacts;
emit this->preListChanged(); // this->listbk = this->list;
this->list = contacts; // qDebug() << "CONATCTS READY AT MODEL" << this->list;
this->listbk = this->list;
qDebug() << "CONATCTS READY AT MODEL" << this->list; // this->filter();
// this->sortList();
this->filter(); // emit this->postListChanged();
this->sortList(); // });
emit this->postListChanged();
// this->getList(true);
});
this->getList(true);
} }
FMH::MODEL_LIST ContactsModel::items() const FMH::MODEL_LIST ContactsModel::items() const
...@@ -53,7 +50,6 @@ QString ContactsModel::getQuery() const ...@@ -53,7 +50,6 @@ QString ContactsModel::getQuery() const
return this->query; return this->query;
} }
void ContactsModel::setSortBy(const SORTBY &sort) void ContactsModel::setSortBy(const SORTBY &sort)
{ {
if(this->sort == sort) if(this->sort == sort)
......
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