From edee2feea4b49f3fe20d8eb5b630ced64e346f22 Mon Sep 17 00:00:00 2001 From: Adam Dobrowolski Date: Thu, 30 Jan 2020 15:31:41 +0100 Subject: [PATCH] [EGD-2394] PR review fixups and cleanup --- .../ApplicationMessages.cpp | 7 ++----- .../windows/ThreadViewWindow.cpp | 17 +++-------------- module-services/service-db/ServiceDB.cpp | 2 +- module-services/service-db/api/DBServiceAPI.cpp | 2 +- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/module-apps/application-messages/ApplicationMessages.cpp b/module-apps/application-messages/ApplicationMessages.cpp index eb0f23181..254c28dbf 100644 --- a/module-apps/application-messages/ApplicationMessages.cpp +++ b/module-apps/application-messages/ApplicationMessages.cpp @@ -41,24 +41,21 @@ sys::Message_t ApplicationMessages::DataReceivedHandler(sys::DataMessage *msgl, return retMsg; } - if (msgl->messageType == (uint32_t)MessageType::DBServiceNotification) + if (msgl->messageType == static_cast(MessageType::DBServiceNotification)) { DBNotificationMessage *msg = dynamic_cast(msgl); LOG_DEBUG("Received multicast"); - if ((msg->baseType == DB::BaseType::SmsDB) && + if ((msg != nullptr) && (msg->baseType == DB::BaseType::SmsDB) && ((msg->notificationType == DB::NotificatonType::Updated) || (msg->notificationType == DB::NotificatonType::Added))) { if (this->getCurrentWindow() == this->windows[gui::name::window::thread_view]) { LOG_DEBUG("TODO"); this->getCurrentWindow()->rebuild(); - // TODO rebuild fixme - // TODO refresh if it's for interesting thread } return std::make_shared(); } } - // this variable defines whether message was processed. bool handled = false; diff --git a/module-apps/application-messages/windows/ThreadViewWindow.cpp b/module-apps/application-messages/windows/ThreadViewWindow.cpp index 2ba2ae121..f8ac8d257 100644 --- a/module-apps/application-messages/windows/ThreadViewWindow.cpp +++ b/module-apps/application-messages/windows/ThreadViewWindow.cpp @@ -45,7 +45,6 @@ namespace style namespace gui { - ThreadViewWindow::ThreadViewWindow(app::Application *app) : AppWindow(app, name::window::thread_view) { AppWindow::buildInterface(); @@ -57,7 +56,6 @@ namespace gui bottomBar->setText(BottomBar::Side::LEFT, utils::localize.get("common_options")); bottomBar->setText(BottomBar::Side::CENTER, utils::localize.get("common_send")); bottomBar->setText(BottomBar::Side::RIGHT, utils::localize.get("common_back")); - auto elements_width = this->getWidth() - style::window::default_left_margin * 2; body = new gui::VBox(this, style::window::default_left_margin, title->offset_h(), elements_width, bottomBar->getY() - title->offset_h()); body->setPenWidth(style::window::default_border_no_focus_w); @@ -88,7 +86,6 @@ namespace gui setFocusItem(body); } - // TODO fix text and dont rebuild it... void ThreadViewWindow::rebuildText() { if (text) @@ -101,7 +98,6 @@ namespace gui text->setPenFocusWidth(style::window::default_border_focucs_w); text->setPenWidth(style::window::default_border_focucs_w); text->setEdges(gui::RectangleEdgeFlags::GUI_RECT_EDGE_BOTTOM); - // TODO IFS text->activatedCallback = [&](gui::Item &item) { if (text->getText().length() == 0) { @@ -139,8 +135,6 @@ namespace gui return true; } - // TODO TODO TODO - // ez - najpierw wylicz ile sie zmieƛci - potem wstaw void ThreadViewWindow::addSMS(ThreadViewWindow::Action what) { LOG_DEBUG("--- %d ---", what); @@ -184,8 +178,7 @@ namespace gui { SMS.start -= maxsmsinwindow; } - // TODO show text field here! - LOG_DEBUG("---> In progress %d", SMS.start); + LOG_DEBUG("in progress %d", SMS.start); } SMS.sms = DBServiceAPI::SMSGetLimitOffsetByThreadID(this->application, SMS.start, maxsmsinwindow, SMS.thread); LOG_DEBUG("=> SMS %d < %d < %d", SMS.start, SMS.sms->size(), maxsmsinwindow); @@ -213,14 +206,12 @@ namespace gui { body->setVisible(true, true); } - LOG_DEBUG("-------------"); + LOG_DEBUG("sms built"); } bool ThreadViewWindow::smsBuild(const SMSRecord &el, bool bottom) { - /// dummy sms thread - TODO TODO load from db - on switchData - /// this is not 'static' do it on window focus (on swtich window) - // auto label = new gui::Label(nullptr, labelmeta); + /// dummy sms thread - TODO load from db - on switchData auto label = new Text(nullptr, 0, 1, 300, 5); label->setTextType(Text::TextType::MULTI_LINE); label->setEditMode(Text::EditMode::SCROLL); @@ -281,8 +272,6 @@ namespace gui void ThreadViewWindow::rebuild() { addSMS(ThreadViewWindow::Action::Start); - // destroyInterface(); - // buildInterface(); } void ThreadViewWindow::buildInterface() diff --git a/module-services/service-db/ServiceDB.cpp b/module-services/service-db/ServiceDB.cpp index bf212368b..141d02cfe 100644 --- a/module-services/service-db/ServiceDB.cpp +++ b/module-services/service-db/ServiceDB.cpp @@ -28,7 +28,7 @@ const char *ServiceDB::serviceName = "ServiceDB"; class TimeStamp { - ssize_t timestamp; + TickType_t timestamp; std::string text; public: diff --git a/module-services/service-db/api/DBServiceAPI.cpp b/module-services/service-db/api/DBServiceAPI.cpp index f426975cc..eb497e466 100644 --- a/module-services/service-db/api/DBServiceAPI.cpp +++ b/module-services/service-db/api/DBServiceAPI.cpp @@ -173,7 +173,7 @@ uint32_t DBServiceAPI::SMSGetCount(sys::Service *serv) } else { - return false; + return 0; } }