summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp4
-rw-r--r--noncore/graphics/drawpad/exportdialog.cpp5
-rw-r--r--noncore/graphics/drawpad/importdialog.cpp7
-rw-r--r--noncore/graphics/drawpad/importdialog.h2
-rw-r--r--noncore/graphics/drawpad/main.cpp2
5 files changed, 13 insertions, 7 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index 55b23cc..3331193 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -1,146 +1,148 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "drawpad.h" 14#include "drawpad.h"
15 15
16#include "drawpadcanvas.h" 16#include "drawpadcanvas.h"
17#include "ellipsetool.h" 17#include "ellipsetool.h"
18#include "erasetool.h" 18#include "erasetool.h"
19#include "exportdialog.h" 19#include "exportdialog.h"
20#include "filledellipsetool.h" 20#include "filledellipsetool.h"
21#include "filledrectangletool.h" 21#include "filledrectangletool.h"
22#include "filltool.h" 22#include "filltool.h"
23#include "importdialog.h" 23#include "importdialog.h"
24#include "linetool.h" 24#include "linetool.h"
25#include "newpagedialog.h" 25#include "newpagedialog.h"
26#include "page.h" 26#include "page.h"
27#include "pageinformationdialog.h" 27#include "pageinformationdialog.h"
28#include "pointtool.h" 28#include "pointtool.h"
29#include "rectangletool.h" 29#include "rectangletool.h"
30#include "texttool.h" 30#include "texttool.h"
31#include "thumbnailview.h" 31#include "thumbnailview.h"
32 32
33#include <opie2/qcolordialog.h> 33#include <opie2/qcolordialog.h>
34#include <opie2/ocolorpopupmenu.h> 34#include <opie2/ocolorpopupmenu.h>
35 35
36#include <qpe/applnk.h> 36#include <qpe/applnk.h>
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qpe/qpetoolbar.h> 38#include <qtoolbar.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
41 41
42#include <qmenubar.h> 42#include <qmenubar.h>
43#include <qaction.h> 43#include <qaction.h>
44#include <qfile.h> 44#include <qfile.h>
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46#include <qspinbox.h> 46#include <qspinbox.h>
47#include <qtoolbutton.h> 47#include <qtoolbutton.h>
48#include <qtooltip.h> 48#include <qtooltip.h>
49#include <qwhatsthis.h> 49#include <qwhatsthis.h>
50 50
51using namespace Opie::Ui;
52using namespace Opie::Ui;
51DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ ) 53DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ )
52 : QMainWindow(parent, name, WStyle_ContextHelp) 54 : QMainWindow(parent, name, WStyle_ContextHelp)
53{ 55{
54 // init members 56 // init members
55 57
56 m_pDrawPadCanvas = new DrawPadCanvas(this, this); 58 m_pDrawPadCanvas = new DrawPadCanvas(this, this);
57 59
58 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); 60 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView()));
59 61
60 setCentralWidget(m_pDrawPadCanvas); 62 setCentralWidget(m_pDrawPadCanvas);
61 63
62 // init menu 64 // init menu
63 65
64 setToolBarsMovable(false); 66 setToolBarsMovable(false);
65 67
66 QToolBar* menuToolBar = new QToolBar(this); 68 QToolBar* menuToolBar = new QToolBar(this);
67 QMenuBar* menuBar = new QMenuBar(menuToolBar); 69 QMenuBar* menuBar = new QMenuBar(menuToolBar);
68 70
69 QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); 71 QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar);
70 72
71 QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); 73 QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this);
72 connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); 74 connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll()));
73 deleteAllAction->addTo(toolsPopupMenu); 75 deleteAllAction->addTo(toolsPopupMenu);
74 76
75 toolsPopupMenu->insertSeparator(); 77 toolsPopupMenu->insertSeparator();
76 78
77 QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); 79 QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this);
78 connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); 80 connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage()));
79 importPageAction->addTo(toolsPopupMenu); 81 importPageAction->addTo(toolsPopupMenu);
80 82
81 QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); 83 QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this);
82 connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); 84 connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage()));
83 exportPageAction->addTo(toolsPopupMenu); 85 exportPageAction->addTo(toolsPopupMenu);
84 86
85 toolsPopupMenu->insertSeparator(); 87 toolsPopupMenu->insertSeparator();
86 88
87 QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); 89 QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this);
88 connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); 90 connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView()));
89 thumbnailViewAction->addTo(toolsPopupMenu); 91 thumbnailViewAction->addTo(toolsPopupMenu);
90 92
91 QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); 93 QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this);
92 connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); 94 connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation()));
93 pageInformationAction->addTo(toolsPopupMenu); 95 pageInformationAction->addTo(toolsPopupMenu);
94 96
95 toolsPopupMenu->insertSeparator(); 97 toolsPopupMenu->insertSeparator();
96 98
97 m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); 99 m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this);
98 m_pAntiAliasingAction->setToggleAction(true); 100 m_pAntiAliasingAction->setToggleAction(true);
99 m_pAntiAliasingAction->addTo(toolsPopupMenu); 101 m_pAntiAliasingAction->addTo(toolsPopupMenu);
100 102
101 menuBar->insertItem(tr("Tools"), toolsPopupMenu); 103 menuBar->insertItem(tr("Tools"), toolsPopupMenu);
102 104
103 // init page toolbar 105 // init page toolbar
104 106
105 QToolBar* pageToolBar = new QToolBar(this); 107 QToolBar* pageToolBar = new QToolBar(this);
106 108
107 QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); 109 QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this);
108 connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); 110 connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage()));
109 newPageAction->addTo(pageToolBar); 111 newPageAction->addTo(pageToolBar);
110 newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); 112 newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) );
111 113
112 QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); 114 QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this);
113 connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); 115 connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage()));
114 clearPageAction->addTo(pageToolBar); 116 clearPageAction->addTo(pageToolBar);
115 clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); 117 clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) );
116 118
117 QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); 119 QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this);
118 connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); 120 connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage()));
119 deletePageAction->addTo(pageToolBar); 121 deletePageAction->addTo(pageToolBar);
120 deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); 122 deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) );
121 123
122 QToolBar* emptyToolBar = new QToolBar(this); 124 QToolBar* emptyToolBar = new QToolBar(this);
123 emptyToolBar->setHorizontalStretchable(true); 125 emptyToolBar->setHorizontalStretchable(true);
124 126
125 // init navigation toolbar 127 // init navigation toolbar
126 128
127 QToolBar* navigationToolBar = new QToolBar(this); 129 QToolBar* navigationToolBar = new QToolBar(this);
128 130
129 m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this); 131 m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this);
130 connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); 132 connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo()));
131 m_pUndoAction->addTo(navigationToolBar); 133 m_pUndoAction->addTo(navigationToolBar);
132 m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); 134 m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) );
133 135
134 m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this); 136 m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this);
135 connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); 137 connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo()));
136 m_pRedoAction->addTo(navigationToolBar); 138 m_pRedoAction->addTo(navigationToolBar);
137 m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); 139 m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) );
138 140
139 m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); 141 m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this);
140 connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); 142 connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage()));
141 m_pFirstPageAction->addTo(navigationToolBar); 143 m_pFirstPageAction->addTo(navigationToolBar);
142 m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); 144 m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) );
143 145
144 m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); 146 m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this);
145 connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); 147 connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage()));
146 m_pPreviousPageAction->addTo(navigationToolBar); 148 m_pPreviousPageAction->addTo(navigationToolBar);
diff --git a/noncore/graphics/drawpad/exportdialog.cpp b/noncore/graphics/drawpad/exportdialog.cpp
index 169acef..f053bb5 100644
--- a/noncore/graphics/drawpad/exportdialog.cpp
+++ b/noncore/graphics/drawpad/exportdialog.cpp
@@ -1,166 +1,167 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "exportdialog.h" 14#include "exportdialog.h"
15 15
16#include <opie2/ofileselector.h> 16#include <opie2/ofileselector.h>
17 17
18#include <qbuttongroup.h> 18#include <qbuttongroup.h>
19#include <qcombobox.h> 19#include <qcombobox.h>
20#include <qimage.h> 20#include <qimage.h>
21#include <qlabel.h> 21#include <qlabel.h>
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qlineedit.h> 23#include <qlineedit.h>
24#include <qradiobutton.h> 24#include <qradiobutton.h>
25#include <qspinbox.h> 25#include <qspinbox.h>
26 26
27#include <stdlib.h> 27#include <stdlib.h>
28 28
29using namespace Opie::Ui;
29ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const char* name) 30ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const char* name)
30 : QDialog(parent, name, true) 31 : QDialog(parent, name, true)
31{ 32{
32 setCaption(tr("DrawPad - Export")); 33 setCaption(tr("DrawPad - Export"));
33 34
34 m_pageAt = pageAt; 35 m_pageAt = pageAt;
35 m_pageCount = pageCount; 36 m_pageCount = pageCount;
36 37
37 QButtonGroup* selectionButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Page Selection"), this); 38 QButtonGroup* selectionButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Page Selection"), this);
38 connect(selectionButtonGroup, SIGNAL(pressed(int)), this, SLOT(selectionChanged(int))); 39 connect(selectionButtonGroup, SIGNAL(pressed(int)), this, SLOT(selectionChanged(int)));
39 40
40 QRadioButton* selectAllRadioButton = new QRadioButton(tr("All"), selectionButtonGroup); 41 QRadioButton* selectAllRadioButton = new QRadioButton(tr("All"), selectionButtonGroup);
41 QRadioButton* selectCurrentRadioButton = new QRadioButton(tr("Current"), selectionButtonGroup); 42 QRadioButton* selectCurrentRadioButton = new QRadioButton(tr("Current"), selectionButtonGroup);
42 QRadioButton* selectRangeRadioButton = new QRadioButton(tr("Range"), selectionButtonGroup); 43 QRadioButton* selectRangeRadioButton = new QRadioButton(tr("Range"), selectionButtonGroup);
43 44
44 QLabel* toLabel = new QLabel(tr("To:"), selectionButtonGroup); 45 QLabel* toLabel = new QLabel(tr("To:"), selectionButtonGroup);
45 46
46 m_pFromPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); 47 m_pFromPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup);
47 connect(m_pFromPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fromPageChanged(int))); 48 connect(m_pFromPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fromPageChanged(int)));
48 49
49 m_pToPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); 50 m_pToPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup);
50 connect(m_pToPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toPageChanged(int))); 51 connect(m_pToPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toPageChanged(int)));
51 52
52 selectionButtonGroup->setButton(1); 53 selectionButtonGroup->setButton(1);
53 selectionChanged(1); 54 selectionChanged(1);
54 55
55 m_pFromPageSpinBox->setValue(pageAt); 56 m_pFromPageSpinBox->setValue(pageAt);
56 m_pToPageSpinBox->setValue(pageAt); 57 m_pToPageSpinBox->setValue(pageAt);
57 58
58 QGroupBox* exportGroupBox = new QGroupBox(0, Qt::Vertical, tr("Export As"), this); 59 QGroupBox* exportGroupBox = new QGroupBox(0, Qt::Vertical, tr("Export As"), this);
59 60
60 QLabel* nameLabel = new QLabel(tr("Name:"), exportGroupBox); 61 QLabel* nameLabel = new QLabel(tr("Name:"), exportGroupBox);
61 QLabel* formatLabel = new QLabel(tr("Format:"), exportGroupBox); 62 QLabel* formatLabel = new QLabel(tr("Format:"), exportGroupBox);
62 63
63 m_pNameLineEdit = new QLineEdit(exportGroupBox); 64 m_pNameLineEdit = new QLineEdit(exportGroupBox);
64 65
65 m_pFormatComboBox = new QComboBox(exportGroupBox); 66 m_pFormatComboBox = new QComboBox(exportGroupBox);
66 m_pFormatComboBox->insertStrList(QImageIO::outputFormats()); 67 m_pFormatComboBox->insertStrList(QImageIO::outputFormats());
67 68
68 MimeTypes types; types.insert( tr("All Images"), "image/*" ); 69 MimeTypes types; types.insert( tr("All Images"), "image/*" );
69 Opie::OFileSelector* fileSelector = new Opie::OFileSelector(this, Opie::OFileSelector::FileSelector, 70 OFileSelector* fileSelector = new OFileSelector(this, OFileSelector::FileSelector,
70 Opie::OFileSelector::Normal, 71 OFileSelector::Normal,
71 QString::null, QString::null, 72 QString::null, QString::null,
72 types ); 73 types );
73 fileSelector->setNameVisible( false ); 74 fileSelector->setNameVisible( false );
74 75
75 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); 76 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
76 selectionButtonGroup->layout()->setSpacing(4); 77 selectionButtonGroup->layout()->setSpacing(4);
77 exportGroupBox->layout()->setSpacing(4); 78 exportGroupBox->layout()->setSpacing(4);
78 QGridLayout* selectionLayout = new QGridLayout(selectionButtonGroup->layout(), 2, 2); 79 QGridLayout* selectionLayout = new QGridLayout(selectionButtonGroup->layout(), 2, 2);
79 QHBoxLayout* rangeLayout = new QHBoxLayout(); 80 QHBoxLayout* rangeLayout = new QHBoxLayout();
80 QGridLayout* exportLayout = new QGridLayout(exportGroupBox->layout(), 2, 2); 81 QGridLayout* exportLayout = new QGridLayout(exportGroupBox->layout(), 2, 2);
81 82
82 selectionLayout->addWidget(selectAllRadioButton, 0, 0); 83 selectionLayout->addWidget(selectAllRadioButton, 0, 0);
83 selectionLayout->addWidget(selectCurrentRadioButton, 1, 0); 84 selectionLayout->addWidget(selectCurrentRadioButton, 1, 0);
84 selectionLayout->addWidget(selectRangeRadioButton, 0, 1); 85 selectionLayout->addWidget(selectRangeRadioButton, 0, 1);
85 selectionLayout->addLayout(rangeLayout, 1, 1); 86 selectionLayout->addLayout(rangeLayout, 1, 1);
86 87
87 rangeLayout->addWidget(m_pFromPageSpinBox); 88 rangeLayout->addWidget(m_pFromPageSpinBox);
88 rangeLayout->addWidget(toLabel); 89 rangeLayout->addWidget(toLabel);
89 rangeLayout->addWidget(m_pToPageSpinBox); 90 rangeLayout->addWidget(m_pToPageSpinBox);
90 91
91 exportLayout->addWidget(nameLabel, 0, 0); 92 exportLayout->addWidget(nameLabel, 0, 0);
92 exportLayout->addWidget(formatLabel, 1, 0); 93 exportLayout->addWidget(formatLabel, 1, 0);
93 94
94 exportLayout->addWidget(m_pNameLineEdit, 0, 1); 95 exportLayout->addWidget(m_pNameLineEdit, 0, 1);
95 exportLayout->addWidget(m_pFormatComboBox, 1, 1); 96 exportLayout->addWidget(m_pFormatComboBox, 1, 1);
96 97
97 exportLayout->setColStretch(1, 1); 98 exportLayout->setColStretch(1, 1);
98 99
99 mainLayout->addWidget(selectionButtonGroup); 100 mainLayout->addWidget(selectionButtonGroup);
100 mainLayout->addWidget(exportGroupBox); 101 mainLayout->addWidget(exportGroupBox);
101 mainLayout->addWidget(fileSelector); 102 mainLayout->addWidget(fileSelector);
102 103
103 m_pNameLineEdit->setFocus(); 104 m_pNameLineEdit->setFocus();
104} 105}
105 106
106ExportDialog::~ExportDialog() 107ExportDialog::~ExportDialog()
107{ 108{
108} 109}
109 110
110uint ExportDialog::selectedFromPage() 111uint ExportDialog::selectedFromPage()
111{ 112{
112 return (m_pFromPageSpinBox->value()); 113 return (m_pFromPageSpinBox->value());
113} 114}
114 115
115uint ExportDialog::selectedToPage() 116uint ExportDialog::selectedToPage()
116{ 117{
117 return (m_pToPageSpinBox->value()); 118 return (m_pToPageSpinBox->value());
118} 119}
119 120
120QString ExportDialog::selectedName() 121QString ExportDialog::selectedName()
121{ 122{
122 return (m_pNameLineEdit->text()); 123 return (m_pNameLineEdit->text());
123} 124}
124 125
125QString ExportDialog::selectedFormat() 126QString ExportDialog::selectedFormat()
126{ 127{
127 return (m_pFormatComboBox->currentText()); 128 return (m_pFormatComboBox->currentText());
128} 129}
129 130
130void ExportDialog::accept() 131void ExportDialog::accept()
131{ 132{
132 if (!(m_pNameLineEdit->text().isEmpty())) { 133 if (!(m_pNameLineEdit->text().isEmpty())) {
133 QDialog::accept(); 134 QDialog::accept();
134 } 135 }
135} 136}
136 137
137void ExportDialog::selectionChanged(int id) 138void ExportDialog::selectionChanged(int id)
138{ 139{
139 switch (id) { 140 switch (id) {
140 case 0: 141 case 0:
141 m_pFromPageSpinBox->setValue(1); 142 m_pFromPageSpinBox->setValue(1);
142 m_pToPageSpinBox->setValue(m_pageCount); 143 m_pToPageSpinBox->setValue(m_pageCount);
143 144
144 m_pFromPageSpinBox->setEnabled(false); 145 m_pFromPageSpinBox->setEnabled(false);
145 m_pToPageSpinBox->setEnabled(false); 146 m_pToPageSpinBox->setEnabled(false);
146 break; 147 break;
147 case 1: 148 case 1:
148 m_pFromPageSpinBox->setValue(m_pageAt); 149 m_pFromPageSpinBox->setValue(m_pageAt);
149 m_pToPageSpinBox->setValue(m_pageAt); 150 m_pToPageSpinBox->setValue(m_pageAt);
150 151
151 m_pFromPageSpinBox->setEnabled(false); 152 m_pFromPageSpinBox->setEnabled(false);
152 m_pToPageSpinBox->setEnabled(false); 153 m_pToPageSpinBox->setEnabled(false);
153 break; 154 break;
154 case 2: 155 case 2:
155 m_pFromPageSpinBox->setEnabled(true); 156 m_pFromPageSpinBox->setEnabled(true);
156 m_pToPageSpinBox->setEnabled(true); 157 m_pToPageSpinBox->setEnabled(true);
157 break; 158 break;
158 default: 159 default:
159 break; 160 break;
160 } 161 }
161} 162}
162 163
163void ExportDialog::fromPageChanged(int value) 164void ExportDialog::fromPageChanged(int value)
164{ 165{
165 if (m_pToPageSpinBox->value() < value) { 166 if (m_pToPageSpinBox->value() < value) {
166 m_pToPageSpinBox->setValue(value); 167 m_pToPageSpinBox->setValue(value);
diff --git a/noncore/graphics/drawpad/importdialog.cpp b/noncore/graphics/drawpad/importdialog.cpp
index 4fc0a0e..a2f4c40 100644
--- a/noncore/graphics/drawpad/importdialog.cpp
+++ b/noncore/graphics/drawpad/importdialog.cpp
@@ -1,116 +1,117 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "importdialog.h" 14#include "importdialog.h"
15 15
16#include <qpe/mimetype.h> 16#include <qpe/mimetype.h>
17 17
18#include <qcheckbox.h> 18#include <qcheckbox.h>
19#include <qimage.h> 19#include <qimage.h>
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qpushbutton.h> 22#include <qpushbutton.h>
23 23
24using namespace Opie::Ui;
24ImportDialog::ImportDialog(QWidget* parent, const char* name) 25ImportDialog::ImportDialog(QWidget* parent, const char* name)
25 : QDialog(parent, name, true) 26 : QDialog(parent, name, true)
26{ 27{
27 setCaption(tr("DrawPad - Import")); 28 setCaption(tr("DrawPad - Import"));
28 29
29 MimeTypes types; types.insert( tr("All images"),"image/*" ); 30 MimeTypes types; types.insert( tr("All images"),"image/*" );
30 m_pFileSelector = new Opie::OFileSelector(this, 31 m_pFileSelector = new OFileSelector(this,
31 Opie::OFileSelector::FileSelector, 32 OFileSelector::FileSelector,
32 Opie::OFileSelector::Normal, 33 OFileSelector::Normal,
33 QString::null, 34 QString::null,
34 QString::null, types ); 35 QString::null, types );
35 m_pFileSelector->setNameVisible( false ); 36 m_pFileSelector->setNameVisible( false );
36 connect(m_pFileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(fileChanged())); 37 connect(m_pFileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(fileChanged()));
37 38
38 m_pPreviewLabel = new QLabel(this); 39 m_pPreviewLabel = new QLabel(this);
39 m_pPreviewLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); 40 m_pPreviewLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
40 m_pPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 41 m_pPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
41 m_pPreviewLabel->setFixedSize(114, 114); 42 m_pPreviewLabel->setFixedSize(114, 114);
42 m_pPreviewLabel->setBackgroundMode(QWidget::PaletteMid); 43 m_pPreviewLabel->setBackgroundMode(QWidget::PaletteMid);
43 44
44 m_pAutomaticPreviewCheckBox = new QCheckBox(tr("Automatic preview"), this); 45 m_pAutomaticPreviewCheckBox = new QCheckBox(tr("Automatic preview"), this);
45 m_pAutomaticPreviewCheckBox->setChecked(true); 46 m_pAutomaticPreviewCheckBox->setChecked(true);
46 47
47 QPushButton* previewPushButton = new QPushButton(tr("Preview"), this); 48 QPushButton* previewPushButton = new QPushButton(tr("Preview"), this);
48 connect(previewPushButton, SIGNAL(clicked()), this, SLOT(preview())); 49 connect(previewPushButton, SIGNAL(clicked()), this, SLOT(preview()));
49 50
50 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); 51 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
51 QHBoxLayout* previewLayout = new QHBoxLayout(4); 52 QHBoxLayout* previewLayout = new QHBoxLayout(4);
52 QVBoxLayout* previewSecondLayout = new QVBoxLayout(4); 53 QVBoxLayout* previewSecondLayout = new QVBoxLayout(4);
53 54
54 previewSecondLayout->addWidget(m_pAutomaticPreviewCheckBox); 55 previewSecondLayout->addWidget(m_pAutomaticPreviewCheckBox);
55 previewSecondLayout->addWidget(previewPushButton); 56 previewSecondLayout->addWidget(previewPushButton);
56 previewSecondLayout->addStretch(); 57 previewSecondLayout->addStretch();
57 58
58 previewLayout->addWidget(m_pPreviewLabel); 59 previewLayout->addWidget(m_pPreviewLabel);
59 previewLayout->addLayout(previewSecondLayout); 60 previewLayout->addLayout(previewSecondLayout);
60 61
61 mainLayout->addWidget(m_pFileSelector); 62 mainLayout->addWidget(m_pFileSelector);
62 mainLayout->addLayout(previewLayout); 63 mainLayout->addLayout(previewLayout);
63 64
64 preview(); 65 preview();
65} 66}
66 67
67ImportDialog::~ImportDialog() 68ImportDialog::~ImportDialog()
68{ 69{
69} 70}
70 71
71const DocLnk* ImportDialog::selected() 72const DocLnk* ImportDialog::selected()
72{ 73{
73 // FIXME change from pointer to reference -zecke 74 // FIXME change from pointer to reference -zecke
74 DocLnk *lnk = new DocLnk( m_pFileSelector->selectedDocument() ); 75 DocLnk *lnk = new DocLnk( m_pFileSelector->selectedDocument() );
75 return lnk; 76 return lnk;
76} 77}
77 78
78void ImportDialog::fileChanged() 79void ImportDialog::fileChanged()
79{ 80{
80 if (m_pAutomaticPreviewCheckBox->isChecked()) { 81 if (m_pAutomaticPreviewCheckBox->isChecked()) {
81 preview(); 82 preview();
82 } 83 }
83} 84}
84 85
85void ImportDialog::preview() 86void ImportDialog::preview()
86{ 87{
87 const DocLnk* docLnk = selected(); 88 const DocLnk* docLnk = selected();
88 89
89 if (docLnk) { 90 if (docLnk) {
90 QImage image(docLnk->file()); 91 QImage image(docLnk->file());
91 92
92 int previewWidth = m_pPreviewLabel->contentsRect().width(); 93 int previewWidth = m_pPreviewLabel->contentsRect().width();
93 int previewHeight = m_pPreviewLabel->contentsRect().height(); 94 int previewHeight = m_pPreviewLabel->contentsRect().height();
94 95
95 float widthScale = 1.0; 96 float widthScale = 1.0;
96 float heightScale = 1.0; 97 float heightScale = 1.0;
97 98
98 if (previewWidth < image.width()) { 99 if (previewWidth < image.width()) {
99 widthScale = (float)previewWidth / float(image.width()); 100 widthScale = (float)previewWidth / float(image.width());
100 } 101 }
101 102
102 if (previewHeight < image.height()) { 103 if (previewHeight < image.height()) {
103 heightScale = (float)previewHeight / float(image.height()); 104 heightScale = (float)previewHeight / float(image.height());
104 } 105 }
105 106
106 float scale = (widthScale < heightScale ? widthScale : heightScale); 107 float scale = (widthScale < heightScale ? widthScale : heightScale);
107 QImage previewImage = image.smoothScale((int)(image.width() * scale) , (int)(image.height() * scale)); 108 QImage previewImage = image.smoothScale((int)(image.width() * scale) , (int)(image.height() * scale));
108 109
109 QPixmap previewPixmap; 110 QPixmap previewPixmap;
110 previewPixmap.convertFromImage(previewImage); 111 previewPixmap.convertFromImage(previewImage);
111 112
112 m_pPreviewLabel->setPixmap(previewPixmap); 113 m_pPreviewLabel->setPixmap(previewPixmap);
113 114
114 delete docLnk; 115 delete docLnk;
115 } 116 }
116} 117}
diff --git a/noncore/graphics/drawpad/importdialog.h b/noncore/graphics/drawpad/importdialog.h
index 16227d2..0e0727a 100644
--- a/noncore/graphics/drawpad/importdialog.h
+++ b/noncore/graphics/drawpad/importdialog.h
@@ -1,46 +1,46 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#ifndef IMPORTDIALOG_H 14#ifndef IMPORTDIALOG_H
15#define IMPORTDIALOG_H 15#define IMPORTDIALOG_H
16 16
17#include <opie2/ofileselector.h> 17#include <opie2/ofileselector.h>
18 18
19#include <qdialog.h> 19#include <qdialog.h>
20 20
21class DocLnk; 21class DocLnk;
22 22
23class QCheckBox; 23class QCheckBox;
24class QLabel; 24class QLabel;
25 25
26class ImportDialog : public QDialog 26class ImportDialog : public QDialog
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29 29
30public: 30public:
31 ImportDialog(QWidget* parent = 0, const char* name = 0); 31 ImportDialog(QWidget* parent = 0, const char* name = 0);
32 ~ImportDialog(); 32 ~ImportDialog();
33 33
34 const DocLnk* selected(); 34 const DocLnk* selected();
35 35
36private slots: 36private slots:
37 void fileChanged(); 37 void fileChanged();
38 void preview(); 38 void preview();
39 39
40private: 40private:
41 Opie::OFileSelector* m_pFileSelector; 41 Opie::Ui::OFileSelector* m_pFileSelector;
42 QLabel* m_pPreviewLabel; 42 QLabel* m_pPreviewLabel;
43 QCheckBox* m_pAutomaticPreviewCheckBox; 43 QCheckBox* m_pAutomaticPreviewCheckBox;
44}; 44};
45 45
46#endif // IMPORTDIALOG_H 46#endif // IMPORTDIALOG_H
diff --git a/noncore/graphics/drawpad/main.cpp b/noncore/graphics/drawpad/main.cpp
index a6c666b..e48bb2e 100644
--- a/noncore/graphics/drawpad/main.cpp
+++ b/noncore/graphics/drawpad/main.cpp
@@ -1,18 +1,20 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "drawpad.h" 14#include "drawpad.h"
15 15
16#include <opie2/oapplicationfactory.h> 16#include <opie2/oapplicationfactory.h>
17 17
18using namespace Opie::Core;
19using namespace Opie::Core;
18OPIE_EXPORT_APP( OApplicationFactory<DrawPad> ) 20OPIE_EXPORT_APP( OApplicationFactory<DrawPad> )