-
Notifications
You must be signed in to change notification settings - Fork 4
/
wasabiqtwindow.h
162 lines (127 loc) · 4.9 KB
/
wasabiqtwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/********************************************************************************
**
** [W]ASABI [A]ffect [S]imulation [A]rchitecture for [B]elievable [I]nteractivity
**
** Copyright (C) 2011 Christian Becker-Asano.
** All rights reserved.
** Contact: Christian Becker-Asano (christian@becker-asano.de)
**
** This file is part of the WASABIQtGui program.
**
** The WASABIQtGui program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** The WASABIQtGui program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with the WASABIQtGui program. If not, see <http://www.gnu.org/licenses/>
**
********************************************************************************/
#ifndef WASABIQTWINDOW_H
#define WASABIQTWINDOW_H
#define CURRENT_VERSION "0.8.1"
#include <QMainWindow>
#include "WASABIEngine/includes/WASABIEngine.h"
#include <QWidget>
#include <QStandardItemModel>
#include <QTimer>
#include <QTextEdit>
#include <QXmlStreamReader>
#include <QDomDocument>
#include <ctime>
#include <unistd.h>
namespace Ui {
class WASABIQtWindow;
}
class PADWindow;
class QUdpSocket;
class WASABIQtWindow : public QMainWindow
{
Q_OBJECT
public:
explicit WASABIQtWindow(QWidget *parent = 0);
~WASABIQtWindow();
bool loadInitFile(int& sPort);
WASABIEngine* wasabi;
bool serverAutoStart;
bool startMinimized;
std::string globalInitFilename;
int getCurrentEA() {return currentEA;}
AffectiveState* getHighlightedAffectiveState() {return highlighted_as;}
QTimer *timer;
QTimer *timerSender;
bool isRunning();
bool showXYZ();
std::string composeEmoML(cogaEmotionalAttendee* ea);
std::string EmoMLString;
void setPADspace(bool state);
public slots:
void actionAbout();
void actionPAD_space();
private slots:
void on_spinBoxForceX_valueChanged(int arg1);
void on_spinBoxForceY_valueChanged(int arg1);
void update();
void on_pushButtonAdd_clicked();
void on_comboBoxEmoAttendee_currentIndexChanged(const QString &arg1);
void on_checkBoxRun_stateChanged(int arg1);
void on_spinBoxSlope_valueChanged(int arg1);
void on_spinBoxMass_valueChanged(int arg1);
void on_spinBoxUpdateRate_valueChanged(int arg1);
void on_spinBoxAlpha_valueChanged(int arg1);
void on_spinBoxBeta_valueChanged(int arg1);
void on_spinBoxFactor_valueChanged(int arg1);
void on_pushButtonMinus50_clicked();
void on_pushButtonPlus50_clicked();
void on_pushButtonReset_clicked();
void on_verticalSliderP_valueChanged(int value);
void on_horizontalSliderA_valueChanged(int value);
void on_verticalSliderD_valueChanged(int value);
void on_treeViewAffectiveStates_activated(const QModelIndex &index);
void on_pushButtonTrigger_clicked();
void processPendingDatagrams();
void on_lineEditSenderPort_textEdited(const QString &arg1);
void on_spinBoxSendRate_valueChanged(int arg1);
void broadcastDatagram();
void on_checkBoxSending_stateChanged(int arg1);
void on_pushButton_network_send_clicked();
private:
PADWindow *padWindow;
Ui::WASABIQtWindow *ui;
void comboBoxAttendee_update();
void initValues(cogaEmotionalAttendee* ea);
QStandardItemModel *ea_model;
void resetValues();
void updateGUI(bool force = false);
int currentEA;
int guiUpdate;
int updateRate;
int updateRateSender;
long lastPackageTimeStamp;
int addEmotionalAttendee(const QString& name, const QString& globalID);
void updateGuiAfterAddingAgent(cogaEmotionalAttendee* ea);
AffectiveState* highlighted_as;
QUdpSocket *udpSocketReceiver;
QUdpSocket *udpSocketSender;
int sPort;
// prints a message with time and status into the "Network traffic" box.
// type: true = receive, false = transmit
void printNetworkMessage(QString m, bool type, bool success = false, bool parsed = false);
bool parseMessage(QString data);
std::string buildAffectedLikelihoodStrings(std::vector<cogaEmotionalAttendee*> attendees, std::string timeStamp);
void sendAffectedLikelihood(std::string padStrings);
void sendEmoMlPadTrace();
void sendXmlFile(QString filename);
QString *networkOutputFormat;
bool initEAbyXML(cogaEmotionalAttendee* ea);
bool readEmotionML(QXmlStreamReader& xml, cogaEmotionalAttendee *ea);
bool readInfo(QXmlStreamReader& xml, cogaEmotionalAttendee *ea);
bool readEmotion(QXmlStreamReader& xml, cogaEmotionalAttendee *ea);
std::string getPackageTimeStamp();
};
#endif // WASABIQTWINDOW_H