2023-04-09 03:28:39 +00:00
|
|
|
#include <QGuiApplication>
|
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include <QQmlContext>
|
|
|
|
|
|
|
|
#include <QDirIterator>
|
2023-04-29 02:21:23 +00:00
|
|
|
#include <QSettings>
|
2023-04-09 03:28:39 +00:00
|
|
|
|
|
|
|
#include "llm.h"
|
2023-05-18 22:59:10 +00:00
|
|
|
#include "localdocs.h"
|
2023-04-19 01:10:06 +00:00
|
|
|
#include "download.h"
|
2023-04-14 18:44:28 +00:00
|
|
|
#include "network.h"
|
2023-04-16 23:20:43 +00:00
|
|
|
#include "config.h"
|
2023-06-01 14:50:42 +00:00
|
|
|
#include "logger.h"
|
2023-04-09 03:28:39 +00:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2023-04-19 01:10:06 +00:00
|
|
|
QCoreApplication::setOrganizationName("nomic.ai");
|
|
|
|
QCoreApplication::setOrganizationDomain("gpt4all.io");
|
|
|
|
QCoreApplication::setApplicationName("GPT4All");
|
2023-04-16 23:20:43 +00:00
|
|
|
QCoreApplication::setApplicationVersion(APP_VERSION);
|
2023-04-29 02:21:23 +00:00
|
|
|
QSettings::setDefaultFormat(QSettings::IniFormat);
|
2023-04-16 23:20:43 +00:00
|
|
|
|
2023-06-01 14:50:42 +00:00
|
|
|
Logger::globalInstance();
|
|
|
|
|
2023-04-09 03:28:39 +00:00
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
QQmlApplicationEngine engine;
|
|
|
|
qmlRegisterSingletonInstance("llm", 1, 0, "LLM", LLM::globalInstance());
|
2023-04-19 01:10:06 +00:00
|
|
|
qmlRegisterSingletonInstance("download", 1, 0, "Download", Download::globalInstance());
|
2023-04-14 18:44:28 +00:00
|
|
|
qmlRegisterSingletonInstance("network", 1, 0, "Network", Network::globalInstance());
|
2023-05-18 22:59:10 +00:00
|
|
|
qmlRegisterSingletonInstance("localdocs", 1, 0, "LocalDocs", LocalDocs::globalInstance());
|
2023-04-23 13:42:35 +00:00
|
|
|
const QUrl url(u"qrc:/gpt4all/main.qml"_qs);
|
2023-04-09 03:28:39 +00:00
|
|
|
|
|
|
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
|
|
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
|
|
|
if (!obj && url == objUrl)
|
|
|
|
QCoreApplication::exit(-1);
|
|
|
|
}, Qt::QueuedConnection);
|
|
|
|
engine.load(url);
|
|
|
|
|
2023-04-19 01:10:06 +00:00
|
|
|
#if 0
|
2023-04-09 03:28:39 +00:00
|
|
|
QDirIterator it("qrc:", QDirIterator::Subdirectories);
|
|
|
|
while (it.hasNext()) {
|
|
|
|
qDebug() << it.next();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|