aboutsummaryrefslogtreecommitdiff
path: root/afdnotebook.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-06-13 17:35:15 +0200
committerJavier <dev.git@javispedro.com>2015-06-13 17:35:15 +0200
commit72a71a2003028fc97d74cebecebb1541d66ded86 (patch)
treef9850b0091f50c0dab524bec47445380fed62ef3 /afdnotebook.h
parent41f9a9b0563c3bd523bd534b854e50161a2626b3 (diff)
downloadscribiu-72a71a2003028fc97d74cebecebb1541d66ded86.tar.gz
scribiu-72a71a2003028fc97d74cebecebb1541d66ded86.zip
split afdpageaddress into new class
Diffstat (limited to 'afdnotebook.h')
-rw-r--r--afdnotebook.h50
1 files changed, 5 insertions, 45 deletions
diff --git a/afdnotebook.h b/afdnotebook.h
index 737196e..74861ca 100644
--- a/afdnotebook.h
+++ b/afdnotebook.h
@@ -5,6 +5,7 @@
#include <QtCore/QDir>
#include <QtCore/QMap>
#include <QtGui/QImage>
+#include "afdpageaddress.h"
#include "stfreader.h"
class AfdNotebook : public QObject
@@ -15,26 +16,6 @@ public:
AfdNotebook(QObject *parent = 0);
~AfdNotebook();
- struct PageAddress {
- PageAddress();
- explicit PageAddress(uint shelf, uint segment, uint book, uint page);
- explicit PageAddress(uint series, uint shelf, uint segment, uint book, uint page);
- explicit PageAddress(quint64 addr);
- explicit PageAddress(const QString &str);
-
- QString toString() const;
- quint64 toUInt64() const;
-
- bool operator<(const PageAddress& o) const;
- bool operator==(const PageAddress& o) const;
-
- uint series : 12;
- uint shelf : 12;
- uint segment : 16;
- uint book : 12;
- uint page : 12;
- };
-
bool open(const QString &path);
void close();
@@ -43,6 +24,9 @@ public:
int numPages() const;
+ AfdPageAddress getPageAddress(int pageNum) const;
+ int getPageNumber(const AfdPageAddress &addr) const;
+
QString getPageBackgroundName(int page) const;
QPixmap getPageBackground(int page);
@@ -85,39 +69,15 @@ private:
bool parseGfx(const QString &file);
bool findPenData();
- PageAddress getPageAddress(int page) const;
- int getPageNumber(const PageAddress &addr);
-
private:
QDir _dir;
QString _title;
quint64 _guid;
- PageAddress _firstPage, _lastPage;
+ AfdPageAddress _firstPage, _lastPage;
uint _pagesPerBook;
QMap<QString, Gfx> _gfx;
QList<Page> _pages;
QMap<QString, PenData> _penData;
};
-inline AfdNotebook::PageAddress::PageAddress()
- : series(0), shelf(0), segment(0), book(0), page(0)
-{
-}
-
-inline AfdNotebook::PageAddress::PageAddress(uint shelf, uint segment, uint book, uint page)
- : series(0), shelf(shelf), segment(segment), book(book), page(page)
-{
-}
-
-inline AfdNotebook::PageAddress::PageAddress(uint series, uint shelf, uint segment, uint book, uint page)
- : series(series), shelf(shelf), segment(segment), book(book), page(page)
-{
-}
-
-inline bool AfdNotebook::PageAddress::operator ==(const PageAddress &o) const
-{
- return series == o.series && shelf == o.shelf && segment == o.segment &&
- book == o.book && page == o.page;
-}
-
#endif