noo/client/main.cpp

40 lines
997 B
C++
Raw Normal View History

2022-05-29 14:19:56 +03:00
#include "config.h"
2018-09-24 22:25:14 +03:00
#include "mainwindow.h"
#include <QApplication>
#include <QLayout>
2019-11-13 14:30:18 +02:00
#include <QFileInfo>
#include <QDir>
2018-10-05 18:20:40 +03:00
#include "settings.h"
#include "helper.h"
2018-09-24 22:25:14 +03:00
int main(int argc, char *argv[])
{
2021-06-05 18:22:07 +03:00
QApplication app(argc, argv);
2019-01-13 14:11:00 +03:00
helper::theme::applyCurrent(Settings::instance());
2018-09-24 22:25:14 +03:00
2022-05-29 14:19:56 +03:00
app.setApplicationName(APPNAME);
2022-06-03 21:08:18 +03:00
auto& settings = Settings::instance();
QFont f;
if (settings.data().count(KEY_APP_FONT) > 0)
{
if (f.fromString(settings.data()[KEY_APP_FONT].toString()))
app.setFont(f);
}
2021-06-05 18:22:07 +03:00
2021-02-18 21:44:13 +02:00
// Path to database.
2022-06-03 21:08:18 +03:00
QString path = settings.getDatabasePath();
2019-08-17 22:03:17 +03:00
QString folder = QFileInfo(path).absoluteDir().path();
Storage::instance().setPath(path);
2018-10-05 18:20:40 +03:00
MainWindow w;
w.layout()->invalidate();
2018-09-24 22:25:14 +03:00
2018-10-05 18:20:40 +03:00
w.setAttribute(Qt::WA_WState_ExplicitShowHide, false);
w.setAttribute(Qt::WA_WState_Hidden, true);
2022-05-29 10:50:15 +03:00
w.setWindowIcon(MainWindow::getAppIcon());
2018-10-05 18:20:40 +03:00
w.show();
2021-06-05 18:22:07 +03:00
return app.exec();
2018-09-24 22:25:14 +03:00
}