author | leseb <leseb> | 2002-03-21 17:33:38 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-03-21 17:33:38 (UTC) |
commit | 29baf8dcda3d05d91d340b739de0fdd9e37f5749 (patch) (side-by-side diff) | |
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) (show 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 @@ #include <qtoolbutton.h> #include <qtooltip.h> -DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) - : QMainWindow(parent, name, f) +DrawPad::DrawPad(QWidget* parent, const char* name) + : QMainWindow(parent, name) { - setCaption(tr("DrawPad")); - // init members m_pDrawPadCanvas = new DrawPadCanvas(this, this); + connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateNavigationToolButtons())); + connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateCaption())); connect(m_pDrawPadCanvas, SIGNAL(pageBackupsChanged()), this, SLOT(updateUndoRedoToolButtons())); - QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); - - if (file.open(IO_ReadOnly)) { - m_pDrawPadCanvas->load(&file); - file.close(); - } - setCentralWidget(m_pDrawPadCanvas); // init menu @@ -106,8 +99,6 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); m_pRedoAction->addTo(navigationToolBar); - updateUndoRedoToolButtons(); - m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); m_pFirstPageAction->addTo(navigationToolBar); @@ -124,8 +115,6 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); m_pLastPageAction->addTo(navigationToolBar); - updateNavigationToolButtons(); - // init draw mode toolbar QPEToolBar* drawModeToolBar = new QPEToolBar(this); @@ -217,6 +206,17 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) m_pBrushColorToolButton->setPopupDelay(0); brushColorPopupMenu->activateItemAt(1); + + // init pages + + QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); + + if (file.open(IO_ReadOnly)) { + m_pDrawPadCanvas->load(&file); + file.close(); + } else { + m_pDrawPadCanvas->initialPage(); + } } DrawPad::~DrawPad() @@ -379,3 +379,12 @@ void DrawPad::updateNavigationToolButtons() m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); } + +void DrawPad::updateCaption() +{ + uint pagePosition = m_pDrawPadCanvas->pagePosition(); + uint pageCount = m_pDrawPadCanvas->pageCount(); + + setCaption(tr("DrawPad") + " - " + tr("Page") + " " + + QString::number(pagePosition) + "/" + QString::number(pageCount)); +} |