From 33088e3bc0af16b6d000433cb3f73161e86a5bf5 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sun, 13 Apr 2003 00:11:53 +0000 Subject: add error message of camera is not found remove inlines (for now) because of link-problems --- (limited to 'noncore/multimedia') diff --git a/noncore/multimedia/camera/mainwindow.cpp b/noncore/multimedia/camera/mainwindow.cpp index 7080e63..34ebe9e 100644 --- a/noncore/multimedia/camera/mainwindow.cpp +++ b/noncore/multimedia/camera/mainwindow.cpp @@ -19,9 +19,12 @@ #include #include +#include #include -#include #include +#include +#include +#include #include #include #include @@ -34,6 +37,21 @@ CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) :QMainWindow( parent, name, f ) { + if ( !ZCameraIO::instance()->isOpen() ) + { + QVBox* v = new QVBox( this ); + v->setMargin( 10 ); + QLabel* l1 = new QLabel( v ); + l1->setPixmap( Resource::loadPixmap( "camera/error" ) ); + QLabel* l2 = new QLabel( v ); + l2->setText( "Sorry. could not detect your camera :-(

" + "* Is the sharpzdc_cs module loaded ?
" + "* Is /dev/sharpzdc read/writable ?

" ); + connect( new QPushButton( "Exit", v ), SIGNAL( clicked() ), this, SLOT( close() ) ); + setCentralWidget( v ); + return; + } + _rotation = 270; //TODO: grab these from the actual settings preview = new PreviewWidget( this, "camera preview widget" ); @@ -46,6 +64,7 @@ CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags connect( _sysChannel, SIGNAL( received( const QCString&, const QByteArray& ) ), this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); + connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) ); }; @@ -67,7 +86,9 @@ void CameraMainWindow::systemMessage( const QCString& msg, const QByteArray& dat { case 270: preview->resize( QSize( 240, 288 ) ); break; case 180: preview->resize( QSize( 320, 208 ) ); break; - default: assert( 0 ); // not yet handled + default: QMessageBox::warning( this, "opie-camera", + "This rotation is not supported.\n" + "Supported are 180° and 270°" ); } } } @@ -87,3 +108,14 @@ void CameraMainWindow::changeZoom( int zoom ) ZCameraIO::instance()->setCaptureFrame( 240, 160, z ); } + +void CameraMainWindow::showContextMenu() +{ + QPopupMenu m( this ); + m.insertItem( "Item 1" ); + m.insertItem( "Item 1" ); + m.insertItem( "Item 1" ); + m.insertItem( "Item 1" ); + m.exec( QCursor::pos() ); +} + diff --git a/noncore/multimedia/camera/mainwindow.h b/noncore/multimedia/camera/mainwindow.h index cc12840..df66204 100644 --- a/noncore/multimedia/camera/mainwindow.h +++ b/noncore/multimedia/camera/mainwindow.h @@ -40,6 +40,8 @@ class CameraMainWindow: public QMainWindow void changeZoom( int ); void systemMessage( const QCString&, const QByteArray& ); + void showContextMenu(); + protected: private: diff --git a/noncore/multimedia/camera/zcameraio.cpp b/noncore/multimedia/camera/zcameraio.cpp index 51771a5..b37ae8c 100644 --- a/noncore/multimedia/camera/zcameraio.cpp +++ b/noncore/multimedia/camera/zcameraio.cpp @@ -75,32 +75,32 @@ ZCameraIO::~ZCameraIO() } -inline bool ZCameraIO::isOpen() const +bool ZCameraIO::isOpen() const { return _driver != -1; } -inline bool ZCameraIO::isShutterPressed() +bool ZCameraIO::isShutterPressed() { return _status[0] == 'S'; clearShutterLatch(); } -inline bool ZCameraIO::isFinderReversed() const +bool ZCameraIO::isFinderReversed() const { return _status[1] == 'M'; } -inline bool ZCameraIO::isCapturing() const +bool ZCameraIO::isCapturing() const { return _status[2] == 'C'; } -inline bool ZCameraIO::isAvailable() const +bool ZCameraIO::isAvailable() const { return _status[3] == 'A'; } diff --git a/noncore/multimedia/camera/zcameraio.h b/noncore/multimedia/camera/zcameraio.h index bc4926b..9d4b1d7 100644 --- a/noncore/multimedia/camera/zcameraio.h +++ b/noncore/multimedia/camera/zcameraio.h @@ -38,8 +38,8 @@ class ZCameraIO bool isAvailable() const; bool isCapturing() const; bool isFinderReversed() const; - bool isOpen() const; + bool snapshot( QImage* ); bool snapshot( unsigned char* ); static ZCameraIO* instance(); -- cgit v0.9.0.2