Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add more functionality

  • Loading branch information...
commit acfcfd997b6ba3306c3c32d847a7b47c99f88a87 1 parent 338dee7
Pavol Rusnak prusnak authored
64 software/mainwindow.cpp
View
@@ -1,8 +1,10 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
+#include "microview.h"
#include <gst/gst.h>
#include <gst/interfaces/xoverlay.h>
#include <QMessageBox>
+#include <qdebug.h>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
@@ -43,3 +45,65 @@ void MainWindow::on_pushAbout_clicked()
aboutBox.setIconPixmap(QPixmap(":/icons/icon.png"));
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;
+ }
+}
8 software/mainwindow.h
View
@@ -19,6 +19,14 @@ private slots:
void on_pushExit_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:
Ui::MainWindow *ui;
4 software/mainwindow.ui
View
@@ -83,7 +83,7 @@
<widget class="QPushButton" name="pushZoomIn">
<property name="geometry">
<rect>
- <x>660</x>
+ <x>740</x>
<y>160</y>
<width>51</width>
<height>31</height>
@@ -96,7 +96,7 @@
<widget class="QPushButton" name="pushZoomOut">
<property name="geometry">
<rect>
- <x>740</x>
+ <x>660</x>
<y>160</y>
<width>51</width>
<height>31</height>
12 software/microview.h
View
@@ -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
3  software/microview.pro
View
@@ -15,7 +15,8 @@ SOURCES += main.cpp\
videoview.cpp
HEADERS += mainwindow.h \
- videoview.h
+ videoview.h \
+ microview.h
FORMS += mainwindow.ui
10 software/videoview.cpp
View
@@ -1,4 +1,5 @@
#include "videoview.h"
+#include "microview.h"
#include <qdebug.h>
VideoView::VideoView(QWidget *parent) :
@@ -8,12 +9,15 @@ VideoView::VideoView(QWidget *parent) :
void VideoView::mouseMoveEvent(QMouseEvent *event)
{
- // TODO: process position
qDebug() << event->pos();
}
void VideoView::wheelEvent(QWheelEvent *event)
{
- // TODO: process delta
- qDebug() << event->delta();
+ if (event->delta() > 0) {
+ qDebug() << MSG_PLUS;
+ } else
+ if (event->delta() < 0) {
+ qDebug() << MSG_MINUS;
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.