Remove lambda due to compiler segfault on Win64

This commit is contained in:
Daniel Kamil Kozar 2020-02-09 10:16:04 +01:00
parent e4790fd15c
commit ec66ec3e42
No known key found for this signature in database
GPG Key ID: A5FB0175B3A93F03
2 changed files with 29 additions and 30 deletions

View File

@ -691,21 +691,6 @@ void TsMuxerWindow::colorizeCurrentRow(const QtvCodecInfo *codecInfo, int rowInd
updateCurrentColor(0, 0, 0, rowIndex);
}
template <typename Fn>
void TsMuxerWindow::executeOnDefaultComboForTrack(int trackRowIdx, Fn &&f)
{
auto comboBoxIdx = ui->defaultAudioTrackComboBox->findData(trackRowIdx);
if (comboBoxIdx != -1)
{
f(comboBoxIdx, ui->defaultAudioTrackCheckBox, ui->defaultAudioTrackComboBox);
}
comboBoxIdx = ui->defaultSubTrackComboBox->findData(trackRowIdx);
if (comboBoxIdx != -1)
{
f(comboBoxIdx, ui->defaultSubTrackCheckBox, ui->defaultSubTrackComboBox);
}
}
void TsMuxerWindow::addTrackToDefaultComboBox(int trackRowIdx)
{
auto codecInfo = getCodecInfo(trackRowIdx);
@ -720,21 +705,36 @@ void TsMuxerWindow::addTrackToDefaultComboBox(int trackRowIdx)
}
}
void TsMuxerWindow::removeTrackFromDefaultComboBox(QComboBox *targetComboBox, QCheckBox *targetCheckBox,
int comboBoxIdx, int trackRowIdx)
{
if (targetComboBox->currentData().toInt() == trackRowIdx)
{
targetCheckBox->setChecked(false);
}
for (int i = comboBoxIdx + 1; i < targetComboBox->count(); ++i)
{
auto curTrackIdx = targetComboBox->itemData(i).toInt();
targetComboBox->setItemData(i, curTrackIdx - 1);
}
targetComboBox->removeItem(comboBoxIdx);
updateTracksComboBox(targetComboBox);
}
void TsMuxerWindow::removeTrackFromDefaultComboBox(int trackRowIdx)
{
executeOnDefaultComboForTrack(trackRowIdx, [&](auto comboBoxIdx, auto targetCheckBox, auto targetComboBox) {
if (targetComboBox->currentData().toInt() == trackRowIdx)
{
targetCheckBox->setChecked(false);
}
for (int i = comboBoxIdx + 1; i < targetComboBox->count(); ++i)
{
auto curTrackIdx = targetComboBox->itemData(i).toInt();
targetComboBox->setItemData(i, curTrackIdx - 1);
}
targetComboBox->removeItem(comboBoxIdx);
updateTracksComboBox(targetComboBox);
});
auto comboBoxIdx = ui->defaultAudioTrackComboBox->findData(trackRowIdx);
if (comboBoxIdx != -1)
{
removeTrackFromDefaultComboBox(ui->defaultAudioTrackComboBox, ui->defaultAudioTrackCheckBox, comboBoxIdx,
trackRowIdx);
}
comboBoxIdx = ui->defaultSubTrackComboBox->findData(trackRowIdx);
if (comboBoxIdx != -1)
{
removeTrackFromDefaultComboBox(ui->defaultSubTrackComboBox, ui->defaultSubTrackCheckBox, comboBoxIdx,
trackRowIdx);
}
}
void TsMuxerWindow::updateTracksComboBox(QComboBox *comboBox)

View File

@ -138,10 +138,9 @@ class TsMuxerWindow : public QWidget
void updateCurrentColor(int dr, int dg, int db, int rowIndex);
void colorizeCurrentRow(const QtvCodecInfo* codecInfo, int rowIndex = -1);
template <typename Fn>
void executeOnDefaultComboForTrack(int trackRowIdx, Fn&& f);
void addTrackToDefaultComboBox(int trackRowIdx);
void removeTrackFromDefaultComboBox(int trackRowIdx);
void removeTrackFromDefaultComboBox(QComboBox*, QCheckBox*, int comboBoxIdx, int trackRowIdx);
void updateTracksComboBox(QComboBox*);
void moveTrackInDefaultComboBox(int oldIndex, int newIndex);
void postMoveComboBoxUpdate(QComboBox*, const QVariant& preMoveIndex, int oldIndex, int newIndex);