Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Thiago Santini
EyeRecToo
Commits
fdd49102
Commit
fdd49102
authored
Aug 08, 2017
by
Thiago Santini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Starts Log Widget
parent
3d3367c7
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
218 additions
and
23 deletions
+218
-23
EyeRecToo/EyeRecToo.pro
EyeRecToo/EyeRecToo.pro
+6
-3
EyeRecToo/icons/logWidget.png
EyeRecToo/icons/logWidget.png
+0
-0
EyeRecToo/resources.qrc
EyeRecToo/resources.qrc
+1
-0
EyeRecToo/src/LogWidget.cpp
EyeRecToo/src/LogWidget.cpp
+22
-0
EyeRecToo/src/LogWidget.h
EyeRecToo/src/LogWidget.h
+25
-0
EyeRecToo/src/LogWidget.ui
EyeRecToo/src/LogWidget.ui
+48
-0
EyeRecToo/src/MainWindow.cpp
EyeRecToo/src/MainWindow.cpp
+19
-0
EyeRecToo/src/MainWindow.h
EyeRecToo/src/MainWindow.h
+12
-0
EyeRecToo/src/MainWindow.ui
EyeRecToo/src/MainWindow.ui
+67
-20
EyeRecToo/src/utils.cpp
EyeRecToo/src/utils.cpp
+13
-0
EyeRecToo/src/utils.h
EyeRecToo/src/utils.h
+5
-0
No files found.
EyeRecToo/EyeRecToo.pro
View file @
fdd49102
...
...
@@ -33,7 +33,8 @@ SOURCES +=\
$$
{
TOP
}
/
src
/
gaze
-
estimation
/
Homography
.
cpp
\
$$
{
TOP
}
/
src
/
DataRecorder
.
cpp
\
$$
{
TOP
}
/
src
/
NetworkStream
.
cpp
\
$$
{
TOP
}
/
src
/
Reference
.
cpp
$$
{
TOP
}
/
src
/
Reference
.
cpp
\
$$
{
TOP
}
/
src
/
LogWidget
.
cpp
HEADERS
+=
\
$$
{
TOP
}
/
src
/
MainWindow
.
h
\
...
...
@@ -56,12 +57,14 @@ HEADERS += \
$$
{
TOP
}
/
src
/
gaze
-
estimation
/
Homography
.
h
\
$$
{
TOP
}
/
src
/
DataRecorder
.
h
\
$$
{
TOP
}
/
src
/
NetworkStream
.
h
\
$$
{
TOP
}
/
src
/
Reference
.
h
$$
{
TOP
}
/
src
/
Reference
.
h
\
$$
{
TOP
}
/
src
/
LogWidget
.
h
FORMS
+=
\
$$
{
TOP
}
/
src
/
MainWindow
.
ui
\
$$
{
TOP
}
/
src
/
CameraWidget
.
ui
\
$$
{
TOP
}
/
src
/
GazeEstimationWidget
.
ui
$$
{
TOP
}
/
src
/
GazeEstimationWidget
.
ui
\
src
/
LogWidget
.
ui
RESOURCES
+=
\
$$
{
TOP
}
/
resources
.
qrc
...
...
EyeRecToo/icons/logWidget.png
0 → 100644
View file @
fdd49102
48.4 KB
EyeRecToo/resources.qrc
View file @
fdd49102
...
...
@@ -6,5 +6,6 @@
<file>icons/fieldWidget.png</file>
<file>icons/EyeRecToo.png</file>
<file>icons/gazeEstimationWidget.png</file>
<file>icons/logWidget.png</file>
</qresource>
</RCC>
EyeRecToo/src/LogWidget.cpp
0 → 100644
View file @
fdd49102
#include "LogWidget.h"
#include "ui_LogWidget.h"
LogWidget
::
LogWidget
(
QWidget
*
parent
)
:
QMainWindow
(
parent
),
ui
(
new
Ui
::
LogWidget
)
{
ui
->
setupUi
(
this
);
setWindowTitle
(
"Log Widget"
);
setWindowIcon
(
QIcon
(
":/icons/logWidget.png"
));
}
LogWidget
::~
LogWidget
()
{
delete
ui
;
}
void
LogWidget
::
appendMessage
(
const
QString
&
msg
)
{
ui
->
log
->
appendPlainText
(
msg
.
trimmed
());
}
EyeRecToo/src/LogWidget.h
0 → 100644
View file @
fdd49102
#ifndef LOGWIDGET_H
#define LOGWIDGET_H
#include <QMainWindow>
namespace
Ui
{
class
LogWidget
;
}
class
LogWidget
:
public
QMainWindow
{
Q_OBJECT
public:
explicit
LogWidget
(
QWidget
*
parent
=
0
);
~
LogWidget
();
public
slots
:
void
appendMessage
(
const
QString
&
msg
);
private:
Ui
::
LogWidget
*
ui
;
};
#endif // LOGWIDGET_H
EyeRecToo/src/LogWidget.ui
0 → 100644
View file @
fdd49102
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
LogWidget
</class>
<widget
class=
"QMainWindow"
name=
"LogWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
640
</width>
<height>
240
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
MainWindow
</string>
</property>
<widget
class=
"QWidget"
name=
"centralwidget"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QPlainTextEdit"
name=
"log"
>
<property
name=
"font"
>
<font>
<family>
Courier New
</family>
</font>
</property>
<property
name=
"undoRedoEnabled"
>
<bool>
false
</bool>
</property>
<property
name=
"readOnly"
>
<bool>
true
</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget
class=
"QMenuBar"
name=
"menubar"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
640
</width>
<height>
20
</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
EyeRecToo/src/MainWindow.cpp
View file @
fdd49102
...
...
@@ -34,6 +34,12 @@ MainWindow::MainWindow(QWidget *parent) :
ui
->
blinker
->
hide
();
logWidget
=
new
LogWidget
();
logWidget
->
show
();
logWidget
->
move
(
cfg
.
logWidgetPos
);
logWidget
->
resize
(
cfg
.
logWidgetSize
);
gLogWidget
=
logWidget
;
/*
* WARNING: DO NOT REMOVE THIS CALL to QCameraInfo::availableCameras()
* Logically, its meaningless, but it guarantees that DirectShow will work
...
...
@@ -138,6 +144,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
cfg
.
mainWindowPos
=
pos
();
cfg
.
mainWindowSize
=
size
();
cfg
.
logWidgetPos
=
logWidget
->
pos
();
cfg
.
logWidgetSize
=
logWidget
->
size
();
cfg
.
leftEyeWidgetPos
=
lEyeWidget
->
pos
();
cfg
.
leftEyeWidgetSize
=
lEyeWidget
->
size
();
cfg
.
rightEyeWidgetPos
=
rEyeWidget
->
pos
();
...
...
@@ -182,6 +190,11 @@ void MainWindow::closeEvent(QCloseEvent *event)
if
(
networkStream
)
networkStream
->
deleteLater
();
if
(
logWidget
)
{
gLogWidget
=
NULL
;
logWidget
->
deleteLater
();
}
if
(
settings
)
settings
->
deleteLater
();
...
...
@@ -375,6 +388,11 @@ void MainWindow::on_gazeEstimation_clicked()
widgetButtonReact
(
gazeEstimationWidget
,
ui
->
gazeEstimation
->
isChecked
());
}
void
MainWindow
::
on_log_clicked
()
{
widgetButtonReact
(
logWidget
,
ui
->
log
->
isChecked
());
}
void
MainWindow
::
keyPressEvent
(
QKeyEvent
*
event
)
{
if
(
event
->
isAutoRepeat
())
...
...
@@ -524,3 +542,4 @@ void MainWindow::checkForOpenH264()
qInfo
()
<<
"Video encoder:"
<<
(
gHasOpenH264
?
"OpenH264"
:
"DivX"
);
}
EyeRecToo/src/MainWindow.h
View file @
fdd49102
...
...
@@ -21,6 +21,8 @@
#include "Reference.h"
#include "LogWidget.h"
#include "utils.h"
class
MainWindowConfig
...
...
@@ -29,6 +31,8 @@ public:
MainWindowConfig
()
:
mainWindowPos
(
QPoint
(
0
,
0
)
),
mainWindowSize
(
QSize
(
100
,
100
)),
logWidgetPos
(
QPoint
(
0
,
0
)
),
logWidgetSize
(
QSize
(
640
,
240
)),
leftEyeWidgetPos
(
QPoint
(
0
,
0
)
),
leftEyeWidgetSize
(
QSize
(
320
,
240
)
),
rightEyeWidgetPos
(
QPoint
(
0
,
0
)
),
...
...
@@ -43,6 +47,8 @@ public:
QPoint
mainWindowPos
;
QSize
mainWindowSize
;
QPoint
logWidgetPos
;
QSize
logWidgetSize
;
QPoint
leftEyeWidgetPos
;
QSize
leftEyeWidgetSize
;
QPoint
rightEyeWidgetPos
;
...
...
@@ -59,6 +65,8 @@ public:
settings
->
sync
();
settings
->
setValue
(
"mainWindowPos"
,
mainWindowPos
);
settings
->
setValue
(
"mainWindowSize"
,
mainWindowSize
);
settings
->
setValue
(
"logWidgetPos"
,
logWidgetPos
);
settings
->
setValue
(
"logWidgetSize"
,
logWidgetSize
);
settings
->
setValue
(
"leftEyeWidgetPos"
,
leftEyeWidgetPos
);
settings
->
setValue
(
"leftEyeWidgetSize"
,
leftEyeWidgetSize
);
settings
->
setValue
(
"rightEyeWidgetPos"
,
rightEyeWidgetPos
);
...
...
@@ -76,6 +84,8 @@ public:
settings
->
sync
();
set
(
settings
,
"mainWindowPos"
,
mainWindowPos
);
set
(
settings
,
"mainWindowSize"
,
mainWindowSize
);
set
(
settings
,
"logWidgetPos"
,
logWidgetPos
);
set
(
settings
,
"logWidgetSize"
,
logWidgetSize
);
set
(
settings
,
"leftEyeWidgetPos"
,
leftEyeWidgetPos
);
set
(
settings
,
"leftEyeWidgetSize"
,
leftEyeWidgetSize
);
set
(
settings
,
"rightEyeWidgetPos"
,
rightEyeWidgetPos
);
...
...
@@ -119,6 +129,7 @@ private:
QThread
*
journalThread
;
DataRecorderThread
*
journal
;
NetworkStream
*
networkStream
;
LogWidget
*
logWidget
;
QElapsedTimer
elapsedTime
;
int
elapsedTimeUpdateTimer
;
...
...
@@ -151,6 +162,7 @@ private slots:
void
menuOption
(
QAction
*
);
void
showReferencesDialog
();
void
showAboutDialog
();
void
on_log_clicked
();
};
#endif // MAINWINDOW_H
EyeRecToo/src/MainWindow.ui
View file @
fdd49102
...
...
@@ -6,7 +6,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
252
</width>
<width>
319
</width>
<height>
371
</height>
</rect>
</property>
...
...
@@ -393,6 +393,56 @@
<string>
Widgets
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout_3"
>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QPushButton"
name=
"rightEyeCam"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
40
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
40
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"toolTip"
>
<string>
Toggle Right Eye Cam Widget
</string>
</property>
<property
name=
"statusTip"
>
<string/>
</property>
<property
name=
"whatsThis"
>
<string/>
</property>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../resources.qrc"
>
<normaloff>
:/icons/rEyeWidget.png
</normaloff>
:/icons/rEyeWidget.png
</iconset>
</property>
<property
name=
"iconSize"
>
<size>
<width>
33
</width>
<height>
33
</height>
</size>
</property>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"leftEyeCam"
>
<property
name=
"sizePolicy"
>
...
...
@@ -452,8 +502,8 @@
</property>
</widget>
</item>
<item
row=
"0"
column=
"
1
"
>
<widget
class=
"QPushButton"
name=
"
rightEye
Cam"
>
<item
row=
"0"
column=
"
2
"
>
<widget
class=
"QPushButton"
name=
"
field
Cam"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
...
...
@@ -473,7 +523,7 @@
</size>
</property>
<property
name=
"toolTip"
>
<string>
Toggle
Right Eye
Cam Widget
</string>
<string>
Toggle
Field
Cam Widget
</string>
</property>
<property
name=
"statusTip"
>
<string/>
...
...
@@ -486,7 +536,7 @@
</property>
<property
name=
"icon"
>
<iconset
resource=
"../resources.qrc"
>
<normaloff>
:/icons/
rEye
Widget.png
</normaloff>
:/icons/
rEye
Widget.png
</iconset>
<normaloff>
:/icons/
field
Widget.png
</normaloff>
:/icons/
field
Widget.png
</iconset>
</property>
<property
name=
"iconSize"
>
<size>
...
...
@@ -502,8 +552,8 @@
</property>
</widget>
</item>
<item
row=
"0"
column=
"
2
"
>
<widget
class=
"QPushButton"
name=
"
fieldCam
"
>
<item
row=
"0"
column=
"
3
"
>
<widget
class=
"QPushButton"
name=
"
gazeEstimation
"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
...
...
@@ -523,7 +573,7 @@
</size>
</property>
<property
name=
"toolTip"
>
<string>
Toggle
Field Cam
Widget
</string>
<string>
Toggle
Gaze Estimation
Widget
</string>
</property>
<property
name=
"statusTip"
>
<string/>
...
...
@@ -536,7 +586,7 @@
</property>
<property
name=
"icon"
>
<iconset
resource=
"../resources.qrc"
>
<normaloff>
:/icons/
field
Widget.png
</normaloff>
:/icons/
field
Widget.png
</iconset>
<normaloff>
:/icons/
gazeEstimation
Widget.png
</normaloff>
:/icons/
gazeEstimation
Widget.png
</iconset>
</property>
<property
name=
"iconSize"
>
<size>
...
...
@@ -552,8 +602,11 @@
</property>
</widget>
</item>
<item
row=
"0"
column=
"3"
>
<widget
class=
"QPushButton"
name=
"gazeEstimation"
>
<item
row=
"0"
column=
"4"
>
<widget
class=
"QPushButton"
name=
"log"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
...
...
@@ -573,20 +626,14 @@
</size>
</property>
<property
name=
"toolTip"
>
<string>
Toggle Gaze Estimation Widget
</string>
</property>
<property
name=
"statusTip"
>
<string/>
</property>
<property
name=
"whatsThis"
>
<string/>
<string>
Toggle Log Widget
</string>
</property>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../resources.qrc"
>
<normaloff>
:/icons/
gazeEstimation
Widget.png
</normaloff>
:/icons/
gazeEstimation
Widget.png
</iconset>
<normaloff>
:/icons/
log
Widget.png
</normaloff>
:/icons/
log
Widget.png
</iconset>
</property>
<property
name=
"iconSize"
>
<size>
...
...
@@ -614,7 +661,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
252
</width>
<width>
319
</width>
<height>
20
</height>
</rect>
</property>
...
...
EyeRecToo/src/utils.cpp
View file @
fdd49102
...
...
@@ -20,6 +20,9 @@ QTextStream gLogStream;
std
::
atomic
<
bool
>
gRecording
(
false
);
bool
gHasOpenH264
=
false
;
LogWidget
*
gLogWidget
=
NULL
;
std
::
vector
<
QString
>
gLogBuffer
;
/*
* Utility functions
*/
...
...
@@ -88,6 +91,16 @@ void logMessages(QtMsgType type, const QMessageLogContext &context, const QStrin
if
(
gLogStream
.
status
()
==
QTextStream
::
Ok
)
gLogStream
<<
str
.
c_str
();
if
(
gLogWidget
)
{
if
(
gLogBuffer
.
size
()
>
0
)
{
for
(
auto
s
=
gLogBuffer
.
begin
();
s
!=
gLogBuffer
.
end
();
s
++
)
QMetaObject
::
invokeMethod
(
gLogWidget
,
"appendMessage"
,
Q_ARG
(
const
QString
&
,
*
s
)
);
gLogBuffer
.
clear
();
}
QMetaObject
::
invokeMethod
(
gLogWidget
,
"appendMessage"
,
Q_ARG
(
const
QString
&
,
QString
(
str
.
c_str
()))
);
}
else
gLogBuffer
.
push_back
(
QString
(
str
.
c_str
())
);
std
::
cout
.
flush
();
gLogStream
.
flush
();
}
...
...
EyeRecToo/src/utils.h
View file @
fdd49102
...
...
@@ -24,6 +24,8 @@
#include <opencv2/imgproc.hpp>
#include <opencv2/calib3d.hpp>
#include "LogWidget.h"
/*
* Global variables
*/
...
...
@@ -96,4 +98,7 @@ template<typename T> void set(const QSettings *settings, const QString key, T &v
void
loadSoundEffect
(
QSoundEffect
&
effect
,
QString
fileName
);
extern
LogWidget
*
gLogWidget
;
extern
std
::
vector
<
QString
>
gLogBuffer
;
#endif // UTILS_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment