Skip to content
Snippets Groups Projects
Unverified Commit 2e2f66f0 authored by Burak Hançerli's avatar Burak Hançerli :headphones:
Browse files

add: register userhash permanently

parent 1d5ddf02
No related branches found
No related tags found
1 merge request!12QDS-10485 Implement QR code integration
Pipeline #62765 passed
......@@ -43,6 +43,7 @@
#include <QRandomGenerator>
#include <QRegularExpression>
#include <QResource>
#include <QSettings>
#include <QSslSocket>
#include <QTemporaryDir>
#include <QTemporaryFile>
......@@ -73,6 +74,16 @@ Backend::Backend(QObject *parent)
+ buildType + " Build"
+ "\nOpenSSL support: " + QVariant(QSslSocket::supportsSsl()).toString();
emit buildInfoChanged();
QSettings settings;
m_userHash = settings.value("user/hash").toString();
if (m_userHash.isEmpty())
printLog("User Hash is not registered. Scan QR code to register.");
else {
printLog("User Hash: " + m_userHash);
updateUserProjectList();
}
printLog("Initialization complete");
}
......@@ -443,7 +454,14 @@ void Backend::registerUser(const QUrl &url)
const QString userHash = url.toString().remove("qtdesignviewer://");
printLog("Registering User Hash: " + userHash);
m_userHash = userHash;
auto reply = fetchResource("https://designviewer.qt.io/api/v1/qmlrc/list/" + userHash
QSettings().setValue("user/hash", m_userHash);
updateUserProjectList();
}
void Backend::updateUserProjectList()
{
printLog("Fetching available project list for user: " + m_userHash);
auto reply = fetchResource("https://designviewer.qt.io/api/v1/qmlrc/list/" + m_userHash
+ "?key=818815");
if (reply->error() != QNetworkReply::NoError) {
printErr("Could not fetch available project list");
......
......@@ -82,6 +82,7 @@ private:
QString findFile(const QString &dir, const QString &filter);
void parseQmlprojectFile(const QString &fileName, QString *mainFile, QStringList *importPaths);
bool runProject(const QByteArray &projectData, const QString &projectName);
void updateUserProjectList();
signals:
void logsChanged();
......
......@@ -33,6 +33,7 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QApplication::setOrganizationName("Qt");
QApplication::setApplicationName(QStringLiteral("Qt Design Viewer"));
QApplication::setApplicationVersion(QString("Built on %1 %2").arg(__DATE__, __TIME__));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment