summaryrefslogtreecommitdiff
path: root/noncore/multimedia/camera/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/camera/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/camera/mainwindow.cpp41
1 files changed, 35 insertions, 6 deletions
diff --git a/noncore/multimedia/camera/mainwindow.cpp b/noncore/multimedia/camera/mainwindow.cpp
index 8578bce..7080e63 100644
--- a/noncore/multimedia/camera/mainwindow.cpp
+++ b/noncore/multimedia/camera/mainwindow.cpp
@@ -11,42 +11,71 @@
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 "mainwindowbase.h" 17#include "previewwidget.h"
18#include "zcameraio.h" 18#include "zcameraio.h"
19 19
20#include <qvbox.h> 20#include <qvbox.h>
21#include <qcombobox.h> 21#include <qcombobox.h>
22#include <qdatastream.h>
22#include <qpushbutton.h> 23#include <qpushbutton.h>
23#include <qlabel.h> 24#include <qlabel.h>
24#include <qdirectpainter_qws.h> 25#include <qdirectpainter_qws.h>
25#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qcopenvelope_qws.h>
26#include <opie/ofiledialog.h> 28#include <opie/ofiledialog.h>
27 29
30#include <opie2/odebug.h>
31
28#include <assert.h> 32#include <assert.h>
29 33
30CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) 34CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f )
31 :QMainWindow( parent, name, f ) 35 :QMainWindow( parent, name, f )
32{ 36{
33 mw = new MainWindowBase( this, "main widget" ); 37 _rotation = 270; //TODO: grab these from the actual settings
34 ZCameraIO::instance()->setCaptureFrame( 240, 160, 256 ); 38
35 setCentralWidget( mw ); 39 preview = new PreviewWidget( this, "camera preview widget" );
36 mw->show(); 40 //setCentralWidget( preview ); <--- don't do this!
41 preview->resize( QSize( 240, 288 ) );
42 preview->show();
43
44 // construct a System Channel to receive setRotation messages
45 _sysChannel = new QCopChannel( "QPE/System", this );
46 connect( _sysChannel, SIGNAL( received( const QCString&, const QByteArray& ) ),
47 this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) );
37 48
38 connect( mw->zoom, SIGNAL( activated( int ) ), this, SLOT( changeZoom(int) ) );
39}; 49};
40 50
41 51
42CameraMainWindow::~CameraMainWindow() 52CameraMainWindow::~CameraMainWindow()
43{ 53{
44} 54}
45 55
46 56
57void CameraMainWindow::systemMessage( const QCString& msg, const QByteArray& data )
58{
59 QDataStream stream( data, IO_ReadOnly );
60 odebug << "received system message: " << msg << oendl;
61 if ( msg == "setCurrentRotation(int)" )
62 {
63 stream >> _rotation;
64 odebug << "received setCurrentRotation(" << _rotation << ")" << oendl;
65
66 switch ( _rotation )
67 {
68 case 270: preview->resize( QSize( 240, 288 ) ); break;
69 case 180: preview->resize( QSize( 320, 208 ) ); break;
70 default: assert( 0 ); // not yet handled
71 }
72 }
73}
74
75
47void CameraMainWindow::changeZoom( int zoom ) 76void CameraMainWindow::changeZoom( int zoom )
48{ 77{
49 int z; 78 int z;
50 switch ( zoom ) 79 switch ( zoom )
51 { 80 {
52 case 0: z = 128; break; 81 case 0: z = 128; break;