MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / restoreState

Method restoreState

Gui/SequenceFileDialog.cpp:663–781  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

661}
662
663bool
664SequenceFileDialog::restoreState(const QByteArray & state,
665 bool restoreDirectory,
666 bool* directoryRestored)
667{
668 QByteArray sd = state;
669 QDataStream stream(&sd, QIODevice::ReadOnly);
670
671 *directoryRestored = false;
672 if ( stream.atEnd() ) {
673 return false;
674 }
675 QByteArray splitterState;
676 QByteArray headerData;
677 QList<QUrl> bookmarks;
678 QStringList history;
679 QString currentDirectory;
680 QString relativeChoice;
681 int sequenceMode_i;
682 stream >> splitterState
683 >> bookmarks
684 >> history
685 >> currentDirectory
686 >> headerData
687 >> relativeChoice
688 >> sequenceMode_i;
689 if ( !_centerSplitter->restoreState(splitterState) ) {
690 return false;
691 }
692 QList<int> list = _centerSplitter->sizes();
693 if ( (list.count() >= 2) && (list.at(0) == 0) && (list.at(1) == 0) ) {
694 for (int i = 0; i < list.count(); ++i) {
695 list[i] = _centerSplitter->widget(i)->sizeHint().width();
696 }
697 _centerSplitter->setSizes(list);
698 }
699
700
701 for (int i = 0; i < _relativeChoice->count(); ++i) {
702 if (_relativeChoice->itemText(i) == relativeChoice) {
703 _relativeChoice->setCurrentIndex(i);
704 break;
705 }
706 }
707
708 _sequenceButton->setCurrentIndex(sequenceMode_i);
709
710 std::map<std::string, std::string> envVar;
711 _gui->getApp()->getProject()->getEnvironmentVariables(envVar);
712
713 std::vector<QUrl> stdBookMarks;
714 QStringList expandedVars;
715 for (std::map<std::string, std::string>::iterator it = envVar.begin(); it != envVar.end(); ++it) {
716 QString var( QString::fromUtf8( it->second.c_str() ) );
717 if ( (it->first != NATRON_OCIO_ENV_VAR_NAME) && !var.isEmpty() ) {
718 ///The variable may be nested
719 Project::expandVariable(envVar, it->second);
720 expandedVars.push_back(var);

Callers

nothing calls this directly

Calls 15

toLocalFileUrlFixedFunction · 0.85
QModelIndexClass · 0.85
sizesMethod · 0.80
atMethod · 0.80
itemTextMethod · 0.80
getProjectMethod · 0.80
removeMethod · 0.80
emptyMethod · 0.80
getNUrlsMethod · 0.80
headerMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected