Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

init

  • Loading branch information...
commit f6403176a711717ae052fbd113bbbde78a106137 0 parents
@prusnak prusnak authored
1  README
@@ -0,0 +1 @@
+Software and firmware for driving CNC Microscope
3  software/.gitignore
@@ -0,0 +1,3 @@
+*.pro.user
+*-build-desktop
+_build
10 software/main.cpp
@@ -0,0 +1,10 @@
+#include <QtGui/QApplication>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+ return a.exec();
+}
32 software/mainwindow.cpp
@@ -0,0 +1,32 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include <gst/gst.h>
+#include <gst/interfaces/xoverlay.h>
+
+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()
+{
+}
24 software/mainwindow.h
@@ -0,0 +1,24 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+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
167 software/mainwindow.ui
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>µView</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <widget class="VideoView" name="wgtVideo" native="true">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>640</width>
+ <height>480</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushL">
+ <property name="geometry">
+ <rect>
+ <x>660</x>
+ <y>60</y>
+ <width>51</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>⇐</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushR">
+ <property name="geometry">
+ <rect>
+ <x>740</x>
+ <y>60</y>
+ <width>51</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>⇒</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushD">
+ <property name="geometry">
+ <rect>
+ <x>710</x>
+ <y>90</y>
+ <width>31</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>⇓</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushU">
+ <property name="geometry">
+ <rect>
+ <x>710</x>
+ <y>10</y>
+ <width>31</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>⇑</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushZoomIn">
+ <property name="geometry">
+ <rect>
+ <x>660</x>
+ <y>160</y>
+ <width>51</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>+</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushZoomOut">
+ <property name="geometry">
+ <rect>
+ <x>740</x>
+ <y>160</y>
+ <width>51</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>-</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushSnap">
+ <property name="geometry">
+ <rect>
+ <x>660</x>
+ <y>210</y>
+ <width>131</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&amp;Snapshot</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushExit">
+ <property name="geometry">
+ <rect>
+ <x>660</x>
+ <y>460</y>
+ <width>131</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>E&amp;xit</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushAbout_2">
+ <property name="geometry">
+ <rect>
+ <x>660</x>
+ <y>410</y>
+ <width>131</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&amp;About ...</string>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>VideoView</class>
+ <extends>QWidget</extends>
+ <header>videoview.h</header>
+ </customwidget>
+ </customwidgets>
+ <tabstops>
+ <tabstop>pushL</tabstop>
+ <tabstop>pushR</tabstop>
+ <tabstop>pushU</tabstop>
+ <tabstop>pushD</tabstop>
+ <tabstop>pushZoomIn</tabstop>
+ <tabstop>pushZoomOut</tabstop>
+ <tabstop>pushSnap</tabstop>
+ <tabstop>pushAbout_2</tabstop>
+ <tabstop>pushExit</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
25 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
+}
19 software/videoview.cpp
@@ -0,0 +1,19 @@
+#include "videoview.h"
+#include <qdebug.h>
+
+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();
+}
21 software/videoview.h
@@ -0,0 +1,21 @@
+#ifndef VIDEOVIEW_H
+#define VIDEOVIEW_H
+
+#include <QWidget>
+#include <QMouseEvent>
+#include <QWheelEvent>
+
+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

0 comments on commit f640317

Please sign in to comment.
Something went wrong with that request. Please try again.