-
Notifications
You must be signed in to change notification settings - Fork 4
/
metadataEncapsulationDialog.cpp
307 lines (284 loc) · 6.68 KB
/
metadataEncapsulationDialog.cpp
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
/*!
* \project_name EBU Player
* \file metadataEncapsulationDialog.cpp
* \brief EBUCore Metadata encapsulation dialog
* \authors Marco Dos Santos Oliveira
* \version 0.1
* \dateOfCreation 28 march 2013
* \dateOfUpdate 28 march 2013
* \copyright This software is published under MPL v2.0
*
*/
// include files and libraries
#include "metadataEncapsulationDialog.hpp"
// class constructor
metadataEncapsulationDialog::metadataEncapsulationDialog
(
Gtk::Window& parent,
const Glib::ustring& title,
const Glib::ustring& inputLabel,
const Glib::ustring& outputLabel,
const Glib::ustring& inputButtonLabel,
const Glib::ustring& outputButtonLabel,
const Glib::ustring& inputPlaceHolderLabel,
const Glib::ustring& outputPlaceHolderLabel,
bool hasInputFile,
bool hasOutputFile,
bool hasEBUCoreOptions,
bool setModal
)
:
Gtk::Dialog(title, parent, setModal),
dialogOptionBox(get_vbox ())
{
// dialog configuration
set_resizable(true);
set_position(Gtk::WIN_POS_CENTER);
set_decorated(true);
// define labels
Gtk::Label * partitionLabel = Gtk::manage(new Gtk::Label("Set the metadata into :"));
Gtk::Label * encodingLabel = Gtk::manage(new Gtk::Label("Encoded as :"));
Gtk::Label * inputPathLabel = Gtk::manage(new Gtk::Label(inputLabel));
Gtk::Label * outputPathLabel = Gtk::manage(new Gtk::Label(outputLabel));
// define box
Gtk::Box * pathInputBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 2));
Gtk::Box * pathOutputBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 2));
// define buttons
pathInputButton = Gtk::manage(new Gtk::Button(inputButtonLabel));
pathOutputButton = Gtk::manage(new Gtk::Button(outputButtonLabel));
// define entry
pathInputEntry = Gtk::manage(new Gtk::Entry());
pathInputEntry->set_editable(true);
pathInputEntry->set_placeholder_text(inputPlaceHolderLabel);
pathOutputEntry = Gtk::manage(new Gtk::Entry());
pathOutputEntry->set_editable(true);
pathOutputEntry->set_placeholder_text(outputPlaceHolderLabel);
// pack the entry and its button
pathInputBox->pack_start(*pathInputEntry);
pathInputBox->pack_start(*pathInputButton);
pathOutputBox->pack_start(*pathOutputEntry);
pathOutputBox->pack_start(*pathOutputButton);
// define buttonbox
Gtk::ButtonBox * partitionButtonBox = Gtk::manage(new Gtk::ButtonBox(Gtk::ORIENTATION_HORIZONTAL));
Gtk::ButtonBox * encodingButtonBox = Gtk::manage(new Gtk::ButtonBox(Gtk::ORIENTATION_VERTICAL));
// define radio buttons
Gtk::RadioButton::Group partitionGroup;
partitionHeader = Gtk::manage(new Gtk::RadioButton(partitionGroup,"header partition"));
partitionFooter = Gtk::manage(new Gtk::RadioButton(partitionGroup,"footer partition"));
Gtk::RadioButton::Group encodingGroup;
encodingKLV = Gtk::manage(new Gtk::RadioButton(encodingGroup,"KLV"));
encodingDark = Gtk::manage(new Gtk::RadioButton(encodingGroup,"XML"));
encodingSide = Gtk::manage(new Gtk::RadioButton(encodingGroup,"External link"));
// add radio buttons into their own radio box
partitionButtonBox->pack_start(*partitionHeader);
partitionButtonBox->pack_start(*partitionFooter);
encodingButtonBox->pack_start(*encodingKLV);
encodingButtonBox->pack_start(*encodingDark);
encodingButtonBox->pack_start(*encodingSide);
// pack elements into the dialog box
if (hasInputFile)
{
dialogOptionBox->pack_start(*inputPathLabel);
dialogOptionBox->pack_start(*pathInputBox);
}
if (hasEBUCoreOptions)
{
dialogOptionBox->pack_start(*partitionLabel);
dialogOptionBox->pack_start(*partitionButtonBox);
dialogOptionBox->pack_start(*encodingLabel);
dialogOptionBox->pack_start(*encodingButtonBox);
}
if (hasOutputFile)
{
dialogOptionBox->pack_start(*outputPathLabel);
dialogOptionBox->pack_start(*pathOutputBox);
}
// append filechooser buttons and linked events
add_button
(
Gtk::Stock::CANCEL,
Gtk::RESPONSE_CANCEL
);
add_button
(
Gtk::Stock::OK,
Gtk::RESPONSE_OK
);
connectSignalClicked();
show_all_children();
//
// run the filechooser and grab the result
response = run();
}
// class destructor
metadataEncapsulationDialog::~metadataEncapsulationDialog
(
void
)
{
}
void metadataEncapsulationDialog::connectSignalClicked
(
void
)
{
pathInputButton->signal_clicked().connect
(
sigc::mem_fun
(
*this,
&metadataEncapsulationDialog::on_pathInputButton_clicked
)
);
pathOutputButton->signal_clicked().connect
(
sigc::mem_fun
(
*this,
&metadataEncapsulationDialog::on_pathOutputButton_clicked
)
);
// connect radio groups
partitionHeader->signal_group_changed().connect
(
sigc::mem_fun
(
*this,
&metadataEncapsulationDialog::on_partition_group_changed
)
);
encodingKLV->signal_group_changed().connect
(
sigc::mem_fun
(
*this,
&metadataEncapsulationDialog::on_encoding_group_changed
)
);
}
void metadataEncapsulationDialog::on_close_dialog
(
void
)
{
hide();
}
void metadataEncapsulationDialog::on_terminate_clicked
(
void
)
{
hide();
}
void metadataEncapsulationDialog::on_pathInputButton_clicked
(
void
)
{
// instanciate a new local filechooser
genericFilechooserWindow * FC = new genericFilechooserWindow
(
*this,
"Select an MXF file",
Gtk::FILE_CHOOSER_ACTION_OPEN,
Glib::get_home_dir(),
false,
4
);
if (FC->getResponse() == Gtk::RESPONSE_OK)
{
// set the information about the path
pathInputEntry->set_text(FC->getPathToFile());
}
delete FC;
}
void metadataEncapsulationDialog::on_pathOutputButton_clicked
(
void
)
{
// instanciate a new local filechooser
genericFilechooserWindow * FC = new genericFilechooserWindow
(
*this,
"Save into an XML file...",
Gtk::FILE_CHOOSER_ACTION_SAVE,
Glib::get_home_dir(),
false,
3
);
if (FC->getResponse() == Gtk::RESPONSE_OK)
{
// set the information about the path
pathOutputEntry->set_text(FC->getPathToFile());
}
delete FC;
}
void metadataEncapsulationDialog::on_partition_group_changed
(
void
)
{
}
void metadataEncapsulationDialog::on_encoding_group_changed
(
void
)
{
}
int metadataEncapsulationDialog::getResponse
(
void
)
{
return response;
}
std::string metadataEncapsulationDialog::getInputPath
(
void
)
{
return pathInputEntry->get_text();
}
std::string metadataEncapsulationDialog::getOutputPath
(
void
)
{
return pathOutputEntry->get_text();
}
bool metadataEncapsulationDialog::getKLV
(
void
)
{
return encodingKLV->get_active();
}
bool metadataEncapsulationDialog::getDark
(
void
)
{
return encodingDark->get_active();
}
bool metadataEncapsulationDialog::getSidecar
(
void
)
{
return encodingSide->get_active();
}
bool metadataEncapsulationDialog::getHeader
(
void
)
{
return partitionHeader->get_active();
}
bool metadataEncapsulationDialog::getFooter
(
void
)
{
return partitionFooter->get_active();
}