mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
fix media delete button deleting wrong entry
the mediaSwitches UI is sorted alphabetically while the switches data strucutre is not the previous implementation of the delete function was just using the index of the currently selected row to delete this index of the switches data structure the new implementation will try to find the correct entry and delete it
This commit is contained in:
parent
9f03264672
commit
7fef29dafb
|
|
@ -73,17 +73,23 @@ void SceneSwitcher::on_mediaRemove_clicked()
|
|||
if (!item)
|
||||
return;
|
||||
|
||||
int idx = ui->mediaSwitches->currentRow();
|
||||
if (idx == -1)
|
||||
return;
|
||||
|
||||
string mediaStr =
|
||||
item->data(Qt::UserRole).toString().toUtf8().constData();
|
||||
{
|
||||
lock_guard<mutex> lock(switcher->m);
|
||||
|
||||
auto &switches = switcher->mediaSwitches;
|
||||
switches.erase(switches.begin() + idx);
|
||||
|
||||
for (auto it = switches.begin(); it != switches.end(); ++it) {
|
||||
auto &s = *it;
|
||||
|
||||
if (s.mediaSwitchStr == mediaStr) {
|
||||
switches.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
qDeleteAll(ui->mediaSwitches->selectedItems());
|
||||
|
||||
delete item;
|
||||
}
|
||||
|
||||
void SwitcherData::checkMediaSwitch(bool &match, OBSWeakSource &scene,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user