commit f6403176a711717ae052fbd113bbbde78a106137 Author: Pavol Rusnak Date: Mon Aug 29 21:49:25 2011 +0200 init diff --git a/README b/README new file mode 100644 index 0000000..176db50 --- /dev/null +++ b/README @@ -0,0 +1 @@ +Software and firmware for driving CNC Microscope diff --git a/software/.gitignore b/software/.gitignore new file mode 100644 index 0000000..c0d044c --- /dev/null +++ b/software/.gitignore @@ -0,0 +1,3 @@ +*.pro.user +*-build-desktop +_build diff --git a/software/main.cpp b/software/main.cpp new file mode 100644 index 0000000..6e7efd9 --- /dev/null +++ b/software/main.cpp @@ -0,0 +1,10 @@ +#include +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); +} diff --git a/software/mainwindow.cpp b/software/mainwindow.cpp new file mode 100644 index 0000000..661fe86 --- /dev/null +++ b/software/mainwindow.cpp @@ -0,0 +1,32 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" +#include +#include + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); + gst_init (NULL,NULL); + + GstElement *GSTpipeline = gst_pipeline_new ("pipeline"); + g_assert(GSTpipeline); + GstElement *GSTsource = gst_element_factory_make("v4l2src", "source"); + g_assert(GSTsource); + GstElement *GSTdest = gst_element_factory_make("xvimagesink", "view"); + g_assert(GSTdest); + + gst_bin_add_many(GST_BIN(GSTpipeline), GSTsource, GSTdest, NULL); + gst_element_link_many(GSTsource, GSTdest, NULL); + + unsigned long win_id = ui->wgtVideo->winId(); + QApplication::syncX(); + gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GSTdest), win_id); + + gst_element_set_state(GST_ELEMENT(GSTpipeline), GST_STATE_PLAYING); +} + +MainWindow::~MainWindow() +{ +} diff --git a/software/mainwindow.h b/software/mainwindow.h new file mode 100644 index 0000000..276d0e1 --- /dev/null +++ b/software/mainwindow.h @@ -0,0 +1,24 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +namespace Ui { + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private slots: + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/software/mainwindow.ui b/software/mainwindow.ui new file mode 100644 index 0000000..b273b09 --- /dev/null +++ b/software/mainwindow.ui @@ -0,0 +1,167 @@ + + + MainWindow + + + + 0 + 0 + 800 + 500 + + + + µView + + + + + + 10 + 10 + 640 + 480 + + + + + + + 660 + 60 + 51 + 31 + + + + + + + + + + 740 + 60 + 51 + 31 + + + + + + + + + + 710 + 90 + 31 + 51 + + + + + + + + + + 710 + 10 + 31 + 51 + + + + + + + + + + 660 + 160 + 51 + 31 + + + + + + + + + + + 740 + 160 + 51 + 31 + + + + - + + + + + + 660 + 210 + 131 + 31 + + + + &Snapshot + + + + + + 660 + 460 + 131 + 31 + + + + E&xit + + + + + + 660 + 410 + 131 + 31 + + + + &About ... + + + + + + + + VideoView + QWidget +
videoview.h
+
+
+ + pushL + pushR + pushU + pushD + pushZoomIn + pushZoomOut + pushSnap + pushAbout_2 + pushExit + + + +
diff --git a/software/microview.pro b/software/microview.pro new file mode 100644 index 0000000..b6ff7f2 --- /dev/null +++ b/software/microview.pro @@ -0,0 +1,25 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2011-08-12T19:14:06 +# +#------------------------------------------------- + +QT += core gui + +TARGET = microview +TEMPLATE = app + + +SOURCES += main.cpp\ + mainwindow.cpp \ + videoview.cpp + +HEADERS += mainwindow.h \ + videoview.h + +FORMS += mainwindow.ui + +unix { + CONFIG += link_pkgconfig + PKGCONFIG += gstreamer-0.10 gstreamer-interfaces-0.10 +} diff --git a/software/videoview.cpp b/software/videoview.cpp new file mode 100644 index 0000000..1884f30 --- /dev/null +++ b/software/videoview.cpp @@ -0,0 +1,19 @@ +#include "videoview.h" +#include + +VideoView::VideoView(QWidget *parent) : + QWidget(parent) +{ +} + +void VideoView::mouseMoveEvent(QMouseEvent *event) +{ + // TODO: process position + qDebug() << event->pos(); +} + +void VideoView::wheelEvent(QWheelEvent *event) +{ + // TODO: process delta + qDebug() << event->delta(); +} diff --git a/software/videoview.h b/software/videoview.h new file mode 100644 index 0000000..73568f6 --- /dev/null +++ b/software/videoview.h @@ -0,0 +1,21 @@ +#ifndef VIDEOVIEW_H +#define VIDEOVIEW_H + +#include +#include +#include + +class VideoView : public QWidget +{ + Q_OBJECT +public: + explicit VideoView(QWidget *parent = 0); + void mouseMoveEvent(QMouseEvent *event); + void wheelEvent(QWheelEvent *event); +signals: + +public slots: + +}; + +#endif // VIDEOVIEW_H