rewrote void loading

This commit is contained in:
itsmattkc
2019-02-16 14:02:26 -08:00
parent ba2331e40d
commit 3d0a65c70d
3 changed files with 22 additions and 21 deletions
+19 -19
View File
@@ -52,26 +52,26 @@ Effect *VoidEffect::copy(Clip *c) {
void VoidEffect::load(QXmlStreamReader &stream) {
QString tag = stream.name().toString();
qint64 start_index = stream.characterOffset();
qint64 end_index = start_index;
while (!stream.atEnd() && !(stream.name() == tag && stream.isEndElement())) {
end_index = stream.characterOffset();
stream.readNext();
}
qint64 passage_length = end_index - start_index;
if (passage_length > 0) {
// store xml data verbatim
QFile* device = static_cast<QFile*>(stream.device());
QFile passage_get(device->fileName());
if (passage_get.open(QFile::ReadOnly)) {
passage_get.seek(start_index);
bytes = passage_get.read(passage_length);
int passage_end = bytes.lastIndexOf('>')+1;
bytes.remove(passage_end, bytes.size()-passage_end);
passage_get.close();
}
}
QXmlStreamWriter writer(&bytes);
// copy XML from reader to writer
while (!stream.atEnd() && !(stream.name() == tag && stream.isEndElement())) {
stream.readNext();
if (stream.isStartElement()) {
writer.writeStartElement(stream.name().toString());
}
if (stream.isEndElement()) {
writer.writeEndElement();
}
if (stream.isCharacters()) {
writer.writeCharacters(stream.text().toString());
}
for (int i=0;i<stream.attributes().size();i++) {
writer.writeAttribute(stream.attributes().at(i));
}
}
}
void VoidEffect::save(QXmlStreamWriter &stream) {
+2 -1
View File
@@ -99,7 +99,8 @@ int main(int argc, char *argv[]) {
qInstallMessageHandler(debug_message_handler);
}
// init ffmpeg subsystem
// Initialize ffmpeg subsystem
// (these have been deprecated in FFmpeg 4, but are still necessary for FFmpeg 3)
av_register_all();
avfilter_register_all();
+1 -1
View File
@@ -121,7 +121,7 @@ GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(nullptr) {
current_row_desc->setAlignment(Qt::AlignCenter);
layout->addWidget(current_row_desc);
connect(view, SIGNAL(zoom_changed(double)), header, SLOT(update_zoom(double)));
connect(view, SIGNAL(zoom_changed(double, double)), header, SLOT(update_zoom(double)));
connect(view, SIGNAL(x_scroll_changed(int)), header, SLOT(set_scroll(int)));
connect(view, SIGNAL(selection_changed(bool, int)), this, SLOT(set_key_button_enabled(bool, int)));