Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

init

  • Loading branch information...
commit f6403176a711717ae052fbd113bbbde78a106137 0 parents
Pavol Rusnak authored August 29, 2011
1  README
... ...
@@ -0,0 +1 @@
  1
+Software and firmware for driving CNC Microscope
3  software/.gitignore
... ...
@@ -0,0 +1,3 @@
  1
+*.pro.user
  2
+*-build-desktop
  3
+_build
10  software/main.cpp
... ...
@@ -0,0 +1,10 @@
  1
+#include <QtGui/QApplication>
  2
+#include "mainwindow.h"
  3
+
  4
+int main(int argc, char *argv[])
  5
+{
  6
+    QApplication a(argc, argv);
  7
+    MainWindow w;
  8
+    w.show();
  9
+    return a.exec();
  10
+}
32  software/mainwindow.cpp
... ...
@@ -0,0 +1,32 @@
  1
+#include "mainwindow.h"
  2
+#include "ui_mainwindow.h"
  3
+#include <gst/gst.h>
  4
+#include <gst/interfaces/xoverlay.h>
  5
+
  6
+MainWindow::MainWindow(QWidget *parent) :
  7
+    QMainWindow(parent),
  8
+    ui(new Ui::MainWindow)
  9
+{
  10
+    ui->setupUi(this);
  11
+    gst_init (NULL,NULL);
  12
+
  13
+    GstElement *GSTpipeline = gst_pipeline_new ("pipeline");
  14
+    g_assert(GSTpipeline);
  15
+    GstElement *GSTsource = gst_element_factory_make("v4l2src", "source");
  16
+    g_assert(GSTsource);
  17
+    GstElement *GSTdest = gst_element_factory_make("xvimagesink", "view");
  18
+    g_assert(GSTdest);
  19
+
  20
+    gst_bin_add_many(GST_BIN(GSTpipeline), GSTsource, GSTdest, NULL);
  21
+    gst_element_link_many(GSTsource, GSTdest, NULL);
  22
+
  23
+    unsigned long win_id = ui->wgtVideo->winId();
  24
+    QApplication::syncX();
  25
+    gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GSTdest), win_id);
  26
+
  27
+    gst_element_set_state(GST_ELEMENT(GSTpipeline), GST_STATE_PLAYING);
  28
+}
  29
+
  30
+MainWindow::~MainWindow()
  31
+{
  32
+}
24  software/mainwindow.h
... ...
@@ -0,0 +1,24 @@
  1
+#ifndef MAINWINDOW_H
  2
+#define MAINWINDOW_H
  3
+
  4
+#include <QMainWindow>
  5
+
  6
+namespace Ui {
  7
+    class MainWindow;
  8
+}
  9
+
  10
+class MainWindow : public QMainWindow
  11
+{
  12
+    Q_OBJECT
  13
+
  14
+public:
  15
+    explicit MainWindow(QWidget *parent = 0);
  16
+    ~MainWindow();
  17
+
  18
+private slots:
  19
+
  20
+private:
  21
+    Ui::MainWindow *ui;
  22
+};
  23
+
  24
+#endif // MAINWINDOW_H
167  software/mainwindow.ui
... ...
@@ -0,0 +1,167 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<ui version="4.0">
  3
+ <class>MainWindow</class>
  4
+ <widget class="QMainWindow" name="MainWindow">
  5
+  <property name="geometry">
  6
+   <rect>
  7
+    <x>0</x>
  8
+    <y>0</y>
  9
+    <width>800</width>
  10
+    <height>500</height>
  11
+   </rect>
  12
+  </property>
  13
+  <property name="windowTitle">
  14
+   <string>µView</string>
  15
+  </property>
  16
+  <widget class="QWidget" name="centralWidget">
  17
+   <widget class="VideoView" name="wgtVideo" native="true">
  18
+    <property name="geometry">
  19
+     <rect>
  20
+      <x>10</x>
  21
+      <y>10</y>
  22
+      <width>640</width>
  23
+      <height>480</height>
  24
+     </rect>
  25
+    </property>
  26
+   </widget>
  27
+   <widget class="QPushButton" name="pushL">
  28
+    <property name="geometry">
  29
+     <rect>
  30
+      <x>660</x>
  31
+      <y>60</y>
  32
+      <width>51</width>
  33
+      <height>31</height>
  34
+     </rect>
  35
+    </property>
  36
+    <property name="text">
  37
+     <string>⇐</string>
  38
+    </property>
  39
+   </widget>
  40
+   <widget class="QPushButton" name="pushR">
  41
+    <property name="geometry">
  42
+     <rect>
  43
+      <x>740</x>
  44
+      <y>60</y>
  45
+      <width>51</width>
  46
+      <height>31</height>
  47
+     </rect>
  48
+    </property>
  49
+    <property name="text">
  50
+     <string>⇒</string>
  51
+    </property>
  52
+   </widget>
  53
+   <widget class="QPushButton" name="pushD">
  54
+    <property name="geometry">
  55
+     <rect>
  56
+      <x>710</x>
  57
+      <y>90</y>
  58
+      <width>31</width>
  59
+      <height>51</height>
  60
+     </rect>
  61
+    </property>
  62
+    <property name="text">
  63
+     <string>⇓</string>
  64
+    </property>
  65
+   </widget>
  66
+   <widget class="QPushButton" name="pushU">
  67
+    <property name="geometry">
  68
+     <rect>
  69
+      <x>710</x>
  70
+      <y>10</y>
  71
+      <width>31</width>
  72
+      <height>51</height>
  73
+     </rect>
  74
+    </property>
  75
+    <property name="text">
  76
+     <string>⇑</string>
  77
+    </property>
  78
+   </widget>
  79
+   <widget class="QPushButton" name="pushZoomIn">
  80
+    <property name="geometry">
  81
+     <rect>
  82
+      <x>660</x>
  83
+      <y>160</y>
  84
+      <width>51</width>
  85
+      <height>31</height>
  86
+     </rect>
  87
+    </property>
  88
+    <property name="text">
  89
+     <string>+</string>
  90
+    </property>
  91
+   </widget>
  92
+   <widget class="QPushButton" name="pushZoomOut">
  93
+    <property name="geometry">
  94
+     <rect>
  95
+      <x>740</x>
  96
+      <y>160</y>
  97
+      <width>51</width>
  98
+      <height>31</height>
  99
+     </rect>
  100
+    </property>
  101
+    <property name="text">
  102
+     <string>-</string>
  103
+    </property>
  104
+   </widget>
  105
+   <widget class="QPushButton" name="pushSnap">
  106
+    <property name="geometry">
  107
+     <rect>
  108
+      <x>660</x>
  109
+      <y>210</y>
  110
+      <width>131</width>
  111
+      <height>31</height>
  112
+     </rect>
  113
+    </property>
  114
+    <property name="text">
  115
+     <string>&amp;Snapshot</string>
  116
+    </property>
  117
+   </widget>
  118
+   <widget class="QPushButton" name="pushExit">
  119
+    <property name="geometry">
  120
+     <rect>
  121
+      <x>660</x>
  122
+      <y>460</y>
  123
+      <width>131</width>
  124
+      <height>31</height>
  125
+     </rect>
  126
+    </property>
  127
+    <property name="text">
  128
+     <string>E&amp;xit</string>
  129
+    </property>
  130
+   </widget>
  131
+   <widget class="QPushButton" name="pushAbout_2">
  132
+    <property name="geometry">
  133
+     <rect>
  134
+      <x>660</x>
  135
+      <y>410</y>
  136
+      <width>131</width>
  137
+      <height>31</height>
  138
+     </rect>
  139
+    </property>
  140
+    <property name="text">
  141
+     <string>&amp;About ...</string>
  142
+    </property>
  143
+   </widget>
  144
+  </widget>
  145
+ </widget>
  146
+ <layoutdefault spacing="6" margin="11"/>
  147
+ <customwidgets>
  148
+  <customwidget>
  149
+   <class>VideoView</class>
  150
+   <extends>QWidget</extends>
  151
+   <header>videoview.h</header>
  152
+  </customwidget>
  153
+ </customwidgets>
  154
+ <tabstops>
  155
+  <tabstop>pushL</tabstop>
  156
+  <tabstop>pushR</tabstop>
  157
+  <tabstop>pushU</tabstop>
  158
+  <tabstop>pushD</tabstop>
  159
+  <tabstop>pushZoomIn</tabstop>
  160
+  <tabstop>pushZoomOut</tabstop>
  161
+  <tabstop>pushSnap</tabstop>
  162
+  <tabstop>pushAbout_2</tabstop>
  163
+  <tabstop>pushExit</tabstop>
  164
+ </tabstops>
  165
+ <resources/>
  166
+ <connections/>
  167
+</ui>
25  software/microview.pro
... ...
@@ -0,0 +1,25 @@
  1
+#-------------------------------------------------
  2
+#
  3
+# Project created by QtCreator 2011-08-12T19:14:06
  4
+#
  5
+#-------------------------------------------------
  6
+
  7
+QT       += core gui
  8
+
  9
+TARGET = microview
  10
+TEMPLATE = app
  11
+
  12
+
  13
+SOURCES += main.cpp\
  14
+        mainwindow.cpp \
  15
+    videoview.cpp
  16
+
  17
+HEADERS  += mainwindow.h \
  18
+    videoview.h
  19
+
  20
+FORMS    += mainwindow.ui
  21
+
  22
+unix {
  23
+    CONFIG += link_pkgconfig
  24
+    PKGCONFIG += gstreamer-0.10 gstreamer-interfaces-0.10
  25
+}
19  software/videoview.cpp
... ...
@@ -0,0 +1,19 @@
  1
+#include "videoview.h"
  2
+#include <qdebug.h>
  3
+
  4
+VideoView::VideoView(QWidget *parent) :
  5
+    QWidget(parent)
  6
+{
  7
+}
  8
+
  9
+void VideoView::mouseMoveEvent(QMouseEvent *event)
  10
+{
  11
+    // TODO: process position
  12
+    qDebug() << event->pos();
  13
+}
  14
+
  15
+void VideoView::wheelEvent(QWheelEvent *event)
  16
+{
  17
+    // TODO: process delta
  18
+    qDebug() << event->delta();
  19
+}
21  software/videoview.h
... ...
@@ -0,0 +1,21 @@
  1
+#ifndef VIDEOVIEW_H
  2
+#define VIDEOVIEW_H
  3
+
  4
+#include <QWidget>
  5
+#include <QMouseEvent>
  6
+#include <QWheelEvent>
  7
+
  8
+class VideoView : public QWidget
  9
+{
  10
+    Q_OBJECT
  11
+public:
  12
+    explicit VideoView(QWidget *parent = 0);
  13
+    void mouseMoveEvent(QMouseEvent *event);
  14
+    void wheelEvent(QWheelEvent *event);
  15
+signals:
  16
+
  17
+public slots:
  18
+
  19
+};
  20
+
  21
+#endif // VIDEOVIEW_H

0 notes on commit f640317

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