First working release
83
android-sources/AndroidManifest.xml
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<manifest package="com.itsblue.fannyapp" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.01" android:versionCode="2" android:installLocation="auto">
|
||||||
|
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="fannyapp" android:icon="@drawable/icon">
|
||||||
|
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="fannyapp" android:screenOrientation="unspecified" android:launchMode="singleTop">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- Application arguments -->
|
||||||
|
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
|
||||||
|
<!-- Application arguments -->
|
||||||
|
|
||||||
|
<meta-data android:name="android.app.lib_name" android:value="fannyapp"/>
|
||||||
|
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||||
|
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||||
|
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||||
|
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||||
|
<!-- Deploy Qt libs as part of package -->
|
||||||
|
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/>
|
||||||
|
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||||
|
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||||
|
<!-- Run with local libs -->
|
||||||
|
<meta-data android:name="android.app.use_local_qt_libs" android:value="1"/>
|
||||||
|
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||||
|
<meta-data android:name="android.app.load_local_libs" android:value="plugins/platforms/android/libqtforandroid.so:plugins/bearer/libqandroidbearer.so:lib/libQt5QuickParticles.so"/>
|
||||||
|
<meta-data android:name="android.app.load_local_jars" android:value="jar/QtAndroid.jar:jar/QtAndroid-bundled.jar:jar/QtAndroidBearer.jar:jar/QtAndroidBearer-bundled.jar:jar/QtAndroidWebView.jar:jar/QtAndroidWebView-bundled.jar"/>
|
||||||
|
<meta-data android:name="android.app.static_init_classes" android:value=""/>
|
||||||
|
<!-- Used to specify custom system library path to run with local system libs -->
|
||||||
|
<!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
|
||||||
|
<!-- Messages maps -->
|
||||||
|
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
|
||||||
|
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
||||||
|
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||||
|
<!-- Messages maps -->
|
||||||
|
|
||||||
|
<!-- Splash screen -->
|
||||||
|
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
|
||||||
|
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
|
||||||
|
<!-- Splash screen -->
|
||||||
|
|
||||||
|
<!-- Background running -->
|
||||||
|
<!-- Warning: changing this value to true may cause unexpected crashes if the
|
||||||
|
application still try to draw after
|
||||||
|
"applicationStateChanged(Qt::ApplicationSuspended)"
|
||||||
|
signal is sent! -->
|
||||||
|
<meta-data android:name="android.app.background_running" android:value="false"/>
|
||||||
|
<!-- Background running -->
|
||||||
|
|
||||||
|
<!-- auto screen scale factor -->
|
||||||
|
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
|
||||||
|
<!-- auto screen scale factor -->
|
||||||
|
|
||||||
|
<!-- extract android style -->
|
||||||
|
<!-- available android:values :
|
||||||
|
* full - useful QWidget & Quick Controls 1 apps
|
||||||
|
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
|
||||||
|
* none - useful for apps that don't use any of the above Qt modules
|
||||||
|
-->
|
||||||
|
<meta-data android:name="android.app.extract_android_style" android:value="full"/>
|
||||||
|
<!-- extract android style -->
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26"/>
|
||||||
|
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||||
|
|
||||||
|
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||||
|
Remove the comment if you do not require these default permissions. -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
|
||||||
|
Remove the comment if you do not require these default features. -->
|
||||||
|
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
|
||||||
|
|
||||||
|
</manifest>
|
BIN
android-sources/res/drawable-hdpi/icon.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
android-sources/res/drawable-ldpi/icon.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
android-sources/res/drawable-mdpi/icon.png
Normal file
After Width: | Height: | Size: 63 KiB |
22
fannyapp.pro
|
@ -1,4 +1,4 @@
|
||||||
QT += quick
|
QT += qml quick quickcontrols2
|
||||||
CONFIG += c++11
|
CONFIG += c++11
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
@ -12,15 +12,21 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
TEMPLATE = app
|
||||||
|
TARGET = fannyapp
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
source/serverconn.cpp \
|
source/serverconn.cpp \
|
||||||
source/main.cpp
|
source/main.cpp \
|
||||||
|
source/appsettings.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
headers/serverconn.h
|
headers/serverconn.h \
|
||||||
|
headers/appsettings.h
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
qml/qml.qrc
|
qml/qml.qrc \
|
||||||
|
shared.qrc
|
||||||
|
|
||||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||||
QML_IMPORT_PATH =
|
QML_IMPORT_PATH =
|
||||||
|
@ -33,4 +39,12 @@ qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
!isEmpty(target.path): INSTALLS += target
|
!isEmpty(target.path): INSTALLS += target
|
||||||
|
|
||||||
|
android {
|
||||||
|
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources
|
||||||
|
}
|
||||||
|
|
||||||
|
DISTFILES += \
|
||||||
|
favicon.png \
|
||||||
|
android-sources/AndroidManifest.xml
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.6.2, 2018-06-21T08:52:42. -->
|
<!-- Written by QtCreator 4.6.2, 2018-06-21T16:27:15. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
<value type="int">0</value>
|
<value type="int">1</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dorian/Documents/Fanny App/build-fannyapp-Desktop_Qt_5_10_1_GCC_64bit-Debug</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dorian/Documents/builds/Qt/fanny-app</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -310,7 +310,7 @@
|
||||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fannyapp.pro</value>
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fannyapp.pro</value>
|
||||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/dorian/Documents/Fanny App/build-fannyapp-Desktop_Qt_5_10_1_GCC_64bit-Debug</value>
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/dorian/Documents/builds/Qt/fanny-app/build-fannyapp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_10_1_for_Android_armv7-Release</value>
|
||||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
|
@ -327,7 +327,7 @@
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Android for armeabi-v7a (GCC 4.9, Qt 5.10.1 for Android armv7)</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Android for armeabi-v7a (GCC 4.9, Qt 5.10.1 for Android armv7)</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Android for armeabi-v7a (GCC 4.9, Qt 5.10.1 for Android armv7)</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Android for armeabi-v7a (GCC 4.9, Qt 5.10.1 for Android armv7)</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{c2d2fa4a-1656-4ab9-a542-92c96158a688}</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{c2d2fa4a-1656-4ab9-a542-92c96158a688}</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
|
@ -407,7 +407,7 @@
|
||||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dorian/Documents/Fanny App/build-fannyapp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_10_1_for_Android_armv7-Release</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dorian/Documents/builds/Qt/fanny-app/build-fannyapp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_10_1_for_Android_armv7-Release</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -441,7 +441,7 @@
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.3">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.3">
|
||||||
<value type="QString" key="BuildTargetSdk">android-27</value>
|
<value type="QString" key="BuildTargetSdk">android-27</value>
|
||||||
<value type="QString" key="KeystoreLocation"></value>
|
<value type="QString" key="KeystoreLocation">/home/dorian/Documents/gitlab/fanny-app/android_release.keystore</value>
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build Android APK</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build Android APK</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
@ -579,7 +579,10 @@
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidDeployConfiguration2</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidDeployConfiguration2</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings">
|
||||||
|
<value type="QString" key="AndroidDeviceSerialNumber">MWS0216A15001488</value>
|
||||||
|
<value type="int" key="AndroidVersion.ApiLevel">24</value>
|
||||||
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||||
|
@ -625,8 +628,8 @@
|
||||||
<valuelist type="QVariantList" key="Android.PreStartShellCmdListKey"/>
|
<valuelist type="QVariantList" key="Android.PreStartShellCmdListKey"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fannyapp</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fannyapp</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">fannyapp</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">fannyapp</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidRunConfiguration:/home/dorian/Documents/Fanny App/App/fannyapp.pro</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidRunConfiguration:/home/dorian/Documents/gitlab/fanny-app/fannyapp.pro</value>
|
||||||
<value type="QString" key="QMakeProjectManager.QmakeAndroidRunConfiguration.ProFile">../../Fanny App/App/fannyapp.pro</value>
|
<value type="QString" key="QMakeProjectManager.QmakeAndroidRunConfiguration.ProFile">fannyapp.pro</value>
|
||||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
|
|
BIN
favicon.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
favicon.xcf
Normal file
BIN
graphics/Banner.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
graphics/FannyLogo.png
Normal file
After Width: | Height: | Size: 98 KiB |
BIN
graphics/Screenshot1.jpg
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
graphics/Screenshot2.jpg
Normal file
After Width: | Height: | Size: 68 KiB |
BIN
graphics/favicon.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
graphics/favicon.xcf
Normal file
BIN
graphics/icon.jpg
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
graphics/sheute.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
graphics/smorgen.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
26
headers/appsettings.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef APPSETTINGS_H
|
||||||
|
#define APPSETTINGS_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
class AppSettings : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit AppSettings(QObject *parent = nullptr);
|
||||||
|
~AppSettings();
|
||||||
|
|
||||||
|
Q_INVOKABLE QString loadSetting(const QString &key);
|
||||||
|
Q_INVOKABLE void writeSetting(const QString &key, const QVariant &variant);
|
||||||
|
|
||||||
|
QSettings *settingsManager;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
};
|
||||||
|
extern AppSettings * pGlobalAppSettings;
|
||||||
|
|
||||||
|
#endif // APPSETTINGS_H
|
|
@ -2,8 +2,12 @@
|
||||||
#define SERVERCONN_H
|
#define SERVERCONN_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QDir>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
#include <QAuthenticator>
|
#include <QAuthenticator>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
|
#include "headers/appsettings.h"
|
||||||
|
|
||||||
typedef struct strReturnData{
|
typedef struct strReturnData{
|
||||||
int status_code;
|
int status_code;
|
||||||
|
@ -13,10 +17,20 @@ typedef struct strReturnData{
|
||||||
class ServerConn : public QObject
|
class ServerConn : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
QString username;
|
||||||
|
QString password;
|
||||||
QNetworkAccessManager *networkManager;
|
QNetworkAccessManager *networkManager;
|
||||||
|
QNetworkAccessManager *refreshNetworkManager;
|
||||||
|
public:
|
||||||
explicit ServerConn(QObject *parent = nullptr);
|
explicit ServerConn(QObject *parent = nullptr);
|
||||||
Q_INVOKABLE QString login();
|
~ServerConn();
|
||||||
|
|
||||||
|
Q_INVOKABLE QString login(QString username, QString password, bool permanent);
|
||||||
|
Q_INVOKABLE int logout();
|
||||||
|
Q_INVOKABLE QString getDay(QString day);
|
||||||
|
Q_INVOKABLE int checkConn();
|
||||||
ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData);
|
ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
28
qml/AppToolBar.qml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import QtQuick 2.6
|
||||||
|
import QtQuick.Controls 2.1
|
||||||
|
import QtQuick.Controls.Material 2.1
|
||||||
|
|
||||||
|
ToolBar {
|
||||||
|
property bool showErrorBar: true
|
||||||
|
Material.theme: Material.Light
|
||||||
|
Rectangle {
|
||||||
|
id: errorField
|
||||||
|
width: parent.width
|
||||||
|
height: 30
|
||||||
|
visible: window.is_error & stackView.currentItem.objectName !== "LoginPage" & showErrorBar
|
||||||
|
anchors.top: parent.bottom
|
||||||
|
|
||||||
|
|
||||||
|
color: "red"
|
||||||
|
Text {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
id: errorText
|
||||||
|
font.family: "Helvetica"
|
||||||
|
color: "White"
|
||||||
|
font.pointSize: 8
|
||||||
|
|
||||||
|
text: window.error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
121
qml/HomeForm.qml
|
@ -2,15 +2,126 @@ import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
width: 600
|
anchors.fill: parent
|
||||||
height: 400
|
|
||||||
|
|
||||||
title: qsTr("Home")
|
title: qsTr("Vertretungsplan")
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("You are on the home page.")
|
id: laWelcome
|
||||||
anchors.centerIn: parent
|
text: "Hier kannst du dir den Vertretungsplan des Fannys anschuen"
|
||||||
|
font.pixelSize: 20
|
||||||
|
wrapMode: Label.Wrap
|
||||||
|
width: window.width / 1.2
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
topMargin: window.height / 8 - laWelcome.height / 2
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id:buttToday
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: (window.width / 4) - (buttToday.width / 2)
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
verificationDialog.day = "sheute"
|
||||||
|
verificationDialog.open()
|
||||||
|
}
|
||||||
|
background: Image {
|
||||||
|
id: sheuteImage
|
||||||
|
source: "qrc:/graphics/sheute.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: buttTomorrow
|
||||||
|
anchors {
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: (window.width / 4) - (buttTomorrow.width / 2)
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
verificationDialog.day = "smorgen"
|
||||||
|
verificationDialog.open()
|
||||||
|
}
|
||||||
|
background: Image {
|
||||||
|
id: smorgenImage
|
||||||
|
source: "qrc:/graphics/smorgen.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
property string day
|
||||||
|
id: verificationDialog
|
||||||
|
modal: true
|
||||||
|
focus: true
|
||||||
|
title: "Bedingung"
|
||||||
|
x: (window.width - width) / 2
|
||||||
|
y: window.height / 6
|
||||||
|
width: Math.min(window.width, window.height) / 3 * 2
|
||||||
|
contentHeight: aboutColumn.height
|
||||||
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||||
|
onAccepted: {
|
||||||
|
busyDialog.open()
|
||||||
|
text.visible = false
|
||||||
|
console.log("getting file of ", day)
|
||||||
|
var ret = _cppServerConn.getDay(day)
|
||||||
|
console.log(ret)
|
||||||
|
busyDialog.close()
|
||||||
|
text.visible = true
|
||||||
|
if(ret === "OK"){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
else if(ret === "Ungültige Benutzerdaten."){
|
||||||
|
root.StackView.view.pop()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error.text = ret
|
||||||
|
window.is_error = true
|
||||||
|
window.error = ret
|
||||||
|
error.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: aboutColumn
|
||||||
|
spacing: 20
|
||||||
|
Label {
|
||||||
|
id: text
|
||||||
|
visible: true
|
||||||
|
width: verificationDialog.availableWidth
|
||||||
|
|
||||||
|
|
||||||
|
wrapMode: Label.Wrap
|
||||||
|
text: "Vertretungsplan, vertraulich, nur zum persönlichen Gebrauch, keine Speicherung!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
id: busyDialog
|
||||||
|
modal: true
|
||||||
|
closePolicy: "NoAutoClose"
|
||||||
|
focus: true
|
||||||
|
//title: "Please wait..."
|
||||||
|
x: (window.width - width) / 2
|
||||||
|
y: window.height / 6
|
||||||
|
//width: Math.min(window.width, window.height) / 3 * 2
|
||||||
|
height: contentHeight * 1.5
|
||||||
|
width: contentWidth * 1.5
|
||||||
|
contentHeight: busyIndicator.height
|
||||||
|
contentWidth: busyIndicator.width
|
||||||
|
BusyIndicator {
|
||||||
|
id: busyIndicator
|
||||||
|
visible: true
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,143 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
id: root
|
id: root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
objectName: "LoginPage";
|
||||||
|
|
||||||
|
header: AppToolBar {
|
||||||
|
|
||||||
Label {
|
|
||||||
text: qsTr("You are on login")
|
|
||||||
anchors.centerIn: parent
|
|
||||||
}
|
}
|
||||||
BusyIndicator {
|
|
||||||
id: busyIndicator
|
Image {
|
||||||
visible: true
|
id: bigLogo
|
||||||
x: 40
|
source: "favicon.png"
|
||||||
y: 49
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.margins: window.height * 0.01
|
||||||
|
height: window.height * 0.2
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
}
|
}
|
||||||
Button {
|
|
||||||
text: "main"
|
|
||||||
height: 30
|
|
||||||
width: 50
|
|
||||||
|
|
||||||
onClicked: {
|
ColumnLayout {
|
||||||
var ret = _cppServerConn.login();
|
|
||||||
|
|
||||||
|
spacing: 40
|
||||||
|
width: parent.width
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: bigLogo.height + window.height * 0.01
|
||||||
|
anchors.bottomMargin: window.height * 0.2
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: tiuname
|
||||||
|
placeholderText: "Username"
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked)
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.margins: window.width * 0.05
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: tipasswd
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
placeholderText: "Password"
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked)
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.margins: window.width * 0.05
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckDelegate {
|
||||||
|
id: cBperm
|
||||||
|
text: qsTr("Stay logged in")
|
||||||
|
checked: true
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: loginButton
|
||||||
|
objectName: "loginButton"
|
||||||
|
text: qsTr("Login")
|
||||||
|
enabled: tiuname.length > 0 & tipasswd.length > 0
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.margins: window.width * 0.05
|
||||||
|
onClicked: login(tiuname.text, tipasswd.text, cBperm.checked)
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
id: laStatus
|
||||||
|
text: qsTr("")
|
||||||
|
font.pixelSize: 20
|
||||||
|
color: "red"
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function login(username, password, permanent){
|
||||||
|
Qt.inputMethod.hide();
|
||||||
|
busyDialog.open()
|
||||||
|
loginButton.enabled = false
|
||||||
|
loginButton.text = "Loggin in.."
|
||||||
|
console.log(username, password, permanent)
|
||||||
|
var ret = _cppServerConn.login(username, password, permanent);
|
||||||
|
busyDialog.close()
|
||||||
|
loginButton.enabled = true
|
||||||
|
loginButton.text = "Login"
|
||||||
|
if(ret === "OK"){
|
||||||
|
_cppAppSettings.writeSetting("init", 1);
|
||||||
|
window.is_error = false;
|
||||||
root.StackView.view.push("MainPage.qml")
|
root.StackView.view.push("MainPage.qml")
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
if(_cppAppSettings.loadSetting("permanent") === "1"){
|
||||||
|
tiuname.text = _cppAppSettings.loadSetting("username")
|
||||||
|
tipasswd.text = _cppAppSettings.loadSetting("password")
|
||||||
|
_cppAppSettings.writeSetting("permanent", "0")
|
||||||
|
_cppAppSettings.writeSetting("username", "")
|
||||||
|
_cppAppSettings.writeSetting("password", "")
|
||||||
|
}
|
||||||
|
laStatus.text = ret
|
||||||
|
}
|
||||||
|
//root.qmlSignal(tiuname.text, tipasswd.text)
|
||||||
|
}
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
id: busyDialog
|
||||||
|
modal: true
|
||||||
|
closePolicy: "NoAutoClose"
|
||||||
|
focus: true
|
||||||
|
title: "Please wait..."
|
||||||
|
x: (window.width - width) / 2
|
||||||
|
y: window.height / 6
|
||||||
|
width: Math.min(window.width, window.height) / 3 * 2
|
||||||
|
height: 150
|
||||||
|
contentHeight: aboutColumn.height
|
||||||
|
Column {
|
||||||
|
id: aboutColumn
|
||||||
|
spacing: 20
|
||||||
|
RowLayout {
|
||||||
|
width: parent.width
|
||||||
|
BusyIndicator {
|
||||||
|
id: busyIndicator
|
||||||
|
visible: true
|
||||||
|
x: 22
|
||||||
|
y: 38
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
width: busyDialog.availableWidth
|
||||||
|
text: "logging in..."
|
||||||
|
wrapMode: Label.Wrap
|
||||||
|
font.pixelSize: 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,16 @@ import QtQuick.Controls 2.2
|
||||||
Page {
|
Page {
|
||||||
id: root
|
id: root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
header: ToolBar {
|
header: AppToolBar {
|
||||||
contentHeight: toolButton.implicitHeight
|
contentHeight: toolButton.implicitHeight
|
||||||
|
|
||||||
ToolButton {
|
ToolButton {
|
||||||
id: toolButton
|
id: toolButton
|
||||||
text: stackView.depth > 1 ? "\u25C0" : "\u2630"
|
text: stackView.depth > 1 ? "\u25C0" : "\u4E09"
|
||||||
font.pixelSize: Qt.application.font.pixelSize * 1.6
|
font.pixelSize: Qt.application.font.pixelSize * 1.6
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
console.log(toolButton.font.styleName)
|
||||||
if (stackView.depth > 1) {
|
if (stackView.depth > 1) {
|
||||||
stackView.pop()
|
stackView.pop()
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,21 +35,42 @@ Page {
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
ItemDelegate {
|
ItemDelegate {
|
||||||
text: qsTr("page 1")
|
text: qsTr("Fanny Webseite")
|
||||||
width: parent.width
|
width: parent.width
|
||||||
onClicked: {
|
onClicked: {
|
||||||
stackView.push("Page1Form.qml")
|
stackView.push("WebsitePage.qml")
|
||||||
drawer.close()
|
drawer.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ItemDelegate {
|
ItemDelegate {
|
||||||
text: qsTr("Page 2")
|
text: qsTr("abmelden")
|
||||||
width: parent.width
|
width: parent.width
|
||||||
onClicked: {
|
onClicked: {
|
||||||
stackView.push("Page2Form.qml")
|
confirmationDialog.open()
|
||||||
drawer.close()
|
}
|
||||||
|
Dialog {
|
||||||
|
id: confirmationDialog
|
||||||
|
|
||||||
|
x: (window.width - width) / 2
|
||||||
|
y: (window.height - height) / 2
|
||||||
|
parent: ApplicationWindow.overlay
|
||||||
|
|
||||||
|
|
||||||
|
modal: true
|
||||||
|
standardButtons: Dialog.Cancel | Dialog.Ok
|
||||||
|
Column {
|
||||||
|
spacing: 20
|
||||||
|
anchors.fill: parent
|
||||||
|
Label {
|
||||||
|
text: "Möchtest du dich wirklich abmelden?"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onAccepted: {
|
||||||
|
_cppServerConn.logout()
|
||||||
|
drawer.close()
|
||||||
|
root.StackView.view.push("LoginPage.qml")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
import QtQuick 2.9
|
|
||||||
import QtQuick.Controls 2.2
|
|
||||||
|
|
||||||
Page {
|
|
||||||
width: 600
|
|
||||||
height: 400
|
|
||||||
|
|
||||||
objectName: "Page1";
|
|
||||||
|
|
||||||
property string title: "value"
|
|
||||||
|
|
||||||
title: qsTr(title)
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: qsTr("You are on Page 1.")
|
|
||||||
anchors.centerIn: parent
|
|
||||||
}
|
|
||||||
BusyIndicator {
|
|
||||||
id: busyIndicator
|
|
||||||
visible: true
|
|
||||||
x: 40
|
|
||||||
y: 49
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
import QtQuick 2.9
|
|
||||||
import QtQuick.Controls 2.2
|
|
||||||
import QtQuick.Controls.Universal 2.2
|
|
||||||
|
|
||||||
Page {
|
|
||||||
width: 600
|
|
||||||
height: 400
|
|
||||||
|
|
||||||
title: qsTr("Page 2")
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: butt
|
|
||||||
text: "test"
|
|
||||||
width: parent.width
|
|
||||||
height: 20
|
|
||||||
|
|
||||||
background: Rectangle{
|
|
||||||
id: background
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "lightblue"
|
|
||||||
}
|
|
||||||
|
|
||||||
onReleased: {
|
|
||||||
background.color = "lightblue"
|
|
||||||
}
|
|
||||||
|
|
||||||
onPressed: {
|
|
||||||
background.color = "red"
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: window.width / 2 - butt.width / 2
|
|
||||||
topMargin: 200
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
46
qml/WebsitePage.qml
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import QtQuick 2.9
|
||||||
|
import QtWebView 1.1
|
||||||
|
import QtQuick.Controls 2.2
|
||||||
|
|
||||||
|
import QtWebView 1.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.Controls.Styles 1.2
|
||||||
|
|
||||||
|
Page {
|
||||||
|
id:root
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
objectName: "WebsitePage";
|
||||||
|
|
||||||
|
title: qsTr("Fanny Webseite")
|
||||||
|
ProgressBar {
|
||||||
|
id: progress
|
||||||
|
width: parent.width
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
|
//z: Qt.platform.os === "android" ? -1 : 1
|
||||||
|
visible: webView.loadProgress < 100
|
||||||
|
|
||||||
|
value: webView.loadProgress == 100 ? 0 : webView.loadProgress / 100
|
||||||
|
}
|
||||||
|
|
||||||
|
WebView {
|
||||||
|
id: webView
|
||||||
|
anchors {
|
||||||
|
top: webView.loadProgress < 100 ? progress.bottom:parent.top
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
|
||||||
|
url: "http://www.fanny-leicht.de/j34"
|
||||||
|
onLoadingChanged: {
|
||||||
|
|
||||||
|
if (loadRequest.errorString)
|
||||||
|
console.error(loadRequest.errorString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
85
qml/main.qml
|
@ -4,12 +4,91 @@ import QtQuick.Controls 2.2
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: window
|
id: window
|
||||||
visible: true
|
visible: true
|
||||||
width: 640
|
width: 540
|
||||||
height: 480
|
height: 960
|
||||||
|
|
||||||
|
property bool is_error
|
||||||
|
property string error
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
//runs only one time at applictaion lauch
|
||||||
|
id: initTimer
|
||||||
|
interval: 1;
|
||||||
|
running: true
|
||||||
|
repeat: false
|
||||||
|
onTriggered: {
|
||||||
|
var perm = _cppAppSettings.loadSetting("permanent")
|
||||||
|
console.log("checkoldlogin", perm);
|
||||||
|
if(perm === "1"){
|
||||||
|
console.log("Perm")
|
||||||
|
var ret = _cppServerConn.login(_cppAppSettings.loadSetting("username"), _cppAppSettings.loadSetting("password"), true);
|
||||||
|
if(ret === "OK"){
|
||||||
|
_cppAppSettings.writeSetting("init", 1);
|
||||||
|
window.is_error = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ret = _cppServerConn.checkConn()
|
||||||
|
handleError(ret)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stackView.push("qrc:/LoginPage.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: refreshTimer
|
||||||
|
interval: 1000;
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
onTriggered: {
|
||||||
|
var ret = _cppServerConn.checkConn()
|
||||||
|
handleError(ret)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StackView {
|
StackView {
|
||||||
id: stackView
|
id: stackView
|
||||||
initialItem: "LoginPage.qml"
|
initialItem: "MainPage.qml"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleError(error_code){
|
||||||
|
if(error_code === 200){
|
||||||
|
window.is_error = false;
|
||||||
|
window.error = "";
|
||||||
|
}
|
||||||
|
else if(error_code === 401){
|
||||||
|
_cppAppSettings.writeSetting("permanent", 0)
|
||||||
|
_cppAppSettings.writeSetting("username", "")
|
||||||
|
_cppAppSettings.writeSetting("password", "")
|
||||||
|
if(["LoginPage"].indexOf(stackView.currentItem.objectName) < 0){
|
||||||
|
console.log("switching to login page")
|
||||||
|
stackView.push("qrc:/LoginPage.qml");
|
||||||
|
}
|
||||||
|
window.is_error = true;
|
||||||
|
window.error = "Nicht angemeldet!!";
|
||||||
|
}
|
||||||
|
else if(error_code === 500){
|
||||||
|
window.is_error = true;
|
||||||
|
window.error = "Interner Server Fehler!";
|
||||||
|
}
|
||||||
|
else if(error_code === 0){
|
||||||
|
window.is_error = true;
|
||||||
|
window.error = "Keine Verbindung zum Server!";
|
||||||
|
}
|
||||||
|
else if(error_code === 404){
|
||||||
|
//the testcon function calls a non existent file to be fast, so no error here
|
||||||
|
window.is_error = false;
|
||||||
|
}
|
||||||
|
else if(error_code === 111){
|
||||||
|
window.is_error = true;
|
||||||
|
window.error = "Unbekannter interner Fehler!";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
window.is_error = true;
|
||||||
|
window.error = "Unbekannter Fehler! ("+error_code+")";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>main.qml</file>
|
<file>main.qml</file>
|
||||||
<file>HomeForm.qml</file>
|
<file>HomeForm.qml</file>
|
||||||
<file>Page1Form.qml</file>
|
|
||||||
<file>Page2Form.qml</file>
|
|
||||||
<file>qtquickcontrols2.conf</file>
|
<file>qtquickcontrols2.conf</file>
|
||||||
<file>LoginPage.qml</file>
|
<file>LoginPage.qml</file>
|
||||||
<file>MainPage.qml</file>
|
<file>MainPage.qml</file>
|
||||||
|
<file>AppToolBar.qml</file>
|
||||||
|
<file>WebsitePage.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
7
shared.qrc
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>favicon.png</file>
|
||||||
|
<file>graphics/sheute.png</file>
|
||||||
|
<file>graphics/smorgen.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
37
source/appsettings.cpp
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#include "headers/appsettings.h"
|
||||||
|
|
||||||
|
AppSettings * pGlobalAppSettings = NULL;
|
||||||
|
|
||||||
|
AppSettings::AppSettings(QObject* parent)
|
||||||
|
:QObject(parent)
|
||||||
|
{
|
||||||
|
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||||
|
qDebug(path.toLatin1());
|
||||||
|
this->settingsManager = new QSettings(path+"/fannyapp/settings.ini", QSettings::IniFormat);
|
||||||
|
|
||||||
|
qDebug("AppSettings konstruktor");
|
||||||
|
if(loadSetting("init") == "false"){
|
||||||
|
this->writeSetting("init", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AppSettings::loadSetting(const QString &key)
|
||||||
|
{
|
||||||
|
this->settingsManager->beginGroup("AppSettings");
|
||||||
|
QString value = this->settingsManager->value(key , false).toString();
|
||||||
|
this->settingsManager->endGroup();
|
||||||
|
return(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppSettings::writeSetting(const QString &key, const QVariant &variant)
|
||||||
|
{
|
||||||
|
this->settingsManager->beginGroup("AppSettings");
|
||||||
|
this->settingsManager->setValue(key , variant);
|
||||||
|
this->settingsManager->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
AppSettings::~AppSettings()
|
||||||
|
{
|
||||||
|
delete settingsManager;
|
||||||
|
}
|
||||||
|
|
|
@ -2,26 +2,41 @@
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
|
#include <QQuickStyle>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QtQml>
|
#include <QtQml>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
#include "serverconn.h"
|
#include "headers/serverconn.h"
|
||||||
|
#include "headers/appsettings.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
ServerConn * pServerConn = new ServerConn;
|
ServerConn * pServerConn = new ServerConn;
|
||||||
|
AppSettings * pAppSettings = new AppSettings();
|
||||||
|
pGlobalAppSettings = pAppSettings;
|
||||||
|
|
||||||
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
|
QQuickStyle::setStyle("Material");
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||||
if (engine.rootObjects().isEmpty())
|
if (engine.rootObjects().isEmpty())
|
||||||
return -1;
|
return -1;
|
||||||
engine.rootContext()->setContextProperty("_cppServerConn", pServerConn);
|
engine.rootContext()->setContextProperty("_cppServerConn", pServerConn);
|
||||||
|
engine.rootContext()->setContextProperty("_cppAppSettings", pAppSettings);
|
||||||
|
|
||||||
return app.exec();
|
int ret;
|
||||||
|
ret = app.exec();
|
||||||
|
|
||||||
|
delete pServerConn;
|
||||||
|
delete pAppSettings;
|
||||||
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,25 @@
|
||||||
#include "serverconn.h"
|
#include "headers/serverconn.h"
|
||||||
|
|
||||||
ServerConn::ServerConn(QObject *parent) : QObject(parent)
|
ServerConn::ServerConn(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
qDebug("serverconn konstruktor");
|
qDebug("serverconn konstruktor");
|
||||||
this->networkManager = new QNetworkAccessManager();
|
this->networkManager = new QNetworkAccessManager();
|
||||||
|
this->refreshNetworkManager = new QNetworkAccessManager();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ServerConn::login()
|
ServerConn::~ServerConn()
|
||||||
|
{
|
||||||
|
qDebug("serverconn destruktor");
|
||||||
|
delete this->networkManager;
|
||||||
|
delete this->refreshNetworkManager;
|
||||||
|
|
||||||
|
QString path = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||||
|
QDir dir(path + "/.fannyapp-tmp");
|
||||||
|
dir.removeRecursively();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ServerConn::login(QString username, QString password, bool permanent)
|
||||||
{
|
{
|
||||||
// QUrlQuery pdata;
|
// QUrlQuery pdata;
|
||||||
// ReturnData_t ret = this->senddata(QUrl("http://www.fanny-leicht.de/static15/http.intern/sheute.pdf"), pdata);
|
// ReturnData_t ret = this->senddata(QUrl("http://www.fanny-leicht.de/static15/http.intern/sheute.pdf"), pdata);
|
||||||
|
@ -19,16 +30,136 @@ QString ServerConn::login()
|
||||||
request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/sheute.pdf" ) );
|
request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/sheute.pdf" ) );
|
||||||
|
|
||||||
// Pack in credentials
|
// Pack in credentials
|
||||||
QString concatenatedCredentials = "ZedlerDo:LxyJQB";
|
QString concatenatedCredentials = username + ":" + password;
|
||||||
QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64();
|
QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64();
|
||||||
QString headerData = "Basic " + data;
|
QString headerData = "Basic " + data;
|
||||||
request.setRawHeader( "Authorization", headerData.toLocal8Bit() );
|
request.setRawHeader( "Authorization", headerData.toLocal8Bit() );
|
||||||
|
|
||||||
QUrlQuery pdata;
|
QUrlQuery pdata;
|
||||||
// Send request and connect all possible signals
|
// Send request and connect all possible signals
|
||||||
QNetworkReply*reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8());
|
QNetworkReply*reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8());
|
||||||
qDebug() << QString::fromUtf8(reply->readAll());
|
//QNetworkReply*reply = networkManager->get( request );
|
||||||
|
|
||||||
|
QEventLoop loop;
|
||||||
|
loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit()));
|
||||||
|
loop.exec();
|
||||||
|
int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
|
||||||
|
if(status_code == 200){
|
||||||
|
this->username = username;
|
||||||
|
this->password = password;
|
||||||
|
if(permanent){
|
||||||
|
pGlobalAppSettings->writeSetting("permanent", "1");
|
||||||
|
pGlobalAppSettings->writeSetting("username", username);
|
||||||
|
pGlobalAppSettings->writeSetting("password", password);
|
||||||
|
}
|
||||||
|
return("OK");
|
||||||
|
}
|
||||||
|
else if(status_code == 401){
|
||||||
|
return("Ungültige Benutzerdaten.");
|
||||||
|
}
|
||||||
|
else if(status_code == 0){
|
||||||
|
return("Keine Verbindung zum Server.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QString ret = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toChar();
|
||||||
|
ret = ret + reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toChar();
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ServerConn::logout()
|
||||||
|
{
|
||||||
|
this->username = "";
|
||||||
|
this->password = "";
|
||||||
|
pGlobalAppSettings->writeSetting("permanent", "0");
|
||||||
|
pGlobalAppSettings->writeSetting("username", "");
|
||||||
|
pGlobalAppSettings->writeSetting("password", "");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ServerConn::getDay(QString day)
|
||||||
|
{
|
||||||
|
qDebug("getting file of day");
|
||||||
|
// Create request
|
||||||
|
QNetworkRequest request;
|
||||||
|
request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/" + day + ".pdf" ) );
|
||||||
|
|
||||||
|
// Pack in credentials
|
||||||
|
// Pack in credentials
|
||||||
|
QString concatenatedCredentials = this->username + ":" + this->password;
|
||||||
|
QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64();
|
||||||
|
QString headerData = "Basic " + data;
|
||||||
|
request.setRawHeader( "Authorization", headerData.toLocal8Bit() );
|
||||||
|
|
||||||
|
QUrlQuery pdata;
|
||||||
|
// Send request and connect all possible signals
|
||||||
|
QNetworkReply*reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8());
|
||||||
|
//QNetworkReply*reply = networkManager->get( request );
|
||||||
|
|
||||||
|
QEventLoop loop;
|
||||||
|
loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit()));
|
||||||
|
loop.exec();
|
||||||
|
|
||||||
|
int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
if(status_code == 200){
|
||||||
|
qDebug("OK");
|
||||||
|
QString path = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||||
|
QDir dir;
|
||||||
|
dir.mkdir(path + "/.fannyapp-tmp");
|
||||||
|
QFile file(path + "/.fannyapp-tmp/" + day + ".pdf");
|
||||||
|
|
||||||
|
file.open(QIODevice::ReadWrite);
|
||||||
|
file.write(reply->readAll());
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
QDesktopServices::openUrl(QUrl::fromLocalFile(path + "/.fannyapp-tmp/" + day + ".pdf"));
|
||||||
|
qDebug() << QString::fromUtf8(reply->readAll());
|
||||||
|
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
|
||||||
|
return("OK");
|
||||||
|
}
|
||||||
|
else if(status_code == 401){
|
||||||
|
return("Ungültige Benutzerdaten.");
|
||||||
|
}
|
||||||
|
else if(status_code == 0){
|
||||||
|
return("Keine Verbindung zum Server.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QString ret = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toChar();
|
||||||
|
ret = ret + " (" + reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toChar() + ")";
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ServerConn::checkConn()
|
||||||
|
{
|
||||||
|
// Create request
|
||||||
|
QNetworkRequest request;
|
||||||
|
request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/" ) );
|
||||||
|
|
||||||
|
// Pack in credentials
|
||||||
|
// Pack in credentials
|
||||||
|
//ZedlerDo:LxyJQB
|
||||||
|
QString concatenatedCredentials = this->username + ":" + this->password;
|
||||||
|
QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64();
|
||||||
|
QString headerData = "Basic " + data;
|
||||||
|
request.setRawHeader( "Authorization", headerData.toLocal8Bit() );
|
||||||
|
|
||||||
|
QUrlQuery pdata;
|
||||||
|
// Send request and connect all possible signals
|
||||||
|
QNetworkReply*reply = this->refreshNetworkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8());
|
||||||
|
//QNetworkReply*reply = networkManager->get( request );
|
||||||
|
|
||||||
|
QEventLoop loop;
|
||||||
|
loop.connect(this->refreshNetworkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit()));
|
||||||
|
loop.exec();
|
||||||
|
|
||||||
|
int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
return(status_code);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ReturnData_t ServerConn::senddata(QUrl serviceUrl, QUrlQuery pdata)
|
ReturnData_t ServerConn::senddata(QUrl serviceUrl, QUrlQuery pdata)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|