Merge v0.6.0 and v0.6.1 #29
8 changed files with 30 additions and 8 deletions
11
README.md
11
README.md
|
@ -7,3 +7,14 @@ App to view ranking and calendar data from https://www.digitalrock.de/
|
|||
git submodule init
|
||||
git submodule update
|
||||
´´´
|
||||
|
||||
# Poster
|
||||
The poster offsets are (always top left of the element):
|
||||
- Width: 1654
|
||||
- Height: 2339
|
||||
### QR-Code
|
||||
- Cooridnates: 276, 276
|
||||
- Size: 1100x1100
|
||||
### Comp name
|
||||
- Cooridnates: x: 216, y: 1670
|
||||
- Size: 44
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <QTextCursor>
|
||||
#include <QPageSize>
|
||||
#include <QPdfWriter>
|
||||
#include <QSizeF>
|
||||
#include "QZXing.h"
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 120 KiB |
Binary file not shown.
BIN
resources/shared/fonts/OpenSans-Light.ttf
Normal file
BIN
resources/shared/fonts/OpenSans-Light.ttf
Normal file
Binary file not shown.
|
@ -21,5 +21,6 @@
|
|||
<file>fonts/fa5regular.otf</file>
|
||||
<file>fonts/fa5solid.otf</file>
|
||||
<file>PosterTemplate.png</file>
|
||||
<file>fonts/OpenSans-Light.ttf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -112,8 +112,9 @@ void BlueRockBackend::shareResultsAsPoster(QString url, QString compName) {
|
|||
}
|
||||
}
|
||||
|
||||
compName = compName.replace("/", "");
|
||||
path += "/" + compName + ".pdf";
|
||||
QString rawCompName = compName;
|
||||
QString escapedCompName = compName.replace("/", " ");
|
||||
path += "/" + escapedCompName + ".pdf";
|
||||
|
||||
QFile file(path);
|
||||
file.remove();
|
||||
|
@ -123,7 +124,7 @@ void BlueRockBackend::shareResultsAsPoster(QString url, QString compName) {
|
|||
}
|
||||
|
||||
QPdfWriter writer(&file);
|
||||
writer.setPageSize(QPageSize(QPageSize::A4));
|
||||
writer.setPageSize(QPageSize(QSizeF(70.02, 99.02), QPageSize::Millimeter));
|
||||
writer.setPageMargins(QMargins(0, 0, 0, 0));
|
||||
writer.setResolution(600);
|
||||
|
||||
|
@ -132,17 +133,22 @@ void BlueRockBackend::shareResultsAsPoster(QString url, QString compName) {
|
|||
painter.drawPixmap(0,0, writer.width(), writer.height(), background);
|
||||
|
||||
QPixmap barcode;
|
||||
int size = writer.width() * 0.5;
|
||||
|
||||
QZXingEncoderConfig encoderConfig(QZXing::EncoderFormat_QR_CODE, QSize(size, size), QZXing::EncodeErrorCorrectionLevel_M, false, false);
|
||||
int size = 1100;
|
||||
QZXingEncoderConfig encoderConfig(QZXing::EncoderFormat_QR_CODE, QSize(size, size), QZXing::EncodeErrorCorrectionLevel_H, false, false);
|
||||
barcode.convertFromImage(QZXing::encodeData(url, encoderConfig));
|
||||
painter.drawPixmap(276, 276, size, size, barcode);
|
||||
|
||||
painter.drawPixmap((writer.width() - size) / 2, size * 0.5, size, size, barcode);
|
||||
QFont font("OpenSans-Light");
|
||||
font.setPixelSize(44);
|
||||
painter.setFont(font);
|
||||
painter.setPen(Qt::black);
|
||||
// QFontMetrics(painter.font()).size(Qt::TextSingleLine, "One ").width()
|
||||
painter.drawText(QRect(216, 1670, 1100, 100), Qt::AlignLeft|Qt::AlignTop|Qt::TextWordWrap, rawCompName);
|
||||
|
||||
painter.end();
|
||||
file.close();
|
||||
|
||||
this->_shareUtils->sendFile(path, compName, "application/pdf", 1);
|
||||
this->_shareUtils->sendFile(path, escapedCompName, "application/pdf", 1);
|
||||
}
|
||||
|
||||
bool BlueRockBackend::isCameraPermissionGranted() {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <QtQml/QQmlContext>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QUrl>
|
||||
#include <QFontDatabase>
|
||||
#include "QZXing.h"
|
||||
|
||||
#include "headers/bluerockbackend.h"
|
||||
|
@ -41,6 +42,8 @@ int main(int argc, char *argv[])
|
|||
if(!translator->load(":/" + localeName + ".qm"))
|
||||
translator->load(":/en.qm");
|
||||
|
||||
QFontDatabase::addApplicationFont(":/fonts/OpenSans-Light.ttf");
|
||||
|
||||
QGuiApplication::installTranslator(translator);
|
||||
|
||||
QQuickStyle::setStyle("Material");
|
||||
|
|
Loading…
Reference in a new issue