mirror of
https://github.com/status-im/status-app.git
synced 2026-08-27 07:01:14 +00:00
* fix(browser): fix pr comments * fix(browser): fix offset between navigation and webview * fix(browser): split logic into contexts * dialogs * favorites * webview * fix(browser): crash when webview tries to render and destroy at the same time * fix(browser): opened dialogs counter * fix(browser): load platform-specific webview * fix(wc): unused wc files * fix(browser): separate dapps and websocket logic * fix(browser): fix pr comments * fix(browser): fix popup tracker * fix(browser): fix pr * fix(browser): fix PR * fix(browser): fix PR
84 lines
2.9 KiB
C++
84 lines
2.9 KiB
C++
#include <QDir>
|
|
#include <QGuiApplication>
|
|
#include <QLibraryInfo>
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include <StatusQ/typesregistration.h>
|
|
|
|
using namespace Qt::Literals::StringLiterals;
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
Q_INIT_RESOURCE(storybook);
|
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
QGuiApplication::setOrganizationName(u"Status"_s);
|
|
QGuiApplication::setOrganizationDomain(u"status.im"_s);
|
|
|
|
const QString pagesPath = QML_IMPORT_ROOT u"/pages"_s;
|
|
QDir pagesDir(pagesPath);
|
|
const QFileInfoList files = pagesDir.entryInfoList({u"*Page.qml"_s},
|
|
QDir::Files,
|
|
QDir::Name);
|
|
|
|
const QStringList additionalImportPaths{STATUSQ_MODULE_IMPORT_PATH,
|
|
u"qrc:/"_s,
|
|
QML_IMPORT_ROOT u"/../ui/app"_s,
|
|
QML_IMPORT_ROOT u"/../ui/imports"_s,
|
|
QML_IMPORT_ROOT u"/src"_s,
|
|
QML_IMPORT_ROOT u"/stubs"_s};
|
|
|
|
int errorCount = 0;
|
|
QStringList warnings;
|
|
QStringList failedPages;
|
|
|
|
qInfo() << ">>> StoryBook page verification started; Qt runtime version:"
|
|
<< qVersion() << "; built against version:"
|
|
<< QLibraryInfo::version().toString();
|
|
|
|
registerStatusQTypes();
|
|
|
|
for (const auto &fileInfo : files) {
|
|
warnings.clear();
|
|
QQmlApplicationEngine engine;
|
|
engine.setOutputWarningsToStandardError(false);
|
|
engine.setBaseUrl(QUrl::fromLocalFile(pagesPath + QDir::separator()));
|
|
|
|
for (const auto &path : additionalImportPaths)
|
|
engine.addImportPath(path);
|
|
|
|
QObject::connect(&engine, &QQmlApplicationEngine::warnings, &app,
|
|
[&warnings](const QList<QQmlError> &qmlWarnings) {
|
|
for (const auto &qmlWarning: qmlWarnings)
|
|
warnings.append(qmlWarning.toString());
|
|
});
|
|
|
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
|
&app, [&errorCount, &warnings, &failedPages](QObject *obj, const QUrl &objUrl) {
|
|
if (!obj) {
|
|
errorCount++;
|
|
failedPages << objUrl.toLocalFile();
|
|
|
|
for (const auto &warning: std::as_const(warnings))
|
|
qWarning() << " " << warning;
|
|
}
|
|
});
|
|
|
|
auto fileName = fileInfo.filePath();
|
|
qInfo() << ">>> Checking StoryBook page:" << fileName;
|
|
|
|
engine.load(fileName);
|
|
}
|
|
|
|
if (errorCount) {
|
|
qWarning() << ">>> StoryBook page verification failed with" << errorCount << "errors.";
|
|
qWarning() << ">>> StoryBook pages with errors:" << failedPages;
|
|
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
qInfo() << ">>> StoryBook page verification completed successfully.";
|
|
return EXIT_SUCCESS;
|
|
}
|