Signapse
Signals | Public Member Functions | List of all members
Gui Class Reference

#include <Gui.h>

Inheritance diagram for Gui:
Inheritance graph
Collaboration diagram for Gui:
Collaboration graph

Signals

void progressChanged (int progress)
 

Public Member Functions

virtual void NextScene (Scene next)
 
 Gui (QMainWindow *win, Ui_MainWindow *ui_win)
 
void SetVisible (bool visible)
 
void SetTargetImage (int target)
 
void SetTargetImage (std::string target)
 
void SetTask (std::string newTask)
 
void buttonPressed ()
 
void updateThreshold ()
 
virtual void NextScene (Scene next)=0
 

Detailed Description

Definition at line 22 of file Gui.h.

Constructor & Destructor Documentation

◆ Gui()

Gui::Gui ( QMainWindow *  win,
Ui_MainWindow *  ui_win 
)

Constructor sets up GUI, makes signal connections

Parameters
winpoints to QMainWindow from main thread
ui_winpoints to Ui_MainWindow from main thread

Definition at line 11 of file Gui.cpp.

11 {
12 widget = win;
13 widget->setFixedSize(UI_WDH, UI_HGT);
14 ui = ui_win;
15 ui->setupUi(widget);
16 SetTask("A");
17 makeConnections();
18 SignapseUtils::randSeed();
19}
#define UI_WDH
Definition: Gui.cpp:3
#define UI_HGT
Definition: Gui.cpp:4
void SetTask(std::string newTask)
Definition: Gui.cpp:99

Member Function Documentation

◆ buttonPressed()

void Gui::buttonPressed ( )

Method handler for when the next task button is pressed, sets new task and resets the progress bar.

Definition at line 63 of file Gui.cpp.

63 {
64 std::string new_task = SignapseUtils::makeTask();
65 SetTargetImage(new_task);
66 currentTask = new_task;
67 progressBar.ResetProgress();
68}
void SetTargetImage(int target)
void ResetProgress()
Definition: ProgressBar.cpp:17

◆ NextScene()

void Gui::NextScene ( Scene  next)
virtual

Handles the next scene from the video processing pipeline. If the result is empty, the viewing pane is updated, otherwise, the progress bar is updated.

Parameters
nextThe Scene to be processed

Implements SceneCallback.

Definition at line 24 of file Gui.cpp.

24 {
25 //flip frame
26 if(next.result == "") {
27 cv::Mat temp;
28 cv::flip(next.frame, temp, 1);
29 QImage imgIn = QImage((uchar *) temp.data, temp.cols, temp.rows, temp.step,
30 QImage::Format_RGB888);
31 ui->label->setPixmap(QPixmap::fromImage(imgIn));
32 ui->label->resize(ui->label->pixmap()->size());
33 }
34 else{
35 int progress = progressBar.GetProgress(next.result, currentTask);
36 emit progressChanged(progress);
37 if(progress >= 100){
39 }
40 }
41
42}
void buttonPressed()
Definition: Gui.cpp:63
void progressChanged(int progress)
int GetProgress(std::string s, std::string task)
Definition: ProgressBar.cpp:9
std::string result
Member variable.
Definition: Scene.h:47
cv::Mat frame
Member variable.
Definition: Scene.h:42

◆ progressChanged

void Gui::progressChanged ( int  progress)
signal

◆ SetTargetImage() [1/2]

void Gui::SetTargetImage ( int  target)

◆ SetTargetImage() [2/2]

void Gui::SetTargetImage ( std::string  letter)

Sets the target to match with user sign

Parameters
letterstring represenation of the target sign

Definition at line 54 of file Gui.cpp.

54 {
55 std::string impath = testFolder + letter + "_test.jpg";
56 cv::Mat img = cv::imread(impath);
57 setDemoImage(img);
58 setTaskText(letter);
59}
#define testFolder
Definition: Gui.h:16

◆ SetTask()

void Gui::SetTask ( std::string  newTask)

Definition at line 99 of file Gui.cpp.

99 {
100 currentTask = newTask;
101 SetTargetImage("A");
102}

◆ SetVisible()

void Gui::SetVisible ( bool  visible)

Sets underlying widget visibility.

Parameters
visible

Definition at line 47 of file Gui.cpp.

47 {
48 widget->setVisible(visible);
49}

◆ updateThreshold()

void Gui::updateThreshold ( )

Definition at line 70 of file Gui.cpp.

70 {
71 progressBar.SetThreshold(ui->spinBox->value());
72 progressBar.ResetProgress();
73}
void SetThreshold(int thres)
Definition: ProgressBar.cpp:21

The documentation for this class was generated from the following files: