MCPcopy Create free account
hub / github.com/clementgallet/libTAS / pasteInputsInRange

Method pasteInputsInRange

src/program/ui/InputEditorModel.cpp:901–926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899}
900
901void InputEditorModel::pasteInputsInRange(int row, int count)
902{
903 /* Rewind to past frame if needed */
904 if (row < static_cast<int>(context->framecount)) {
905 bool ret = rewind(row);
906 if (!ret) {
907 startHighlight(row, row+count-1, 0, columnCount()-1, false);
908 return;
909 }
910 }
911
912 QClipboard *clipboard = QGuiApplication::clipboard();
913 std::istringstream inputString(clipboard->text().toStdString());
914
915 std::vector<AllInputs> paste_ais;
916 InputSerialization::readInputs(inputString, paste_ais);
917
918 if (paste_ais.empty())
919 return;
920
921 /* Update the movie by ranges of pasted inputs */
922 for (int i = 0; i < count; i+=paste_ais.size()) {
923 size_t range_size = std::min(paste_ais.size(), (size_t)(count-i));
924 movie->inputs->editInputs(paste_ais, row+i, range_size);
925 }
926}
927
928int InputEditorModel::pasteInsertInputs(int row)
929{

Callers 1

pasteInputsMethod · 0.80

Calls 4

textMethod · 0.80
editInputsMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected