Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add more functionality

  • Loading branch information...
commit acfcfd997b6ba3306c3c32d847a7b47c99f88a87 1 parent 338dee7
Pavol Rusnak authored August 30, 2011
64  software/mainwindow.cpp
... ...
@@ -1,8 +1,10 @@
1 1
 #include "mainwindow.h"
2 2
 #include "ui_mainwindow.h"
  3
+#include "microview.h"
3 4
 #include <gst/gst.h>
4 5
 #include <gst/interfaces/xoverlay.h>
5 6
 #include <QMessageBox>
  7
+#include <qdebug.h>
6 8
 
7 9
 MainWindow::MainWindow(QWidget *parent) :
8 10
     QMainWindow(parent),
@@ -43,3 +45,65 @@ void MainWindow::on_pushAbout_clicked()
43 45
     aboutBox.setIconPixmap(QPixmap(":/icons/icon.png"));
44 46
     aboutBox.exec();
45 47
 }
  48
+
  49
+void MainWindow::on_pushL_clicked()
  50
+{
  51
+    qDebug() << MSG_LEFT;
  52
+}
  53
+
  54
+void MainWindow::on_pushR_clicked()
  55
+{
  56
+    qDebug() << MSG_RIGHT;
  57
+}
  58
+
  59
+void MainWindow::on_pushU_clicked()
  60
+{
  61
+    qDebug() << MSG_UP;
  62
+}
  63
+
  64
+void MainWindow::on_pushD_clicked()
  65
+{
  66
+    qDebug() << MSG_DOWN;
  67
+}
  68
+
  69
+void MainWindow::on_pushZoomIn_clicked()
  70
+{
  71
+    qDebug() << MSG_PLUS;
  72
+}
  73
+
  74
+void MainWindow::on_pushZoomOut_clicked()
  75
+{
  76
+    qDebug() << MSG_MINUS;
  77
+}
  78
+
  79
+void MainWindow::on_pushSnap_clicked()
  80
+{
  81
+    qDebug() << MSG_SNAP;
  82
+}
  83
+
  84
+void MainWindow::keyPressEvent(QKeyEvent *e)
  85
+{
  86
+    switch (e->key()) {
  87
+    case Qt::Key_A:
  88
+        on_pushL_clicked();
  89
+        break;
  90
+    case Qt::Key_S:
  91
+        on_pushD_clicked();
  92
+        break;
  93
+    case Qt::Key_D:
  94
+        on_pushR_clicked();
  95
+        break;
  96
+    case Qt::Key_W:
  97
+        on_pushU_clicked();
  98
+        break;
  99
+    case Qt::Key_O:
  100
+        on_pushZoomIn_clicked();
  101
+        break;
  102
+    case Qt::Key_L:
  103
+        on_pushZoomOut_clicked();
  104
+        break;
  105
+    case Qt::Key_Y:
  106
+        on_pushSnap_clicked();
  107
+        break;
  108
+    }
  109
+}
8  software/mainwindow.h
@@ -19,6 +19,14 @@ private slots:
19 19
 
20 20
     void on_pushExit_clicked();
21 21
     void on_pushAbout_clicked();
  22
+    void on_pushL_clicked();
  23
+    void on_pushR_clicked();
  24
+    void on_pushU_clicked();
  25
+    void on_pushD_clicked();
  26
+    void on_pushZoomIn_clicked();
  27
+    void on_pushZoomOut_clicked();
  28
+    void on_pushSnap_clicked();
  29
+    void keyPressEvent(QKeyEvent *e);
22 30
 
23 31
 private:
24 32
     Ui::MainWindow *ui;
4  software/mainwindow.ui
@@ -83,7 +83,7 @@
83 83
    <widget class="QPushButton" name="pushZoomIn">
84 84
     <property name="geometry">
85 85
      <rect>
86  
-      <x>660</x>
  86
+      <x>740</x>
87 87
       <y>160</y>
88 88
       <width>51</width>
89 89
       <height>31</height>
@@ -96,7 +96,7 @@
96 96
    <widget class="QPushButton" name="pushZoomOut">
97 97
     <property name="geometry">
98 98
      <rect>
99  
-      <x>740</x>
  99
+      <x>660</x>
100 100
       <y>160</y>
101 101
       <width>51</width>
102 102
       <height>31</height>
12  software/microview.h
... ...
@@ -0,0 +1,12 @@
  1
+#ifndef MICROVIEW_H
  2
+#define MICROVIEW_H
  3
+
  4
+#define MSG_LEFT  "X-10"
  5
+#define MSG_RIGHT "X+10"
  6
+#define MSG_UP    "Y-10"
  7
+#define MSG_DOWN  "Y+10"
  8
+#define MSG_MINUS "Z-10"
  9
+#define MSG_PLUS  "Z+10"
  10
+#define MSG_SNAP  "SNAP"
  11
+
  12
+#endif // MICROVIEW_H
3  software/microview.pro
@@ -15,7 +15,8 @@ SOURCES += main.cpp\
15 15
     videoview.cpp
16 16
 
17 17
 HEADERS  += mainwindow.h \
18  
-    videoview.h
  18
+    videoview.h \
  19
+    microview.h
19 20
 
20 21
 FORMS    += mainwindow.ui
21 22
 
10  software/videoview.cpp
... ...
@@ -1,4 +1,5 @@
1 1
 #include "videoview.h"
  2
+#include "microview.h"
2 3
 #include <qdebug.h>
3 4
 
4 5
 VideoView::VideoView(QWidget *parent) :
@@ -8,12 +9,15 @@ VideoView::VideoView(QWidget *parent) :
8 9
 
9 10
 void VideoView::mouseMoveEvent(QMouseEvent *event)
10 11
 {
11  
-    // TODO: process position
12 12
     qDebug() << event->pos();
13 13
 }
14 14
 
15 15
 void VideoView::wheelEvent(QWheelEvent *event)
16 16
 {
17  
-    // TODO: process delta
18  
-    qDebug() << event->delta();
  17
+    if (event->delta() > 0) {
  18
+        qDebug() << MSG_PLUS;
  19
+    } else
  20
+    if (event->delta() < 0) {
  21
+        qDebug() << MSG_MINUS;
  22
+    }
19 23
 }

0 notes on commit acfcfd9

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