update ui so that map and events tabs share widgets
- use a programmatically created QTabBar to switch between pages of stacked widget - use stacked widget to display selected objects and metatiles frames - remove unique map events tab this gives access to the toolbuttons while editing events (not functional yet)
This commit is contained in:
parent
c0674d9676
commit
fa42beac1d
5 changed files with 2179 additions and 2362 deletions
4493
forms/mainwindow.ui
4493
forms/mainwindow.ui
File diff suppressed because it is too large
Load diff
|
@ -49,7 +49,7 @@ public:
|
|||
void setRecentMap(QString map);
|
||||
void setMapSortOrder(MapSortOrder order);
|
||||
void setPrettyCursors(bool enabled);
|
||||
void setGeometry(QByteArray, QByteArray, QByteArray, QByteArray, QByteArray);
|
||||
void setGeometry(QByteArray, QByteArray, QByteArray, QByteArray);
|
||||
void setCollisionOpacity(int opacity);
|
||||
void setMetatilesZoom(int zoom);
|
||||
void setShowPlayerView(bool enabled);
|
||||
|
|
|
@ -78,7 +78,7 @@ private slots:
|
|||
void on_actionMonitor_Project_Files_triggered(bool checked);
|
||||
void on_actionUse_Poryscript_triggered(bool checked);
|
||||
|
||||
void on_tabWidget_currentChanged(int index);
|
||||
void on_mainTabBar_tabBarClicked(int index);
|
||||
|
||||
void on_actionUndo_triggered();
|
||||
void on_actionRedo_triggered();
|
||||
|
|
|
@ -127,8 +127,6 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
|||
this->windowState = bytesFromString(value);
|
||||
} else if (key == "map_splitter_state") {
|
||||
this->mapSplitterState = bytesFromString(value);
|
||||
} else if (key == "events_splitter_state") {
|
||||
this->eventsSlpitterState = bytesFromString(value);
|
||||
} else if (key == "main_splitter_state") {
|
||||
this->mainSplitterState = bytesFromString(value);
|
||||
} else if (key == "collision_opacity") {
|
||||
|
@ -190,7 +188,6 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
|
|||
map.insert("window_geometry", stringFromByteArray(this->windowGeometry));
|
||||
map.insert("window_state", stringFromByteArray(this->windowState));
|
||||
map.insert("map_splitter_state", stringFromByteArray(this->mapSplitterState));
|
||||
map.insert("events_splitter_state", stringFromByteArray(this->eventsSlpitterState));
|
||||
map.insert("main_splitter_state", stringFromByteArray(this->mainSplitterState));
|
||||
map.insert("collision_opacity", QString("%1").arg(this->collisionOpacity));
|
||||
map.insert("metatiles_zoom", QString("%1").arg(this->metatilesZoom));
|
||||
|
@ -245,12 +242,11 @@ void PorymapConfig::setMonitorFiles(bool monitor) {
|
|||
this->save();
|
||||
}
|
||||
|
||||
void PorymapConfig::setGeometry(QByteArray windowGeometry_, QByteArray windowState_, QByteArray mapSplitterState_,
|
||||
QByteArray eventsSlpitterState_, QByteArray mainSplitterState_) {
|
||||
void PorymapConfig::setGeometry(QByteArray windowGeometry_, QByteArray windowState_,
|
||||
QByteArray mapSplitterState_, QByteArray mainSplitterState_) {
|
||||
this->windowGeometry = windowGeometry_;
|
||||
this->windowState = windowState_;
|
||||
this->mapSplitterState = mapSplitterState_;
|
||||
this->eventsSlpitterState = eventsSlpitterState_;
|
||||
this->mainSplitterState = mainSplitterState_;
|
||||
this->save();
|
||||
}
|
||||
|
@ -305,7 +301,6 @@ QMap<QString, QByteArray> PorymapConfig::getGeometry() {
|
|||
geometry.insert("window_geometry", this->windowGeometry);
|
||||
geometry.insert("window_state", this->windowState);
|
||||
geometry.insert("map_splitter_state", this->mapSplitterState);
|
||||
geometry.insert("events_splitter_state", this->eventsSlpitterState);
|
||||
geometry.insert("main_splitter_state", this->mainSplitterState);
|
||||
|
||||
return geometry;
|
||||
|
|
|
@ -79,6 +79,15 @@ void MainWindow::initExtraShortcuts() {
|
|||
}
|
||||
|
||||
void MainWindow::initCustomUI() {
|
||||
// Set up the tab bar
|
||||
ui->mainTabBar->addTab("Map"); // add the icon
|
||||
ui->mainTabBar->setTabIcon(0, QIcon(QStringLiteral(":/icons/map.ico")));
|
||||
ui->mainTabBar->addTab("Events");
|
||||
ui->mainTabBar->addTab("Header");
|
||||
ui->mainTabBar->addTab("Connections");
|
||||
ui->mainTabBar->addTab("Wild Pokemon"); // add the icon
|
||||
ui->mainTabBar->setTabIcon(4, QIcon(QStringLiteral(":/icons/tall_grass.ico")));
|
||||
|
||||
// Right-clicking on items in the map list tree view brings up a context menu.
|
||||
ui->mapList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->mapList, SIGNAL(customContextMenuRequested(const QPoint &)),
|
||||
|
@ -152,11 +161,14 @@ void MainWindow::initMapSortOrder() {
|
|||
|
||||
void MainWindow::setProjectSpecificUIVisibility()
|
||||
{
|
||||
ui->tabWidget->setTabEnabled(4, projectConfig.getEncounterJsonActive());
|
||||
|
||||
ui->actionUse_Encounter_Json->setChecked(projectConfig.getEncounterJsonActive());
|
||||
ui->actionUse_Poryscript->setChecked(projectConfig.getUsePoryScript());
|
||||
|
||||
if (!projectConfig.getEncounterJsonActive()) {
|
||||
ui->mainTabBar->removeTab(4);
|
||||
ui->mainStackedWidget->removeWidget(ui->mainStackedWidget->widget(4));
|
||||
}
|
||||
|
||||
switch (projectConfig.getBaseGameVersion())
|
||||
{
|
||||
case BaseGameVersion::pokeruby:
|
||||
|
@ -264,7 +276,6 @@ void MainWindow::restoreWindowState() {
|
|||
this->restoreGeometry(geometry.value("window_geometry"));
|
||||
this->restoreState(geometry.value("window_state"));
|
||||
this->ui->splitter_map->restoreState(geometry.value("map_splitter_state"));
|
||||
this->ui->splitter_events->restoreState(geometry.value("events_splitter_state"));
|
||||
this->ui->splitter_main->restoreState(geometry.value("main_splitter_state"));
|
||||
}
|
||||
|
||||
|
@ -444,7 +455,7 @@ void MainWindow::redrawMapScene()
|
|||
if (!editor->displayMap())
|
||||
return;
|
||||
|
||||
on_tabWidget_currentChanged(ui->tabWidget->currentIndex());
|
||||
on_mainTabBar_tabBarClicked(ui->mainStackedWidget->currentIndex());
|
||||
|
||||
double base = editor->scale_base;
|
||||
double exp = editor->scale_exp;
|
||||
|
@ -455,11 +466,7 @@ void MainWindow::redrawMapScene()
|
|||
ui->graphicsView_Map->setScene(editor->scene);
|
||||
ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
|
||||
ui->graphicsView_Map->setFixedSize(width, height);
|
||||
|
||||
ui->graphicsView_Objects_Map->setScene(editor->scene);
|
||||
ui->graphicsView_Objects_Map->setSceneRect(editor->scene->sceneRect());
|
||||
ui->graphicsView_Objects_Map->setFixedSize(width, height);
|
||||
ui->graphicsView_Objects_Map->editor = editor;
|
||||
ui->graphicsView_Map->editor = editor;
|
||||
|
||||
ui->graphicsView_Connections->setScene(editor->scene);
|
||||
ui->graphicsView_Connections->setSceneRect(editor->scene->sceneRect());
|
||||
|
@ -1203,11 +1210,16 @@ void MainWindow::on_action_Exit_triggered()
|
|||
QApplication::quit();
|
||||
}
|
||||
|
||||
void MainWindow::on_tabWidget_currentChanged(int index)
|
||||
void MainWindow::on_mainTabBar_tabBarClicked(int index)
|
||||
{
|
||||
int tabIndexToStackIndex[5] = {0, 0, 1, 2, 3};
|
||||
ui->mainStackedWidget->setCurrentIndex(tabIndexToStackIndex[index]);
|
||||
|
||||
if (index == 0) {
|
||||
ui->stackedWidget_MapEvents->setCurrentIndex(0);
|
||||
on_tabWidget_2_currentChanged(ui->tabWidget_2->currentIndex());
|
||||
} else if (index == 1) {
|
||||
ui->stackedWidget_MapEvents->setCurrentIndex(1);
|
||||
editor->setEditingObjects();
|
||||
} else if (index == 3) {
|
||||
editor->setEditingConnections();
|
||||
|
@ -1318,13 +1330,11 @@ void MainWindow::scaleMapView(int s) {
|
|||
double sfactor = pow(base,s);
|
||||
|
||||
ui->graphicsView_Map->scale(sfactor,sfactor);
|
||||
ui->graphicsView_Objects_Map->scale(sfactor,sfactor);
|
||||
ui->graphicsView_Connections->scale(sfactor,sfactor);
|
||||
|
||||
int width = static_cast<int>(ceil((editor->scene->width()) * pow(base,exp))) + 2;
|
||||
int height = static_cast<int>(ceil((editor->scene->height()) * pow(base,exp))) + 2;
|
||||
ui->graphicsView_Map->setFixedSize(width, height);
|
||||
ui->graphicsView_Objects_Map->setFixedSize(width, height);
|
||||
ui->graphicsView_Connections->setFixedSize(width, height);
|
||||
}
|
||||
}
|
||||
|
@ -2512,7 +2522,6 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||
this->saveGeometry(),
|
||||
this->saveState(),
|
||||
this->ui->splitter_map->saveState(),
|
||||
this->ui->splitter_events->saveState(),
|
||||
this->ui->splitter_main->saveState()
|
||||
);
|
||||
porymapConfig.save();
|
||||
|
|
Loading…
Reference in a new issue