parent
cabfaf1ed6
commit
5f659da9f8
|
@ -20,4 +20,5 @@ set(QML_IMPORT_PATH
|
|||
|
||||
add_subdirectory(vendor/SortFilterProxyModel)
|
||||
add_subdirectory(sandbox)
|
||||
add_subdirectory(sanity_checker)
|
||||
add_subdirectory(tests)
|
||||
|
|
|
@ -5,7 +5,7 @@ find_package(
|
|||
COMPONENTS Core Quick QuickControls2
|
||||
REQUIRED)
|
||||
|
||||
file(GLOB_RECURSE QML_FILES "../*.qml")
|
||||
file(GLOB_RECURSE QML_FILES "../*.qml" "../qmldir")
|
||||
file(GLOB_RECURSE JS_FILES "../*.js")
|
||||
file(GLOB_RECURSE HEADERS *.h)
|
||||
if(APPLE)
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
project(SanityChecker)
|
||||
|
||||
find_package(
|
||||
Qt5
|
||||
COMPONENTS Core Quick QuickControls2
|
||||
REQUIRED)
|
||||
|
||||
set(QRC_FILES ../src/statusq.qrc ../src/assets.qrc)
|
||||
qt5_add_resources(QRC_COMPILED ${QRC_FILES})
|
||||
|
||||
add_executable(
|
||||
${PROJECT_NAME}
|
||||
main.cpp
|
||||
${QRC_FILES}
|
||||
${QRC_COMPILED}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::QuickControls2
|
||||
SortFilterProxyModel)
|
||||
|
||||
if (APPLE)
|
||||
find_library(AppKit AppKit)
|
||||
find_library(Foundation Foundation)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${AppKit} ${Foundation})
|
||||
endif()
|
|
@ -0,0 +1,48 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QDirIterator>
|
||||
#include <QQmlComponent>
|
||||
#include <QQmlEngine>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
QQmlEngine engine;
|
||||
|
||||
engine.addImportPath(QStringLiteral(":/"));
|
||||
|
||||
QDirIterator it(":", QDirIterator::Subdirectories);
|
||||
bool errorsFound = false;
|
||||
|
||||
while (it.hasNext()) {
|
||||
QFileInfo info = it.fileInfo();
|
||||
|
||||
if (info.suffix() == QStringLiteral("qml")) {
|
||||
QFile file(it.filePath());
|
||||
file.open(QIODevice::ReadOnly);
|
||||
|
||||
QTextStream in(&file);
|
||||
QString line = in.readLine();
|
||||
|
||||
if (line != QStringLiteral("pragma Singleton")) {
|
||||
engine.setBaseUrl(QStringLiteral("qrc") + info.dir().path()
|
||||
+ QDir::separator());
|
||||
|
||||
QQmlComponent component(&engine, it.fileName());
|
||||
|
||||
if (component.isError()) {
|
||||
qWarning() << component.errors();
|
||||
errorsFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
it.next();
|
||||
}
|
||||
|
||||
if (errorsFound)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
qDebug() << "Verification completed successfully.";
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue