mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-06-28 18:27:08 -04:00
[EGD-3572] Application has an instance of Settings - removed from derived apps [EGD-3572] review issues resolved [EGD-3572] shared_ptr -> unique_ptr [EGD-3572] Primary Key for settings_tab:path [EGD-3572] empty values handling
58 lines
1.5 KiB
C++
58 lines
1.5 KiB
C++
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include <service-db/DBServiceAPI.hpp>
|
|
#include "widgets/NotesItem.hpp"
|
|
|
|
#include "NotesModel.hpp"
|
|
#include "ListView.hpp"
|
|
|
|
#include <module-utils/Utils.hpp>
|
|
#include <module-services/service-db/agents/settings/SystemSettings.hpp>
|
|
|
|
NotesModel::NotesModel(app::Application *app) : DatabaseModel(app)
|
|
{}
|
|
|
|
unsigned int NotesModel::requestRecordsCount()
|
|
{
|
|
recordsCount = DBServiceAPI::NotesGetCount(application);
|
|
return recordsCount;
|
|
}
|
|
|
|
void NotesModel::requestRecords(const uint32_t offset, const uint32_t limit)
|
|
{
|
|
DBServiceAPI::NotesGetLimitOffset(application, offset, limit);
|
|
}
|
|
|
|
bool NotesModel::updateRecords(std::vector<NotesRecord> records)
|
|
{
|
|
#if DEBUG_DB_MODEL_DATA == 1
|
|
LOG_DEBUG("Offset: %" PRIu32 ", Limit: %" PRIu32 " Count: %" PRIu32 "", offset, limit, count);
|
|
for (uint32_t i = 0; i < records.get()->size(); ++i) {
|
|
LOG_DEBUG("id: %" PRIu32 ", filename: %s",
|
|
records.get()->operator[](i).ID,
|
|
records.get()->operator[](i).path.c_str());
|
|
}
|
|
#endif
|
|
|
|
DatabaseModel::updateRecords(std::move(records));
|
|
list->onProviderDataUpdate();
|
|
|
|
return true;
|
|
}
|
|
|
|
unsigned int NotesModel::getMinimalItemHeight() const
|
|
{
|
|
return 146;
|
|
}
|
|
|
|
gui::ListItem *NotesModel::getItem(gui::Order order)
|
|
{
|
|
std::shared_ptr<NotesRecord> note = getRecord(order);
|
|
|
|
auto *item = new gui::NotesItem(this, !(application->isTimeFormat12()));
|
|
|
|
item->setNote(note);
|
|
return item;
|
|
}
|