mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
mapeditor: add extension and open vcmi folder
This commit is contained in:
parent
e00046dd70
commit
284cc3460d
@ -90,6 +90,9 @@ void MainWindow::loadUserSettings()
|
|||||||
{
|
{
|
||||||
move(position);
|
move(position);
|
||||||
}
|
}
|
||||||
|
lastSavingDir = s.value(lastDirectorySetting).toString();
|
||||||
|
if(lastSavingDir.isEmpty())
|
||||||
|
lastSavingDir = QString::fromStdString(VCMIDirs::get().userDataPath().make_preferred().string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::saveUserSettings()
|
void MainWindow::saveUserSettings()
|
||||||
@ -97,6 +100,7 @@ void MainWindow::saveUserSettings()
|
|||||||
QSettings s(Ui::teamName, Ui::appName);
|
QSettings s(Ui::teamName, Ui::appName);
|
||||||
s.setValue(mainWindowSizeSetting, size());
|
s.setValue(mainWindowSizeSetting, size());
|
||||||
s.setValue(mainWindowPositionSetting, pos());
|
s.setValue(mainWindowPositionSetting, pos());
|
||||||
|
s.setValue(lastDirectorySetting, lastSavingDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::parseCommandLine(ExtractionOptions & extractionOptions)
|
void MainWindow::parseCommandLine(ExtractionOptions & extractionOptions)
|
||||||
@ -382,7 +386,7 @@ void MainWindow::on_actionOpen_triggered()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto filenameSelect = QFileDialog::getOpenFileName(this, tr("Open map"),
|
auto filenameSelect = QFileDialog::getOpenFileName(this, tr("Open map"),
|
||||||
QString::fromStdString(VCMIDirs::get().userCachePath().make_preferred().string()),
|
QString::fromStdString(VCMIDirs::get().userDataPath().make_preferred().string()),
|
||||||
tr("All supported maps (*.vmap *.h3m);;VCMI maps(*.vmap);;HoMM3 maps(*.h3m)"));
|
tr("All supported maps (*.vmap *.h3m);;VCMI maps(*.vmap);;HoMM3 maps(*.h3m)"));
|
||||||
if(filenameSelect.isEmpty())
|
if(filenameSelect.isEmpty())
|
||||||
return;
|
return;
|
||||||
@ -439,11 +443,13 @@ void MainWindow::on_actionSave_as_triggered()
|
|||||||
if(filenameSelect.isNull())
|
if(filenameSelect.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(filenameSelect == filename)
|
QFileInfo fileInfo(filenameSelect);
|
||||||
return;
|
lastSavingDir = fileInfo.dir().path();
|
||||||
|
|
||||||
|
if(fileInfo.suffix().toLower() != "vmap")
|
||||||
|
filenameSelect += ".vmap";
|
||||||
|
|
||||||
filename = filenameSelect;
|
filename = filenameSelect;
|
||||||
lastSavingDir = filenameSelect.remove(QUrl(filenameSelect).fileName());
|
|
||||||
|
|
||||||
saveMap();
|
saveMap();
|
||||||
}
|
}
|
||||||
@ -1171,7 +1177,7 @@ void MainWindow::on_actionTranslations_triggered()
|
|||||||
void MainWindow::on_actionh3m_converter_triggered()
|
void MainWindow::on_actionh3m_converter_triggered()
|
||||||
{
|
{
|
||||||
auto mapFiles = QFileDialog::getOpenFileNames(this, tr("Select maps to convert"),
|
auto mapFiles = QFileDialog::getOpenFileNames(this, tr("Select maps to convert"),
|
||||||
QString::fromStdString(VCMIDirs::get().userCachePath().make_preferred().string()),
|
QString::fromStdString(VCMIDirs::get().userDataPath().make_preferred().string()),
|
||||||
tr("HoMM3 maps(*.h3m)"));
|
tr("HoMM3 maps(*.h3m)"));
|
||||||
if(mapFiles.empty())
|
if(mapFiles.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -27,6 +27,7 @@ class MainWindow : public QMainWindow
|
|||||||
|
|
||||||
const QString mainWindowSizeSetting = "MainWindow/Size";
|
const QString mainWindowSizeSetting = "MainWindow/Size";
|
||||||
const QString mainWindowPositionSetting = "MainWindow/Position";
|
const QString mainWindowPositionSetting = "MainWindow/Position";
|
||||||
|
const QString lastDirectorySetting = "MainWindow/Directory";
|
||||||
|
|
||||||
#ifdef ENABLE_QT_TRANSLATIONS
|
#ifdef ENABLE_QT_TRANSLATIONS
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
|
Loading…
Reference in New Issue
Block a user