diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b51549..3b5bc97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,6 @@ set(libtest_DIR libtest) get_filename_component(libtest_ABSOLUTE ${libtest_DIR} ABSOLUTE) add_subdirectory(${libtest_ABSOLUTE}) -#set(qt_DIR qt) -#get_filename_component(qt_ABSOLUTE ${qt_DIR} ABSOLUTE) -#add_subdirectory(${qt_ABSOLUTE}) +set(qt_DIR qt) +get_filename_component(qt_ABSOLUTE ${qt_DIR} ABSOLUTE) +add_subdirectory(${qt_ABSOLUTE}) diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index 7b23af3..277bc81 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -11,37 +11,35 @@ include_directories( ${SDL_INCLUDE_DIR} ${SDLIMAGE_INCLUDE_DIR} ) # the next line sets up include and link directories and defines some variables that we will use. # you can modify the behavior by setting some variables, e.g. -set(QT_USE_QTOPENGL TRUE) +#set(QT_USE_QTOPENGL TRUE) # -> this will cause cmake to include and link against the OpenGL module include(${QT_USE_FILE}) # the variable "qtproject_SRCS" contains all .cpp files of this project set(aigoqt_SRCS - + aigoqt.cpp + main.cpp ) #ui set(aigoqt_UIS - + main.ui ) qt4_wrap_ui(aigoqt_UIS_H ${aigoqt_UIS}) set(CMAKE_INCLUDE_CURRENT_DIR ON) - #moc qt4_automoc(${aigoqt_SRCS}) #resources -qt4_add_resources(aigoqt_RESOURCES resources) +#qt4_add_resources(aigoqt_RESOURCES resources) -link_directories(${effector_ABSOLUTE}) include_directories( ${QT_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} - #${dgl_ABSOLUTE} - ${current_demo_dir} + ../lib/ ) -add_executable(aigoqt ${aigoqt_SRCS} ${aigoqt_UIS_H} ${aigoqt_RESOURCES}) +add_executable(aigoqt ${aigoqt_SRCS} ${aigoqt_UIS_H}) target_link_libraries(aigoqt ${QT_LIBRARIES} aigolib) diff --git a/qt/aigoqt.cpp b/qt/aigoqt.cpp new file mode 100644 index 0000000..e55f1b2 --- /dev/null +++ b/qt/aigoqt.cpp @@ -0,0 +1,38 @@ +#include "aigoqt.h" +#include + +AigoQt::AigoQt(QWidget *parent) + : QMainWindow(parent) +{ + setupUi(this); + cam = new Quickcam("/dev/video0"); + + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(updateImage())); + timer->start(200); +} + +AigoQt::~AigoQt( void ) +{ + delete cam; +} + +void AigoQt::updateImage( void ) +{ + cam->update(); + SDL_Surface *s = cam->getSurface(); + image->setPixmap(QPixmap::fromImage(QImage((uchar*)s->pixels, s->w, s->h, QImage::Format_RGB32))); +} + +void AigoQt::on_buttonSetCorners_clicked( void ) +{ + +} + +void AigoQt::on_slider_valueChanged( int value) +{ + timer->stop(); + timer->start(value); +} + +#include "aigoqt.moc" diff --git a/qt/aigoqt.h b/qt/aigoqt.h new file mode 100644 index 0000000..9e5c716 --- /dev/null +++ b/qt/aigoqt.h @@ -0,0 +1,30 @@ +#ifndef _AIGOQT_H_ +#define _AIGOQT_H_ + +#include +#include +#include +#include + +class AigoQt : public QMainWindow, public Ui::AigoQt +{ + Q_OBJECT + + public: + AigoQt(QWidget *parent = NULL); + virtual ~AigoQt( void ); + + + private slots: + void on_buttonSetCorners_clicked( void ); + void on_slider_valueChanged(int value); + void updateImage(); + + private: + + Quickcam *cam; + QTimer *timer; + +}; + +#endif /* ifndef _AIGOQT_H_ */ diff --git a/qt/main.cpp b/qt/main.cpp new file mode 100644 index 0000000..259e300 --- /dev/null +++ b/qt/main.cpp @@ -0,0 +1,20 @@ +#include +//#include +#include "aigoqt.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + /* + QGLFormat f; + f.setDoubleBuffer(true); + f.setRgba(true); + f.setDepth(true); + QGLFormat::setDefaultFormat(f); + */ + + AigoQt vindu; + vindu.show(); + return app.exec(); +} diff --git a/qt/main.ui b/qt/main.ui new file mode 100644 index 0000000..87bb962 --- /dev/null +++ b/qt/main.ui @@ -0,0 +1,190 @@ + + AigoQt + + + + 0 + 0 + 849 + 644 + + + + AigoQT + + + + + 9 + + + 6 + + + + + + + + 10 + + + 400 + + + 10 + + + 50 + + + 200 + + + Qt::Horizontal + + + + + + + + 4 + 5 + 0 + 0 + + + + Controls + + + + 9 + + + 6 + + + + + Set corners + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 700 + 550 + + + + Preview + + + + + 40 + 40 + 640 + 480 + + + + + 640 + 480 + + + + + 640 + 480 + + + + + + + + + + + + + + 0 + 0 + 849 + 25 + + + + + &File + + + + + + + + + &Quit + + + + + + + slider + valueChanged(int) + lcdNumber + display(int) + + + 702 + 618 + + + 727 + 618 + + + + + slider + sliderMoved(int) + lcdNumber + display(int) + + + 542 + 621 + + + 829 + 628 + + + + +