Merge v0.6.0 and v0.6.1 #29

Merged
dorian merged 30 commits from version/0.5.1 into master 2024-10-17 17:52:37 +02:00
10 changed files with 58 additions and 51 deletions
Showing only changes of commit 229732762c - Show all commits

View file

@ -17,8 +17,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \ SOURCES += \
sources/appsettings.cpp \ sources/appsettings.cpp \
sources/main.cpp \ sources/bluerockbackend.cpp \
sources/serverconn.cpp sources/main.cpp
RESOURCES += resources/qml/qml.qrc \ RESOURCES += resources/qml/qml.qrc \
resources/shared/shared.qrc \ resources/shared/shared.qrc \
@ -42,7 +42,7 @@ DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
HEADERS += \ HEADERS += \
headers/appsettings.h \ headers/appsettings.h \
headers/serverconn.h headers/bluerockbackend.h
DISTFILES += \ DISTFILES += \
CHANGELOG.md \ CHANGELOG.md \

View file

@ -21,12 +21,6 @@ private:
QSettings *settingsManager; QSettings *settingsManager;
// QSettings object which cares about our settings.ini file // QSettings object which cares about our settings.ini file
QSettings *themeSettingsManager;
// QSettings object which cares about the themes
signals:
void themeChanged();
public slots: public slots:
Q_INVOKABLE QString read(const QString &key); Q_INVOKABLE QString read(const QString &key);
// function to read values from the settings file // function to read values from the settings file

View file

@ -25,11 +25,11 @@
#include <QTimer> #include <QTimer>
#include <QUrl> #include <QUrl>
class ServerConn : public QObject class BlueRockBackend : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ServerConn(QObject *parent = nullptr); explicit BlueRockBackend(QObject *parent = nullptr);
private: private:
QVariantMap senddata(QUrl serviceUrl, QUrlQuery pdata = QUrlQuery()); QVariantMap senddata(QUrl serviceUrl, QUrlQuery pdata = QUrlQuery());
@ -40,6 +40,8 @@ public slots:
QVariant getWidgetData(QVariantMap params); QVariant getWidgetData(QVariantMap params);
QVariantMap getParamsFromUrl(QString url);
}; };
#endif // SERVERCONN_H #endif // SERVERCONN_H

View file

@ -18,6 +18,7 @@
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.12
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
Item { Item {
@ -37,10 +38,6 @@ Item {
property double dragRefreshPositionMultiplier: 0.6 // position of the item when starting to refresh property double dragRefreshPositionMultiplier: 0.6 // position of the item when starting to refresh
property color backgroundColor: "white" // color for the pre-defined background
property color pullIndicatorColor: "black" // color for the pre-defined pull indicator
//property color busyIndicatorColor: "pink" // color for the pre-defined busy indicator
readonly property double dragProgress: Math.min( userPosition / dragOutPosition, 1) readonly property double dragProgress: Math.min( userPosition / dragOutPosition, 1)
property Component background: Item { property Component background: Item {
@ -61,7 +58,7 @@ Item {
anchors.fill: parent anchors.fill: parent
radius: width * 0.5 radius: width * 0.5
color: control.backgroundColor color: Material.dialogColor
} }
} }
property Component busyIndicator: BusyIndicator { running: true } property Component busyIndicator: BusyIndicator { running: true }
@ -107,7 +104,7 @@ Item {
ctx.reset() ctx.reset()
ctx.lineWidth = lineWidth; ctx.lineWidth = lineWidth;
ctx.strokeStyle = control.pullIndicatorColor; ctx.strokeStyle = control.Material.foreground;
// middle line // middle line
ctx.moveTo(width/2, topMargin); ctx.moveTo(width/2, topMargin);

View file

@ -1,5 +1,6 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import QtPurchasing 1.12 import QtPurchasing 1.12
@ -9,7 +10,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
anchors.margins: -20 anchors.margins: -20
color: "white" color: Material.background
Connections { Connections {
target: speedFlowChartProduct target: speedFlowChartProduct
@ -47,30 +48,15 @@ Rectangle {
//spacing: parent.height * 0.05 //spacing: parent.height * 0.05
Image { Label {
id: name
Layout.alignment: Layout.Center
Layout.preferredHeight: height
Layout.preferredWidth: width
width: lockedLayout.height * 0.05
height: width
mipmap: true
source: "qrc:/icons/lock.png"
}
Text {
Layout.fillWidth: true Layout.fillWidth: true
height: parent.height * 0.05 height: parent.height * 0.015
text: qsTr("This is a premium feature.") text: qsTr("This is a premium feature.")
font.bold: true font.bold: true
font.pixelSize: parent.height * 0.05 font.pixelSize: height
fontSizeMode: Text.Fit fontSizeMode: Text.Fit
minimumPixelSize: 1 minimumPixelSize: 1

View file

@ -88,7 +88,13 @@ Page {
root.ready = false root.ready = false
} }
} }
else if(ret["status"] === 404 && [WidgetPage.WidgetType.Registration, WidgetPage.WidgetType.Startlist, WidgetPage.WidgetType.Result].includes(root.widgetType) && root.params["route"] !== "") { else if(ret["status"] === 404 &&
[
WidgetPage.WidgetType.Registration,
WidgetPage.WidgetType.Startlist,
WidgetPage.WidgetType.Result
].includes(root.widgetType) &&
root.params["route"] !== "") {
// if we get a 404 and have startlist, results or registration, the route was not found -> remove round and try again // if we get a 404 and have startlist, results or registration, the route was not found -> remove round and try again
root.params["route"] = "" root.params["route"] = ""
loadData(root.params) loadData(root.params)

View file

@ -23,7 +23,7 @@ import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.12 import QtQuick.Controls.Material 2.12
import QtPurchasing 1.12 import QtPurchasing 1.12
import com.itsblue.digitalRockRanking 1.0 import de.itsblue.blueROCK 1.0
import "./Pages" import "./Pages"
import "./Components" import "./Components"
@ -142,8 +142,13 @@ Window {
onActivated: app.goBack() onActivated: app.goBack()
} }
ServerConn { BlueRockBackend {
id: serverConn id: serverConn
Component.onCompleted: {
var params = serverConn.getParamsFromUrl("https://www.digitalrock.de/egroupware/ranking/sitemgr/digitalrock/eliste.html#!comp=11471&cat=GER_F_A")
app.openWidget(params)
}
} }
AppSettings { AppSettings {
@ -484,7 +489,7 @@ Window {
Product { Product {
id: speedFlowChartProduct id: speedFlowChartProduct
//identifier: "speed_flowchart" //identifier: "speed_flowchart"
identifier: "android.test.purchased" identifier: QT_DEBUG ? "android.test.purchased":"speed_flowchart"
//identifier: "android.test.canceled" //identifier: "android.test.canceled"
//identifier: "android.test.refunded" //identifier: "android.test.refunded"

View file

@ -15,8 +15,6 @@ AppSettings::AppSettings(QObject* parent)
// set the values to their defaults if they haven't been created yet // set the values to their defaults if they haven't been created yet
// create or open the settings.ini file
this->themeSettingsManager = new QSettings(":/themes/" + this->read("theme") + ".ini", QSettings::IniFormat);
} }
QString AppSettings::read(const QString &key) QString AppSettings::read(const QString &key)

View file

@ -16,13 +16,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "headers/serverconn.h" #include "headers/bluerockbackend.h"
ServerConn::ServerConn(QObject *parent) : QObject(parent) BlueRockBackend::BlueRockBackend(QObject *parent) : QObject(parent)
{ {
} }
QVariant ServerConn::getWidgetData(QVariantMap params) { QVariant BlueRockBackend::getWidgetData(QVariantMap params) {
QString requestUrl; QString requestUrl;
if(params["nation"].toString() == "ICC") { if(params["nation"].toString() == "ICC") {
requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?"; requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?";
@ -61,11 +61,29 @@ QVariant ServerConn::getWidgetData(QVariantMap params) {
return data; return data;
} }
QVariantMap BlueRockBackend::getParamsFromUrl(QString stringUrl) {
stringUrl = stringUrl.replace("#!", "?");
QUrl url(stringUrl);
QUrlQuery query(url.query());
QVariantMap params;
for(QPair<QString, QString> pair : query.queryItems()) {
if(params.contains(pair.first))
params[pair.first] = pair.second;
else
params.insert(pair.first, pair.second);
}
return params;
}
// ------------------------ // ------------------------
// --- Helper functions --- // --- Helper functions ---
// ------------------------ // ------------------------
QVariantMap ServerConn::senddata(QUrl serviceUrl, QUrlQuery pdata) QVariantMap BlueRockBackend::senddata(QUrl serviceUrl, QUrlQuery pdata)
{ {
// create network manager // create network manager
QNetworkAccessManager * networkManager = new QNetworkAccessManager(); QNetworkAccessManager * networkManager = new QNetworkAccessManager();

View file

@ -22,8 +22,9 @@
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QIcon> #include <QIcon>
#include <QStyleFactory> #include <QStyleFactory>
#include <QUrl>
#include "headers/serverconn.h" #include "headers/bluerockbackend.h"
#include "headers/appsettings.h" #include "headers/appsettings.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -37,8 +38,8 @@ int main(int argc, char *argv[])
QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << ":/resources/shared/icons"); QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << ":/resources/shared/icons");
QIcon::setThemeName("bluerock"); QIcon::setThemeName("bluerock");
qmlRegisterType<ServerConn>("com.itsblue.digitalRockRanking", 1, 0, "ServerConn"); qmlRegisterType<BlueRockBackend>("de.itsblue.blueROCK", 1, 0, "BlueRockBackend");
qmlRegisterType<AppSettings>("com.itsblue.digitalRockRanking", 1, 0, "AppSettings"); qmlRegisterType<AppSettings>("de.itsblue.blueROCK", 1, 0, "AppSettings");
QQmlApplicationEngine engine; QQmlApplicationEngine engine;