mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-10-24 15:38:30 -04:00
Added model for notes.
This commit is contained in:
1 parent
b7808ec50c
commit
4dccaf3370
17 files changed
+195
-30
No files matched your search
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "../ApplicationNotes.hpp"
|
||||
|
||||
|
||||
#include "service-db/messages/DBMessage.hpp"
|
||||
#include "i18/i18.hpp"
|
||||
|
||||
#include "Label.hpp"
|
||||
@@ -22,7 +22,9 @@
|
||||
|
||||
namespace gui {
|
||||
|
||||
NotesMainWindow::NotesMainWindow( app::Application* app ) : AppWindow(app,"MainWindow"){
|
||||
NotesMainWindow::NotesMainWindow( app::Application* app ) :
|
||||
AppWindow(app,"MainWindow"),
|
||||
notesModel{ new NotesModel( app ) }{
|
||||
setSize( 480, 600 );
|
||||
|
||||
buildInterface();
|
||||
@@ -34,6 +36,13 @@ void NotesMainWindow::rebuild() {
|
||||
}
|
||||
void NotesMainWindow::buildInterface() {
|
||||
AppWindow::buildInterface();
|
||||
|
||||
list = new gui::ListView(this, 16, 104, 480-32, 440 );
|
||||
list->setMaxElements(3);
|
||||
list->setPageSize(3);
|
||||
|
||||
setFocusItem(list);
|
||||
|
||||
// bottomBar->setActive( BottomBar::Side::CENTER, true );
|
||||
// bottomBar->setActive( BottomBar::Side::RIGHT, true );
|
||||
// bottomBar->setText( BottomBar::Side::CENTER, utils::localize.get("common_open"));
|
||||
@@ -99,7 +108,10 @@ NotesMainWindow::~NotesMainWindow() {
|
||||
}
|
||||
|
||||
void NotesMainWindow::onBeforeShow( ShowMode mode, uint32_t command, SwitchData* data ) {
|
||||
// setFocusItem( options[0] );
|
||||
notesModel->clear();
|
||||
notesModel->requestRecordsCount();
|
||||
list->clear();
|
||||
list->setElementsCount( notesModel->getItemCount() );
|
||||
}
|
||||
|
||||
bool NotesMainWindow::onInput( const InputEvent& inputEvent ) {
|
||||
@@ -128,4 +140,12 @@ bool NotesMainWindow::onInput( const InputEvent& inputEvent ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NotesMainWindow::onDatabaseMessage( sys::Message* msgl ) {
|
||||
DBNotesResponseMessage* msg = reinterpret_cast<DBNotesResponseMessage*>( msgl );
|
||||
if( notesModel->updateRecords( std::move(msg->records), msg->offset, msg->limit, msg->count ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} /* namespace gui */
|
||||
Reference in new issue
Block a user