Refactor: Simplify export zone file action and use lambda expressions.
This commit is contained in:
parent
d11783ebfc
commit
9a5ae3bf51
@ -490,12 +490,12 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
});
|
});
|
||||||
QAction *exportZoneFileAction = new QAction("Export Zone File");
|
QAction *exportZoneFileAction = new QAction("Export Zone File");
|
||||||
exportSubmenu->addAction(exportZoneFileAction);
|
exportSubmenu->addAction(exportZoneFileAction);
|
||||||
connect(exportZoneFileAction, &QAction::triggered, this, [fastFile](bool checked) {
|
connect(exportZoneFileAction, &QAction::triggered, this, [](bool checked) {
|
||||||
Q_UNUSED(checked);
|
Q_UNUSED(checked);
|
||||||
|
|
||||||
const QString zoneFilePath = QFileDialog::getSaveFileName(
|
// const QString zoneFilePath = QFileDialog::getSaveFileName(
|
||||||
nullptr, "Export Zone File...", QDir::currentPath(),
|
// nullptr, "Export Zone File...", QDir::currentPath(),
|
||||||
"Zone File (*.zone);;All Files(*.*)");
|
// "Zone File (*.zone);;All Files(*.*)");
|
||||||
//fastFile->GetZoneFile()->SaveZoneFile(zoneFilePath);
|
//fastFile->GetZoneFile()->SaveZoneFile(zoneFilePath);
|
||||||
});
|
});
|
||||||
} else if (activeText.contains(".zone")) {
|
} else if (activeText.contains(".zone")) {
|
||||||
@ -508,7 +508,7 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
QMenu *exportSubmenu = new QMenu("Export...", this);
|
QMenu *exportSubmenu = new QMenu("Export...", this);
|
||||||
contextMenu->addMenu(exportSubmenu);
|
contextMenu->addMenu(exportSubmenu);
|
||||||
|
|
||||||
const ZoneFile* zoneFile = mZoneFiles[fileStem];
|
//const ZoneFile* zoneFile = mZoneFiles[fileStem];
|
||||||
|
|
||||||
QAction *exportZoneFileAction = new QAction("Export Zone File");
|
QAction *exportZoneFileAction = new QAction("Export Zone File");
|
||||||
exportSubmenu->addAction(exportZoneFileAction);
|
exportSubmenu->addAction(exportZoneFileAction);
|
||||||
@ -530,7 +530,7 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (parentItem && parentItem != invisibleRootItem() && parentItem->text(0).contains(".zone")) {
|
if (parentItem && parentItem != invisibleRootItem() && parentItem->text(0).contains(".zone")) {
|
||||||
const QString fileStem = parentItem->text(0).section('.', 0, 0);
|
//const QString fileStem = parentItem->text(0).section('.', 0, 0);
|
||||||
// QVector<LoadedSound> LoadedSounds = mZoneFiles[fileStem]->GetAssetMap().sounds;
|
// QVector<LoadedSound> LoadedSounds = mZoneFiles[fileStem]->GetAssetMap().sounds;
|
||||||
// for (LoadedSound LoadedSound : LoadedSounds) {
|
// for (LoadedSound LoadedSound : LoadedSounds) {
|
||||||
// for (Sound sound : LoadedSound.sounds) {
|
// for (Sound sound : LoadedSound.sounds) {
|
||||||
@ -577,14 +577,14 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
}
|
}
|
||||||
if (parentItem && parentItem != invisibleRootItem() && parentItem->text(0).contains(".zone")) {
|
if (parentItem && parentItem != invisibleRootItem() && parentItem->text(0).contains(".zone")) {
|
||||||
const QString fileStem = parentItem->text(0).section('.', 0, 0);
|
const QString fileStem = parentItem->text(0).section('.', 0, 0);
|
||||||
auto zoneFile = mZoneFiles[fileStem];
|
//auto zoneFile = mZoneFiles[fileStem];
|
||||||
|
|
||||||
QMenu *exportSubmenu = new QMenu("Export...", this);
|
QMenu *exportSubmenu = new QMenu("Export...", this);
|
||||||
contextMenu->addMenu(exportSubmenu);
|
contextMenu->addMenu(exportSubmenu);
|
||||||
|
|
||||||
QAction *exportAllWAVAction = new QAction("Export ALL as WAV Files");
|
QAction *exportAllWAVAction = new QAction("Export ALL as WAV Files");
|
||||||
exportSubmenu->addAction(exportAllWAVAction);
|
exportSubmenu->addAction(exportAllWAVAction);
|
||||||
connect(exportAllWAVAction, &QAction::triggered, this, [zoneFile](bool checked) {
|
connect(exportAllWAVAction, &QAction::triggered, this, [](bool checked) {
|
||||||
Q_UNUSED(checked);
|
Q_UNUSED(checked);
|
||||||
|
|
||||||
// for (LoadedSound LoadedSound : zoneFile->GetAssetMap().sounds) {
|
// for (LoadedSound LoadedSound : zoneFile->GetAssetMap().sounds) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user