MCPcopy Create free account
hub / github.com/IENT/YUView / savePlaylist

Method savePlaylist

YUViewLib/src/ui/ViewStateHandler.cpp:147–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void ViewStateHandler::savePlaylist(QDomElement &root)
148{
149 for (int i = 0; i < 8; i++)
150 {
151 if (playbackStateFrameIdx(i) != -1)
152 {
153 // Create a new entry for this slot
154 YUViewDomElement state = root.ownerDocument().createElement(QString("slot%1").arg(i));
155 root.appendChild(state);
156
157 // Append the frame index
158 state.appendProperiteChild("frameIdx", QString::number(playbackStateFrameIdx(i)));
159 // Append the IDs of the selected items
160 if (selectionStates[i][0] != nullptr)
161 state.appendProperiteChild("itemID1",
162 QString::number(selectionStates[i][0]->properties().id));
163 if (selectionStates[i][1] != nullptr)
164 state.appendProperiteChild("itemID2",
165 QString::number(selectionStates[i][1]->properties().id));
166 // Append the state of the split view
167 state.appendProperiteChild("centerOffsetX", QString::number(viewStates[i].centerOffset.x()));
168 state.appendProperiteChild("centerOffsetY", QString::number(viewStates[i].centerOffset.y()));
169 if (viewStates[i].splitting)
170 {
171 state.appendProperiteChild("splitting", QString("1"));
172 state.appendProperiteChild("splittingPoint", QString::number(viewStates[i].splittingPoint));
173 }
174 state.appendProperiteChild("viewMode", QString::number(viewStates[i].viewMode));
175 state.appendProperiteChild("zoomFactor", QString::number(viewStates[i].zoomFactor));
176 }
177 }
178
179 // Finally, save the current state
180 YUViewDomElement state = root.ownerDocument().createElement(QString("current"));
181 root.appendChild(state);
182
183 // Append the frame index
184 state.appendProperiteChild("frameIdx", QString::number(playback->getCurrentFrame()));
185
186 // Append the IDs of the selected items
187 auto items = playlist->getSelectedItems();
188 if (items[0] != nullptr)
189 state.appendProperiteChild("itemID1", QString::number(items[0]->properties().id));
190 if (items[1] != nullptr)
191 state.appendProperiteChild("itemID2", QString::number(items[1]->properties().id));
192
193 // Append the state of the split view
194 splitViewWidgetState viewState;
195 splitView[0]->getViewState(
196 viewState.centerOffset, viewState.zoomFactor, viewState.splittingPoint, viewState.viewMode);
197 state.appendProperiteChild("centerOffsetX", QString::number(viewState.centerOffset.x()));
198 state.appendProperiteChild("centerOffsetY", QString::number(viewState.centerOffset.y()));
199 if (viewState.splitting)
200 {
201 state.appendProperiteChild("splitting", QString("1"));
202 state.appendProperiteChild("splittingPoint", QString::number(viewState.splittingPoint));
203 }
204 state.appendProperiteChild("viewMode", QString::number(viewState.viewMode));

Callers 2

getPlaylistStringMethod · 0.45

Calls 5

appendProperiteChildMethod · 0.80
propertiesMethod · 0.80
getCurrentFrameMethod · 0.80
getSelectedItemsMethod · 0.80
getViewStateMethod · 0.80

Tested by

no test coverage detected