mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-05-03 21:33:57 -04:00
Apply new style
This commit is contained in:
committed by
Radosław Wicik
parent
82b718e8d4
commit
a8573a404c
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user