Commit 035f20c6 authored by camilo higuita's avatar camilo higuita

now working again on android with qt > 5.12

parent de3bbc5b
Pipeline #6439 failed with stage
in 19 minutes and 35 seconds
......@@ -2,20 +2,17 @@ QT += qml
QT += quick
QT += sql
CONFIG += c++11
TARGET = index
CONFIG += c++17
QMAKE_LINK += -nostdlib++
#DESTDIR = $$OUT_PWD/../
linux:unix:!android {
message(Building for Linux KDE)
include($$PWD/src/kde/kde.pri)
} else:android {
message(Building helpers for Android)
include($$PWD/mauikit/mauikit.pri)
include($$PWD/3rdparty/kirigami/kirigami.pri)
include($$PWD/3rdparty/mauikit/mauikit.pri)
DEFINES += STATIC_KIRIGAMI
......@@ -38,9 +35,12 @@ SOURCES += \
$$PWD/src/main.cpp \
$$PWD/src/index.cpp \
HEADERS += \
$$PWD/src/index.h \
$$PWD/src/inx.h \
RESOURCES += \
$$PWD/src/qml.qrc \
# $$PWD/src/assets.qrc \
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
......@@ -53,11 +53,19 @@ qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
$$PWD/src/index.h \
$$PWD/src/inx.h \
include($$PWD/install.pri)
DISTFILES += \
$$PWD/org.kde.index.desktop
$$PWD/org.kde.index.desktop \
3rdparty/mauikit/src/android/AndroidManifest.xml \
3rdparty/mauikit/src/android/build.gradle \
3rdparty/mauikit/src/android/gradle/wrapper/gradle-wrapper.jar \
3rdparty/mauikit/src/android/gradle/wrapper/gradle-wrapper.properties \
3rdparty/mauikit/src/android/gradlew \
3rdparty/mauikit/src/android/gradlew.bat \
3rdparty/mauikit/src/android/res/values/libs.xml
contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
ANDROID_PACKAGE_SOURCE_DIR = \
$$PWD/3rdparty/mauikit/src/android
}
*.pro.user
*.*~
~*.*
QT += KService KNotifications KNotifications KI18n
QT += KIOCore KIOFileWidgets KIOWidgets KNTLM
desktop.files += $$PWD../../org.kde.index.desktop
desktop.path += /usr/share/applications
INSTALLS += desktop
DISTFILES += \
$$PWD/kde.pri
HEADERS += \
$$PWD/kde.h \
$$PWD/notify.h
SOURCES += \
$$PWD/notify.cpp
LIBS += -lMauiKit
/***
Pix Copyright (C) 2018 Camilo Higuita
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
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 General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "notify.h"
Notify::Notify(QObject *parent) : QObject(parent)
{}
Notify::~Notify()
{
qDebug()<<"DELETING KNOTIFY";
}
void Notify::notify(const QString &title, const QString &body)
{
// notification->setComponentName(QStringLiteral("Babe"));
auto notification = new KNotification(QStringLiteral("Notify"),KNotification::CloseOnTimeout, this);
connect(notification, &KNotification::closed, notification, &KNotification::deleteLater);
notification->setTitle(QStringLiteral("%1").arg(title));
notification->setText(QStringLiteral("%1").arg(body));
notification->sendEvent();
}
/***
Pix Copyright (C) 2018 Camilo Higuita
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
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 General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef NOTIFY_H
#define NOTIFY_H
#include <QObject>
#include <QByteArray>
#include <klocalizedstring.h>
#include <knotifyconfig.h>
#include <knotification.h>
#include <QStandardPaths>
#include <QPixmap>
#include <QDebug>
#include <QMap>
class Notify : public QObject
{
Q_OBJECT
public:
explicit Notify(QObject *parent = nullptr);
~Notify();
void notify(const QString &title, const QString &body);
private:
};
#endif // NOTIFY_H
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QIcon>
#include <QCommandLineParser>
#include <QFileInfo>
#include <QDebug>
#include "index.h"
#include "inx.h"
......@@ -16,7 +14,11 @@
#endif
#ifdef STATIC_KIRIGAMI
#include "./../3rdparty/kirigami/src/kirigamiplugin.h"
#include "3rdparty/kirigami/src/kirigamiplugin.h"
#endif
#ifdef STATIC_MAUIKIT
#include "3rdparty/mauikit/src/mauikit.h"
#endif
int main(int argc, char *argv[])
......@@ -47,19 +49,6 @@ int main(int argc, char *argv[])
if(!args.isEmpty())
paths = args;
Index index;
QQmlApplicationEngine engine;
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, [&]()
{
if(!paths.isEmpty())
index.openPaths(paths);
});
auto context = engine.rootContext();
context->setContextProperty("inx", &index);
#ifdef STATIC_KIRIGAMI
KirigamiPlugin::getInstance().registerTypes();
#endif
......@@ -68,18 +57,22 @@ int main(int argc, char *argv[])
MauiKit::getInstance().registerTypes();
#endif
#ifndef Q_OS_ANDROID
// QStringList importPathList = engine.importPathList();
// importPathList.prepend(QCoreApplication::applicationDirPath() + "/kde/qmltermwidget");
// engine.setImportPathList(importPathList);
// QQuickStyle::setStyle("material");
#endif
Index index;
QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url, paths, &index](QObject *obj, const QUrl &objUrl)
{
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
// QQuickStyle::setStyle("Material");
if(!paths.isEmpty())
index.openPaths(paths);
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
}, Qt::QueuedConnection);
auto context = engine.rootContext();
context->setContextProperty("inx", &index);
engine.load(url);
return app.exec();
}
......@@ -208,6 +208,6 @@ Maui.ApplicationWindow
Component.onCompleted:
{
if(isAndroid)
Maui.Android.statusbarColor(backgroundColor, true)
Maui.Android.statusbarColor(Kirigami.Theme.backgroundColor, true)
}
}
import QtQuick 2.9
import QtQuick.Controls 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.0 as Kirigami
import org.kde.mauikit 1.0 as Maui
......
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