summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-13 00:11:53 (UTC)
committer mickeyl <mickeyl>2003-04-13 00:11:53 (UTC)
commit33088e3bc0af16b6d000433cb3f73161e86a5bf5 (patch) (side-by-side diff)
tree4113ab8c293486d7f0438d4fd4ae1037aaeaa519
parent6d62efcd8964194cae47dc3dfe71b7cc41cbf3e2 (diff)
downloadopie-33088e3bc0af16b6d000433cb3f73161e86a5bf5.zip
opie-33088e3bc0af16b6d000433cb3f73161e86a5bf5.tar.gz
opie-33088e3bc0af16b6d000433cb3f73161e86a5bf5.tar.bz2
add error message of camera is not found
remove inlines (for now) because of link-problems
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/camera/mainwindow.cpp36
-rw-r--r--noncore/multimedia/camera/mainwindow.h2
-rw-r--r--noncore/multimedia/camera/zcameraio.cpp10
-rw-r--r--noncore/multimedia/camera/zcameraio.h2
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
@@ -20,7 +20,10 @@
#include <qvbox.h>
#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>
#include <qpe/resource.h>
@@ -35,4 +38,19 @@ CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags
: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( "<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
@@ -47,4 +65,5 @@ CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags
this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) );
+ connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) );
};
@@ -68,5 +87,7 @@ 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°" );
}
}
@@ -88,2 +109,13 @@ 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
@@ -41,4 +41,6 @@ class CameraMainWindow: public QMainWindow
void systemMessage( const QCString&, const QByteArray& );
+ 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
@@ -76,5 +76,5 @@ ZCameraIO::~ZCameraIO()
-inline bool ZCameraIO::isOpen() const
+bool ZCameraIO::isOpen() const
{
return _driver != -1;
@@ -82,5 +82,5 @@ inline bool ZCameraIO::isOpen() const
-inline bool ZCameraIO::isShutterPressed()
+bool ZCameraIO::isShutterPressed()
{
return _status[0] == 'S';
@@ -89,5 +89,5 @@ inline bool ZCameraIO::isShutterPressed()
-inline bool ZCameraIO::isFinderReversed() const
+bool ZCameraIO::isFinderReversed() const
{
return _status[1] == 'M';
@@ -95,5 +95,5 @@ inline bool ZCameraIO::isFinderReversed() const
-inline bool ZCameraIO::isCapturing() const
+bool ZCameraIO::isCapturing() const
{
return _status[2] == 'C';
@@ -101,5 +101,5 @@ inline bool ZCameraIO::isCapturing() const
-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
@@ -39,6 +39,6 @@ class ZCameraIO
bool isCapturing() const;
bool isFinderReversed() const;
-
bool isOpen() const;
+
bool snapshot( QImage* );
bool snapshot( unsigned char* );