author | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
commit | b6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff) | |
tree | d3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/multimedia/camera/gui/mainwindow.cpp | |
parent | 0d59c780513da78033f4d9040475dee9db0256d4 (diff) | |
download | opie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2 |
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/multimedia/camera/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/gui/mainwindow.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/multimedia/camera/gui/mainwindow.cpp b/noncore/multimedia/camera/gui/mainwindow.cpp index 2f42049..e4e1b6c 100644 --- a/noncore/multimedia/camera/gui/mainwindow.cpp +++ b/noncore/multimedia/camera/gui/mainwindow.cpp | |||
@@ -1,294 +1,294 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | #include "previewwidget.h" | 17 | #include "previewwidget.h" |
18 | #include "zcameraio.h" | 18 | #include "zcameraio.h" |
19 | #include "imageio.h" | 19 | #include "imageio.h" |
20 | #include "avi.h" | 20 | #include "avi.h" |
21 | 21 | ||
22 | /* OPIE */ | 22 | /* OPIE */ |
23 | #include <opie2/ofiledialog.h> | 23 | #include <opie2/ofiledialog.h> |
24 | #include <opie2/odevice.h> | 24 | #include <opie2/odevice.h> |
25 | #include <opie2/oapplication.h> | 25 | #include <opie2/oapplication.h> |
26 | #include <opie2/oconfig.h> | 26 | #include <opie2/oconfig.h> |
27 | #include <opie2/odebug.h> | 27 | #include <opie2/odebug.h> |
28 | #include <qpe/global.h> | 28 | #include <qpe/global.h> |
29 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
30 | #include <qpe/qcopenvelope_qws.h> | 30 | #include <qpe/qcopenvelope_qws.h> |
31 | using namespace Opie; | 31 | using namespace Opie; |
32 | 32 | ||
33 | /* QT */ | 33 | /* QT */ |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qaction.h> | 35 | #include <qaction.h> |
36 | #include <qvbox.h> | 36 | #include <qvbox.h> |
37 | #include <qcombobox.h> | 37 | #include <qcombobox.h> |
38 | #include <qcursor.h> | 38 | #include <qcursor.h> |
39 | #include <qdatastream.h> | 39 | #include <qdatastream.h> |
40 | #include <qdir.h> | 40 | #include <qdir.h> |
41 | #include <qfile.h> | 41 | #include <qfile.h> |
42 | #include <qimage.h> | 42 | #include <qimage.h> |
43 | #include <qlabel.h> | 43 | #include <qlabel.h> |
44 | #include <qlineedit.h> | 44 | #include <qlineedit.h> |
45 | #include <qpopupmenu.h> | 45 | #include <qpopupmenu.h> |
46 | #include <qprogressbar.h> | 46 | #include <qprogressbar.h> |
47 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
48 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
49 | #include <qlayout.h> | 49 | #include <qlayout.h> |
50 | #include <qdirectpainter_qws.h> | 50 | #include <qdirectpainter_qws.h> |
51 | 51 | ||
52 | /* STD */ | 52 | /* STD */ |
53 | #include <assert.h> | 53 | #include <assert.h> |
54 | #include <sys/types.h> | 54 | #include <sys/types.h> |
55 | #include <sys/stat.h> | 55 | #include <sys/stat.h> |
56 | #include <fcntl.h> | 56 | #include <fcntl.h> |
57 | #include <string.h> | 57 | #include <string.h> |
58 | #include <errno.h> | 58 | #include <errno.h> |
59 | #include <unistd.h> | 59 | #include <unistd.h> |
60 | 60 | ||
61 | #define CAPTUREFILE "/tmp/capture.dat" | 61 | #define CAPTUREFILE "/tmp/capture.dat" |
62 | #define OUTPUTFILE "/tmp/output.avi" | 62 | #define OUTPUTFILE "/tmp/output.avi" |
63 | 63 | ||
64 | #define OUTPUT_TO_CUSTOM 250 | 64 | #define OUTPUT_TO_CUSTOM 250 |
65 | #define OUTPUT_TO_DOCFOLDER 251 | 65 | #define OUTPUT_TO_DOCFOLDER 251 |
66 | 66 | ||
67 | CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) | 67 | CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) |
68 | :QMainWindow( parent, name, f ), | 68 | :QMainWindow( parent, name, f ), |
69 | _rotation( 270 ), // FIXME: get this from current settings (ODevice?) | 69 | _rotation( 270 ), // FIXME: get this from current settings (ODevice?) |
70 | _capturing( false ), | 70 | _capturing( false ), |
71 | _pics( 1 ), _videos( 1 ) | 71 | _pics( 1 ), _videos( 1 ) |
72 | { | 72 | { |
73 | #ifdef QT_NO_DEBUG | 73 | #ifdef QT_NO_DEBUG |
74 | if ( !ZCameraIO::instance()->isOpen() ) | 74 | if ( !ZCameraIO::instance()->isOpen() ) |
75 | { | 75 | { |
76 | QVBox* v = new QVBox( this ); | 76 | QVBox* v = new QVBox( this ); |
77 | v->setMargin( 10 ); | 77 | v->setMargin( 10 ); |
78 | QLabel* l1 = new QLabel( v ); | 78 | QLabel* l1 = new QLabel( v ); |
79 | l1->setPixmap( Resource::loadPixmap( "camera/error" ) ); | 79 | l1->setPixmap( Resource::loadPixmap( "camera/error" ) ); |
80 | QLabel* l2 = new QLabel( v ); | 80 | QLabel* l2 = new QLabel( v ); |
81 | l2->setText( "<b>Sorry. could not detect your camera :-(</b><p>" | 81 | l2->setText( "<b>Sorry. could not detect your camera :-(</b><p>" |
82 | "* Is the sharpzdc_cs module loaded ?<br>" | 82 | "* Is the sharpzdc_cs module loaded ?<br>" |
83 | "* Is /dev/sharpzdc read/writable ?<p>" ); | 83 | "* Is /dev/sharpzdc read/writable ?<p>" ); |
84 | connect( new QPushButton( "Exit", v ), SIGNAL( clicked() ), this, SLOT( close() ) ); | 84 | connect( new QPushButton( "Exit", v ), SIGNAL( clicked() ), this, SLOT( close() ) ); |
85 | setCentralWidget( v ); | 85 | setCentralWidget( v ); |
86 | return; | 86 | return; |
87 | } | 87 | } |
88 | #endif | 88 | #endif |
89 | 89 | ||
90 | init(); | 90 | init(); |
91 | 91 | ||
92 | _rotation = 270; //TODO: grab these from the actual settings | 92 | _rotation = 270; //TODO: grab these from the actual settings |
93 | 93 | ||
94 | preview = new PreviewWidget( this, "camera preview widget" ); | 94 | preview = new PreviewWidget( this, "camera preview widget" ); |
95 | //setCentralWidget( preview ); <--- don't do this! | 95 | //setCentralWidget( preview ); <--- don't do this! |
96 | preview->resize( QSize( 240, 288 ) ); | 96 | preview->resize( QSize( 240, 288 ) ); |
97 | preview->show(); | 97 | preview->show(); |
98 | 98 | ||
99 | // construct a System Channel to receive setRotation messages | 99 | // construct a System Channel to receive setRotation messages |
100 | _sysChannel = new QCopChannel( "QPE/System", this ); | 100 | _sysChannel = new QCopChannel( "QPE/System", this ); |
101 | connect( _sysChannel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 101 | connect( _sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
102 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); | 102 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); |
103 | 103 | ||
104 | connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) ); | 104 | connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) ); |
105 | 105 | ||
106 | connect( ZCameraIO::instance(), SIGNAL( shutterClicked() ), this, SLOT( shutterClicked() ) ); | 106 | connect( ZCameraIO::instance(), SIGNAL( shutterClicked() ), this, SLOT( shutterClicked() ) ); |
107 | 107 | ||
108 | updateCaption(); | 108 | updateCaption(); |
109 | 109 | ||
110 | }; | 110 | }; |
111 | 111 | ||
112 | 112 | ||
113 | CameraMainWindow::~CameraMainWindow() | 113 | CameraMainWindow::~CameraMainWindow() |
114 | { | 114 | { |
115 | // write back configuration | 115 | // write back configuration |
116 | OConfigGroupSaver cgs( oApp->config(), "General" ); | 116 | OConfigGroupSaver cgs( oApp->config(), "General" ); |
117 | cgs.config()->writeEntry( "flip", flip ); | 117 | cgs.config()->writeEntry( "flip", flip ); |
118 | cgs.config()->writeEntry( "quality", quality ); | 118 | cgs.config()->writeEntry( "quality", quality ); |
119 | cgs.config()->writeEntry( "zoom", zoom ); | 119 | cgs.config()->writeEntry( "zoom", zoom ); |
120 | cgs.config()->writeEntry( "captureX", captureX ); | 120 | cgs.config()->writeEntry( "captureX", captureX ); |
121 | cgs.config()->writeEntry( "captureY", captureY ); | 121 | cgs.config()->writeEntry( "captureY", captureY ); |
122 | cgs.config()->writeEntry( "captureFormat", captureFormat ); | 122 | cgs.config()->writeEntry( "captureFormat", captureFormat ); |
123 | cgs.config()->writeEntry( "outputTo", outputTo ); | 123 | cgs.config()->writeEntry( "outputTo", outputTo ); |
124 | cgs.config()->writeEntry( "prefix", prefix ); | 124 | cgs.config()->writeEntry( "prefix", prefix ); |
125 | cgs.config()->writeEntry( "appendSettings", appendSettings ); | 125 | cgs.config()->writeEntry( "appendSettings", appendSettings ); |
126 | } | 126 | } |
127 | 127 | ||
128 | 128 | ||
129 | void CameraMainWindow::init() | 129 | void CameraMainWindow::init() |
130 | { | 130 | { |
131 | // get values from configuration | 131 | // get values from configuration |
132 | OConfigGroupSaver cgs( oApp->config(), "General" ); | 132 | OConfigGroupSaver cgs( oApp->config(), "General" ); |
133 | flip = cgs.config()->readEntry( "flip", "A" ); | 133 | flip = cgs.config()->readEntry( "flip", "A" ); |
134 | quality = cgs.config()->readNumEntry( "quality", 50 ); | 134 | quality = cgs.config()->readNumEntry( "quality", 50 ); |
135 | zoom = cgs.config()->readNumEntry( "zoom", 1 ); | 135 | zoom = cgs.config()->readNumEntry( "zoom", 1 ); |
136 | captureX = cgs.config()->readNumEntry( "captureX", 480 ); | 136 | captureX = cgs.config()->readNumEntry( "captureX", 480 ); |
137 | captureY = cgs.config()->readNumEntry( "captureY", 640 ); | 137 | captureY = cgs.config()->readNumEntry( "captureY", 640 ); |
138 | captureFormat = cgs.config()->readEntry( "captureFormat", "JPEG" ); | 138 | captureFormat = cgs.config()->readEntry( "captureFormat", "JPEG" ); |
139 | outputTo = cgs.config()->readEntry( "outputTo", "Documents Folder" ); | 139 | outputTo = cgs.config()->readEntry( "outputTo", "Documents Folder" ); |
140 | prefix = cgs.config()->readEntry( "prefix", "Untitled" ); | 140 | prefix = cgs.config()->readEntry( "prefix", "Untitled" ); |
141 | appendSettings = cgs.config()->readBoolEntry( "appendSettings", true ); | 141 | appendSettings = cgs.config()->readBoolEntry( "appendSettings", true ); |
142 | 142 | ||
143 | // create action groups | 143 | // create action groups |
144 | QAction* a; | 144 | QAction* a; |
145 | resog = new QActionGroup( 0, "reso", true ); | 145 | resog = new QActionGroup( 0, "reso", true ); |
146 | resog->setToggleAction( true ); | 146 | resog->setToggleAction( true ); |
147 | new QAction( " 64 x 48", 0, 0, resog, "64x48", true ); | 147 | new QAction( " 64 x 48", 0, 0, resog, "64x48", true ); |
148 | new QAction( "128 x 96", 0, 0, resog, "128x96", true ); | 148 | new QAction( "128 x 96", 0, 0, resog, "128x96", true ); |
149 | new QAction( "192 x 144", 0, 0, resog, "192x144", true ); | 149 | new QAction( "192 x 144", 0, 0, resog, "192x144", true ); |
150 | new QAction( "256 x 192", 0, 0, resog, "256x192", true ); | 150 | new QAction( "256 x 192", 0, 0, resog, "256x192", true ); |
151 | new QAction( "320 x 240", 0, 0, resog, "320x240", true ); | 151 | new QAction( "320 x 240", 0, 0, resog, "320x240", true ); |
152 | new QAction( "384 x 288", 0, 0, resog, "384x288", true ); | 152 | new QAction( "384 x 288", 0, 0, resog, "384x288", true ); |
153 | new QAction( "448 x 336", 0, 0, resog, "448x336", true ); | 153 | new QAction( "448 x 336", 0, 0, resog, "448x336", true ); |
154 | new QAction( "512 x 384", 0, 0, resog, "512x384", true ); | 154 | new QAction( "512 x 384", 0, 0, resog, "512x384", true ); |
155 | new QAction( "576 x 432", 0, 0, resog, "576x432", true ); | 155 | new QAction( "576 x 432", 0, 0, resog, "576x432", true ); |
156 | new QAction( "640 x 480", 0, 0, resog, "640x480", true ); | 156 | new QAction( "640 x 480", 0, 0, resog, "640x480", true ); |
157 | a = (QAction*) resog->child( QString().sprintf( "%dx%d", captureX>captureY ? captureX:captureY, captureX>captureY ? captureY:captureX ) ); | 157 | a = (QAction*) resog->child( QString().sprintf( "%dx%d", captureX>captureY ? captureX:captureY, captureX>captureY ? captureY:captureX ) ); |
158 | if ( a ) a->setOn( true ); | 158 | if ( a ) a->setOn( true ); |
159 | else owarn << "can't set resolution" << oendl; | 159 | else owarn << "can't set resolution" << oendl; |
160 | 160 | ||
161 | qualityg = new QActionGroup( 0, "quality", true ); | 161 | qualityg = new QActionGroup( 0, "quality", true ); |
162 | qualityg->setToggleAction( true ); | 162 | qualityg->setToggleAction( true ); |
163 | new QAction( " 0 (&minimal)", 0, 0, qualityg, "0", true ); | 163 | new QAction( " 0 (&minimal)", 0, 0, qualityg, "0", true ); |
164 | new QAction( " 25 (&low)", 0, 0, qualityg, "25", true ); | 164 | new QAction( " 25 (&low)", 0, 0, qualityg, "25", true ); |
165 | new QAction( " 50 (&good)", 0, 0, qualityg, "50", true ); | 165 | new QAction( " 50 (&good)", 0, 0, qualityg, "50", true ); |
166 | new QAction( " 75 (&better)", 0, 0, qualityg, "75", true ); | 166 | new QAction( " 75 (&better)", 0, 0, qualityg, "75", true ); |
167 | new QAction( "100 (bes&t)", 0, 0, qualityg, "100", true ); | 167 | new QAction( "100 (bes&t)", 0, 0, qualityg, "100", true ); |
168 | a = (QAction*) qualityg->child( QString().sprintf( "%d", quality ) ); | 168 | a = (QAction*) qualityg->child( QString().sprintf( "%d", quality ) ); |
169 | if ( a ) a->setOn( true ); | 169 | if ( a ) a->setOn( true ); |
170 | else owarn << "can't set quality" << oendl; | 170 | else owarn << "can't set quality" << oendl; |
171 | 171 | ||
172 | zoomg = new QActionGroup( 0, "zoom", true ); | 172 | zoomg = new QActionGroup( 0, "zoom", true ); |
173 | zoomg->setToggleAction( true ); | 173 | zoomg->setToggleAction( true ); |
174 | new QAction( "x 1", 0, 0, zoomg, "1", true ); | 174 | new QAction( "x 1", 0, 0, zoomg, "1", true ); |
175 | new QAction( "x 2", 0, 0, zoomg, "2", true ); | 175 | new QAction( "x 2", 0, 0, zoomg, "2", true ); |
176 | a = (QAction*) zoomg->child( QString().sprintf( "%d", zoom ) ); | 176 | a = (QAction*) zoomg->child( QString().sprintf( "%d", zoom ) ); |
177 | if ( a ) a->setOn( true ); | 177 | if ( a ) a->setOn( true ); |
178 | else owarn << "can't set zoom" << oendl; | 178 | else owarn << "can't set zoom" << oendl; |
179 | 179 | ||
180 | flipg = new QActionGroup( 0, "flip", true ); | 180 | flipg = new QActionGroup( 0, "flip", true ); |
181 | flipg->setToggleAction( true ); | 181 | flipg->setToggleAction( true ); |
182 | new QAction( "Auto (recommended)", 0, 0, flipg, "A", true ); | 182 | new QAction( "Auto (recommended)", 0, 0, flipg, "A", true ); |
183 | new QAction( "0 (always off)", 0, 0, flipg, "0", true ); | 183 | new QAction( "0 (always off)", 0, 0, flipg, "0", true ); |
184 | new QAction( "X (always horizontal)", 0, 0, flipg, "X", true ); | 184 | new QAction( "X (always horizontal)", 0, 0, flipg, "X", true ); |
185 | new QAction( "Y (always vertical)", 0, 0, flipg, "Y", true ); | 185 | new QAction( "Y (always vertical)", 0, 0, flipg, "Y", true ); |
186 | new QAction( "* (always both)", 0, 0, flipg, "*", true ); | 186 | new QAction( "* (always both)", 0, 0, flipg, "*", true ); |
187 | a = (QAction*) flipg->child( QString().sprintf( "%s", (const char*) flip ) ); | 187 | a = (QAction*) flipg->child( QString().sprintf( "%s", (const char*) flip ) ); |
188 | if ( a ) a->setOn( true ); | 188 | if ( a ) a->setOn( true ); |
189 | else owarn << "can't set flip" << oendl; | 189 | else owarn << "can't set flip" << oendl; |
190 | 190 | ||
191 | outputTog = new QActionGroup( 0, "output", true ); | 191 | outputTog = new QActionGroup( 0, "output", true ); |
192 | outputTog->setToggleAction( true ); | 192 | outputTog->setToggleAction( true ); |
193 | new QAction( "/tmp/", 0, 0, outputTog, "/tmp/", true ); | 193 | new QAction( "/tmp/", 0, 0, outputTog, "/tmp/", true ); |
194 | new QAction( "/mnt/card/", 0, 0, outputTog, "/mnt/card/", true ); | 194 | new QAction( "/mnt/card/", 0, 0, outputTog, "/mnt/card/", true ); |
195 | new QAction( "/mnt/cf/", 0, 0, outputTog, "/mnt/cf/", true ); | 195 | new QAction( "/mnt/cf/", 0, 0, outputTog, "/mnt/cf/", true ); |
196 | docfolder = new QAction( "Documents Folder", 0, 0, outputTog, "Documents Folder", true ); | 196 | docfolder = new QAction( "Documents Folder", 0, 0, outputTog, "Documents Folder", true ); |
197 | custom = new QAction( "&Custom...", 0, 0, outputTog, "custom", true ); //TODO: How to save custom!? | 197 | custom = new QAction( "&Custom...", 0, 0, outputTog, "custom", true ); //TODO: How to save custom!? |
198 | a = (QAction*) outputTog->child( QString().sprintf( "%s", (const char*) outputTo ) ); | 198 | a = (QAction*) outputTog->child( QString().sprintf( "%s", (const char*) outputTo ) ); |
199 | if ( a ) a->setOn( true ); | 199 | if ( a ) a->setOn( true ); |
200 | else owarn << "can't set outputTo" << oendl; | 200 | else owarn << "can't set outputTo" << oendl; |
201 | 201 | ||
202 | outputg = new QActionGroup( 0, "output", true ); | 202 | outputg = new QActionGroup( 0, "output", true ); |
203 | outputg->setToggleAction( true ); | 203 | outputg->setToggleAction( true ); |
204 | new QAction( "JPEG", 0, 0, outputg, "JPEG", true ); | 204 | new QAction( "JPEG", 0, 0, outputg, "JPEG", true ); |
205 | new QAction( "PNG", 0, 0, outputg, "PNG", true ); | 205 | new QAction( "PNG", 0, 0, outputg, "PNG", true ); |
206 | new QAction( "BMP", 0, 0, outputg, "BMP", true ); | 206 | new QAction( "BMP", 0, 0, outputg, "BMP", true ); |
207 | new QAction( "AVI", 0, 0, outputg, "AVI", true ); | 207 | new QAction( "AVI", 0, 0, outputg, "AVI", true ); |
208 | a = (QAction*) outputg->child( QString().sprintf( "%s", (const char*) captureFormat ) ); | 208 | a = (QAction*) outputg->child( QString().sprintf( "%s", (const char*) captureFormat ) ); |
209 | if ( a ) a->setOn( true ); | 209 | if ( a ) a->setOn( true ); |
210 | else owarn << "can't set output format" << oendl; | 210 | else owarn << "can't set output format" << oendl; |
211 | 211 | ||
212 | connect( resog, SIGNAL( selected(QAction*) ), this, SLOT( resoMenuItemClicked(QAction*) ) ); | 212 | connect( resog, SIGNAL( selected(QAction*) ), this, SLOT( resoMenuItemClicked(QAction*) ) ); |
213 | connect( qualityg, SIGNAL( selected(QAction*) ), this, SLOT( qualityMenuItemClicked(QAction*) ) ); | 213 | connect( qualityg, SIGNAL( selected(QAction*) ), this, SLOT( qualityMenuItemClicked(QAction*) ) ); |
214 | connect( zoomg, SIGNAL( selected(QAction*) ), this, SLOT( zoomMenuItemClicked(QAction*) ) ); | 214 | connect( zoomg, SIGNAL( selected(QAction*) ), this, SLOT( zoomMenuItemClicked(QAction*) ) ); |
215 | connect( flipg, SIGNAL( selected(QAction*) ), this, SLOT( flipMenuItemClicked(QAction*) ) ); | 215 | connect( flipg, SIGNAL( selected(QAction*) ), this, SLOT( flipMenuItemClicked(QAction*) ) ); |
216 | connect( outputTog, SIGNAL( selected(QAction*) ), this, SLOT( outputToMenuItemClicked(QAction*) ) ); | 216 | connect( outputTog, SIGNAL( selected(QAction*) ), this, SLOT( outputToMenuItemClicked(QAction*) ) ); |
217 | connect( outputg, SIGNAL( selected(QAction*) ), this, SLOT( outputMenuItemClicked(QAction*) ) ); | 217 | connect( outputg, SIGNAL( selected(QAction*) ), this, SLOT( outputMenuItemClicked(QAction*) ) ); |
218 | } | 218 | } |
219 | 219 | ||
220 | 220 | ||
221 | void CameraMainWindow::systemMessage( const QCString& msg, const QByteArray& data ) | 221 | void CameraMainWindow::systemMessage( const QCString& msg, const QByteArray& data ) |
222 | { | 222 | { |
223 | int _newrotation; | 223 | int _newrotation; |
224 | 224 | ||
225 | QDataStream stream( data, IO_ReadOnly ); | 225 | QDataStream stream( data, IO_ReadOnly ); |
226 | odebug << "received system message: " << msg << oendl; | 226 | odebug << "received system message: " << msg << oendl; |
227 | if ( msg == "setCurrentRotation(int)" ) | 227 | if ( msg == "setCurrentRotation(int)" ) |
228 | { | 228 | { |
229 | stream >> _newrotation; | 229 | stream >> _newrotation; |
230 | odebug << "received setCurrentRotation(" << _newrotation << ")" << oendl; | 230 | odebug << "received setCurrentRotation(" << _newrotation << ")" << oendl; |
231 | 231 | ||
232 | switch ( _newrotation ) | 232 | switch ( _newrotation ) |
233 | { | 233 | { |
234 | case 270: preview->resize( QSize( 240, 288 ) ); break; | 234 | case 270: preview->resize( QSize( 240, 288 ) ); break; |
235 | case 180: preview->resize( QSize( 320, 208 ) ); break; | 235 | case 180: preview->resize( QSize( 320, 208 ) ); break; |
236 | default: QMessageBox::warning( this, "opie-camera", | 236 | default: QMessageBox::warning( this, "opie-camera", |
237 | "This rotation is not supported.\n" | 237 | "This rotation is not supported.\n" |
238 | "Supported are 180° and 270°" ); | 238 | "Supported are 180° and 270°" ); |
239 | } | 239 | } |
240 | 240 | ||
241 | if ( _newrotation != _rotation ) | 241 | if ( _newrotation != _rotation ) |
242 | { | 242 | { |
243 | int tmp = captureX; | 243 | int tmp = captureX; |
244 | captureX = captureY; | 244 | captureX = captureY; |
245 | captureY = tmp; | 245 | captureY = tmp; |
246 | _rotation = _newrotation; | 246 | _rotation = _newrotation; |
247 | } | 247 | } |
248 | 248 | ||
249 | updateCaption(); | 249 | updateCaption(); |
250 | 250 | ||
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | 254 | ||
255 | void CameraMainWindow::changeZoom( int zoom ) | 255 | void CameraMainWindow::changeZoom( int zoom ) |
256 | { | 256 | { |
257 | int z; | 257 | int z; |
258 | switch ( zoom ) | 258 | switch ( zoom ) |
259 | { | 259 | { |
260 | case 0: z = 128; break; | 260 | case 0: z = 128; break; |
261 | case 1: z = 256; break; | 261 | case 1: z = 256; break; |
262 | case 2: z = 512; break; | 262 | case 2: z = 512; break; |
263 | default: assert( 0 ); break; | 263 | default: assert( 0 ); break; |
264 | } | 264 | } |
265 | 265 | ||
266 | ZCameraIO::instance()->setCaptureFrame( 240, 160, z ); | 266 | ZCameraIO::instance()->setCaptureFrame( 240, 160, z ); |
267 | } | 267 | } |
268 | 268 | ||
269 | 269 | ||
270 | void CameraMainWindow::showContextMenu() | 270 | void CameraMainWindow::showContextMenu() |
271 | { | 271 | { |
272 | QPopupMenu reso; | 272 | QPopupMenu reso; |
273 | reso.setCheckable( true ); | 273 | reso.setCheckable( true ); |
274 | resog->addTo( &reso ); | 274 | resog->addTo( &reso ); |
275 | 275 | ||
276 | QPopupMenu quality; | 276 | QPopupMenu quality; |
277 | quality.setCheckable( true ); | 277 | quality.setCheckable( true ); |
278 | qualityg->addTo( &quality ); | 278 | qualityg->addTo( &quality ); |
279 | 279 | ||
280 | QPopupMenu flip; | 280 | QPopupMenu flip; |
281 | flip.setCheckable( true ); | 281 | flip.setCheckable( true ); |
282 | flipg->addTo( &flip ); | 282 | flipg->addTo( &flip ); |
283 | 283 | ||
284 | QPopupMenu zoom; | 284 | QPopupMenu zoom; |
285 | zoom.setCheckable( true ); | 285 | zoom.setCheckable( true ); |
286 | zoomg->addTo( &zoom ); | 286 | zoomg->addTo( &zoom ); |
287 | 287 | ||
288 | QPopupMenu prefix; | 288 | QPopupMenu prefix; |
289 | prefix.insertItem( "&Choose...", this, SLOT( prefixItemChoosen() ) ); | 289 | prefix.insertItem( "&Choose...", this, SLOT( prefixItemChoosen() ) ); |
290 | int id = prefix.insertItem( "&Append Settings", this, SLOT( appendSettingsChoosen() ) ); | 290 | int id = prefix.insertItem( "&Append Settings", this, SLOT( appendSettingsChoosen() ) ); |
291 | prefix.setItemChecked( id, appendSettings ); | 291 | prefix.setItemChecked( id, appendSettings ); |
292 | 292 | ||
293 | QPopupMenu outputTo; | 293 | QPopupMenu outputTo; |
294 | outputTo.setCheckable( true ); | 294 | outputTo.setCheckable( true ); |