add more functionality

This commit is contained in:
Pavol Rusnak 2011-08-30 01:30:05 +02:00
parent 338dee788a
commit acfcfd997b
6 changed files with 95 additions and 6 deletions

View file

@ -1,8 +1,10 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "microview.h"
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/xoverlay.h>
#include <QMessageBox> #include <QMessageBox>
#include <qdebug.h>
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
@ -43,3 +45,65 @@ void MainWindow::on_pushAbout_clicked()
aboutBox.setIconPixmap(QPixmap(":/icons/icon.png")); aboutBox.setIconPixmap(QPixmap(":/icons/icon.png"));
aboutBox.exec(); aboutBox.exec();
} }
void MainWindow::on_pushL_clicked()
{
qDebug() << MSG_LEFT;
}
void MainWindow::on_pushR_clicked()
{
qDebug() << MSG_RIGHT;
}
void MainWindow::on_pushU_clicked()
{
qDebug() << MSG_UP;
}
void MainWindow::on_pushD_clicked()
{
qDebug() << MSG_DOWN;
}
void MainWindow::on_pushZoomIn_clicked()
{
qDebug() << MSG_PLUS;
}
void MainWindow::on_pushZoomOut_clicked()
{
qDebug() << MSG_MINUS;
}
void MainWindow::on_pushSnap_clicked()
{
qDebug() << MSG_SNAP;
}
void MainWindow::keyPressEvent(QKeyEvent *e)
{
switch (e->key()) {
case Qt::Key_A:
on_pushL_clicked();
break;
case Qt::Key_S:
on_pushD_clicked();
break;
case Qt::Key_D:
on_pushR_clicked();
break;
case Qt::Key_W:
on_pushU_clicked();
break;
case Qt::Key_O:
on_pushZoomIn_clicked();
break;
case Qt::Key_L:
on_pushZoomOut_clicked();
break;
case Qt::Key_Y:
on_pushSnap_clicked();
break;
}
}

View file

@ -19,6 +19,14 @@ private slots:
void on_pushExit_clicked(); void on_pushExit_clicked();
void on_pushAbout_clicked(); void on_pushAbout_clicked();
void on_pushL_clicked();
void on_pushR_clicked();
void on_pushU_clicked();
void on_pushD_clicked();
void on_pushZoomIn_clicked();
void on_pushZoomOut_clicked();
void on_pushSnap_clicked();
void keyPressEvent(QKeyEvent *e);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;

View file

@ -83,7 +83,7 @@
<widget class="QPushButton" name="pushZoomIn"> <widget class="QPushButton" name="pushZoomIn">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>660</x> <x>740</x>
<y>160</y> <y>160</y>
<width>51</width> <width>51</width>
<height>31</height> <height>31</height>
@ -96,7 +96,7 @@
<widget class="QPushButton" name="pushZoomOut"> <widget class="QPushButton" name="pushZoomOut">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>740</x> <x>660</x>
<y>160</y> <y>160</y>
<width>51</width> <width>51</width>
<height>31</height> <height>31</height>

12
software/microview.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef MICROVIEW_H
#define MICROVIEW_H
#define MSG_LEFT "X-10"
#define MSG_RIGHT "X+10"
#define MSG_UP "Y-10"
#define MSG_DOWN "Y+10"
#define MSG_MINUS "Z-10"
#define MSG_PLUS "Z+10"
#define MSG_SNAP "SNAP"
#endif // MICROVIEW_H

View file

@ -15,7 +15,8 @@ SOURCES += main.cpp\
videoview.cpp videoview.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
videoview.h videoview.h \
microview.h
FORMS += mainwindow.ui FORMS += mainwindow.ui

View file

@ -1,4 +1,5 @@
#include "videoview.h" #include "videoview.h"
#include "microview.h"
#include <qdebug.h> #include <qdebug.h>
VideoView::VideoView(QWidget *parent) : VideoView::VideoView(QWidget *parent) :
@ -8,12 +9,15 @@ VideoView::VideoView(QWidget *parent) :
void VideoView::mouseMoveEvent(QMouseEvent *event) void VideoView::mouseMoveEvent(QMouseEvent *event)
{ {
// TODO: process position
qDebug() << event->pos(); qDebug() << event->pos();
} }
void VideoView::wheelEvent(QWheelEvent *event) void VideoView::wheelEvent(QWheelEvent *event)
{ {
// TODO: process delta if (event->delta() > 0) {
qDebug() << event->delta(); qDebug() << MSG_PLUS;
} else
if (event->delta() < 0) {
qDebug() << MSG_MINUS;
}
} }