From d20277736dc84bbbee093c8912bc2d432cfc1360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Fri, 26 May 2017 17:24:56 +0200 Subject: [PATCH] Added model classes for reading lists and labels. --- YACReaderLibrary/YACReaderLibrary.pro | 6 ++- YACReaderLibrary/db/reading_list.cpp | 44 +++++++++++++++++++ YACReaderLibrary/db/reading_list.h | 36 +++++++++++++++ .../YACReaderLibraryServer.pro | 6 ++- 4 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 YACReaderLibrary/db/reading_list.cpp create mode 100644 YACReaderLibrary/db/reading_list.h diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index fa1f7a7e..7b26afa2 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -146,7 +146,8 @@ HEADERS += comic_flow.h \ yacreader_comics_views_manager.h \ info_comics_view.h \ yacreader_comics_selection_helper.h \ - yacreader_comic_info_helper.h + yacreader_comic_info_helper.h \ + db/reading_list.cpp !CONFIG(no_opengl) { CONFIG(legacy_gl_widget) { @@ -220,7 +221,8 @@ SOURCES += comic_flow.cpp \ yacreader_comics_views_manager.cpp \ info_comics_view.cpp \ yacreader_comics_selection_helper.cpp \ - yacreader_comic_info_helper.cpp + yacreader_comic_info_helper.cpp \ + db/reading_list.cpp !CONFIG(no_opengl) { CONFIG(legacy_gl_widget) { diff --git a/YACReaderLibrary/db/reading_list.cpp b/YACReaderLibrary/db/reading_list.cpp new file mode 100644 index 00000000..b27b6650 --- /dev/null +++ b/YACReaderLibrary/db/reading_list.cpp @@ -0,0 +1,44 @@ +#include "reading_list.h" + +ReadingList::ReadingList(const QString &name, qulonglong id, int ordering) + :name(name), id(id), ordering(ordering) +{ + +} + +qulonglong ReadingList::getId() const +{ + return id; +} + +QString ReadingList::getName() const +{ + return name; +} + +int ReadingList::getOrdering() const +{ + return ordering; +} + + +Label::Label(const QString &name, qulonglong id, YACReader::LabelColors colorid) + :name(name), id(id), colorid(colorid) +{ + +} + +YACReader::LabelColors Label::getColorID() const +{ + return colorid; +} + +QString Label::getName() const +{ + return name; +} + +qulonglong Label::getId() const +{ + return id; +} diff --git a/YACReaderLibrary/db/reading_list.h b/YACReaderLibrary/db/reading_list.h new file mode 100644 index 00000000..84e41846 --- /dev/null +++ b/YACReaderLibrary/db/reading_list.h @@ -0,0 +1,36 @@ +#ifndef READING_LIST_H +#define READING_LIST_H + +#include "yacreader_global.h" + +class ReadingList +{ +public: + ReadingList(const QString &name, qulonglong id, int ordering); + + qulonglong getId() const; + QString getName() const; + int getOrdering() const; +private: + QString name; + qulonglong id; + int ordering; +}; + +class Label +{ +public: + Label(const QString &name, qulonglong id, YACReader::LabelColors colorid); + + YACReader::LabelColors getColorID() const; + QString getName() const; + qulonglong getId() const; + +private: + QString name; + qulonglong id; + YACReader::LabelColors colorid; + +}; + +#endif // READING_LIST_H diff --git a/YACReaderLibraryServer/YACReaderLibraryServer.pro b/YACReaderLibraryServer/YACReaderLibraryServer.pro index 59e8ad18..a6fcae8b 100644 --- a/YACReaderLibraryServer/YACReaderLibraryServer.pro +++ b/YACReaderLibraryServer/YACReaderLibraryServer.pro @@ -60,7 +60,8 @@ HEADERS += ../YACReaderLibrary/library_creator.h \ ../common/http_worker.h \ ../YACReaderLibrary/yacreader_libraries.h \ ../YACReaderLibrary/comic_files_manager.h \ - console_ui_library_creator.h + console_ui_library_creator.h \ + ../YACReaderLibrary/db/reading_list.h SOURCES += ../YACReaderLibrary/library_creator.cpp \ @@ -81,6 +82,7 @@ SOURCES += ../YACReaderLibrary/library_creator.cpp \ ../YACReaderLibrary/yacreader_libraries.cpp \ ../YACReaderLibrary/comic_files_manager.cpp \ console_ui_library_creator.cpp \ + ../YACReaderLibrary/db/reading_list.cpp \ main.cpp include(../YACReaderLibrary/server/server.pri) @@ -151,4 +153,4 @@ translation.files = ../release/languages/yacreaderlibrary_* #manpage.path = $$DATADIR/man/man1 #manpage.files = ../YACReaderLibrary.1 -} \ No newline at end of file +}