-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.h | 4 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.pro | 7 | ||||
-rw-r--r-- | noncore/graphics/drawpad/main.cpp | 12 |
4 files changed, 10 insertions, 18 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index aac6bc1..ac08e15 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp @@ -28,49 +28,49 @@ #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/config.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> #include <qwhatsthis.h> -DrawPad::DrawPad(QWidget* parent, const char* name) +DrawPad::DrawPad(QWidget* parent, const char* name, WFlags fl ) : QMainWindow(parent, name, WStyle_ContextHelp) { // init members m_pDrawPadCanvas = new DrawPadCanvas(this, this); connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); setCentralWidget(m_pDrawPadCanvas); // init menu setToolBarsMovable(false); 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(); @@ -257,52 +257,53 @@ DrawPad::DrawPad(QWidget* parent, const char* name) QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, m_pPenColorToolButton); connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); m_pPenColorToolButton->setPopup(penColorPopupMenu); m_pPenColorToolButton->setPopupDelay(0); changePenColor(Qt::black); m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor")); QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) ); OColorPopupMenu* brushColorPopupMenu = new OColorPopupMenu(Qt::white, m_pBrushColorToolButton); connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); m_pBrushColorToolButton->setPopup(brushColorPopupMenu); m_pBrushColorToolButton->setPopupDelay(0); changeBrushColor(Qt::white); + finishStartup(); } -void DrawPad::finishStartup() +void DrawPad::finishStartup() { // init pages QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); if (file.open(IO_ReadOnly)) { m_pDrawPadCanvas->load(&file); file.close(); } else { m_pDrawPadCanvas->initialPage(); } loadConfig(); } DrawPad::~DrawPad() { saveConfig(); QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); if (file.open(IO_WriteOnly)) { m_pDrawPadCanvas->save(&file); diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h index 2cae700..48d5225 100644 --- a/noncore/graphics/drawpad/drawpad.h +++ b/noncore/graphics/drawpad/drawpad.h @@ -11,51 +11,53 @@ * * ***************************************************************************/ #ifndef DRAWPAD_H #define DRAWPAD_H #include <qmainwindow.h> #include <qpen.h> class DrawPadCanvas; class Tool; class QAction; class QColor; class QSpinBox; class QToolButton; class QWidgetStack; class DrawPad : public QMainWindow { Q_OBJECT public: - DrawPad(QWidget* parent = 0, const char* name = 0); + DrawPad(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); ~DrawPad(); + static QString appName() { return QString::fromLatin1("drawpad"); } + Tool* tool() { return m_pTool; } QPen pen() { return m_pen; } QBrush brush() { return m_brush; } bool antiAliasing(); void finishStartup(); private slots: void newPage(); void clearPage(); 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); diff --git a/noncore/graphics/drawpad/drawpad.pro b/noncore/graphics/drawpad/drawpad.pro index bfe6ac4..03cf7aa 100644 --- a/noncore/graphics/drawpad/drawpad.pro +++ b/noncore/graphics/drawpad/drawpad.pro @@ -1,69 +1,66 @@ -TEMPLATE = app -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app 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 DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -DESTDIR = $(OPIEDIR)/bin + TARGET = drawpad TRANSLATIONS = ../../../i18n/de/drawpad.ts \ ../../../i18n/nl/drawpad.ts \ ../../../i18n/da/drawpad.ts \ ../../../i18n/xx/drawpad.ts \ ../../../i18n/en/drawpad.ts \ ../../../i18n/es/drawpad.ts \ ../../../i18n/fr/drawpad.ts \ ../../../i18n/hu/drawpad.ts \ ../../../i18n/ja/drawpad.ts \ ../../../i18n/ko/drawpad.ts \ ../../../i18n/no/drawpad.ts \ ../../../i18n/pl/drawpad.ts \ ../../../i18n/pt/drawpad.ts \ ../../../i18n/pt_BR/drawpad.ts \ ../../../i18n/sl/drawpad.ts \ ../../../i18n/zh_CN/drawpad.ts \ ../../../i18n/it/drawpad.ts \ ../../../i18n/zh_TW/drawpad.ts - - include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/graphics/drawpad/main.cpp b/noncore/graphics/drawpad/main.cpp index 12f8084..87bc621 100644 --- a/noncore/graphics/drawpad/main.cpp +++ b/noncore/graphics/drawpad/main.cpp @@ -1,27 +1,19 @@ /*************************************************************************** * * * 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 <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> -int main(int argc, char **argv) -{ - QPEApplication a(argc, argv); - - DrawPad mw; // = new DrawPad();; - a.showMainWidget(&mw ); - mw.finishStartup(); - - return a.exec(); -} +OPIE_EXPORT_APP( OApplicationFactory<DrawPad> ) |