--- a/src/main.cpp Mon Jun 20 16:59:09 2022 +0300 +++ b/src/main.cpp Mon Jun 20 17:27:30 2022 +0300 @@ -413,6 +413,22 @@ saveSettings(); updateRecentlyOpenedDocumentsMenu(); }; + const auto logMessage = [&ui](const Message& message){ + QString messagetext = message.time.toString(QObject::tr("[hh:mm:ss]")); + switch(message.type) { + case Message::Info: + messagetext += QObject::tr(" [INFO] "); + break; + case Message::Warning: + messagetext += QObject::tr(" [WARN] "); + break; + case Message::Error: + messagetext += QObject::tr(" [ERR!] "); + break; + } + messagetext += message.text; + ui.messageLog->append(messagetext); + }; const auto openModelForEditing = [&](const ModelId modelId){ Model* model = documents.getModelById(modelId); if (model != nullptr) { @@ -626,6 +642,7 @@ } }); QObject::connect(ui.actionAboutQt, &QAction::triggered, &app, &QApplication::aboutQt); + QObject::connect(&documents, &DocumentManager::message, logMessage); mainWindow.setWindowTitle(title()); mainWindow.restoreGeometry(setting<Setting::MainWindowGeometry>()); restoreSettings();