-rw-r--r-- | noncore/multimedia/camera/mainwindow.cpp | 36 | ||||
-rw-r--r-- | noncore/multimedia/camera/mainwindow.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/camera/zcameraio.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/camera/zcameraio.h | 2 |
4 files changed, 42 insertions, 8 deletions
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 @@ -21,5 +21,8 @@ #include <qcombobox.h> +#include <qcursor.h> #include <qdatastream.h> -#include <qpushbutton.h> #include <qlabel.h> +#include <qpopupmenu.h> +#include <qpushbutton.h> +#include <qmessagebox.h> #include <qdirectpainter_qws.h> @@ -36,2 +39,17 @@ CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags { + 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( "<b>Sorry. could not detect your camera :-(</b><p>" + "* Is the sharpzdc_cs module loaded ?<br>" + "* Is /dev/sharpzdc read/writable ?<p>" ); + connect( new QPushButton( "Exit", v ), SIGNAL( clicked() ), this, SLOT( close() ) ); + setCentralWidget( v ); + return; + } + _rotation = 270; //TODO: grab these from the actual settings @@ -48,2 +66,3 @@ CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags + connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) ); }; @@ -69,3 +88,5 @@ void CameraMainWindow::systemMessage( const QCString& msg, const QByteArray& dat 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°" ); } @@ -89 +110,12 @@ void CameraMainWindow::changeZoom( int zoom ) + +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 @@ -42,2 +42,4 @@ class CameraMainWindow: public QMainWindow + void showContextMenu(); + protected: 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 @@ -77,3 +77,3 @@ ZCameraIO::~ZCameraIO() -inline bool ZCameraIO::isOpen() const +bool ZCameraIO::isOpen() const { @@ -83,3 +83,3 @@ inline bool ZCameraIO::isOpen() const -inline bool ZCameraIO::isShutterPressed() +bool ZCameraIO::isShutterPressed() { @@ -90,3 +90,3 @@ inline bool ZCameraIO::isShutterPressed() -inline bool ZCameraIO::isFinderReversed() const +bool ZCameraIO::isFinderReversed() const { @@ -96,3 +96,3 @@ inline bool ZCameraIO::isFinderReversed() const -inline bool ZCameraIO::isCapturing() const +bool ZCameraIO::isCapturing() const { @@ -102,3 +102,3 @@ inline bool ZCameraIO::isCapturing() const -inline bool ZCameraIO::isAvailable() const +bool ZCameraIO::isAvailable() const { 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 @@ -40,4 +40,4 @@ class ZCameraIO bool isFinderReversed() const; - bool isOpen() const; + bool snapshot( QImage* ); |