Apply new style

This commit is contained in:
Radoslaw Wicik
2020-03-16 17:21:00 +01:00
committed by Radosław Wicik
parent 82b718e8d4
commit a8573a404c
769 changed files with 124668 additions and 115090 deletions

View File

@@ -13,79 +13,82 @@
#include "ApplicationNotes.hpp"
namespace app {
namespace app
{
ApplicationNotes::ApplicationNotes(std::string name, std::string parent, bool startBackgound) :
Application( name, parent, startBackgound, 4096 ) {
}
ApplicationNotes::ApplicationNotes(std::string name, std::string parent, bool startBackgound)
: Application(name, parent, startBackgound, 4096)
{}
ApplicationNotes::~ApplicationNotes() {
LOG_INFO("deleting");
}
// Invoked upon receiving data message
sys::Message_t ApplicationNotes::DataReceivedHandler(sys::DataMessage* msgl,sys::ResponseMessage* resp) {
auto retMsg = Application::DataReceivedHandler(msgl);
//if message was handled by application's template there is no need to process further.
if( (reinterpret_cast<sys::ResponseMessage*>( retMsg.get() )->retCode == sys::ReturnCodes::Success ) ){
return retMsg;
}
bool handled = false;
//handle database response
if( resp != nullptr ) {
handled = true;
switch (resp->responseTo)
{
case MessageType::DBNotesGetLimitOffset: {
if (getCurrentWindow()->onDatabaseMessage(resp))
refreshWindow(gui::RefreshModes::GUI_REFRESH_FAST);
}
break;
default:
break;
}
ApplicationNotes::~ApplicationNotes()
{
LOG_INFO("deleting");
}
if( handled )
return std::make_shared<sys::ResponseMessage>();
else
return std::make_shared<sys::ResponseMessage>(sys::ReturnCodes::Unresolved);
}
// Invoked upon receiving data message
sys::Message_t ApplicationNotes::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
{
// Invoked during initialization
sys::ReturnCodes ApplicationNotes::InitHandler() {
auto retMsg = Application::DataReceivedHandler(msgl);
// if message was handled by application's template there is no need to process further.
if ((reinterpret_cast<sys::ResponseMessage *>(retMsg.get())->retCode == sys::ReturnCodes::Success)) {
return retMsg;
}
auto ret = Application::InitHandler();
if( ret != sys::ReturnCodes::Success )
return ret;
bool handled = false;
createUserInterface();
// handle database response
if (resp != nullptr) {
handled = true;
switch (resp->responseTo) {
case MessageType::DBNotesGetLimitOffset: {
if (getCurrentWindow()->onDatabaseMessage(resp))
refreshWindow(gui::RefreshModes::GUI_REFRESH_FAST);
} break;
default:
break;
}
}
setActiveWindow(gui::name::window::main_window);
if (handled)
return std::make_shared<sys::ResponseMessage>();
else
return std::make_shared<sys::ResponseMessage>(sys::ReturnCodes::Unresolved);
}
return ret;
}
// Invoked during initialization
sys::ReturnCodes ApplicationNotes::InitHandler()
{
sys::ReturnCodes ApplicationNotes::DeinitHandler() {
return sys::ReturnCodes::Success;
}
auto ret = Application::InitHandler();
if (ret != sys::ReturnCodes::Success)
return ret;
void ApplicationNotes::createUserInterface() {
createUserInterface();
gui::AppWindow* window = nullptr;
setActiveWindow(gui::name::window::main_window);
window = new gui::NotesMainWindow(this);
windows.insert(std::pair<std::string,gui::AppWindow*>(window->getName(), window));
return ret;
}
window = new gui::NotesEditWindow(this);
windows.insert(std::pair<std::string,gui::AppWindow*>(window->getName(), window));
}
sys::ReturnCodes ApplicationNotes::DeinitHandler()
{
return sys::ReturnCodes::Success;
}
void ApplicationNotes::destroyUserInterface() {
}
void ApplicationNotes::createUserInterface()
{
gui::AppWindow *window = nullptr;
window = new gui::NotesMainWindow(this);
windows.insert(std::pair<std::string, gui::AppWindow *>(window->getName(), window));
window = new gui::NotesEditWindow(this);
windows.insert(std::pair<std::string, gui::AppWindow *>(window->getName(), window));
}
void ApplicationNotes::destroyUserInterface()
{}
} /* namespace app */