Skip to content
Snippets Groups Projects

QDS-11858 Cannot open project with passwords

Merged Burak Hançerli requested to merge QDS-11858/cannot-open-project-with-passwords into master
Files
13
+ 31
33
@@ -61,42 +61,30 @@ Backend::Backend(QObject *parent)
&ServiceConnector::downloadProgress,
this,
&Backend::downloadProgress);
}
void Backend::initialize()
{
const QRect screenGeometry = QGuiApplication::primaryScreen()->geometry();
qDebug() << "Qt Design Viewer";
qDebug() << "System information:";
qDebug() << "-- Qt version: " << QT_VERSION_STR;
qDebug() << "-- OpenSSL support: " << QVariant(QSslSocket::supportsSsl()).toString();
qDebug() << "-- Screen height: " << QString::number(screenGeometry.height());
qDebug() << "-- Screen width: " << QString::number(screenGeometry.width());
updateUserProjectList();
// Initialize background update
connect(&m_backgroundTimer, &QTimer::timeout, this, &Backend::updateUserProjectList);
m_backgroundTimer.setInterval(1000 * 10);
enableBackgroundUpdate(updateInBackground());
#ifdef QT_DEBUG
const QString buildType = "Debug";
#else
const QString buildType = "Release";
#endif
const QString buildInfo = QCoreApplication::applicationVersion() + "\nTechnology Preview - "
+ QString(GIT_VERSION) + "\nQt " + QString(QT_VERSION_STR) + " - "
+ buildType + " Build" + "\nQt Quick Components "
+ QString(QT_QUICK_COMPONENTS_VERSION) + "\nOpenSSL support: "
+ QVariant(QSslSocket::supportsSsl()).toString();
emit buildInfoChanged(buildInfo);
if (userHash().isEmpty())
qDebug("User Hash is not registered. Scan QR code to register.");
else {
qDebug() << "User Hash: " << userHash();
updateUserProjectList();
}
m_buildInfo = QCoreApplication::applicationVersion() + "\nTechnology Preview - "
+ QString(GIT_VERSION) + "\nQt " + QString(QT_VERSION_STR) + " - " + buildType
+ " Build" + "\nQt Quick Components " + QString(QT_QUICK_COMPONENTS_VERSION)
+ "\nOpenSSL support: " + QVariant(QSslSocket::supportsSsl()).toString();
// Initialize background update
connect(&m_backgroundTimer, &QTimer::timeout, this, &Backend::updateUserProjectList);
m_backgroundTimer.setInterval(1000 * 10);
enableBackgroundUpdate(updateInBackground());
qDebug() << "Initialization complete";
const QRect screenGeometry = QGuiApplication::primaryScreen()->geometry();
qDebug() << "Qt Design Viewer";
qDebug() << "System information:";
qDebug() << "-- Qt version: " << QT_VERSION_STR;
qDebug() << "-- OpenSSL support: " << QVariant(QSslSocket::supportsSsl()).toString();
qDebug() << "-- Screen height: " << QString::number(screenGeometry.height());
qDebug() << "-- Screen width: " << QString::number(screenGeometry.width());
}
void Backend::enableBackgroundUpdate(const bool &enabled)
@@ -400,7 +388,7 @@ void Backend::clearDemoCaches()
emit popupClose();
}
void Backend::runUserProject(const QString &projectName)
void Backend::runUserProject(const QString &projectName, const QString &password)
{
initializeProjectManager();
updatePopup("Running user project");
@@ -408,10 +396,20 @@ void Backend::runUserProject(const QString &projectName)
qDebug() << "Running user project:" << projectName;
QString projectLastModified;
QString projectId;
// fetch the project list to check if the project is cached
const std::optional<QJsonArray> projectList = m_serviceConnector.fetchUserProjectList(
userHash());
if (projectList == std::nullopt) {
qCritical()
<< "Could not fetch user project list. Please check your internet connection and "
"try again.";
emit popupClose();
return;
}
QJsonObject projectInfo;
for (const auto &project : m_projectList) {
for (const auto &project : projectList.value()) {
if (projectName == project.toObject().value("appName").toString()) {
projectInfo = project.toObject();
break;
@@ -424,7 +422,7 @@ void Backend::runUserProject(const QString &projectName)
qDebug("Project is not cached. Downloading...");
updatePopup("Project is not cached. Downloading...", false);
const std::optional<QByteArray> projectData
= m_serviceConnector.fetchUserProject(userHash(), projectName);
= m_serviceConnector.fetchUserProject(userHash(), projectName, password);
if (projectData == std::nullopt) {
qCritical()
Loading