Commit ad2e0e7f authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Rename project

parent 09e911c6
project(qrskanner)
project(orca)
cmake_minimum_required(VERSION 2.8.12)
set(QT_MIN_VERSION "5.5.0")
......@@ -41,7 +41,7 @@ endif()
################# build and install #################
add_subdirectory(src)
install(PROGRAMS org.kde.qrskanner.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES org.kde.qrskanner.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install(PROGRAMS org.kde.qrca.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES org.kde.qrca.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
$XGETTEXT $(find . -name \*.cpp -o -name \*.h -o -name \*.qml) -o $podir/qrca.pot
<?xml version="1.0" encoding="utf-8"?>
<component type="desktop-application">
<id>org.kde.qrskanner</id>
<id>org.kde.qrca</id>
<name>Barcode Scanner</name>
<summary>Scan and create QR-Codes</summary>
<metadata_license>"CC0-1.0"</metadata_license>
......
[Desktop Entry]
Name=QrSkanner
Name=Qrca
GenericName=Barcode Scanner
Comment=Scan and create QR-Codes
Version=1.0
Exec=qrskanner
MimeType=application/x-QrSkanner;
Exec=Qrca
Icon=view-barcode
Type=Application
Terminal=false
......
{
"id": "org.kde.qrskanner",
"id": "org.kde.qrca",
"runtime": "org.kde.Platform",
"runtime-version": "5.12",
"sdk": "org.kde.Sdk",
"command": "QrSkanner",
"command": "orca",
"tags": ["nightly"],
"desktop-file-name-suffix": " (Nightly)",
"finish-args": [
......@@ -104,7 +104,7 @@
]
},
{
"name": "QrSkanner",
"name": "qrca",
"buildsystem": "cmake-ninja",
"builddir": true,
"sources": [ { "type": "dir", "path": ".", "skip": [".git"] } ]
......
set(qrskanner_SRCS
set(qrca_SRCS
main.cpp
QrCodeScanner.cpp
QrSkanner.cpp
Qrca.cpp
)
qt5_add_resources(RESOURCES resources.qrc)
add_executable(qrskanner ${qrskanner_SRCS} ${RESOURCES})
target_link_libraries(qrskanner Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::Multimedia ZXing::Core KF5::I18n KF5::Contacts)
install(TARGETS qrskanner ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
add_executable(qrca ${qrca_SRCS} ${RESOURCES})
target_link_libraries(qrca Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::Multimedia ZXing::Core KF5::I18n KF5::Contacts)
install(TARGETS qrca ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
......@@ -14,24 +14,24 @@
#include <ZXing/MultiFormatWriter.h>
#include <ZXing/BitMatrix.h>
#include "QrSkanner.h"
#include "Qrca.h"
QrSkanner::QrSkanner()
Qrca::Qrca()
{
}
bool QrSkanner::isUrl(const QString &text) {
bool Qrca::isUrl(const QString &text) {
QRegularExpression exp("(?:https?|ftp)://\\S+");
return exp.match(text).hasMatch();
}
bool QrSkanner::isVCard(const QString &text) {
bool Qrca::isVCard(const QString &text) {
return (text.startsWith("BEGIN:VCARD") && text.endsWith("END:VCARD"));
}
void QrSkanner::saveVCard(const QString &text) {
void Qrca::saveVCard(const QString &text) {
QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ ("/kpeoplevcard");
......@@ -48,14 +48,14 @@ void QrSkanner::saveVCard(const QString &text) {
file.close();
}
QString QrSkanner::getVCardName(const QString &text) {
QString Qrca::getVCardName(const QString &text) {
KContacts::VCardConverter converter;
KContacts::Addressee adressee = converter.parseVCard(text.toUtf8());
return adressee.realName();
}
QImage QrSkanner::encode(const QString &text, const int &width) {
QImage Qrca::encode(const QString &text, const int &width) {
try {
ZXing::MultiFormatWriter writer(ZXing::BarcodeFormat::QR_CODE);
......@@ -79,7 +79,7 @@ QImage QrSkanner::encode(const QString &text, const int &width) {
return(QImage());
}
QString QrSkanner::save(const QImage &image) {
QString Qrca::save(const QImage &image) {
const QString directory = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)
+ "/qrcodes/";
......
#ifndef QRSKANNER_H
#define QRSKANNER_H
#ifndef ORCASCANNER_H
#define ORCASCANNER_H
#include <QObject>
#include <QImage>
class QrSkanner : public QObject
class Qrca : public QObject
{
Q_OBJECT
public:
QrSkanner();
Qrca();
Q_INVOKABLE bool isUrl(const QString &text);
Q_INVOKABLE bool isVCard(const QString &text);
Q_INVOKABLE QImage encode(const QString &text, const int &width);
......
......@@ -19,7 +19,7 @@ Kirigami.ScrollablePage {
text: i18n("Save")
icon.name: "document-save"
onTriggered: {
path = "file://" + qrSkanner.save(codeView.source)
path = "file://" + qrca.save(codeView.source)
showPassiveNotification(i18n("Saved image to " + path), 1000, "Open Externally", function() {Qt.openUrlExternally(path)})
}
},
......@@ -27,7 +27,7 @@ Kirigami.ScrollablePage {
text: i18n("Share")
icon.name: "document-share"
onTriggered: {
shareSheet.url = qrSkanner.save(codeView.source)
shareSheet.url = qrca.save(codeView.source)
shareSheet.open()
}
}
......@@ -41,7 +41,7 @@ Kirigami.ScrollablePage {
Layout.fillWidth: true
width: Kirigami.Units.gridUnit * 20
height: Kirigami.Units.gridUnit * 20
source: qrSkanner.encode(inputText.text.length > 0 ? inputText.text: " ", width)
source: qrca.encode(inputText.text.length > 0 ? inputText.text: " ", width)
}
Kirigami.ActionTextField {
......
......@@ -34,7 +34,7 @@ import QtMultimedia 5.9
import org.kde.kirigami 2.2 as Kirigami
import QtQuick.Layouts 1.3
import org.kde.qrskanner 1.0
import org.kde.qrca 1.0
Kirigami.Page {
leftPadding: 0
......@@ -89,7 +89,7 @@ Kirigami.Page {
}
Controls.Label {
visible: resultSheet.isVCard
text: i18n("Name: ") + qrSkanner.getVCardName(resultSheet.tag)
text: i18n("Name: ") + qrca.getVCardName(resultSheet.tag)
}
RowLayout {
......@@ -98,7 +98,7 @@ Kirigami.Page {
enabled: resultSheet.isLink || resultSheet.isVCard
onClicked: {
if (resultSheet.isVCard)
qrSkanner.saveVCard(resultSheet.tag)
qrca.saveVCard(resultSheet.tag)
else
Qt.openUrlExternally(resultSheet.tag)
......@@ -126,8 +126,8 @@ Kirigami.Page {
camera: camera
onScanningSucceeded: {
resultSheet.tag = result
resultSheet.isLink = qrSkanner.isUrl(result)
resultSheet.isVCard = qrSkanner.isVCard(result)
resultSheet.isLink = qrca.isUrl(result)
resultSheet.isVCard = qrca.isVCard(result)
resultSheet.open()
}
}
......
......@@ -11,7 +11,7 @@ Kirigami.ApplicationWindow {
showPassiveNotification(text, "long")
}
Component.onCompleted: qrSkanner.passiveNotificationRequested.connect(passiveNotification)
Component.onCompleted: qrca.passiveNotificationRequested.connect(passiveNotification)
globalDrawer: Kirigami.GlobalDrawer {
......
......@@ -4,7 +4,7 @@
#include <QUrl>
#include "QrCodeScanner.h"
#include "QrSkanner.h"
#include "Qrca.h"
Q_DECL_EXPORT int main(int argc, char *argv[])
{
......@@ -12,15 +12,15 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("KDE");
QCoreApplication::setOrganizationDomain("kde.org");
QCoreApplication::setApplicationName("QrSkanner");
QCoreApplication::setApplicationName("qrca");
qRegisterMetaType<QrCodeScanner*>("QrCodeScanner*");
qmlRegisterType<QrCodeScanner>("org.kde.qrskanner", 1, 0, "QrCodeScanner");
qmlRegisterType<QrCodeScanner>("org.kde.qrca", 1, 0, "QrCodeScanner");
QQmlApplicationEngine engine;
QrSkanner *qrSkanner = new QrSkanner();
engine.rootContext()->setContextProperty("qrSkanner", qrSkanner);
auto *qrca = new Qrca();
engine.rootContext()->setContextProperty("qrca", qrca);
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
......
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