-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmetadataEncapsulationInputOutputDialog.cpp
291 lines (268 loc) · 6.64 KB
/
metadataEncapsulationInputOutputDialog.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
/*!
* \project_name EBU Player
* \file metadataEncapsulationInputOutputDialog.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 "metadataEncapsulationInputOutputDialog.hpp"
// class constructor
metadataEncapsulationInputOutputDialog::metadataEncapsulationInputOutputDialog
(
Gtk::Window& parent,
const Glib::ustring& title,
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 * inputLabel = Gtk::manage(new Gtk::Label("In the file :"));
Gtk::Label * outputLabel = Gtk::manage(new Gtk::Label("Select the input XML EBUCore file :"));;
// 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("Select"));
pathOutputButton = Gtk::manage(new Gtk::Button("Select"));
// define entry
// define entry
pathInputEntry = Gtk::manage(new Gtk::Entry());
pathInputEntry->set_editable(true);
pathInputEntry->set_placeholder_text("Select the input XML file...");
pathOutputEntry = Gtk::manage(new Gtk::Entry());
pathOutputEntry->set_editable(true);
pathOutputEntry->set_placeholder_text("Select the destination MXF file...");
// 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
dialogOptionBox->pack_start(*inputLabel);
dialogOptionBox->pack_start(*pathInputBox);
dialogOptionBox->pack_start(*partitionLabel);
dialogOptionBox->pack_start(*partitionButtonBox);
dialogOptionBox->pack_start(*encodingLabel);
dialogOptionBox->pack_start(*encodingButtonBox);
dialogOptionBox->pack_start(*outputLabel);
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
metadataEncapsulationInputOutputDialog::~metadataEncapsulationInputOutputDialog
(
void
)
{
std::cout<<"byebye"<<std::endl;
}
void metadataEncapsulationInputOutputDialog::connectSignalClicked
(
void
)
{
pathInputButton->signal_clicked().connect
(
sigc::mem_fun
(
*this,
&metadataEncapsulationInputOutputDialog::on_pathInputButton_clicked
)
);
pathOutputButton->signal_clicked().connect
(
sigc::mem_fun
(
*this,
&metadataEncapsulationInputOutputDialog::on_pathOutputButton_clicked
)
);
// connect radio groups
partitionHeader->signal_group_changed().connect
(
sigc::mem_fun
(
*this,
&metadataEncapsulationInputOutputDialog::on_partition_group_changed
)
);
encodingKLV->signal_group_changed().connect
(
sigc::mem_fun
(
*this,
&metadataEncapsulationInputOutputDialog::on_encoding_group_changed
)
);
}
void metadataEncapsulationInputOutputDialog::on_close_dialog
(
void
)
{
hide();
}
void metadataEncapsulationInputOutputDialog::on_saveMetadata_clicked
(
void
)
{
hide();
}
void metadataEncapsulationInputOutputDialog::on_pathInputButton_clicked
(
void
)
{
// instanciate a new local filechooser
genericFilechooserWindow * FC = new genericFilechooserWindow
(
*this,
"Select an XML file",
Gtk::FILE_CHOOSER_ACTION_OPEN,
Glib::get_home_dir(),
false,
3
);
if (FC->getResponse() == Gtk::RESPONSE_OK)
{
// set the information about the path
pathInputEntry->set_text(FC->getPathToFile());
}
delete FC;
}
void metadataEncapsulationInputOutputDialog::on_pathOutputButton_clicked
(
void
)
{
// instanciate a new local filechooser
genericFilechooserWindow * FC = new genericFilechooserWindow
(
*this,
"Save into the MXF file...",
Gtk::FILE_CHOOSER_ACTION_SAVE,
Glib::get_home_dir(),
false,
MXFMETADATAMIMETYPE
);
if (FC->getResponse() == Gtk::RESPONSE_OK)
{
// set the information about the path
pathOutputEntry->set_text(FC->getPathToFile());
}
delete FC;
}
void metadataEncapsulationInputOutputDialog::on_partition_group_changed
(
void
)
{
}
void metadataEncapsulationInputOutputDialog::on_encoding_group_changed
(
void
)
{
}
int metadataEncapsulationInputOutputDialog::getResponse
(
void
)
{
return response;
}
std::string metadataEncapsulationInputOutputDialog::getInputPath
(
void
)
{
return pathInputEntry->get_text();
}
std::string metadataEncapsulationInputOutputDialog::getOutputPath
(
void
)
{
return pathOutputEntry->get_text();
}
bool metadataEncapsulationInputOutputDialog::getKLV
(
void
)
{
return encodingKLV->get_active();
}
bool metadataEncapsulationInputOutputDialog::getDark
(
void
)
{
return encodingDark->get_active();
}
bool metadataEncapsulationInputOutputDialog::getSidecar
(
void
)
{
return encodingSide->get_active();
}
bool metadataEncapsulationInputOutputDialog::getHeader
(
void
)
{
return partitionHeader->get_active();
}
bool metadataEncapsulationInputOutputDialog::getFooter
(
void
)
{
return partitionFooter->get_active();
}