author | leseb <leseb> | 2002-06-13 16:43:16 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-06-13 16:43:16 (UTC) |
commit | 54de91b66a2f0f985ff89503e919f85713d1f22c (patch) (side-by-side diff) | |
tree | 55df26ca5f08584beb4e033a1fee4510a8e2d45c | |
parent | 6a178f4ad2c3a9b92224c3506165cf03df41202e (diff) | |
download | opie-54de91b66a2f0f985ff89503e919f85713d1f22c.zip opie-54de91b66a2f0f985ff89503e919f85713d1f22c.tar.gz opie-54de91b66a2f0f985ff89503e919f85713d1f22c.tar.bz2 |
Starting to implement page attributes
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 13 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.h | 1 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.pro | 2 | ||||
-rw-r--r-- | noncore/graphics/drawpad/newpagedialog.cpp | 14 | ||||
-rw-r--r-- | noncore/graphics/drawpad/newpagedialog.h | 3 | ||||
-rw-r--r-- | noncore/graphics/drawpad/pageinformationdialog.cpp | 70 | ||||
-rw-r--r-- | noncore/graphics/drawpad/pageinformationdialog.h | 39 |
7 files changed, 141 insertions, 1 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index ef55268..369e7f0 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp @@ -2,48 +2,49 @@ * * * DrawPad - a drawing program for Opie Environment * * * * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "drawpad.h" #include "drawpadcanvas.h" #include "ellipsetool.h" #include "erasetool.h" #include "exportdialog.h" #include "filledellipsetool.h" #include "filledrectangletool.h" #include "filltool.h" #include "importdialog.h" #include "linetool.h" #include "newpagedialog.h" +#include "pageinformationdialog.h" #include "pointtool.h" #include "rectangletool.h" #include "texttool.h" #include "thumbnailview.h" #include <opie/colordialog.h> #include <opie/colorpopupmenu.h> #include <qpe/applnk.h> #include <qpe/global.h> #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <qaction.h> #include <qfile.h> #include <qmessagebox.h> #include <qpainter.h> #include <qspinbox.h> #include <qtoolbutton.h> #include <qtooltip.h> DrawPad::DrawPad(QWidget* parent, const char* name) : QMainWindow(parent, name) @@ -65,48 +66,52 @@ DrawPad::DrawPad(QWidget* parent, const char* name) QPEToolBar* menuToolBar = new QPEToolBar(this); QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar); QPopupMenu *toolsPopupMenu = new QPopupMenu(menuBar); QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); deleteAllAction->addTo(toolsPopupMenu); toolsPopupMenu->insertSeparator(); QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); importPageAction->addTo(toolsPopupMenu); QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); exportPageAction->addTo(toolsPopupMenu); toolsPopupMenu->insertSeparator(); QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); thumbnailViewAction->addTo(toolsPopupMenu); + + QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); + connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); + pageInformationAction->addTo(toolsPopupMenu); menuBar->insertItem(tr("Tools"), toolsPopupMenu); // init page toolbar QPEToolBar* pageToolBar = new QPEToolBar(this); QAction* newPageAction = new QAction(tr("New Page"), Resource::loadIconSet("new"), QString::null, 0, this); connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); newPageAction->addTo(pageToolBar); QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadIconSet("drawpad/clear"), QString::null, 0, this); connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); clearPageAction->addTo(pageToolBar); QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadIconSet("trash"), QString::null, 0, this); connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); deletePageAction->addTo(pageToolBar); QPEToolBar* emptyToolBar = new QPEToolBar(this); emptyToolBar->setHorizontalStretchable(true); // init navigation toolbar @@ -572,24 +577,32 @@ void DrawPad::importPage() delete docLnk; } } } void DrawPad::exportPage() { ExportDialog exportDialog(m_pDrawPadCanvas->pagePosition(), m_pDrawPadCanvas->pageCount(), this); exportDialog.showMaximized(); if (exportDialog.exec() == QDialog::Accepted) { m_pDrawPadCanvas->exportPage(exportDialog.selectedFromPage(), exportDialog.selectedToPage(), exportDialog.selectedName(), exportDialog.selectedFormat()); } } void DrawPad::thumbnailView() { ThumbnailView thumbnailView(this, m_pDrawPadCanvas, this); thumbnailView.showMaximized(); thumbnailView.exec(); } + +void DrawPad::pageInformation() +{ + PageInformationDialog pageInformationDialog(m_pDrawPadCanvas->currentPage()); + + if (pageInformationDialog.exec() == QDialog::Accepted) { + } +} diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h index 9a821f6..ce62802 100644 --- a/noncore/graphics/drawpad/drawpad.h +++ b/noncore/graphics/drawpad/drawpad.h @@ -44,48 +44,49 @@ private slots: void deletePage(); void setPointTool(); void setLineTool(); void setRectangleTool(); void setFilledRectangleTool(); void setEllipseTool(); void setFilledEllipseTool(); void setTextTool(); void setFillTool(); void setEraseTool(); void changePenWidth(int value); void changePenColor(const QColor& color); void changeBrushColor(const QColor& color); void updateUndoRedoToolButtons(); void updateNavigationToolButtons(); void updateCaption(); void deleteAll(); void importPage(); void exportPage(); void thumbnailView(); + void pageInformation(); private: DrawPadCanvas* m_pDrawPadCanvas; Tool* m_pTool; QPen m_pen; QBrush m_brush; QAction* m_pUndoAction; QAction* m_pRedoAction; QAction* m_pFirstPageAction; QAction* m_pPreviousPageAction; QAction* m_pNextPageAction; QAction* m_pLastPageAction; QAction* m_pPointToolAction; QAction* m_pLineToolAction; QAction* m_pRectangleToolAction; QAction* m_pFilledRectangleToolAction; QAction* m_pEllipseToolAction; QAction* m_pFilledEllipseToolAction; QAction* m_pTextToolAction; QAction* m_pFillToolAction; diff --git a/noncore/graphics/drawpad/drawpad.pro b/noncore/graphics/drawpad/drawpad.pro index 9a640d2..8dc89a2 100644 --- a/noncore/graphics/drawpad/drawpad.pro +++ b/noncore/graphics/drawpad/drawpad.pro @@ -1,57 +1,59 @@ TEMPLATE = app CONFIG = qt warn_on release HEADERS = drawpad.h \ drawpadcanvas.h \ ellipsetool.h \ erasetool.h \ exportdialog.h \ filltool.h \ filledellipsetool.h \ filledrectangletool.h \ importdialog.h \ linetool.h \ newpagedialog.h \ page.h \ + pageinformationdialog.h \ pointtool.h \ rectangletool.h \ shapetool.h \ texttool.h \ thumbnailview.h \ tool.h SOURCES = drawpad.cpp \ drawpadcanvas.cpp \ ellipsetool.cpp \ erasetool.cpp \ exportdialog.cpp \ filltool.cpp \ filledellipsetool.cpp \ filledrectangletool.cpp \ importdialog.cpp \ linetool.cpp \ main.cpp \ newpagedialog.cpp \ page.cpp \ + pageinformationdialog.cpp \ pointtool.cpp \ rectangletool.cpp \ shapetool.cpp \ texttool.cpp \ thumbnailview.cpp \ tool.cpp INCLUDEPATH += $(OPIEDIR)/include \ $(QTDIR)/src/3rdparty/zlib DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie DESTDIR = $(OPIEDIR)/bin TARGET = drawpad TRANSLATIONS = ../../i18n/de/drawpad.ts TRANSLATIONS += ../../i18n/en/drawpad.ts TRANSLATIONS += ../../i18n/fr/drawpad.ts TRANSLATIONS += ../../i18n/hu/drawpad.ts TRANSLATIONS += ../../i18n/ja/drawpad.ts TRANSLATIONS += ../../i18n/ko/drawpad.ts TRANSLATIONS += ../../i18n/no/drawpad.ts TRANSLATIONS += ../../i18n/pl/drawpad.ts TRANSLATIONS += ../../i18n/pt_BR/drawpad.ts TRANSLATIONS += ../../i18n/sl/drawpad.ts TRANSLATIONS += ../../i18n/zh_CN/drawpad.ts diff --git a/noncore/graphics/drawpad/newpagedialog.cpp b/noncore/graphics/drawpad/newpagedialog.cpp index 0592af2..ff31aad 100644 --- a/noncore/graphics/drawpad/newpagedialog.cpp +++ b/noncore/graphics/drawpad/newpagedialog.cpp @@ -1,91 +1,103 @@ /*************************************************************************** * * * DrawPad - a drawing program for Opie Environment * * * * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "newpagedialog.h" #include <qbuttongroup.h> #include <qgroupbox.h> #include <qlabel.h> #include <qlayout.h> +#include <qlineedit.h> #include <qradiobutton.h> #include <qspinbox.h> NewPageDialog::NewPageDialog(uint width, uint height, const QColor& penColor, const QColor& brushColor, QWidget* parent, const char* name) : QDialog(parent, name, true) { setCaption(tr("New Page")); m_penColor = penColor; m_brushColor = brushColor; - QGroupBox* sizeGroupBox = new QGroupBox(0, Qt::Vertical, tr("Page Size"), this); + QGroupBox* generalGroupBox = new QGroupBox(0, Qt::Vertical, tr("General"), this); + + QLabel* titleLabel = new QLabel(tr("Title:"), generalGroupBox); + m_pTitleLineEdit = new QLineEdit(generalGroupBox); + + QGroupBox* sizeGroupBox = new QGroupBox(0, Qt::Vertical, tr("Size"), this); QLabel* widthLabel = new QLabel(tr("Width:"), sizeGroupBox); QLabel* heightLabel = new QLabel(tr("Height:"), sizeGroupBox); m_pWidthSpinBox = new QSpinBox(1, 1024, 1, sizeGroupBox); m_pHeightSpinBox = new QSpinBox(1, 1024, 1, sizeGroupBox); m_pWidthSpinBox->setValue(width); m_pHeightSpinBox->setValue(height); m_pContentButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Background"), this); QRadioButton* whiteColorRadioButton = new QRadioButton(tr("White"), m_pContentButtonGroup); QRadioButton* penColorRadioButton = new QRadioButton(tr("Pen Color"), m_pContentButtonGroup); QRadioButton* brushColorRadioButton = new QRadioButton(tr("Fill Color"), m_pContentButtonGroup); m_pContentButtonGroup->setButton(0); QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); + generalGroupBox->layout()->setSpacing(4); sizeGroupBox->layout()->setSpacing(4); m_pContentButtonGroup->layout()->setSpacing(4); + QGridLayout* generalLayout = new QGridLayout(generalGroupBox->layout(), 1, 1); QGridLayout* sizeLayout = new QGridLayout(sizeGroupBox->layout(), 2, 2); QVBoxLayout* contentLayout = new QVBoxLayout(m_pContentButtonGroup->layout()); + generalLayout->addWidget(titleLabel, 0, 0); + generalLayout->addWidget(m_pTitleLineEdit, 0, 1); + sizeLayout->addWidget(widthLabel, 0, 0); sizeLayout->addWidget(heightLabel, 1, 0); sizeLayout->addWidget(m_pWidthSpinBox, 0, 1); sizeLayout->addWidget(m_pHeightSpinBox, 1, 1); sizeLayout->setColStretch(1, 1); contentLayout->addWidget(whiteColorRadioButton); contentLayout->addWidget(penColorRadioButton); contentLayout->addWidget(brushColorRadioButton); + mainLayout->addWidget(generalGroupBox); mainLayout->addWidget(sizeGroupBox); mainLayout->addWidget(m_pContentButtonGroup); } NewPageDialog::~NewPageDialog() { } uint NewPageDialog::selectedWidth() { return (m_pWidthSpinBox->value()); } uint NewPageDialog::selectedHeight() { return (m_pHeightSpinBox->value()); } const QColor& NewPageDialog::selectedColor() { switch (m_pContentButtonGroup->id(m_pContentButtonGroup->selected())) { case 0: return (Qt::white); break; diff --git a/noncore/graphics/drawpad/newpagedialog.h b/noncore/graphics/drawpad/newpagedialog.h index d680394..fe8f562 100644 --- a/noncore/graphics/drawpad/newpagedialog.h +++ b/noncore/graphics/drawpad/newpagedialog.h @@ -1,45 +1,48 @@ /*************************************************************************** * * * DrawPad - a drawing program for Opie Environment * * * * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef NEWPAGEDIALOG_H #define NEWPAGEDIALOG_H #include <qdialog.h> class QButtonGroup; +class QLineEdit; class QSpinBox; class NewPageDialog : public QDialog { Q_OBJECT public: NewPageDialog(uint width, uint height, const QColor& foregroundColor, const QColor& backgroundColor, QWidget* parent = 0, const char* name = 0); ~NewPageDialog(); uint selectedWidth(); uint selectedHeight(); const QColor& selectedColor(); private: + QLineEdit* m_pTitleLineEdit; + QSpinBox* m_pWidthSpinBox; QSpinBox* m_pHeightSpinBox; QColor m_penColor; QColor m_brushColor; QButtonGroup* m_pContentButtonGroup; }; #endif // NEWPAGEDIALOG_H diff --git a/noncore/graphics/drawpad/pageinformationdialog.cpp b/noncore/graphics/drawpad/pageinformationdialog.cpp new file mode 100644 index 0000000..54cf89d --- a/dev/null +++ b/noncore/graphics/drawpad/pageinformationdialog.cpp @@ -0,0 +1,70 @@ +/*************************************************************************** + * * + * DrawPad - a drawing program for Opie Environment * + * * + * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "pageinformationdialog.h" + +#include "page.h" + +#include <qgroupbox.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> + +PageInformationDialog::PageInformationDialog(Page* page, QWidget* parent, const char* name) + : QDialog(parent, name, true) +{ + m_pPage = page; + + setCaption(tr("Page Information")); + + QGroupBox* generalGroupBox = new QGroupBox(0, Qt::Vertical, tr("General"), this); + + QLabel* titleLabel = new QLabel(tr("Title:"), generalGroupBox); + m_pTitleLineEdit = new QLineEdit(generalGroupBox); + + QGroupBox* sizeGroupBox = new QGroupBox(0, Qt::Vertical, tr("Size"), this); + + QLabel* widthLabel = new QLabel(tr("Width:"), sizeGroupBox); + QLabel* widthValueLabel = new QLabel(QString::number(m_pPage->width()), sizeGroupBox); + + QLabel* heightLabel = new QLabel(tr("Height:"), sizeGroupBox); + QLabel* heightValueLabel = new QLabel(QString::number(m_pPage->height()), sizeGroupBox); + + QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); + generalGroupBox->layout()->setSpacing(4); + sizeGroupBox->layout()->setSpacing(4); + QGridLayout* generalLayout = new QGridLayout(generalGroupBox->layout(), 1, 1); + QGridLayout* sizeLayout = new QGridLayout(sizeGroupBox->layout(), 2, 2); + + generalLayout->addWidget(titleLabel, 0, 0); + generalLayout->addWidget(m_pTitleLineEdit, 0, 1); + + sizeLayout->addWidget(widthLabel, 0, 0); + sizeLayout->addWidget(widthValueLabel, 0, 1); + sizeLayout->addWidget(heightLabel, 1, 0); + sizeLayout->addWidget(heightValueLabel, 1, 1); + + sizeLayout->setColStretch(1, 1); + + mainLayout->addWidget(generalGroupBox); + mainLayout->addWidget(sizeGroupBox); +} + +PageInformationDialog::~PageInformationDialog() +{ +} + +QString PageInformationDialog::selectedTitle() +{ + return (m_pTitleLineEdit->text()); +} diff --git a/noncore/graphics/drawpad/pageinformationdialog.h b/noncore/graphics/drawpad/pageinformationdialog.h new file mode 100644 index 0000000..cce74ec --- a/dev/null +++ b/noncore/graphics/drawpad/pageinformationdialog.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * * + * DrawPad - a drawing program for Opie Environment * + * * + * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PAGEINFORMATIONDIALOG_H +#define PAGEINFORMATIONDIALOG_H + +#include <qdialog.h> + +class Page; + +class QLineEdit; + +class PageInformationDialog : public QDialog +{ + Q_OBJECT + +public: + PageInformationDialog(Page* page, QWidget* parent = 0, const char* name = 0); + ~PageInformationDialog(); + + QString selectedTitle(); + +private: + Page* m_pPage; + + QLineEdit* m_pTitleLineEdit; +}; + +#endif // PAGEINFORMATIONDIALOG_H |