diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 65d57e2..4bc235f 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -89,4 +89,5 @@
+
diff --git a/android/res/xml/filepaths.xml b/android/res/xml/filepaths.xml
index 6b3e3f8..6a45457 100644
--- a/android/res/xml/filepaths.xml
+++ b/android/res/xml/filepaths.xml
@@ -1,3 +1,3 @@
-
+
diff --git a/headers/shareUtils/androidshareutils.h b/headers/shareUtils/androidshareutils.h
index 50786fd..2080ddb 100755
--- a/headers/shareUtils/androidshareutils.h
+++ b/headers/shareUtils/androidshareutils.h
@@ -16,6 +16,7 @@ public:
AndroidShareUtils(QObject* parent = nullptr);
bool checkMimeTypeView(const QString &mimeType) override;
bool checkMimeTypeEdit(const QString &mimeType) override;
+ virtual QString getTemporaryFileLocationPath() override;
void shareText(const QString &text) override;
void sendFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId) override;
void viewFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId) override;
diff --git a/headers/shareUtils/platformshareutils.h b/headers/shareUtils/platformshareutils.h
index 504983f..381b0ba 100644
--- a/headers/shareUtils/platformshareutils.h
+++ b/headers/shareUtils/platformshareutils.h
@@ -18,6 +18,9 @@
#include
#include
+#include
+#include
+#include
class PlatformShareUtils : public QObject
{
@@ -35,6 +38,7 @@ public:
virtual ~PlatformShareUtils();
virtual bool checkMimeTypeView(const QString &mimeType);
virtual bool checkMimeTypeEdit(const QString &mimeType);
+ virtual QString getTemporaryFileLocationPath();
virtual void shareText(const QString &text);
virtual void sendFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId);
virtual void viewFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId);
diff --git a/headers/shareUtils/shareutils.h b/headers/shareUtils/shareutils.h
index 956a316..192d2fd 100755
--- a/headers/shareUtils/shareutils.h
+++ b/headers/shareUtils/shareutils.h
@@ -46,6 +46,7 @@ public:
explicit ShareUtils(QObject *parent = 0);
Q_INVOKABLE bool checkMimeTypeView(const QString &mimeType);
Q_INVOKABLE bool checkMimeTypeEdit(const QString &mimeType);
+ Q_INVOKABLE QString getTemporaryFileLocationPath();
Q_INVOKABLE void shareText(const QString &text);
Q_INVOKABLE void sendFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId);
Q_INVOKABLE void viewFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId);
diff --git a/resources/qml/Components/SharePopup.qml b/resources/qml/Components/SharePopup.qml
index d566d02..818748d 100644
--- a/resources/qml/Components/SharePopup.qml
+++ b/resources/qml/Components/SharePopup.qml
@@ -1,7 +1,8 @@
-import QtQuick 2.0
+import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QZXing 3.1
+import QtGraphicalEffects 1.0
Dialog {
id: control
@@ -31,56 +32,83 @@ Dialog {
Component {
id: shareComponent
StackLayout {
- id: stackLayout
- currentIndex: 0
+ id: stackLayout
+ currentIndex: 0
- RowLayout {
- id: menuRow
- Repeater {
- id: buttonRepeater
- property var buttons: [
- ["\uf0c1", "Link", serverConn.shareResultsAsUrl],
- ["\uf029", "QR-code", function() {
- stackLayout.currentIndex = 1
- }
- ],
- ["\uf1c1", "Poster", serverConn.shareResultsAsPoster],
- ]
-
- model: buttons
-
- delegate: Button {
- flat: true
- font.family: fa5solid.name
- text: "" + modelData[0] + "
" + modelData[1] + " "
- onClicked: buttonRepeater.buttons[index][2](_shareUrl, _compName)
+ RowLayout {
+ id: menuRow
+ Repeater {
+ id: buttonRepeater
+ property var buttons: [
+ ["\uf0c1", "Link", serverConn.shareResultsAsUrl],
+ ["\uf029", "QR-code", function() {
+ stackLayout.currentIndex = 1
}
- }
- }
+ ],
+ ["\uf1c1", "Poster", serverConn.shareResultsAsPoster],
+ ]
+ model: buttons
- Image {
- id: qrCodeImage
-
- property int size: stackLayout.currentIndex === 1 ? (app.landscape() ? app.height * 0.8 : app.width * 0.8):menuRow.height
-
- Layout.preferredHeight: size
- Layout.preferredWidth: size
-
- sourceSize.width: size
- sourceSize.height: size
-
- fillMode: Image.PreserveAspectFit
-
- source: "image://QZXing/encode/" + _shareUrl + "?border=true&correctionLevel=H"
-
- Behavior on size {
- NumberAnimation {
- duration: 200
- }
+ delegate: Button {
+ flat: true
+ font.family: fa5solid.name
+ text: "" + modelData[0] + "
" + modelData[1] + " "
+ onClicked: buttonRepeater.buttons[index][2](_shareUrl, _compName)
}
}
}
+
+
+ Image {
+ id: qrCodeImage
+
+ property int finalSize: app.landscape() ? app.height * 0.8 : app.width * 0.8
+ property int size: stackLayout.currentIndex === 1 ? finalSize:menuRow.height
+
+ Layout.preferredHeight: size
+ Layout.preferredWidth: size
+
+ sourceSize.width: finalSize
+ sourceSize.height: finalSize
+
+ fillMode: Image.PreserveAspectFit
+
+ source: "image://QZXing/encode/" + _shareUrl + "?border=true&correctionLevel=H"
+
+ RectangularGlow {
+ id: effect
+ anchors.fill: blurRockLogoBackgroundRect
+ glowRadius: 0
+ spread: 0
+ opacity: 0.8
+ color: "black"
+ cornerRadius: blurRockLogoBackgroundRect.radius
+ }
+
+ Rectangle {
+ id: blurRockLogoBackgroundRect
+ anchors.centerIn: parent
+ width: parent.width * 0.25
+ height: width
+ radius: height * 0.2
+ color: "white"
+ Image {
+ anchors.centerIn: parent
+ width: parent.width * 0.8
+ height: width
+ mipmap: true
+ source: "qrc:/icons/blueRockHold.png"
+ }
+ }
+
+ Behavior on size {
+ NumberAnimation {
+ duration: 200
+ }
+ }
+ }
+ }
}
function appear(shareUrl, compName) {
diff --git a/sources/bluerockbackend.cpp b/sources/bluerockbackend.cpp
index 21ce732..726dcf8 100644
--- a/sources/bluerockbackend.cpp
+++ b/sources/bluerockbackend.cpp
@@ -97,9 +97,26 @@ void BlueRockBackend::shareResultsAsUrl(QString url, QString compName) {
}
void BlueRockBackend::shareResultsAsPoster(QString url, QString compName) {
- QString path = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
+ QString path = this->_shareUtils->getTemporaryFileLocationPath(); //QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
+ if (!QDir(path).exists()) {
+ if (QDir("").mkpath(path)) {
+ qDebug() << "Created app data /files directory. " << path;
+ } else {
+ qWarning() << "Failed to create app data /files directory. " << path;
+ return;
+ }
+ }
+
path += "/" + compName + ".pdf";
- QPdfWriter writer(path);
+
+ QFile file(path);
+ file.remove();
+ if(!file.open(QIODevice::ReadWrite)) {
+ qWarning("Could not open File for writing!!");
+ return;
+ }
+
+ QPdfWriter writer(&file);
writer.setPageSize(QPageSize(QPageSize::A4));
writer.setPageMargins(QMargins(0, 0, 0, 0));
writer.setResolution(600);
@@ -115,9 +132,9 @@ void BlueRockBackend::shareResultsAsPoster(QString url, QString compName) {
painter.drawPixmap((writer.width() - size) / 2, size * 0.5, size, size, barcode);
painter.end();
+ file.close();
- int requestId;
- this->_shareUtils->sendFile(path, compName, "application/pdf", requestId);
+ this->_shareUtils->sendFile(path, compName, "application/pdf", 1);
}
// ------------------------
diff --git a/sources/shareUtils/androidshareutils.cpp b/sources/shareUtils/androidshareutils.cpp
index 8390008..bbe9d90 100755
--- a/sources/shareUtils/androidshareutils.cpp
+++ b/sources/shareUtils/androidshareutils.cpp
@@ -54,6 +54,10 @@ bool AndroidShareUtils::checkMimeTypeEdit(const QString &mimeType)
return verified;
}
+QString AndroidShareUtils::getTemporaryFileLocationPath() {
+ return QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).value(0) + "/temporaryFiles";
+}
+
void AndroidShareUtils::shareText(const QString &text)
{
QAndroidJniObject jsText = QAndroidJniObject::fromString(text);
@@ -296,7 +300,7 @@ extern "C" {
#endif
JNIEXPORT void JNICALL
-Java_org_ekkescorner_examples_sharex_QShareActivity_setFileUrlReceived(JNIEnv *env,
+Java_de_itsblue_blueROCK_MainActivity_setFileUrlReceived(JNIEnv *env,
jobject obj,
jstring url)
{
@@ -308,7 +312,7 @@ Java_org_ekkescorner_examples_sharex_QShareActivity_setFileUrlReceived(JNIEnv *e
}
JNIEXPORT void JNICALL
-Java_org_ekkescorner_examples_sharex_QShareActivity_setFileReceivedAndSaved(JNIEnv *env,
+Java_de_itsblue_blueROCK_MainActivity_setFileReceivedAndSaved(JNIEnv *env,
jobject obj,
jstring url)
{
@@ -320,7 +324,7 @@ Java_org_ekkescorner_examples_sharex_QShareActivity_setFileReceivedAndSaved(JNIE
}
JNIEXPORT bool JNICALL
-Java_org_ekkescorner_examples_sharex_QShareActivity_checkFileExits(JNIEnv *env,
+Java_de_itsblue_blueROCK_MainActivity_checkFileExits(JNIEnv *env,
jobject obj,
jstring url)
{
@@ -332,7 +336,7 @@ Java_org_ekkescorner_examples_sharex_QShareActivity_checkFileExits(JNIEnv *env,
}
JNIEXPORT void JNICALL
-Java_org_ekkescorner_examples_sharex_QShareActivity_fireActivityResult(JNIEnv *env,
+Java_de_itsblue_blueROCK_MainActivity_fireActivityResult(JNIEnv *env,
jobject obj,
jint requestCode,
jint resultCode)
diff --git a/sources/shareUtils/platformshareutils.cpp b/sources/shareUtils/platformshareutils.cpp
index c90793a..4040d72 100644
--- a/sources/shareUtils/platformshareutils.cpp
+++ b/sources/shareUtils/platformshareutils.cpp
@@ -17,17 +17,23 @@ bool PlatformShareUtils::checkMimeTypeEdit(const QString &mimeType) {
qDebug() << "check edit for " << mimeType;
return true;
}
+QString PlatformShareUtils::getTemporaryFileLocationPath() {
+ return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
+}
void PlatformShareUtils::shareText(const QString &text) {
qDebug() << text;
}
void PlatformShareUtils::sendFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId) {
qDebug() << filePath << " - " << title << "requestId " << requestId << " - " << mimeType << "altImpl? ";
+ QDesktopServices::openUrl(QUrl::fromLocalFile(filePath));
}
void PlatformShareUtils::viewFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId) {
qDebug() << filePath << " - " << title << " requestId: " << requestId << " - " << mimeType << "altImpl? ";
+ QDesktopServices::openUrl(QUrl::fromLocalFile(filePath));
}
void PlatformShareUtils::editFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId) {
qDebug() << filePath << " - " << title << " requestId: " << requestId << " - " << mimeType << "altImpl? ";
+ QDesktopServices::openUrl(QUrl::fromLocalFile(filePath));
}
void PlatformShareUtils::checkPendingIntents(const QString workingDirPath) {
diff --git a/sources/shareUtils/shareutils.cpp b/sources/shareUtils/shareutils.cpp
index effb0f1..d87a500 100755
--- a/sources/shareUtils/shareutils.cpp
+++ b/sources/shareUtils/shareutils.cpp
@@ -54,6 +54,11 @@ bool ShareUtils::checkMimeTypeEdit(const QString &mimeType)
return mPlatformShareUtils->checkMimeTypeEdit(mimeType);
}
+QString ShareUtils::getTemporaryFileLocationPath()
+{
+ return mPlatformShareUtils->getTemporaryFileLocationPath();
+}
+
void ShareUtils::shareText(const QString &text)
{
mPlatformShareUtils->shareText(text);