Diffstat (limited to 'noncore/graphics/drawpad/exportdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/exportdialog.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/graphics/drawpad/exportdialog.cpp b/noncore/graphics/drawpad/exportdialog.cpp index d63f428..169acef 100644 --- a/noncore/graphics/drawpad/exportdialog.cpp +++ b/noncore/graphics/drawpad/exportdialog.cpp | |||
@@ -1,166 +1,166 @@ | |||
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 <opie/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 | ||
29 | ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const char* name) | 29 | ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const char* name) |
30 | : QDialog(parent, name, true) | 30 | : QDialog(parent, name, true) |
31 | { | 31 | { |
32 | setCaption(tr("DrawPad - Export")); | 32 | setCaption(tr("DrawPad - Export")); |
33 | 33 | ||
34 | m_pageAt = pageAt; | 34 | m_pageAt = pageAt; |
35 | m_pageCount = pageCount; | 35 | m_pageCount = pageCount; |
36 | 36 | ||
37 | QButtonGroup* selectionButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Page Selection"), this); | 37 | QButtonGroup* selectionButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Page Selection"), this); |
38 | connect(selectionButtonGroup, SIGNAL(pressed(int)), this, SLOT(selectionChanged(int))); | 38 | connect(selectionButtonGroup, SIGNAL(pressed(int)), this, SLOT(selectionChanged(int))); |
39 | 39 | ||
40 | QRadioButton* selectAllRadioButton = new QRadioButton(tr("All"), selectionButtonGroup); | 40 | QRadioButton* selectAllRadioButton = new QRadioButton(tr("All"), selectionButtonGroup); |
41 | QRadioButton* selectCurrentRadioButton = new QRadioButton(tr("Current"), selectionButtonGroup); | 41 | QRadioButton* selectCurrentRadioButton = new QRadioButton(tr("Current"), selectionButtonGroup); |
42 | QRadioButton* selectRangeRadioButton = new QRadioButton(tr("Range"), selectionButtonGroup); | 42 | QRadioButton* selectRangeRadioButton = new QRadioButton(tr("Range"), selectionButtonGroup); |
43 | 43 | ||
44 | QLabel* toLabel = new QLabel(tr("To:"), selectionButtonGroup); | 44 | QLabel* toLabel = new QLabel(tr("To:"), selectionButtonGroup); |
45 | 45 | ||
46 | m_pFromPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); | 46 | m_pFromPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); |
47 | connect(m_pFromPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fromPageChanged(int))); | 47 | connect(m_pFromPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fromPageChanged(int))); |
48 | 48 | ||
49 | m_pToPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); | 49 | m_pToPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); |
50 | connect(m_pToPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toPageChanged(int))); | 50 | connect(m_pToPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toPageChanged(int))); |
51 | 51 | ||
52 | selectionButtonGroup->setButton(1); | 52 | selectionButtonGroup->setButton(1); |
53 | selectionChanged(1); | 53 | selectionChanged(1); |
54 | 54 | ||
55 | m_pFromPageSpinBox->setValue(pageAt); | 55 | m_pFromPageSpinBox->setValue(pageAt); |
56 | m_pToPageSpinBox->setValue(pageAt); | 56 | m_pToPageSpinBox->setValue(pageAt); |
57 | 57 | ||
58 | QGroupBox* exportGroupBox = new QGroupBox(0, Qt::Vertical, tr("Export As"), this); | 58 | QGroupBox* exportGroupBox = new QGroupBox(0, Qt::Vertical, tr("Export As"), this); |
59 | 59 | ||
60 | QLabel* nameLabel = new QLabel(tr("Name:"), exportGroupBox); | 60 | QLabel* nameLabel = new QLabel(tr("Name:"), exportGroupBox); |
61 | QLabel* formatLabel = new QLabel(tr("Format:"), exportGroupBox); | 61 | QLabel* formatLabel = new QLabel(tr("Format:"), exportGroupBox); |
62 | 62 | ||
63 | m_pNameLineEdit = new QLineEdit(exportGroupBox); | 63 | m_pNameLineEdit = new QLineEdit(exportGroupBox); |
64 | 64 | ||
65 | m_pFormatComboBox = new QComboBox(exportGroupBox); | 65 | m_pFormatComboBox = new QComboBox(exportGroupBox); |
66 | m_pFormatComboBox->insertStrList(QImageIO::outputFormats()); | 66 | m_pFormatComboBox->insertStrList(QImageIO::outputFormats()); |
67 | 67 | ||
68 | MimeTypes types; types.insert( tr("All Images"), "image/*" ); | 68 | MimeTypes types; types.insert( tr("All Images"), "image/*" ); |
69 | OFileSelector* fileSelector = new OFileSelector(this, OFileSelector::FileSelector, | 69 | Opie::OFileSelector* fileSelector = new Opie::OFileSelector(this, Opie::OFileSelector::FileSelector, |
70 | OFileSelector::Normal, | 70 | Opie::OFileSelector::Normal, |
71 | QString::null, QString::null, | 71 | QString::null, QString::null, |
72 | types ); | 72 | types ); |
73 | fileSelector->setNameVisible( false ); | 73 | fileSelector->setNameVisible( false ); |
74 | 74 | ||
75 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); | 75 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); |
76 | selectionButtonGroup->layout()->setSpacing(4); | 76 | selectionButtonGroup->layout()->setSpacing(4); |
77 | exportGroupBox->layout()->setSpacing(4); | 77 | exportGroupBox->layout()->setSpacing(4); |
78 | QGridLayout* selectionLayout = new QGridLayout(selectionButtonGroup->layout(), 2, 2); | 78 | QGridLayout* selectionLayout = new QGridLayout(selectionButtonGroup->layout(), 2, 2); |
79 | QHBoxLayout* rangeLayout = new QHBoxLayout(); | 79 | QHBoxLayout* rangeLayout = new QHBoxLayout(); |
80 | QGridLayout* exportLayout = new QGridLayout(exportGroupBox->layout(), 2, 2); | 80 | QGridLayout* exportLayout = new QGridLayout(exportGroupBox->layout(), 2, 2); |
81 | 81 | ||
82 | selectionLayout->addWidget(selectAllRadioButton, 0, 0); | 82 | selectionLayout->addWidget(selectAllRadioButton, 0, 0); |
83 | selectionLayout->addWidget(selectCurrentRadioButton, 1, 0); | 83 | selectionLayout->addWidget(selectCurrentRadioButton, 1, 0); |
84 | selectionLayout->addWidget(selectRangeRadioButton, 0, 1); | 84 | selectionLayout->addWidget(selectRangeRadioButton, 0, 1); |
85 | selectionLayout->addLayout(rangeLayout, 1, 1); | 85 | selectionLayout->addLayout(rangeLayout, 1, 1); |
86 | 86 | ||
87 | rangeLayout->addWidget(m_pFromPageSpinBox); | 87 | rangeLayout->addWidget(m_pFromPageSpinBox); |
88 | rangeLayout->addWidget(toLabel); | 88 | rangeLayout->addWidget(toLabel); |
89 | rangeLayout->addWidget(m_pToPageSpinBox); | 89 | rangeLayout->addWidget(m_pToPageSpinBox); |
90 | 90 | ||
91 | exportLayout->addWidget(nameLabel, 0, 0); | 91 | exportLayout->addWidget(nameLabel, 0, 0); |
92 | exportLayout->addWidget(formatLabel, 1, 0); | 92 | exportLayout->addWidget(formatLabel, 1, 0); |
93 | 93 | ||
94 | exportLayout->addWidget(m_pNameLineEdit, 0, 1); | 94 | exportLayout->addWidget(m_pNameLineEdit, 0, 1); |
95 | exportLayout->addWidget(m_pFormatComboBox, 1, 1); | 95 | exportLayout->addWidget(m_pFormatComboBox, 1, 1); |
96 | 96 | ||
97 | exportLayout->setColStretch(1, 1); | 97 | exportLayout->setColStretch(1, 1); |
98 | 98 | ||
99 | mainLayout->addWidget(selectionButtonGroup); | 99 | mainLayout->addWidget(selectionButtonGroup); |
100 | mainLayout->addWidget(exportGroupBox); | 100 | mainLayout->addWidget(exportGroupBox); |
101 | mainLayout->addWidget(fileSelector); | 101 | mainLayout->addWidget(fileSelector); |
102 | 102 | ||
103 | m_pNameLineEdit->setFocus(); | 103 | m_pNameLineEdit->setFocus(); |
104 | } | 104 | } |
105 | 105 | ||
106 | ExportDialog::~ExportDialog() | 106 | ExportDialog::~ExportDialog() |
107 | { | 107 | { |
108 | } | 108 | } |
109 | 109 | ||
110 | uint ExportDialog::selectedFromPage() | 110 | uint ExportDialog::selectedFromPage() |
111 | { | 111 | { |
112 | return (m_pFromPageSpinBox->value()); | 112 | return (m_pFromPageSpinBox->value()); |
113 | } | 113 | } |
114 | 114 | ||
115 | uint ExportDialog::selectedToPage() | 115 | uint ExportDialog::selectedToPage() |
116 | { | 116 | { |
117 | return (m_pToPageSpinBox->value()); | 117 | return (m_pToPageSpinBox->value()); |
118 | } | 118 | } |
119 | 119 | ||
120 | QString ExportDialog::selectedName() | 120 | QString ExportDialog::selectedName() |
121 | { | 121 | { |
122 | return (m_pNameLineEdit->text()); | 122 | return (m_pNameLineEdit->text()); |
123 | } | 123 | } |
124 | 124 | ||
125 | QString ExportDialog::selectedFormat() | 125 | QString ExportDialog::selectedFormat() |
126 | { | 126 | { |
127 | return (m_pFormatComboBox->currentText()); | 127 | return (m_pFormatComboBox->currentText()); |
128 | } | 128 | } |
129 | 129 | ||
130 | void ExportDialog::accept() | 130 | void ExportDialog::accept() |
131 | { | 131 | { |
132 | if (!(m_pNameLineEdit->text().isEmpty())) { | 132 | if (!(m_pNameLineEdit->text().isEmpty())) { |
133 | QDialog::accept(); | 133 | QDialog::accept(); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | void ExportDialog::selectionChanged(int id) | 137 | void ExportDialog::selectionChanged(int id) |
138 | { | 138 | { |
139 | switch (id) { | 139 | switch (id) { |
140 | case 0: | 140 | case 0: |
141 | m_pFromPageSpinBox->setValue(1); | 141 | m_pFromPageSpinBox->setValue(1); |
142 | m_pToPageSpinBox->setValue(m_pageCount); | 142 | m_pToPageSpinBox->setValue(m_pageCount); |
143 | 143 | ||
144 | m_pFromPageSpinBox->setEnabled(false); | 144 | m_pFromPageSpinBox->setEnabled(false); |
145 | m_pToPageSpinBox->setEnabled(false); | 145 | m_pToPageSpinBox->setEnabled(false); |
146 | break; | 146 | break; |
147 | case 1: | 147 | case 1: |
148 | m_pFromPageSpinBox->setValue(m_pageAt); | 148 | m_pFromPageSpinBox->setValue(m_pageAt); |
149 | m_pToPageSpinBox->setValue(m_pageAt); | 149 | m_pToPageSpinBox->setValue(m_pageAt); |
150 | 150 | ||
151 | m_pFromPageSpinBox->setEnabled(false); | 151 | m_pFromPageSpinBox->setEnabled(false); |
152 | m_pToPageSpinBox->setEnabled(false); | 152 | m_pToPageSpinBox->setEnabled(false); |
153 | break; | 153 | break; |
154 | case 2: | 154 | case 2: |
155 | m_pFromPageSpinBox->setEnabled(true); | 155 | m_pFromPageSpinBox->setEnabled(true); |
156 | m_pToPageSpinBox->setEnabled(true); | 156 | m_pToPageSpinBox->setEnabled(true); |
157 | break; | 157 | break; |
158 | default: | 158 | default: |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | void ExportDialog::fromPageChanged(int value) | 163 | void ExportDialog::fromPageChanged(int value) |
164 | { | 164 | { |
165 | if (m_pToPageSpinBox->value() < value) { | 165 | if (m_pToPageSpinBox->value() < value) { |
166 | m_pToPageSpinBox->setValue(value); | 166 | m_pToPageSpinBox->setValue(value); |