author | mickeyl <mickeyl> | 2003-04-13 00:11:53 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-13 00:11:53 (UTC) |
commit | 33088e3bc0af16b6d000433cb3f73161e86a5bf5 (patch) (unidiff) | |
tree | 4113ab8c293486d7f0438d4fd4ae1037aaeaa519 /noncore/multimedia/camera/mainwindow.cpp | |
parent | 6d62efcd8964194cae47dc3dfe71b7cc41cbf3e2 (diff) | |
download | opie-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 (limited to 'noncore/multimedia/camera/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/mainwindow.cpp | 36 |
1 files changed, 34 insertions, 2 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 | |||
@@ -19,9 +19,12 @@ | |||
19 | 19 | ||
20 | #include <qvbox.h> | 20 | #include <qvbox.h> |
21 | #include <qcombobox.h> | 21 | #include <qcombobox.h> |
22 | #include <qcursor.h> | ||
22 | #include <qdatastream.h> | 23 | #include <qdatastream.h> |
23 | #include <qpushbutton.h> | ||
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qpopupmenu.h> | ||
26 | #include <qpushbutton.h> | ||
27 | #include <qmessagebox.h> | ||
25 | #include <qdirectpainter_qws.h> | 28 | #include <qdirectpainter_qws.h> |
26 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 30 | #include <qpe/qcopenvelope_qws.h> |
@@ -34,6 +37,21 @@ | |||
34 | CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) | 37 | CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) |
35 | :QMainWindow( parent, name, f ) | 38 | :QMainWindow( parent, name, f ) |
36 | { | 39 | { |
40 | if ( !ZCameraIO::instance()->isOpen() ) | ||
41 | { | ||
42 | QVBox* v = new QVBox( this ); | ||
43 | v->setMargin( 10 ); | ||
44 | QLabel* l1 = new QLabel( v ); | ||
45 | l1->setPixmap( Resource::loadPixmap( "camera/error" ) ); | ||
46 | QLabel* l2 = new QLabel( v ); | ||
47 | l2->setText( "<b>Sorry. could not detect your camera :-(</b><p>" | ||
48 | "* Is the sharpzdc_cs module loaded ?<br>" | ||
49 | "* Is /dev/sharpzdc read/writable ?<p>" ); | ||
50 | connect( new QPushButton( "Exit", v ), SIGNAL( clicked() ), this, SLOT( close() ) ); | ||
51 | setCentralWidget( v ); | ||
52 | return; | ||
53 | } | ||
54 | |||
37 | _rotation = 270; //TODO: grab these from the actual settings | 55 | _rotation = 270; //TODO: grab these from the actual settings |
38 | 56 | ||
39 | preview = new PreviewWidget( this, "camera preview widget" ); | 57 | preview = new PreviewWidget( this, "camera preview widget" ); |
@@ -46,6 +64,7 @@ CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags | |||
46 | connect( _sysChannel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 64 | connect( _sysChannel, SIGNAL( received( const QCString&, const QByteArray& ) ), |
47 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); | 65 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); |
48 | 66 | ||
67 | connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) ); | ||
49 | }; | 68 | }; |
50 | 69 | ||
51 | 70 | ||
@@ -67,7 +86,9 @@ void CameraMainWindow::systemMessage( const QCString& msg, const QByteArray& dat | |||
67 | { | 86 | { |
68 | case 270: preview->resize( QSize( 240, 288 ) ); break; | 87 | case 270: preview->resize( QSize( 240, 288 ) ); break; |
69 | case 180: preview->resize( QSize( 320, 208 ) ); break; | 88 | case 180: preview->resize( QSize( 320, 208 ) ); break; |
70 | default: assert( 0 ); // not yet handled | 89 | default: QMessageBox::warning( this, "opie-camera", |
90 | "This rotation is not supported.\n" | ||
91 | "Supported are 180° and 270°" ); | ||
71 | } | 92 | } |
72 | } | 93 | } |
73 | } | 94 | } |
@@ -87,3 +108,14 @@ void CameraMainWindow::changeZoom( int zoom ) | |||
87 | ZCameraIO::instance()->setCaptureFrame( 240, 160, z ); | 108 | ZCameraIO::instance()->setCaptureFrame( 240, 160, z ); |
88 | } | 109 | } |
89 | 110 | ||
111 | |||
112 | void CameraMainWindow::showContextMenu() | ||
113 | { | ||
114 | QPopupMenu m( this ); | ||
115 | m.insertItem( "Item 1" ); | ||
116 | m.insertItem( "Item 1" ); | ||
117 | m.insertItem( "Item 1" ); | ||
118 | m.insertItem( "Item 1" ); | ||
119 | m.exec( QCursor::pos() ); | ||
120 | } | ||
121 | |||