mirror of
https://github.com/nomic-ai/gpt4all
synced 2024-11-02 09:40:42 +00:00
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
#include <QGuiApplication>
|
|
#include <QQmlApplicationEngine>
|
|
#include <QQmlContext>
|
|
|
|
#include <QDirIterator>
|
|
#include <QSettings>
|
|
|
|
#include "llm.h"
|
|
#include "download.h"
|
|
#include "network.h"
|
|
#include "config.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QCoreApplication::setOrganizationName("nomic.ai");
|
|
QCoreApplication::setOrganizationDomain("gpt4all.io");
|
|
QCoreApplication::setApplicationName("GPT4All");
|
|
QCoreApplication::setApplicationVersion(APP_VERSION);
|
|
QSettings::setDefaultFormat(QSettings::IniFormat);
|
|
|
|
QGuiApplication app(argc, argv);
|
|
QQmlApplicationEngine engine;
|
|
qmlRegisterSingletonInstance("llm", 1, 0, "LLM", LLM::globalInstance());
|
|
qmlRegisterSingletonInstance("download", 1, 0, "Download", Download::globalInstance());
|
|
qmlRegisterSingletonInstance("network", 1, 0, "Network", Network::globalInstance());
|
|
const QUrl url(u"qrc:/gpt4all/main.qml"_qs);
|
|
|
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
|
if (!obj && url == objUrl)
|
|
QCoreApplication::exit(-1);
|
|
}, Qt::QueuedConnection);
|
|
engine.load(url);
|
|
|
|
#if 0
|
|
QDirIterator it("qrc:", QDirIterator::Subdirectories);
|
|
while (it.hasNext()) {
|
|
qDebug() << it.next();
|
|
}
|
|
#endif
|
|
|
|
return app.exec();
|
|
}
|