Diffstat (limited to 'noncore/multimedia/camera/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/mainwindow.cpp | 41 |
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 @@ -15,15 +15,19 @@ #include "mainwindow.h" -#include "mainwindowbase.h" +#include "previewwidget.h" #include "zcameraio.h" #include <qvbox.h> #include <qcombobox.h> +#include <qdatastream.h> #include <qpushbutton.h> #include <qlabel.h> #include <qdirectpainter_qws.h> #include <qpe/resource.h> +#include <qpe/qcopenvelope_qws.h> #include <opie/ofiledialog.h> +#include <opie2/odebug.h> + #include <assert.h> @@ -31,10 +35,16 @@ CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags :QMainWindow( parent, name, f ) { - mw = new MainWindowBase( this, "main widget" ); - ZCameraIO::instance()->setCaptureFrame( 240, 160, 256 ); - setCentralWidget( mw ); - mw->show(); + _rotation = 270; //TODO: grab these from the actual settings + + preview = new PreviewWidget( this, "camera preview widget" ); + //setCentralWidget( preview ); <--- don't do this! + preview->resize( QSize( 240, 288 ) ); + preview->show(); + + // construct a System Channel to receive setRotation messages + _sysChannel = new QCopChannel( "QPE/System", this ); + connect( _sysChannel, SIGNAL( received( const QCString&, const QByteArray& ) ), + this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); - connect( mw->zoom, SIGNAL( activated( int ) ), this, SLOT( changeZoom(int) ) ); }; @@ -45,4 +55,23 @@ CameraMainWindow::~CameraMainWindow() +void CameraMainWindow::systemMessage( const QCString& msg, const QByteArray& data ) +{ + QDataStream stream( data, IO_ReadOnly ); + odebug << "received system message: " << msg << oendl; + if ( msg == "setCurrentRotation(int)" ) + { + stream >> _rotation; + odebug << "received setCurrentRotation(" << _rotation << ")" << oendl; + + switch ( _rotation ) + { + case 270: preview->resize( QSize( 240, 288 ) ); break; + case 180: preview->resize( QSize( 320, 208 ) ); break; + default: assert( 0 ); // not yet handled + } + } +} + + void CameraMainWindow::changeZoom( int zoom ) { |