Fix some missing constant usage
This commit is contained in:
parent
5e9ab4c7c7
commit
728355d202
3 changed files with 26 additions and 21 deletions
|
@ -380,6 +380,7 @@ private:
|
||||||
void redrawMapScene();
|
void redrawMapScene();
|
||||||
void redrawLayoutScene();
|
void redrawLayoutScene();
|
||||||
void refreshMapScene();
|
void refreshMapScene();
|
||||||
|
void setLayoutOnlyMode(bool layoutOnly);
|
||||||
|
|
||||||
bool checkProjectSanity();
|
bool checkProjectSanity();
|
||||||
bool loadProjectData();
|
bool loadProjectData();
|
||||||
|
|
|
@ -425,12 +425,14 @@ void MainWindow::showWindowTitle() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (editor && editor->layout) {
|
if (editor && editor->layout) {
|
||||||
ui->mainTabBar->setTabIcon(0, QIcon());
|
// For some reason (perhaps on Qt < 6?) we had to clear the icon first here or mainTabBar wouldn't display correctly.
|
||||||
|
ui->mainTabBar->setTabIcon(MainTab::Map, QIcon());
|
||||||
|
|
||||||
QPixmap pixmap = editor->layout->pixmap;
|
QPixmap pixmap = editor->layout->pixmap;
|
||||||
if (!pixmap.isNull()) {
|
if (!pixmap.isNull()) {
|
||||||
ui->mainTabBar->setTabIcon(0, QIcon(pixmap));
|
ui->mainTabBar->setTabIcon(MainTab::Map, QIcon(pixmap));
|
||||||
} else {
|
} else {
|
||||||
ui->mainTabBar->setTabIcon(0, QIcon(QStringLiteral(":/icons/map.ico")));
|
ui->mainTabBar->setTabIcon(MainTab::Map, QIcon(QStringLiteral(":/icons/map.ico")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateMapList();
|
updateMapList();
|
||||||
|
@ -801,14 +803,7 @@ void MainWindow::on_action_Close_Project_triggered() {
|
||||||
|
|
||||||
void MainWindow::unsetMap() {
|
void MainWindow::unsetMap() {
|
||||||
this->editor->unsetMap();
|
this->editor->unsetMap();
|
||||||
|
setLayoutOnlyMode(true);
|
||||||
// disable other tabs
|
|
||||||
this->ui->mainTabBar->setTabEnabled(1, false);
|
|
||||||
this->ui->mainTabBar->setTabEnabled(2, false);
|
|
||||||
this->ui->mainTabBar->setTabEnabled(3, false);
|
|
||||||
this->ui->mainTabBar->setTabEnabled(4, false);
|
|
||||||
|
|
||||||
this->ui->comboBox_LayoutSelector->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setMap, but with a visible error message in case of failure.
|
// setMap, but with a visible error message in case of failure.
|
||||||
|
@ -859,13 +854,7 @@ bool MainWindow::setMap(QString map_name, bool scroll) {
|
||||||
ui->mapList->setExpanded(groupListProxyModel->mapFromSource(mapGroupModel->indexOfMap(map_name)), false);
|
ui->mapList->setExpanded(groupListProxyModel->mapFromSource(mapGroupModel->indexOfMap(map_name)), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->ui->mainTabBar->setTabEnabled(1, true);
|
setLayoutOnlyMode(false);
|
||||||
this->ui->mainTabBar->setTabEnabled(2, true);
|
|
||||||
this->ui->mainTabBar->setTabEnabled(3, true);
|
|
||||||
this->ui->mainTabBar->setTabEnabled(4, true);
|
|
||||||
|
|
||||||
this->ui->comboBox_LayoutSelector->setEnabled(true);
|
|
||||||
|
|
||||||
this->lastSelectedEvent.clear();
|
this->lastSelectedEvent.clear();
|
||||||
|
|
||||||
refreshMapScene();
|
refreshMapScene();
|
||||||
|
@ -891,6 +880,18 @@ bool MainWindow::setMap(QString map_name, bool scroll) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These parts of the UI only make sense when editing maps.
|
||||||
|
// When editing in layout-only mode they are disabled.
|
||||||
|
void MainWindow::setLayoutOnlyMode(bool layoutOnly) {
|
||||||
|
bool mapEditingEnabled = !layoutOnly;
|
||||||
|
this->ui->mainTabBar->setTabEnabled(MainTab::Events, mapEditingEnabled);
|
||||||
|
this->ui->mainTabBar->setTabEnabled(MainTab::Header, mapEditingEnabled);
|
||||||
|
this->ui->mainTabBar->setTabEnabled(MainTab::Connections, mapEditingEnabled);
|
||||||
|
this->ui->mainTabBar->setTabEnabled(MainTab::WildPokemon, mapEditingEnabled);
|
||||||
|
|
||||||
|
this->ui->comboBox_LayoutSelector->setEnabled(mapEditingEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWindow::setLayout(QString layoutId) {
|
bool MainWindow::setLayout(QString layoutId) {
|
||||||
if (this->editor->map)
|
if (this->editor->map)
|
||||||
logInfo("Switching to a layout-only editing mode. Disabling map-related edits.");
|
logInfo("Switching to a layout-only editing mode. Disabling map-related edits.");
|
||||||
|
|
|
@ -2327,11 +2327,14 @@ bool Project::readRegionMapSections() {
|
||||||
int Project::appendMapsec(QString name) {
|
int Project::appendMapsec(QString name) {
|
||||||
// This function assumes a valid and unique name.
|
// This function assumes a valid and unique name.
|
||||||
// Will return the new index.
|
// Will return the new index.
|
||||||
int noneBefore = this->mapSectionNameToValue[projectConfig.getIdentifier(ProjectIdentifier::define_map_section_prefix) + "NONE"];
|
const QString emptyMapsecName = projectConfig.getIdentifier(ProjectIdentifier::define_map_section_prefix)
|
||||||
|
+ projectConfig.getIdentifier(ProjectIdentifier::define_map_section_empty);
|
||||||
|
|
||||||
|
int noneBefore = this->mapSectionNameToValue[emptyMapsecName];
|
||||||
this->mapSectionNameToValue[name] = noneBefore;
|
this->mapSectionNameToValue[name] = noneBefore;
|
||||||
this->mapSectionValueToName[noneBefore] = name;
|
this->mapSectionValueToName[noneBefore] = name;
|
||||||
this->mapSectionNameToValue[projectConfig.getIdentifier(ProjectIdentifier::define_map_section_prefix) + "NONE"] = noneBefore + 1;
|
this->mapSectionNameToValue[emptyMapsecName] = noneBefore + 1;
|
||||||
this->mapSectionValueToName[noneBefore + 1] = projectConfig.getIdentifier(ProjectIdentifier::define_map_section_prefix) + "NONE";
|
this->mapSectionValueToName[noneBefore + 1] = emptyMapsecName;
|
||||||
return noneBefore;
|
return noneBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue