summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp6
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp50
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.h2
-rw-r--r--noncore/graphics/drawpad/newpagedialog.cpp5
-rw-r--r--noncore/graphics/drawpad/newpagedialog.h1
-rw-r--r--noncore/graphics/drawpad/page.cpp6
-rw-r--r--noncore/graphics/drawpad/page.h4
-rw-r--r--noncore/graphics/drawpad/thumbnailview.cpp4
8 files changed, 57 insertions, 21 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index 369e7f0..45fb886 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -25,2 +25,3 @@
#include "newpagedialog.h"
+#include "page.h"
#include "pageinformationdialog.h"
@@ -283,4 +284,4 @@ void DrawPad::newPage()
if (newPageDialog.exec() == QDialog::Accepted) {
- m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(),
- newPageDialog.selectedColor());
+ m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(),
+ newPageDialog.selectedHeight(), newPageDialog.selectedColor());
}
@@ -606,2 +607,3 @@ void DrawPad::pageInformation()
if (pageInformationDialog.exec() == QDialog::Accepted) {
+ m_pDrawPadCanvas->currentPage()->setTitle(pageInformationDialog.selectedTitle());
}
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index bcb6877..dcf0871 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -49,2 +49,4 @@ private:
Unknown,
+ InTitle,
+ InDate,
InData
@@ -53,2 +55,4 @@ private:
State m_state;
+ QString m_title;
+ QDateTime m_date;
ulong m_dataLenght;
@@ -78,3 +82,10 @@ bool DrawPadCanvasXmlHandler::startElement(const QString& namespaceURI, const QS
- if (qName.compare("data") == 0) {
+ if (qName == "image") {
+ m_title = QString();
+ m_date = QDateTime(QDate(1970, 1, 1));
+ } else if (qName == "title") {
+ m_state = InTitle;
+ } else if (qName == "date") {
+ m_state = InDate;
+ } else if (qName == "data") {
m_state = InData;
@@ -97,3 +108,7 @@ bool DrawPadCanvasXmlHandler::endElement(const QString& namespaceURI, const QStr
- if (qName.compare("data") == 0) {
+ if (qName == "title") {
+ m_state = Unknown;
+ } else if (qName == "date") {
+ m_state = Unknown;
+ } else if (qName == "data") {
m_state = Unknown;
@@ -104,5 +119,9 @@ bool DrawPadCanvasXmlHandler::endElement(const QString& namespaceURI, const QStr
-bool DrawPadCanvasXmlHandler::characters(const QString& ch)
+bool DrawPadCanvasXmlHandler::characters(const QString& ch)
{
- if (m_state == InData) {
+ if (m_state == InTitle) {
+ m_title = ch;
+ } else if (m_state == InDate) {
+ m_date = m_date.addSecs(ch.toInt());
+ } else if (m_state == InData) {
QByteArray byteArray(ch.length() / 2);
@@ -147,3 +166,4 @@ bool DrawPadCanvasXmlHandler::characters(const QString& ch)
- Page* page = new Page(image.width(), image.height());
+ Page* page = new Page(m_title, image.width(), image.height());
+ page->setLastModified(m_date);
page->convertFromImage(image);
@@ -184,3 +204,3 @@ void DrawPadCanvas::load(QIODevice* ioDevice)
if (m_pages.isEmpty()) {
- m_pages.append(new Page(contentsRect().size()));
+ m_pages.append(new Page("", contentsRect().size()));
m_pages.current()->fill(Qt::white);
@@ -200,3 +220,3 @@ void DrawPadCanvas::initialPage()
{
- m_pages.append(new Page(236, 232));
+ m_pages.append(new Page("", 236, 232));
m_pages.current()->fill(Qt::white);
@@ -225,2 +245,6 @@ void DrawPadCanvas::save(QIODevice* ioDevice)
textStream << " <image>" << endl;
+ textStream << " <title>" << bufferIterator.current()->title() << "</title>" << endl;
+
+ int intDate = QDateTime(QDate(1970, 1, 1)).secsTo(bufferIterator.current()->lastModified());
+ textStream << " <date>" << intDate << "</date>" << endl;
@@ -343,3 +367,5 @@ void DrawPadCanvas::backupPage()
{
- QPixmap* currentBackup = m_pageBackups.current();
+ m_pages.current()->setLastModified(QDateTime::currentDateTime());
+
+ Page* currentBackup = m_pageBackups.current();
while (m_pageBackups.last() != currentBackup) {
@@ -361,3 +387,3 @@ void DrawPadCanvas::deleteAll()
- m_pages.append(new Page(contentsRect().size()));
+ m_pages.append(new Page("", contentsRect().size()));
m_pages.current()->fill(Qt::white);
@@ -374,5 +400,5 @@ void DrawPadCanvas::deleteAll()
-void DrawPadCanvas::newPage(uint width, uint height, const QColor& color)
+void DrawPadCanvas::newPage(QString title, uint width, uint height, const QColor& color)
{
- m_pages.insert(m_pages.at() + 1, new Page(width, height));
+ m_pages.insert(m_pages.at() + 1, new Page(title, width, height));
m_pages.current()->fill(color);
@@ -407,3 +433,3 @@ void DrawPadCanvas::deletePage()
if (m_pages.isEmpty()) {
- m_pages.append(new Page(contentsRect().size()));
+ m_pages.append(new Page("", contentsRect().size()));
m_pages.current()->fill(Qt::white);
diff --git a/noncore/graphics/drawpad/drawpadcanvas.h b/noncore/graphics/drawpad/drawpadcanvas.h
index 39cf752..dcaff5c 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.h
+++ b/noncore/graphics/drawpad/drawpadcanvas.h
@@ -54,3 +54,3 @@ public slots:
void deleteAll();
- void newPage(uint width, uint height, const QColor& color);
+ void newPage(QString title, uint width, uint height, const QColor& color);
void clearPage();
diff --git a/noncore/graphics/drawpad/newpagedialog.cpp b/noncore/graphics/drawpad/newpagedialog.cpp
index ff31aad..e6e7fcb 100644
--- a/noncore/graphics/drawpad/newpagedialog.cpp
+++ b/noncore/graphics/drawpad/newpagedialog.cpp
@@ -87,2 +87,7 @@ NewPageDialog::~NewPageDialog()
+QString NewPageDialog::selectedTitle()
+{
+ return (m_pTitleLineEdit->text());
+}
+
uint NewPageDialog::selectedWidth()
diff --git a/noncore/graphics/drawpad/newpagedialog.h b/noncore/graphics/drawpad/newpagedialog.h
index fe8f562..c8f84b8 100644
--- a/noncore/graphics/drawpad/newpagedialog.h
+++ b/noncore/graphics/drawpad/newpagedialog.h
@@ -31,2 +31,3 @@ public:
+ QString selectedTitle();
uint selectedWidth();
diff --git a/noncore/graphics/drawpad/page.cpp b/noncore/graphics/drawpad/page.cpp
index 7034a20..601d1c3 100644
--- a/noncore/graphics/drawpad/page.cpp
+++ b/noncore/graphics/drawpad/page.cpp
@@ -21,5 +21,6 @@ Page::Page()
-Page::Page(int w, int h)
+Page::Page(QString title, int w, int h)
: QPixmap(w, h)
{
+ m_title = title;
m_lastModified = QDateTime::currentDateTime();
@@ -27,5 +28,6 @@ Page::Page(int w, int h)
-Page::Page(const QSize& size)
+Page::Page(QString title, const QSize& size)
: QPixmap(size)
{
+ m_title = title;
m_lastModified = QDateTime::currentDateTime();
diff --git a/noncore/graphics/drawpad/page.h b/noncore/graphics/drawpad/page.h
index 020ab1f..20a37b5 100644
--- a/noncore/graphics/drawpad/page.h
+++ b/noncore/graphics/drawpad/page.h
@@ -24,4 +24,4 @@ public:
Page();
- Page(int w, int h);
- Page(const QSize& size);
+ Page(QString title, int w, int h);
+ Page(QString title, const QSize& size);
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp
index 35955e8..81ec79f 100644
--- a/noncore/graphics/drawpad/thumbnailview.cpp
+++ b/noncore/graphics/drawpad/thumbnailview.cpp
@@ -323,4 +323,4 @@ void ThumbnailView::newPage()
if (newPageDialog.exec() == QDialog::Accepted) {
- m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(),
- newPageDialog.selectedColor());
+ m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(),
+ newPageDialog.selectedHeight(), newPageDialog.selectedColor());
m_pPageListBox->updateView();