mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Merge pull request #3986 from Laserlicht/mapeditor_improvements
Mapeditor improvements
This commit is contained in:
@@ -40,6 +40,9 @@ ArmyWidget::ArmyWidget(CArmedInstance & a, QWidget *parent) :
|
||||
uiSlots[i]->insertItem(c + 1, creature->getNamePluralTranslated().c_str());
|
||||
uiSlots[i]->setItemData(c + 1, creature->getIndex());
|
||||
}
|
||||
|
||||
uiSlots[i]->completer()->setCompletionMode(QCompleter::PopupCompletion);
|
||||
uiSlots[i]->completer()->setFilterMode(Qt::MatchContains);
|
||||
}
|
||||
|
||||
ui->formationTight->setChecked(true);
|
||||
|
@@ -34,6 +34,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
@@ -44,6 +47,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
@@ -54,6 +60,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
@@ -64,6 +73,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
@@ -74,6 +86,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
@@ -84,6 +99,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@@ -94,6 +112,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
|
@@ -13,6 +13,10 @@
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
||||
QApplication vcmieditor(argc, argv);
|
||||
MainWindow mainWindow;
|
||||
return vcmieditor.exec();
|
||||
|
@@ -90,6 +90,9 @@ void MainWindow::loadUserSettings()
|
||||
{
|
||||
move(position);
|
||||
}
|
||||
lastSavingDir = s.value(lastDirectorySetting).toString();
|
||||
if(lastSavingDir.isEmpty())
|
||||
lastSavingDir = QString::fromStdString(VCMIDirs::get().userDataPath().make_preferred().string());
|
||||
}
|
||||
|
||||
void MainWindow::saveUserSettings()
|
||||
@@ -97,6 +100,7 @@ void MainWindow::saveUserSettings()
|
||||
QSettings s(Ui::teamName, Ui::appName);
|
||||
s.setValue(mainWindowSizeSetting, size());
|
||||
s.setValue(mainWindowPositionSetting, pos());
|
||||
s.setValue(lastDirectorySetting, lastSavingDir);
|
||||
}
|
||||
|
||||
void MainWindow::parseCommandLine(ExtractionOptions & extractionOptions)
|
||||
@@ -382,7 +386,7 @@ void MainWindow::on_actionOpen_triggered()
|
||||
return;
|
||||
|
||||
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)"));
|
||||
if(filenameSelect.isEmpty())
|
||||
return;
|
||||
@@ -439,11 +443,13 @@ void MainWindow::on_actionSave_as_triggered()
|
||||
if(filenameSelect.isNull())
|
||||
return;
|
||||
|
||||
if(filenameSelect == filename)
|
||||
return;
|
||||
QFileInfo fileInfo(filenameSelect);
|
||||
lastSavingDir = fileInfo.dir().path();
|
||||
|
||||
if(fileInfo.suffix().toLower() != "vmap")
|
||||
filenameSelect += ".vmap";
|
||||
|
||||
filename = filenameSelect;
|
||||
lastSavingDir = filenameSelect.remove(QUrl(filenameSelect).fileName());
|
||||
|
||||
saveMap();
|
||||
}
|
||||
@@ -1171,7 +1177,7 @@ void MainWindow::on_actionTranslations_triggered()
|
||||
void MainWindow::on_actionh3m_converter_triggered()
|
||||
{
|
||||
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)"));
|
||||
if(mapFiles.empty())
|
||||
return;
|
||||
|
@@ -27,6 +27,7 @@ class MainWindow : public QMainWindow
|
||||
|
||||
const QString mainWindowSizeSetting = "MainWindow/Size";
|
||||
const QString mainWindowPositionSetting = "MainWindow/Position";
|
||||
const QString lastDirectorySetting = "MainWindow/Directory";
|
||||
|
||||
#ifdef ENABLE_QT_TRANSLATIONS
|
||||
QTranslator translator;
|
||||
|
Reference in New Issue
Block a user