summaryrefslogtreecommitdiff
authorzecke <zecke>2004-03-13 23:10:26 (UTC)
committer zecke <zecke>2004-03-13 23:10:26 (UTC)
commit6b5ec807e25094979f5631a3a46baf7415326d8a (patch) (unidiff)
treea5af190712e332d3b6869795cb944b98102fdb1f
parent874af2f5ce2d48a460d5d9fa1d6535b68e5966da (diff)
downloadopie-6b5ec807e25094979f5631a3a46baf7415326d8a.zip
opie-6b5ec807e25094979f5631a3a46baf7415326d8a.tar.gz
opie-6b5ec807e25094979f5631a3a46baf7415326d8a.tar.bz2
ODP changes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/camera/cmd/capture.cpp2
-rw-r--r--noncore/multimedia/camera/gui/main.cpp2
-rw-r--r--noncore/multimedia/camera/gui/mainwindow.cpp5
-rw-r--r--noncore/multimedia/camera/lib/imageio.cpp1
-rw-r--r--noncore/multimedia/camera/lib/zcameraio.cpp2
-rw-r--r--noncore/multimedia/opierec/helpwindow.cpp2
-rw-r--r--noncore/multimedia/opierec/main.cpp2
7 files changed, 14 insertions, 2 deletions
diff --git a/noncore/multimedia/camera/cmd/capture.cpp b/noncore/multimedia/camera/cmd/capture.cpp
index 64c223c..688622b 100644
--- a/noncore/multimedia/camera/cmd/capture.cpp
+++ b/noncore/multimedia/camera/cmd/capture.cpp
@@ -1,122 +1,124 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2003 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 "capture.h" 16#include "capture.h"
17 17
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#include <opie2/oapplication.h> 22#include <opie2/oapplication.h>
23#include <opie2/odebug.h> 23#include <opie2/odebug.h>
24 24
25#include <qimage.h> 25#include <qimage.h>
26 26
27using namespace Opie::Core;
28using namespace Opie::Core;
27Capturer::Capturer() 29Capturer::Capturer()
28 :QFrame( 0 ), height( 320 ), width( 240 ), zoom( 1 ), quality( 90 ), 30 :QFrame( 0 ), height( 320 ), width( 240 ), zoom( 1 ), quality( 90 ),
29 flip( "A" ), format( "JPEG" ), name( "Untitled" ) 31 flip( "A" ), format( "JPEG" ), name( "Untitled" )
30{ 32{
31} 33}
32 34
33 35
34Capturer::~Capturer() 36Capturer::~Capturer()
35{ 37{
36} 38}
37 39
38 40
39void Capturer::checkSettings() 41void Capturer::checkSettings()
40{ 42{
41 if ( width > height ) 43 if ( width > height )
42 { 44 {
43 if ( 0 != width % 16 || width < 16 || width > 640 ) 45 if ( 0 != width % 16 || width < 16 || width > 640 )
44 { 46 {
45 printf( "Warning: Corrected X resolution to 320 px\n" ); 47 printf( "Warning: Corrected X resolution to 320 px\n" );
46 width = 320; 48 width = 320;
47 } 49 }
48 if ( 0 != height % 16 || height < 16 || height > 480 ) 50 if ( 0 != height % 16 || height < 16 || height > 480 )
49 { 51 {
50 printf( "Warning: Corrected Y resolution to 240 px\n" ); 52 printf( "Warning: Corrected Y resolution to 240 px\n" );
51 height = 240; 53 height = 240;
52 } 54 }
53 } 55 }
54 else 56 else
55 { 57 {
56 if ( 0 != width % 16 || width < 16 || width > 480 ) 58 if ( 0 != width % 16 || width < 16 || width > 480 )
57 { 59 {
58 printf( "Warning: Corrected X resolution to 240 px\n" ); 60 printf( "Warning: Corrected X resolution to 240 px\n" );
59 width = 240; 61 width = 240;
60 } 62 }
61 if ( 0 != height % 16 || height < 16 || height > 640 ) 63 if ( 0 != height % 16 || height < 16 || height > 640 )
62 { 64 {
63 printf( "Warning: Corrected Y resolution to 320 px\n" ); 65 printf( "Warning: Corrected Y resolution to 320 px\n" );
64 height = 320; 66 height = 320;
65 } 67 }
66 } 68 }
67 69
68 if ( quality > 100 || quality < 10 ) 70 if ( quality > 100 || quality < 10 )
69 { 71 {
70 printf( "Warning: Corrected quality to 75%%\n" ); 72 printf( "Warning: Corrected quality to 75%%\n" );
71 quality = 75; 73 quality = 75;
72 } 74 }
73 75
74 if ( zoom > 2 || zoom < 1 ) 76 if ( zoom > 2 || zoom < 1 )
75 { 77 {
76 printf( "Warning: Corrected zoom to x1\n" ); 78 printf( "Warning: Corrected zoom to x1\n" );
77 zoom = 1; 79 zoom = 1;
78 } 80 }
79 81
80 if ( format != "JPEG" && format != "PNG" && format != "BMP" ) 82 if ( format != "JPEG" && format != "PNG" && format != "BMP" )
81 { 83 {
82 printf( "Warning: Corrected format to 'JPEG'\n" ); 84 printf( "Warning: Corrected format to 'JPEG'\n" );
83 format = "JPEG"; 85 format = "JPEG";
84 } 86 }
85} 87}
86 88
87 89
88void Capturer::capture() 90void Capturer::capture()
89{ 91{
90 if ( flip == "A" ) 92 if ( flip == "A" )
91 ZCameraIO::instance()->setFlip( ZCameraIO::AUTOMATICFLIP ); 93 ZCameraIO::instance()->setFlip( ZCameraIO::AUTOMATICFLIP );
92 else if ( flip == "0" ) 94 else if ( flip == "0" )
93 ZCameraIO::instance()->setFlip( ZCameraIO::XNOFLIP | ZCameraIO::YNOFLIP ); 95 ZCameraIO::instance()->setFlip( ZCameraIO::XNOFLIP | ZCameraIO::YNOFLIP );
94 else if ( flip == "X" ) 96 else if ( flip == "X" )
95 ZCameraIO::instance()->setFlip( ZCameraIO::XFLIP ); 97 ZCameraIO::instance()->setFlip( ZCameraIO::XFLIP );
96 else if ( flip == "Y" ) 98 else if ( flip == "Y" )
97 ZCameraIO::instance()->setFlip( ZCameraIO::YFLIP ); 99 ZCameraIO::instance()->setFlip( ZCameraIO::YFLIP );
98 else if ( flip == "*" ) 100 else if ( flip == "*" )
99 ZCameraIO::instance()->setFlip( ZCameraIO::XFLIP | ZCameraIO::YFLIP ); 101 ZCameraIO::instance()->setFlip( ZCameraIO::XFLIP | ZCameraIO::YFLIP );
100 102
101 ZCameraIO::instance()->captureFrame( width, height, zoom, &image ); 103 ZCameraIO::instance()->captureFrame( width, height, zoom, &image );
102 QImage im = image.convertDepth( 32 ); 104 QImage im = image.convertDepth( 32 );
103 bool result = im.save( name, format, quality ); 105 bool result = im.save( name, format, quality );
104 if ( !result ) 106 if ( !result )
105 { 107 {
106 printf( "QImageio-Problem while writing.\n" ); 108 printf( "QImageio-Problem while writing.\n" );
107 } 109 }
108 else 110 else
109 { 111 {
110 printf( "Ok.\n" ); 112 printf( "Ok.\n" );
111 } 113 }
112} 114}
113 115
114 116
115void usage() 117void usage()
116{ 118{
117 printf( "Usage: ./capture [options] filename\n\n" ); 119 printf( "Usage: ./capture [options] filename\n\n" );
118 printf( " -x xresolution (dividable by 16) [default=240]\n" ); 120 printf( " -x xresolution (dividable by 16) [default=240]\n" );
119 printf( " -y xresolution (dividable by 16) [default=320]\n" ); 121 printf( " -y xresolution (dividable by 16) [default=320]\n" );
120 printf( " -q quality (10-100) [default=75]\n" ); 122 printf( " -q quality (10-100) [default=75]\n" );
121 printf( " -f flip (A=auto, 0, X, Y, *=both) [default=Auto]\n" ); 123 printf( " -f flip (A=auto, 0, X, Y, *=both) [default=Auto]\n" );
122 printf( " -o output format (JPEG,BMP,PNG) [default=JPEG]\n" ); 124 printf( " -o output format (JPEG,BMP,PNG) [default=JPEG]\n" );
diff --git a/noncore/multimedia/camera/gui/main.cpp b/noncore/multimedia/camera/gui/main.cpp
index f25475c..7d6b3bb 100644
--- a/noncore/multimedia/camera/gui/main.cpp
+++ b/noncore/multimedia/camera/gui/main.cpp
@@ -1,28 +1,30 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2003 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
16#include "mainwindow.h" 17#include "mainwindow.h"
17#include <opie2/oapplication.h> 18#include <opie2/oapplication.h>
18 19
20using namespace Opie::Core;
19int main( int argc, char **argv ) 21int main( int argc, char **argv )
20{ 22{
21 OApplication a( argc, argv, "Opie-Camera" ); 23 OApplication a( argc, argv, "Opie-Camera" );
22 CameraMainWindow* w = new CameraMainWindow(); 24 CameraMainWindow* w = new CameraMainWindow();
23 a.showMainWidget( w ); 25 a.showMainWidget( w );
24 a.exec(); 26 a.exec();
25 delete w; 27 delete w;
26 return 0; 28 return 0;
27} 29}
28 30
diff --git a/noncore/multimedia/camera/gui/mainwindow.cpp b/noncore/multimedia/camera/gui/mainwindow.cpp
index e4e1b6c..7f2a9bd 100644
--- a/noncore/multimedia/camera/gui/mainwindow.cpp
+++ b/noncore/multimedia/camera/gui/mainwindow.cpp
@@ -1,162 +1,165 @@
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>
31using namespace Opie;
32 31
33/* QT */ 32/* QT */
34#include <qapplication.h> 33#include <qapplication.h>
35#include <qaction.h> 34#include <qaction.h>
36#include <qvbox.h> 35#include <qvbox.h>
37#include <qcombobox.h> 36#include <qcombobox.h>
38#include <qcursor.h> 37#include <qcursor.h>
39#include <qdatastream.h> 38#include <qdatastream.h>
40#include <qdir.h> 39#include <qdir.h>
41#include <qfile.h> 40#include <qfile.h>
42#include <qimage.h> 41#include <qimage.h>
43#include <qlabel.h> 42#include <qlabel.h>
44#include <qlineedit.h> 43#include <qlineedit.h>
45#include <qpopupmenu.h> 44#include <qpopupmenu.h>
46#include <qprogressbar.h> 45#include <qprogressbar.h>
47#include <qpushbutton.h> 46#include <qpushbutton.h>
48#include <qmessagebox.h> 47#include <qmessagebox.h>
49#include <qlayout.h> 48#include <qlayout.h>
50#include <qdirectpainter_qws.h> 49#include <qdirectpainter_qws.h>
51 50
52/* STD */ 51/* STD */
53#include <assert.h> 52#include <assert.h>
54#include <sys/types.h> 53#include <sys/types.h>
55#include <sys/stat.h> 54#include <sys/stat.h>
56#include <fcntl.h> 55#include <fcntl.h>
57#include <string.h> 56#include <string.h>
58#include <errno.h> 57#include <errno.h>
59#include <unistd.h> 58#include <unistd.h>
60 59
61#define CAPTUREFILE "/tmp/capture.dat" 60#define CAPTUREFILE "/tmp/capture.dat"
62#define OUTPUTFILE "/tmp/output.avi" 61#define OUTPUTFILE "/tmp/output.avi"
63 62
64#define OUTPUT_TO_CUSTOM 250 63#define OUTPUT_TO_CUSTOM 250
65#define OUTPUT_TO_DOCFOLDER 251 64#define OUTPUT_TO_DOCFOLDER 251
66 65
66
67using namespace Opie::Ui;
68using namespace Opie::Core;
69
67CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) 70CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f )
68 :QMainWindow( parent, name, f ), 71 :QMainWindow( parent, name, f ),
69 _rotation( 270 ), // FIXME: get this from current settings (ODevice?) 72 _rotation( 270 ), // FIXME: get this from current settings (ODevice?)
70 _capturing( false ), 73 _capturing( false ),
71 _pics( 1 ), _videos( 1 ) 74 _pics( 1 ), _videos( 1 )
72{ 75{
73 #ifdef QT_NO_DEBUG 76 #ifdef QT_NO_DEBUG
74 if ( !ZCameraIO::instance()->isOpen() ) 77 if ( !ZCameraIO::instance()->isOpen() )
75 { 78 {
76 QVBox* v = new QVBox( this ); 79 QVBox* v = new QVBox( this );
77 v->setMargin( 10 ); 80 v->setMargin( 10 );
78 QLabel* l1 = new QLabel( v ); 81 QLabel* l1 = new QLabel( v );
79 l1->setPixmap( Resource::loadPixmap( "camera/error" ) ); 82 l1->setPixmap( Resource::loadPixmap( "camera/error" ) );
80 QLabel* l2 = new QLabel( v ); 83 QLabel* l2 = new QLabel( v );
81 l2->setText( "<b>Sorry. could not detect your camera :-(</b><p>" 84 l2->setText( "<b>Sorry. could not detect your camera :-(</b><p>"
82 "* Is the sharpzdc_cs module loaded ?<br>" 85 "* Is the sharpzdc_cs module loaded ?<br>"
83 "* Is /dev/sharpzdc read/writable ?<p>" ); 86 "* Is /dev/sharpzdc read/writable ?<p>" );
84 connect( new QPushButton( "Exit", v ), SIGNAL( clicked() ), this, SLOT( close() ) ); 87 connect( new QPushButton( "Exit", v ), SIGNAL( clicked() ), this, SLOT( close() ) );
85 setCentralWidget( v ); 88 setCentralWidget( v );
86 return; 89 return;
87 } 90 }
88 #endif 91 #endif
89 92
90 init(); 93 init();
91 94
92 _rotation = 270; //TODO: grab these from the actual settings 95 _rotation = 270; //TODO: grab these from the actual settings
93 96
94 preview = new PreviewWidget( this, "camera preview widget" ); 97 preview = new PreviewWidget( this, "camera preview widget" );
95 //setCentralWidget( preview ); <--- don't do this! 98 //setCentralWidget( preview ); <--- don't do this!
96 preview->resize( QSize( 240, 288 ) ); 99 preview->resize( QSize( 240, 288 ) );
97 preview->show(); 100 preview->show();
98 101
99 // construct a System Channel to receive setRotation messages 102 // construct a System Channel to receive setRotation messages
100 _sysChannel = new QCopChannel( "QPE/System", this ); 103 _sysChannel = new QCopChannel( "QPE/System", this );
101 connect( _sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), 104 connect( _sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
102 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); 105 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
103 106
104 connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) ); 107 connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) );
105 108
106 connect( ZCameraIO::instance(), SIGNAL( shutterClicked() ), this, SLOT( shutterClicked() ) ); 109 connect( ZCameraIO::instance(), SIGNAL( shutterClicked() ), this, SLOT( shutterClicked() ) );
107 110
108 updateCaption(); 111 updateCaption();
109 112
110}; 113};
111 114
112 115
113CameraMainWindow::~CameraMainWindow() 116CameraMainWindow::~CameraMainWindow()
114{ 117{
115 // write back configuration 118 // write back configuration
116 OConfigGroupSaver cgs( oApp->config(), "General" ); 119 OConfigGroupSaver cgs( oApp->config(), "General" );
117 cgs.config()->writeEntry( "flip", flip ); 120 cgs.config()->writeEntry( "flip", flip );
118 cgs.config()->writeEntry( "quality", quality ); 121 cgs.config()->writeEntry( "quality", quality );
119 cgs.config()->writeEntry( "zoom", zoom ); 122 cgs.config()->writeEntry( "zoom", zoom );
120 cgs.config()->writeEntry( "captureX", captureX ); 123 cgs.config()->writeEntry( "captureX", captureX );
121 cgs.config()->writeEntry( "captureY", captureY ); 124 cgs.config()->writeEntry( "captureY", captureY );
122 cgs.config()->writeEntry( "captureFormat", captureFormat ); 125 cgs.config()->writeEntry( "captureFormat", captureFormat );
123 cgs.config()->writeEntry( "outputTo", outputTo ); 126 cgs.config()->writeEntry( "outputTo", outputTo );
124 cgs.config()->writeEntry( "prefix", prefix ); 127 cgs.config()->writeEntry( "prefix", prefix );
125 cgs.config()->writeEntry( "appendSettings", appendSettings ); 128 cgs.config()->writeEntry( "appendSettings", appendSettings );
126} 129}
127 130
128 131
129void CameraMainWindow::init() 132void CameraMainWindow::init()
130{ 133{
131 // get values from configuration 134 // get values from configuration
132 OConfigGroupSaver cgs( oApp->config(), "General" ); 135 OConfigGroupSaver cgs( oApp->config(), "General" );
133 flip = cgs.config()->readEntry( "flip", "A" ); 136 flip = cgs.config()->readEntry( "flip", "A" );
134 quality = cgs.config()->readNumEntry( "quality", 50 ); 137 quality = cgs.config()->readNumEntry( "quality", 50 );
135 zoom = cgs.config()->readNumEntry( "zoom", 1 ); 138 zoom = cgs.config()->readNumEntry( "zoom", 1 );
136 captureX = cgs.config()->readNumEntry( "captureX", 480 ); 139 captureX = cgs.config()->readNumEntry( "captureX", 480 );
137 captureY = cgs.config()->readNumEntry( "captureY", 640 ); 140 captureY = cgs.config()->readNumEntry( "captureY", 640 );
138 captureFormat = cgs.config()->readEntry( "captureFormat", "JPEG" ); 141 captureFormat = cgs.config()->readEntry( "captureFormat", "JPEG" );
139 outputTo = cgs.config()->readEntry( "outputTo", "Documents Folder" ); 142 outputTo = cgs.config()->readEntry( "outputTo", "Documents Folder" );
140 prefix = cgs.config()->readEntry( "prefix", "Untitled" ); 143 prefix = cgs.config()->readEntry( "prefix", "Untitled" );
141 appendSettings = cgs.config()->readBoolEntry( "appendSettings", true ); 144 appendSettings = cgs.config()->readBoolEntry( "appendSettings", true );
142 145
143 // create action groups 146 // create action groups
144 QAction* a; 147 QAction* a;
145 resog = new QActionGroup( 0, "reso", true ); 148 resog = new QActionGroup( 0, "reso", true );
146 resog->setToggleAction( true ); 149 resog->setToggleAction( true );
147 new QAction( " 64 x 48", 0, 0, resog, "64x48", true ); 150 new QAction( " 64 x 48", 0, 0, resog, "64x48", true );
148 new QAction( "128 x 96", 0, 0, resog, "128x96", true ); 151 new QAction( "128 x 96", 0, 0, resog, "128x96", true );
149 new QAction( "192 x 144", 0, 0, resog, "192x144", true ); 152 new QAction( "192 x 144", 0, 0, resog, "192x144", true );
150 new QAction( "256 x 192", 0, 0, resog, "256x192", true ); 153 new QAction( "256 x 192", 0, 0, resog, "256x192", true );
151 new QAction( "320 x 240", 0, 0, resog, "320x240", true ); 154 new QAction( "320 x 240", 0, 0, resog, "320x240", true );
152 new QAction( "384 x 288", 0, 0, resog, "384x288", true ); 155 new QAction( "384 x 288", 0, 0, resog, "384x288", true );
153 new QAction( "448 x 336", 0, 0, resog, "448x336", true ); 156 new QAction( "448 x 336", 0, 0, resog, "448x336", true );
154 new QAction( "512 x 384", 0, 0, resog, "512x384", true ); 157 new QAction( "512 x 384", 0, 0, resog, "512x384", true );
155 new QAction( "576 x 432", 0, 0, resog, "576x432", true ); 158 new QAction( "576 x 432", 0, 0, resog, "576x432", true );
156 new QAction( "640 x 480", 0, 0, resog, "640x480", true ); 159 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 ) ); 160 a = (QAction*) resog->child( QString().sprintf( "%dx%d", captureX>captureY ? captureX:captureY, captureX>captureY ? captureY:captureX ) );
158 if ( a ) a->setOn( true ); 161 if ( a ) a->setOn( true );
159 else owarn << "can't set resolution" << oendl; 162 else owarn << "can't set resolution" << oendl;
160 163
161 qualityg = new QActionGroup( 0, "quality", true ); 164 qualityg = new QActionGroup( 0, "quality", true );
162 qualityg->setToggleAction( true ); 165 qualityg->setToggleAction( true );
diff --git a/noncore/multimedia/camera/lib/imageio.cpp b/noncore/multimedia/camera/lib/imageio.cpp
index ed0d39f..7d20848 100644
--- a/noncore/multimedia/camera/lib/imageio.cpp
+++ b/noncore/multimedia/camera/lib/imageio.cpp
@@ -1,55 +1,56 @@
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 "imageio.h" 16#include "imageio.h"
17 17
18#include <opie2/odebug.h> 18#include <opie2/odebug.h>
19#include <qimage.h> 19#include <qimage.h>
20 20
21using namespace Opie::Core;
21 22
22void bufferToImage( int _width, int _height, unsigned char* bp, QImage* image ) 23void bufferToImage( int _width, int _height, unsigned char* bp, QImage* image )
23{ 24{
24 unsigned char* p; 25 unsigned char* p;
25 26
26 image->create( _width, _height, 16 ); 27 image->create( _width, _height, 16 );
27 for ( int i = 0; i < _height; ++i ) 28 for ( int i = 0; i < _height; ++i )
28 { 29 {
29 p = image->scanLine( i ); 30 p = image->scanLine( i );
30 for ( int j = 0; j < _width; j++ ) 31 for ( int j = 0; j < _width; j++ )
31 { 32 {
32 *p = *bp; 33 *p = *bp;
33 p++; 34 p++;
34 bp++; 35 bp++;
35 *p = *bp; 36 *p = *bp;
36 p++; 37 p++;
37 bp++; 38 bp++;
38 } 39 }
39 } 40 }
40} 41}
41 42
42 43
43void imageToFile( QImage* i, const QString& name, const QString& format, int quality ) 44void imageToFile( QImage* i, const QString& name, const QString& format, int quality )
44{ 45{
45 QImage im = i->convertDepth( 32 ); 46 QImage im = i->convertDepth( 32 );
46 bool result = im.save( name, format, quality ); 47 bool result = im.save( name, format, quality );
47 if ( !result ) 48 if ( !result )
48 { 49 {
49 oerr << "imageio-Problem while writing to " << name << oendl; 50 oerr << "imageio-Problem while writing to " << name << oendl;
50 } 51 }
51 else 52 else
52 { 53 {
53 odebug << format << "-image has been successfully captured" << oendl; 54 odebug << format << "-image has been successfully captured" << oendl;
54 } 55 }
55} 56}
diff --git a/noncore/multimedia/camera/lib/zcameraio.cpp b/noncore/multimedia/camera/lib/zcameraio.cpp
index d59cbbb..c4be42f 100644
--- a/noncore/multimedia/camera/lib/zcameraio.cpp
+++ b/noncore/multimedia/camera/lib/zcameraio.cpp
@@ -1,128 +1,130 @@
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 "zcameraio.h" 16#include "zcameraio.h"
17 17
18#include <sys/types.h> 18#include <sys/types.h>
19#include <sys/stat.h> 19#include <sys/stat.h>
20#include <errno.h> 20#include <errno.h>
21#include <string.h> 21#include <string.h>
22#include <fcntl.h> 22#include <fcntl.h>
23#include <unistd.h> 23#include <unistd.h>
24#include <stdio.h> 24#include <stdio.h>
25 25
26#include <qimage.h> 26#include <qimage.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28 28
29#include <opie2/odebug.h> 29#include <opie2/odebug.h>
30 30
31#define SHARPZDC "/dev/sharp_zdc" 31#define SHARPZDC "/dev/sharp_zdc"
32 32
33using namespace Opie::Core;
34
33ZCameraIO* ZCameraIO::_instance = 0; 35ZCameraIO* ZCameraIO::_instance = 0;
34 36
35ZCameraIO* ZCameraIO::instance() 37ZCameraIO* ZCameraIO::instance()
36{ 38{
37 if ( !ZCameraIO::_instance ) 39 if ( !ZCameraIO::_instance )
38 { 40 {
39 odebug << "Creating ZCameraIO::_instance" << oendl; 41 odebug << "Creating ZCameraIO::_instance" << oendl;
40 ZCameraIO::_instance = new ZCameraIO(); 42 ZCameraIO::_instance = new ZCameraIO();
41 } 43 }
42 return ZCameraIO::_instance; 44 return ZCameraIO::_instance;
43} 45}
44 46
45 47
46ZCameraIO::ZCameraIO() 48ZCameraIO::ZCameraIO()
47 : _pressed( false ), _height( 0 ), _width( 0 ), _zoom( 0 ), 49 : _pressed( false ), _height( 0 ), _width( 0 ), _zoom( 0 ),
48 _flip( -1 ), _rot( 0 ), _readlen( 0 ) 50 _flip( -1 ), _rot( 0 ), _readlen( 0 )
49 51
50{ 52{
51 _driver = ::open( SHARPZDC, O_RDWR ); 53 _driver = ::open( SHARPZDC, O_RDWR );
52 if ( _driver == -1 ) 54 if ( _driver == -1 )
53 oerr << "Can't open camera driver: " << strerror(errno) << oendl; 55 oerr << "Can't open camera driver: " << strerror(errno) << oendl;
54 else 56 else
55 init(); 57 init();
56} 58}
57 59
58 60
59void ZCameraIO::init() 61void ZCameraIO::init()
60{ 62{
61 if ( ZCameraIO::_instance ) 63 if ( ZCameraIO::_instance )
62 ofatal << "Don't create more than one ZCameraIO instances." << oendl; 64 ofatal << "Don't create more than one ZCameraIO instances." << oendl;
63 else 65 else
64 { 66 {
65 _timer = new QTime(); 67 _timer = new QTime();
66 setReadMode( STATUS ); 68 setReadMode( STATUS );
67 } 69 }
68} 70}
69 71
70 72
71ZCameraIO::~ZCameraIO() 73ZCameraIO::~ZCameraIO()
72{ 74{
73 if ( _driver != -1 ) 75 if ( _driver != -1 )
74 { 76 {
75 setReadMode( 0 ); 77 setReadMode( 0 );
76 ::close( _driver ); 78 ::close( _driver );
77 } 79 }
78} 80}
79 81
80 82
81bool ZCameraIO::isOpen() const 83bool ZCameraIO::isOpen() const
82{ 84{
83 return _driver != -1; 85 return _driver != -1;
84} 86}
85 87
86 88
87bool ZCameraIO::isShutterPressed() 89bool ZCameraIO::isShutterPressed()
88{ 90{
89 if ( _status[0] == 'S' ) 91 if ( _status[0] == 'S' )
90 { 92 {
91 if ( !_pressed ) // wasn't pressed before, but is now! 93 if ( !_pressed ) // wasn't pressed before, but is now!
92 { 94 {
93 _pressed = true; 95 _pressed = true;
94 _timer->start(); 96 _timer->start();
95 return true; 97 return true;
96 } 98 }
97 99
98 if ( _timer->elapsed() > 2000 ) // the press is pretty old now 100 if ( _timer->elapsed() > 2000 ) // the press is pretty old now
99 { 101 {
100 clearShutterLatch(); 102 clearShutterLatch();
101 _status[0] = 's'; 103 _status[0] = 's';
102 _pressed = false; 104 _pressed = false;
103 } 105 }
104 } 106 }
105 107
106 return false; 108 return false;
107} 109}
108 110
109 111
110bool ZCameraIO::isFinderReversed() const 112bool ZCameraIO::isFinderReversed() const
111{ 113{
112 return _status[1] == 'M'; 114 return _status[1] == 'M';
113} 115}
114 116
115 117
116bool ZCameraIO::isCapturing() const 118bool ZCameraIO::isCapturing() const
117{ 119{
118 return _status[2] == 'C'; 120 return _status[2] == 'C';
119} 121}
120 122
121 123
122bool ZCameraIO::isAvailable() const 124bool ZCameraIO::isAvailable() const
123{ 125{
124 return _status[3] == 'A'; 126 return _status[3] == 'A';
125} 127}
126 128
127 129
128bool ZCameraIO::setCaptureFrame( int width, int height, int zoom, bool rot ) 130bool ZCameraIO::setCaptureFrame( int width, int height, int zoom, bool rot )
diff --git a/noncore/multimedia/opierec/helpwindow.cpp b/noncore/multimedia/opierec/helpwindow.cpp
index a3b29fa..6aebaa1 100644
--- a/noncore/multimedia/opierec/helpwindow.cpp
+++ b/noncore/multimedia/opierec/helpwindow.cpp
@@ -1,110 +1,110 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
5** 5**
6** This file is part of an example program for Qt. This example 6** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation. 7** program may be used, distributed and modified without limitation.
8** 8**
9*****************************************************************************/ 9*****************************************************************************/
10 10
11#include "helpwindow.h" 11#include "helpwindow.h"
12#include <qlayout.h> 12#include <qlayout.h>
13 13
14#include <qpe/qpetoolbar.h> 14#include <qtoolbar.h>
15#include <qpe/resource.h> 15#include <qpe/resource.h>
16 16
17#include <qaction.h> 17#include <qaction.h>
18#include <qmenubar.h> 18#include <qmenubar.h>
19 19
20#include <ctype.h> 20#include <ctype.h>
21 21
22HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) 22HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name )
23 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() 23 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
24{ 24{
25 QGridLayout *layout = new QGridLayout( this ); 25 QGridLayout *layout = new QGridLayout( this );
26 layout->setSpacing( 2); 26 layout->setSpacing( 2);
27 layout->setMargin( 2); 27 layout->setMargin( 2);
28 qDebug(_path); 28 qDebug(_path);
29 browser = new QTextBrowser( this ); 29 browser = new QTextBrowser( this );
30 QStringList Strlist; 30 QStringList Strlist;
31 Strlist.append( home_); 31 Strlist.append( home_);
32 browser->mimeSourceFactory()->setFilePath( Strlist ); 32 browser->mimeSourceFactory()->setFilePath( Strlist );
33 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 33 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
34 34
35 connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); 35 connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) );
36 36
37 if ( !home_.isEmpty() ) 37 if ( !home_.isEmpty() )
38 browser->setSource( home_ ); 38 browser->setSource( home_ );
39 QToolBar *toolbar = new QToolBar( this ); 39 QToolBar *toolbar = new QToolBar( this );
40 40
41 QAction *a = new QAction( tr( "Backward" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 41 QAction *a = new QAction( tr( "Backward" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
42 connect( a, SIGNAL( activated() ), browser, SLOT( backward() ) ); 42 connect( a, SIGNAL( activated() ), browser, SLOT( backward() ) );
43 a->addTo( toolbar ); 43 a->addTo( toolbar );
44 44
45 a = new QAction( tr( "Forward" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); 45 a = new QAction( tr( "Forward" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 );
46 connect( a, SIGNAL( activated() ), browser, SLOT( forward() ) ); 46 connect( a, SIGNAL( activated() ), browser, SLOT( forward() ) );
47 a->addTo( toolbar ); 47 a->addTo( toolbar );
48 48
49 49
50 layout->addMultiCellWidget( toolbar, 0, 0, 0, 0); 50 layout->addMultiCellWidget( toolbar, 0, 0, 0, 0);
51 51
52 layout->addMultiCellWidget( browser, 1, 2, 0, 2); 52 layout->addMultiCellWidget( browser, 1, 2, 0, 2);
53 53
54 browser->setFocus(); 54 browser->setFocus();
55} 55}
56 56
57 57
58void HelpWindow::setBackwardAvailable( bool b) 58void HelpWindow::setBackwardAvailable( bool b)
59{ 59{
60 menuBar()->setItemEnabled( backwardId, b); 60 menuBar()->setItemEnabled( backwardId, b);
61} 61}
62 62
63void HelpWindow::setForwardAvailable( bool b) 63void HelpWindow::setForwardAvailable( bool b)
64{ 64{
65 menuBar()->setItemEnabled( forwardId, b); 65 menuBar()->setItemEnabled( forwardId, b);
66} 66}
67 67
68 68
69void HelpWindow::textChanged() 69void HelpWindow::textChanged()
70{ 70{
71 if ( browser->documentTitle().isNull() ) { 71 if ( browser->documentTitle().isNull() ) {
72 setCaption( "QpeRec - Helpviewer - " + browser->context() ); 72 setCaption( "QpeRec - Helpviewer - " + browser->context() );
73 selectedURL = browser->context(); 73 selectedURL = browser->context();
74 } 74 }
75 else { 75 else {
76 setCaption( "QpeRec - Helpviewer - " + browser->documentTitle() ) ; 76 setCaption( "QpeRec - Helpviewer - " + browser->documentTitle() ) ;
77 selectedURL = browser->documentTitle(); 77 selectedURL = browser->documentTitle();
78 } 78 }
79 79
80// if ( !selectedURL.isEmpty() && pathCombo ) { 80// if ( !selectedURL.isEmpty() && pathCombo ) {
81// bool exists = FALSE; 81// bool exists = FALSE;
82// int i; 82// int i;
83// for ( i = 0; i < pathCombo->count(); ++i ) { 83// for ( i = 0; i < pathCombo->count(); ++i ) {
84// if ( pathCombo->text( i ) == selectedURL ) { 84// if ( pathCombo->text( i ) == selectedURL ) {
85// exists = TRUE; 85// exists = TRUE;
86// break; 86// break;
87// } 87// }
88// } 88// }
89// if ( !exists ) { 89// if ( !exists ) {
90// pathCombo->insertItem( selectedURL, 0 ); 90// pathCombo->insertItem( selectedURL, 0 );
91// pathCombo->setCurrentItem( 0 ); 91// pathCombo->setCurrentItem( 0 );
92// mHistory[ hist->insertItem( selectedURL ) ] = selectedURL; 92// mHistory[ hist->insertItem( selectedURL ) ] = selectedURL;
93// } else 93// } else
94// pathCombo->setCurrentItem( i ); 94// pathCombo->setCurrentItem( i );
95// selectedURL = QString::null; 95// selectedURL = QString::null;
96// } 96// }
97} 97}
98 98
99HelpWindow::~HelpWindow() 99HelpWindow::~HelpWindow()
100{ 100{
101 history.clear(); 101 history.clear();
102 QMap<int, QString>::Iterator it = mHistory.begin(); 102 QMap<int, QString>::Iterator it = mHistory.begin();
103 for ( ; it != mHistory.end(); ++it ) 103 for ( ; it != mHistory.end(); ++it )
104 history.append( *it ); 104 history.append( *it );
105 105
106 QFile f( QDir::currentDirPath() + "/.history" ); 106 QFile f( QDir::currentDirPath() + "/.history" );
107 f.open( IO_WriteOnly ); 107 f.open( IO_WriteOnly );
108 QDataStream s( &f ); 108 QDataStream s( &f );
109 s << history; 109 s << history;
110 f.close(); 110 f.close();
diff --git a/noncore/multimedia/opierec/main.cpp b/noncore/multimedia/opierec/main.cpp
index bb51446..a435d8e 100644
--- a/noncore/multimedia/opierec/main.cpp
+++ b/noncore/multimedia/opierec/main.cpp
@@ -1,31 +1,33 @@
1/*************************************************************************** 1/***************************************************************************
2
2 main.cpp - main routine 3 main.cpp - main routine
3 ***************************************************************************/ 4 ***************************************************************************/
4//// main.cpp 5//// main.cpp
5//// copyright 2001, 2002, by L. J. Potter <ljp@llornkcor.com> 6//// copyright 2001, 2002, by L. J. Potter <ljp@llornkcor.com>
6/*************************************************************************** 7/***************************************************************************
7 * This program is free software; you can redistribute it and/or modify * 8 * 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 * 9 * 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 * 10 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 11 * (at your option) any later version. *
11 ***************************************************************************/ 12 ***************************************************************************/
12#include "qtrec.h" 13#include "qtrec.h"
13 14
14#ifdef PDAUDIO 15#ifdef PDAUDIO
15int main(int argc, char* argv[]) { 16int main(int argc, char* argv[]) {
16 QPEApplication a(argc, argv); 17 QPEApplication a(argc, argv);
17 QtRec qtrec; 18 QtRec qtrec;
18 a.showMainWidget( &qtrec); 19 a.showMainWidget( &qtrec);
19 return a.exec(); 20 return a.exec();
20} 21}
21 22
22 23
23#else 24#else
24 25
25#include <opie2/oapplicationfactory.h> 26#include <opie2/oapplicationfactory.h>
26 27
28using namespace Opie::Core;
27OPIE_EXPORT_APP( OApplicationFactory<QtRec> ) 29OPIE_EXPORT_APP( OApplicationFactory<QtRec> )
28 30
29#endif 31#endif
30 32
31 33