Commit d1d82d45 authored by Martin Straka's avatar Martin Straka

Small refactoring in the main.cpp

parent 6aaf530c
......@@ -405,13 +405,13 @@ int main(int argc, char *argv[])
cmdLineFileNames = parser.positionalArguments();
#endif /* defined(Q_OS_ANDROID) */
/* set font family and font size from settings. */
/* Set font family and font size from settings. */
QFont font;
font.setFamily(DEFAULT_FONT_FAMILY);
font.setPointSize(GlobInstcs::setPtr->fontSize);
app.setFont(font);
/* load datovka localization and qtbase localization. */
/* Load datovka localization and qtbase localization. */
QTranslator datovkaTrans;
QTranslator qtbaseTrans;
QString lang(
......@@ -437,10 +437,17 @@ int main(int argc, char *argv[])
Log log(&memLog);
IsdsWrapper isds;
GlobalSettingsQmlWrapper settings;
InteractionZfoFile interactionZfoFile;
RecordsManagement recordsManagement;
StringManipulation strManipulation;
Zfo zfo;
/* Inicialize app delegate component for interaction with iOS
* Reaction on the iOS action "Open in..." */
#if defined Q_OS_IOS
QtAppDelegateInitialize(&interactionZfoFile);
#endif
/*
* Connect slot for isds cxt delete when account was deleted
* or updated.
......@@ -459,7 +466,7 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
QQmlContext *ctx = engine.rootContext();
/* Register application pages, components and dialogues to QML. */
/* Register application pages, components and dialogues into QML. */
registerQmlTypes(uri, QML_PAGE_LOC, qmlPages);
registerQmlTypes(uri, QML_COMPONENT_LOC, qmlComponents);
registerQmlTypes(uri, QML_DIALOGUES, qmlDialogues);
......@@ -480,14 +487,6 @@ int main(int argc, char *argv[])
UploadHierarchyQmlProxyModel::declareQML();
QmlIsdsEnvelope::declareQML();
InteractionZfoFile interactionZfoFile;
/* Inicialize app delegate component for interaction with iOS
* Reaction on the iOS action "Open in..." */
#if defined Q_OS_IOS
QtAppDelegateInitialize(&interactionZfoFile);
#endif
/* Register some classes into QML. */
ctx->setContextProperty("isds", &isds);
ctx->setContextProperty("messages", &messages);
......@@ -510,19 +509,17 @@ int main(int argc, char *argv[])
evntsTbl.reloadLocalisedDescription();
msgZfoTbl.reloadLocalisedDescription();
/* Initialise databases. */
/* Initialise databases */
AccountDb accountDb("ACCOUNTS", false);
MsgDbContainer messageDbs("MESSAGES");
FileDbContainer fileDbs("FILES");
ZfoDb zfoDb("ZFOS", false);
/* Set databases to global objects. */
{
GlobInstcs::accountDbPtr = &accountDb;
GlobInstcs::messageDbsPtr = &messageDbs;
GlobInstcs::fileDbsPtr = &fileDbs;
GlobInstcs::zfoDbPtr = &zfoDb;
}
/* Append databases to global objects. */
GlobInstcs::accountDbPtr = &accountDb;
GlobInstcs::messageDbsPtr = &messageDbs;
GlobInstcs::fileDbsPtr = &fileDbs;
GlobInstcs::zfoDbPtr = &zfoDb;
/* Create and initialise account model. */
AccountListModel *accountModelPtr = new (std::nothrow) AccountListModel;
......@@ -624,6 +621,7 @@ int main(int argc, char *argv[])
arg(GlobInstcs::setPtr->lastUpdateStr()), false, true);
}
} else {
logWarningNL("%s", "The device does not support OpenSSL.");
Dialogues::errorMessage(Dialogues::WARNING,
QObject::tr("Security problem"),
QObject::tr("OpenSSL support is required!"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment