From a46668f70b74f27689afb956ff085d42c0775328 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Tue, 01 Apr 2003 22:18:03 +0000 Subject: - backgammon: g++3 fix - add skeleton for opie-camera application --- (limited to 'noncore/multimedia') diff --git a/noncore/multimedia/camera/.cvsignore b/noncore/multimedia/camera/.cvsignore new file mode 100644 index 0000000..6d678c6 --- a/dev/null +++ b/noncore/multimedia/camera/.cvsignore @@ -0,0 +1 @@ +config.in diff --git a/noncore/multimedia/camera/camera.pro b/noncore/multimedia/camera/camera.pro new file mode 100644 index 0000000..e937807 --- a/dev/null +++ b/noncore/multimedia/camera/camera.pro @@ -0,0 +1,21 @@ +MOC_DIR = ./moc +OBJECTS_DIR = ./obj +DESTDIR = $(OPIEDIR)/bin +TEMPLATE = app +CONFIG = qt warn_on debug + +HEADERS = zcameraio.h \ + mainwindow.h + +SOURCES = zcameraio.cpp \ + mainwindow.cpp \ + main.cpp + +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -lopiecore2 +INTERFACES = +TARGET = opiecam + +include ( $(OPIEDIR)/include.pro ) + diff --git a/noncore/multimedia/camera/config.in b/noncore/multimedia/camera/config.in new file mode 100644 index 0000000..a4dd248 --- a/dev/null +++ b/noncore/multimedia/camera/config.in @@ -0,0 +1,7 @@ + config CAMERA + boolean "opie-camera" + default "n" + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBOPIE2CORE + comment "opie-camera needs a libqpe, libopie and libopie2core" + depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBOPIE2CORE) + diff --git a/noncore/multimedia/camera/main.cpp b/noncore/multimedia/camera/main.cpp new file mode 100644 index 0000000..f25475c --- a/dev/null +++ b/noncore/multimedia/camera/main.cpp @@ -0,0 +1,28 @@ +/********************************************************************** +** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#include "mainwindow.h" +#include + +int main( int argc, char **argv ) +{ + OApplication a( argc, argv, "Opie-Camera" ); + CameraMainWindow* w = new CameraMainWindow(); + a.showMainWidget( w ); + a.exec(); + delete w; + return 0; +} + diff --git a/noncore/multimedia/camera/mainwindow.cpp b/noncore/multimedia/camera/mainwindow.cpp new file mode 100644 index 0000000..6431dfa --- a/dev/null +++ b/noncore/multimedia/camera/mainwindow.cpp @@ -0,0 +1,50 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#include "mainwindow.h" + +#include +#include +#include + +#include +#include + +CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) + :QMainWindow( parent, name, f ) +{ + QVBox* v = new QVBox( this ); + QLabel* l = new QLabel( v ); + l->setFixedSize( QSize( 240, 160 ) ); + QPushButton* p = new QPushButton( "Snapshot", v ); + connect( p, SIGNAL( clicked() ), this, SLOT( clickedSnapShot() ) ); + v->show(); + l->show(); + p->show(); + setCentralWidget( v ); + +}; + + +CameraMainWindow::~CameraMainWindow() +{ +} + + +void CameraMainWindow::clickedSnapShot() +{ + qDebug( "Hello!" ); +} + diff --git a/noncore/multimedia/camera/mainwindow.h b/noncore/multimedia/camera/mainwindow.h new file mode 100644 index 0000000..a349652 --- a/dev/null +++ b/noncore/multimedia/camera/mainwindow.h @@ -0,0 +1,40 @@ +/********************************************************************** +** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +class Wellenreiter; +class WellenreiterConfigWindow; +class QIconSet; +class QToolButton; + +class CameraMainWindow: public QMainWindow +{ + Q_OBJECT + + public: + CameraMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); + virtual ~CameraMainWindow(); + + protected: + + public slots: + void clickedSnapShot(); +}; + +#endif diff --git a/noncore/multimedia/camera/zcameraio.cpp b/noncore/multimedia/camera/zcameraio.cpp new file mode 100644 index 0000000..aa6cbe3 --- a/dev/null +++ b/noncore/multimedia/camera/zcameraio.cpp @@ -0,0 +1,56 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#include "zcameraio.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include + +ZCameraIO::ZCameraIO() +{ + _driver = open( "/dev/sharp_zdc", O_RDWR ); + if ( _driver == -1 ) + oerr << "Can't open camera driver: " << strerror(errno) << oendl; + +}; + + +ZCameraIO::~ZCameraIO() +{ + if ( _driver != -1 ) + close( _driver ); +} + + +bool ZCameraIO::snapshot( QImage* img ) +{ + char buf[76800]; + + write( _driver, "M=13", 4 ); + write( _driver, "R=240,160,256,480", 17 ); + write( _driver, "M=12", 4 ); + + int result = read( _driver, &buf, sizeof buf ); + + return result == sizeof buf; +} diff --git a/noncore/multimedia/camera/zcameraio.h b/noncore/multimedia/camera/zcameraio.h new file mode 100644 index 0000000..817d3b4 --- a/dev/null +++ b/noncore/multimedia/camera/zcameraio.h @@ -0,0 +1,35 @@ +/********************************************************************** +** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#ifndef ZCAMERAIO_H +#define ZCAMERAIO_H + +class QImage; + +class ZCameraIO +{ + public: + ZCameraIO(); + virtual ~ZCameraIO(); + + bool isOpen() const { return _driver != -1; }; + + bool snapshot( QImage* ); + + private: + int _driver; +}; + +#endif -- cgit v0.9.0.2