author | leseb <leseb> | 2002-03-21 17:33:38 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-03-21 17:33:38 (UTC) |
commit | 29baf8dcda3d05d91d340b739de0fdd9e37f5749 (patch) (unidiff) | |
tree | 5f2958a16cc1f065cdef3e31c2c9500f8aac2e7b /noncore/graphics/drawpad/drawpad.cpp | |
parent | 60c9126183ea72c08ad5cb77b8939812627aae17 (diff) | |
download | opie-29baf8dcda3d05d91d340b739de0fdd9e37f5749.zip opie-29baf8dcda3d05d91d340b739de0fdd9e37f5749.tar.gz opie-29baf8dcda3d05d91d340b739de0fdd9e37f5749.tar.bz2 |
Enable any size pages
Diffstat (limited to 'noncore/graphics/drawpad/drawpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index f67bef8..e94187f 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -35,24 +35,17 @@ | |||
35 | #include <qtoolbutton.h> | 35 | #include <qtoolbutton.h> |
36 | #include <qtooltip.h> | 36 | #include <qtooltip.h> |
37 | 37 | ||
38 | DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) | 38 | DrawPad::DrawPad(QWidget* parent, const char* name) |
39 | : QMainWindow(parent, name, f) | 39 | : QMainWindow(parent, name) |
40 | { | 40 | { |
41 | setCaption(tr("DrawPad")); | ||
42 | |||
43 | // init members | 41 | // init members |
44 | 42 | ||
45 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); | 43 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); |
44 | |||
46 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateNavigationToolButtons())); | 45 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateNavigationToolButtons())); |
46 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateCaption())); | ||
47 | connect(m_pDrawPadCanvas, SIGNAL(pageBackupsChanged()), this, SLOT(updateUndoRedoToolButtons())); | 47 | connect(m_pDrawPadCanvas, SIGNAL(pageBackupsChanged()), this, SLOT(updateUndoRedoToolButtons())); |
48 | 48 | ||
49 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); | ||
50 | |||
51 | if (file.open(IO_ReadOnly)) { | ||
52 | m_pDrawPadCanvas->load(&file); | ||
53 | file.close(); | ||
54 | } | ||
55 | |||
56 | setCentralWidget(m_pDrawPadCanvas); | 49 | setCentralWidget(m_pDrawPadCanvas); |
57 | 50 | ||
58 | // init menu | 51 | // init menu |
@@ -106,8 +99,6 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) | |||
106 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); | 99 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); |
107 | m_pRedoAction->addTo(navigationToolBar); | 100 | m_pRedoAction->addTo(navigationToolBar); |
108 | 101 | ||
109 | updateUndoRedoToolButtons(); | ||
110 | |||
111 | m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); | 102 | m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); |
112 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); | 103 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); |
113 | m_pFirstPageAction->addTo(navigationToolBar); | 104 | m_pFirstPageAction->addTo(navigationToolBar); |
@@ -124,8 +115,6 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) | |||
124 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); | 115 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); |
125 | m_pLastPageAction->addTo(navigationToolBar); | 116 | m_pLastPageAction->addTo(navigationToolBar); |
126 | 117 | ||
127 | updateNavigationToolButtons(); | ||
128 | |||
129 | // init draw mode toolbar | 118 | // init draw mode toolbar |
130 | 119 | ||
131 | QPEToolBar* drawModeToolBar = new QPEToolBar(this); | 120 | QPEToolBar* drawModeToolBar = new QPEToolBar(this); |
@@ -217,6 +206,17 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) | |||
217 | m_pBrushColorToolButton->setPopupDelay(0); | 206 | m_pBrushColorToolButton->setPopupDelay(0); |
218 | 207 | ||
219 | brushColorPopupMenu->activateItemAt(1); | 208 | brushColorPopupMenu->activateItemAt(1); |
209 | |||
210 | // init pages | ||
211 | |||
212 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); | ||
213 | |||
214 | if (file.open(IO_ReadOnly)) { | ||
215 | m_pDrawPadCanvas->load(&file); | ||
216 | file.close(); | ||
217 | } else { | ||
218 | m_pDrawPadCanvas->initialPage(); | ||
219 | } | ||
220 | } | 220 | } |
221 | 221 | ||
222 | DrawPad::~DrawPad() | 222 | DrawPad::~DrawPad() |
@@ -379,3 +379,12 @@ void DrawPad::updateNavigationToolButtons() | |||
379 | m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | 379 | m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); |
380 | m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | 380 | m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); |
381 | } | 381 | } |
382 | |||
383 | void DrawPad::updateCaption() | ||
384 | { | ||
385 | uint pagePosition = m_pDrawPadCanvas->pagePosition(); | ||
386 | uint pageCount = m_pDrawPadCanvas->pageCount(); | ||
387 | |||
388 | setCaption(tr("DrawPad") + " - " + tr("Page") + " " | ||
389 | + QString::number(pagePosition) + "/" + QString::number(pageCount)); | ||
390 | } | ||