mirror of
https://github.com/brmlab/microview.git
synced 2025-06-07 19:14:00 +02:00
init
This commit is contained in:
commit
f6403176a7
9 changed files with 302 additions and 0 deletions
1
README
Normal file
1
README
Normal file
|
@ -0,0 +1 @@
|
|||
Software and firmware for driving CNC Microscope
|
3
software/.gitignore
vendored
Normal file
3
software/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.pro.user
|
||||
*-build-desktop
|
||||
_build
|
10
software/main.cpp
Normal file
10
software/main.cpp
Normal file
|
@ -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
Normal file
32
software/mainwindow.cpp
Normal file
|
@ -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
Normal file
24
software/mainwindow.h
Normal file
|
@ -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
Normal file
167
software/mainwindow.ui
Normal file
|
@ -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>&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&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>&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
Normal file
25
software/microview.pro
Normal file
|
@ -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
Normal file
19
software/videoview.cpp
Normal file
|
@ -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
Normal file
21
software/videoview.h
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue