summaryrefslogtreecommitdiff
path: root/noncore/multimedia/camera/mainwindow.cpp
authormickeyl <mickeyl>2003-04-12 15:02:32 (UTC)
committer mickeyl <mickeyl>2003-04-12 15:02:32 (UTC)
commit2cc909c36a779d1041a3382939f8ad41d84b0fc5 (patch) (unidiff)
tree42c95673d72f7ecb7a8f4acbb0f517dd75ecc167 /noncore/multimedia/camera/mainwindow.cpp
parent11861d35730cee70920aa6797ba12263bbcce081 (diff)
downloadopie-2cc909c36a779d1041a3382939f8ad41d84b0fc5.zip
opie-2cc909c36a779d1041a3382939f8ad41d84b0fc5.tar.gz
opie-2cc909c36a779d1041a3382939f8ad41d84b0fc5.tar.bz2
- make main layout a full preview window and think about configuring capturing parameters later...adding an on-demand-applet to the taskbar would be spiffy
- portrait or landscape mode is now self-configuring thanks to life-rotation :-D
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
@@ -14,28 +14,38 @@
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
@@ -44,6 +54,25 @@ CameraMainWindow::~CameraMainWindow()
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;