Skip to content

Commit

Permalink
Editor: Allow opening of multiple file paths from the open dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohlstand committed May 29, 2018
1 parent 65da2df commit 5cbaee6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Editor/main_window/file/file_open.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ void MainWindow::on_OpenFile_triggered()
return;
}

QString fileName_DATA = QFileDialog::getOpenFileName(this,
trUtf8("Open file"),GlobalSettings::openPath,
QStringList fileName_DATA = QFileDialog::getOpenFileNames(this,
trUtf8("Open file"),
GlobalSettings::openPath,
QString("All supported formats (*.lvlx *.wldx *.lvl *.wld npc-*.txt *.sav);;"
"All SMBX files (*.lvl *.wld npc-*.txt);;"
"All PGE files (*.lvlx *.wldx npc-*.txt);;"
Expand All @@ -147,9 +148,11 @@ void MainWindow::on_OpenFile_triggered()
"SMBX Game Save file (*.sav);;"
"All Files (*.*)"),0);

if(fileName_DATA==NULL) return;
if(fileName_DATA.isEmpty())
return;

OpenFile(fileName_DATA);
for(const QString &file : fileName_DATA)
OpenFile(file, true);
}

void MainWindow::OpenFile(QString FilePath, bool addToRecentList)
Expand Down Expand Up @@ -194,7 +197,7 @@ void MainWindow::OpenFile(QString FilePath, bool addToRecentList)

GlobalSettings::openPath = in_1.absoluteDir().absolutePath();

if((in_1.suffix().toLower() == "lvl")||(in_1.suffix().toLower() == "lvlx"))
if((in_1.suffix().toLower() == "lvl") || (in_1.suffix().toLower() == "lvlx"))
{
LevelData FileData;

Expand Down Expand Up @@ -236,7 +239,7 @@ void MainWindow::OpenFile(QString FilePath, bool addToRecentList)
}
}
else
if((in_1.suffix().toLower() == "wld")||(in_1.suffix().toLower() == "wldx"))
if((in_1.suffix().toLower() == "wld") || (in_1.suffix().toLower() == "wldx"))
{
WorldData FileData;
if( !FileFormats::OpenWorldFile( FilePath, FileData ) )
Expand Down
1 change: 1 addition & 0 deletions changelog.editor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Editor 0.3.1.14-1-dev
- Added showing of Background-ID in the level section backgrounds list
- Added the button into The Level Section Properties toolbox to open custom background config file
- Added ability to set default zoom on file open or create (In the Application Settings and Editor tab).
- Allow opening of multiple files by the file dialog executed from the "File -> Open" menu

Editor 0.3.1.14
- Fixed a crash on attempt to load some NPC-*.txt files with incorrect values (for example, a grid size value that equal to zero)
Expand Down

0 comments on commit 5cbaee6

Please sign in to comment.