From 2cc909c36a779d1041a3382939f8ad41d84b0fc5 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sat, 12 Apr 2003 15:02:32 +0000 Subject: - 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 --- (limited to 'noncore/multimedia/camera/mainwindow.cpp') 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 @@ **********************************************************************/ #include "mainwindow.h" -#include "mainwindowbase.h" +#include "previewwidget.h" #include "zcameraio.h" #include #include +#include #include #include #include #include +#include #include +#include + #include CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) :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) ) ); }; @@ -44,6 +54,25 @@ 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 ) { int z; -- cgit v0.9.0.2