From 8de1d4c3e5ec65fc967b73f10f420bd0d82a7da7 Mon Sep 17 00:00:00 2001 From: tetektoza Date: Wed, 25 Oct 2023 16:40:36 +0200 Subject: [PATCH] Cleanup: Rename trn1/trn2 instances to trn/trnUnique Cleanup patch - makes the naming a lot clearer. --- source/mainwindow.cpp | 296 +++++++++++++++++++++--------------------- source/mainwindow.h | 42 +++--- source/mainwindow.ui | 40 +++--- 3 files changed, 189 insertions(+), 189 deletions(-) diff --git a/source/mainwindow.cpp b/source/mainwindow.cpp index 0a3d6138..fb77ea8a 100644 --- a/source/mainwindow.cpp +++ b/source/mainwindow.cpp @@ -110,33 +110,33 @@ MainWindow::~MainWindow() void MainWindow::setPal(QString path) { this->pal = this->pals[path]; - this->trn1->setPalette(this->pal); - this->trn1->refreshResultingPalette(); - this->trn2->refreshResultingPalette(); + this->trnUnique->setPalette(this->pal); + this->trnUnique->refreshResultingPalette(); + this->trn->refreshResultingPalette(); this->palWidget->setPal(this->pal); } -void MainWindow::setTrn1(QString path) +void MainWindow::setTrnUnique(QString path) { - this->trn1 = this->trn1s[path]; - this->trn1->setPalette(this->pal); - this->trn1->refreshResultingPalette(); - this->trn2->setPalette(this->trn1->getResultingPalette()); - this->trn2->refreshResultingPalette(); + this->trnUnique = this->trnsUnique[path]; + this->trnUnique->setPalette(this->pal); + this->trnUnique->refreshResultingPalette(); + this->trn->setPalette(this->trnUnique->getResultingPalette()); + this->trn->refreshResultingPalette(); - this->trn1Widget->setTrn(this->trn1); + this->trnUniqueWidget->setTrn(this->trnUnique); } -void MainWindow::setTrn2(QString path) +void MainWindow::setTrn(QString path) { - this->trn2 = this->trn2s[path]; - this->trn2->setPalette(this->trn1->getResultingPalette()); - this->trn2->refreshResultingPalette(); + this->trn = this->trns[path]; + this->trn->setPalette(this->trnUnique->getResultingPalette()); + this->trn->refreshResultingPalette(); - this->gfx->setPalette(this->trn2->getResultingPalette()); + this->gfx->setPalette(this->trn->getResultingPalette()); - this->trn2Widget->setTrn(this->trn2); + this->trnWidget->setTrn(this->trn); } QString MainWindow::getLastFilePath() @@ -186,7 +186,7 @@ bool MainWindow::loadPal(QString palFilePath) return true; } -bool MainWindow::loadTrn1(QString trnFilePath) +bool MainWindow::loadTrnUnique(QString trnFilePath) { QFileInfo trnFileInfo(trnFilePath); // QString path = trnFileInfo.absoluteFilePath(); @@ -200,14 +200,14 @@ bool MainWindow::loadTrn1(QString trnFilePath) return false; } - if (this->trn1s.contains(path)) - delete this->trn1s[path]; - this->trn1s[path] = newTrn; - this->trn1Widget->addPath(path, name); + if (this->trnsUnique.contains(path)) + delete this->trnsUnique[path]; + this->trnsUnique[path] = newTrn; + this->trnUniqueWidget->addPath(path, name); return true; } -bool MainWindow::loadTrn2(QString trnFilePath) +bool MainWindow::loadTrn(QString trnFilePath) { QFileInfo trnFileInfo(trnFilePath); // QString path = trnFileInfo.absoluteFilePath(); @@ -221,10 +221,10 @@ bool MainWindow::loadTrn2(QString trnFilePath) return false; } - if (this->trn2s.contains(path)) - delete this->trn2s[path]; - this->trn2s[path] = newTrn; - this->trn2Widget->addPath(path, name); + if (this->trns.contains(path)) + delete this->trns[path]; + this->trns[path] = newTrn; + this->trnWidget->addPath(path, name); return true; } @@ -248,40 +248,40 @@ void MainWindow::paletteWidget_callback(PaletteWidget *widget, PWIDGET_CALLBACK_ this->on_actionClose_PAL_triggered(); break; } - } else if (widget == this->trn1Widget) { + } else if (widget == this->trnUniqueWidget) { switch (type) { case PWIDGET_CALLBACK_TYPE::PWIDGET_CALLBACK_NEW: - this->on_actionNew_Translation_1_triggered(); + this->on_actionNew_Unique_Translation_triggered(); break; case PWIDGET_CALLBACK_TYPE::PWIDGET_CALLBACK_OPEN: - this->on_actionOpen_Translation_1_triggered(); + this->on_actionOpen_Unique_Translation_triggered(); break; case PWIDGET_CALLBACK_TYPE::PWIDGET_CALLBACK_SAVE: - this->on_actionSave_Translation_1_triggered(); + this->on_actionSave_Unique_Translation_triggered(); break; case PWIDGET_CALLBACK_TYPE::PWIDGET_CALLBACK_SAVEAS: - this->on_actionSave_Translation_1_as_triggered(); + this->on_actionSave_Unique_Translation_as_triggered(); break; case PWIDGET_CALLBACK_TYPE::PWIDGET_CALLBACK_CLOSE: - this->on_actionClose_Translation_1_triggered(); + this->on_actionClose_Unique_Translation_triggered(); break; } - } else if (widget == this->trn2Widget) { + } else if (widget == this->trnWidget) { switch (type) { case PWIDGET_CALLBACK_TYPE::PWIDGET_CALLBACK_NEW: - this->on_actionNew_Translation_2_triggered(); + this->on_actionNew_Translation_triggered(); break; case PWIDGET_CALLBACK_TYPE::PWIDGET_CALLBACK_OPEN: - this->on_actionOpen_Translation_2_triggered(); + this->on_actionOpen_Translation_triggered(); break; case PWIDGET_CALLBACK_TYPE::PWIDGET_CALLBACK_SAVE: - this->on_actionSave_Translation_2_triggered(); + this->on_actionSave_Translation_triggered(); break; case PWIDGET_CALLBACK_TYPE::PWIDGET_CALLBACK_SAVEAS: - this->on_actionSave_Translation_2_as_triggered(); + this->on_actionSave_Translation_as_triggered(); break; case PWIDGET_CALLBACK_TYPE::PWIDGET_CALLBACK_CLOSE: - this->on_actionClose_Translation_2_triggered(); + this->on_actionClose_Translation_triggered(); break; } } @@ -488,12 +488,12 @@ void MainWindow::openFile(const OpenAsParam ¶ms) // Loading default null.trn D1Trn *newTrn = new D1Trn(this->pal); newTrn->load(D1Trn::IDENTITY_PATH); - this->trn1s[D1Trn::IDENTITY_PATH] = newTrn; - this->trn1 = newTrn; - newTrn = new D1Trn(this->trn1->getResultingPalette()); + this->trnsUnique[D1Trn::IDENTITY_PATH] = newTrn; + this->trnUnique = newTrn; + newTrn = new D1Trn(this->trnUnique->getResultingPalette()); newTrn->load(D1Trn::IDENTITY_PATH); - this->trn2s[D1Trn::IDENTITY_PATH] = newTrn; - this->trn2 = newTrn; + this->trns[D1Trn::IDENTITY_PATH] = newTrn; + this->trn = newTrn; QFileInfo celFileInfo = QFileInfo(openFilePath); @@ -518,7 +518,7 @@ void MainWindow::openFile(const OpenAsParam ¶ms) } this->gfx = new D1Gfx(); - this->gfx->setPalette(this->trn2->getResultingPalette()); + this->gfx->setPalette(this->trn->getResultingPalette()); if (isTileset) { // Loading SOL this->sol = new D1Sol(); @@ -577,41 +577,41 @@ void MainWindow::openFile(const OpenAsParam ¶ms) // Add palette widgets for PAL and TRNs this->palWidget = new PaletteWidget(this->undoStack, "Palette"); - this->trn2Widget = new PaletteWidget(this->undoStack, "Translation"); - this->trn1Widget = new PaletteWidget(this->undoStack, "Unique translation"); + this->trnWidget = new PaletteWidget(this->undoStack, "Translation"); + this->trnUniqueWidget = new PaletteWidget(this->undoStack, "Unique translation"); this->ui->palFrame->layout()->addWidget(this->palWidget); - this->ui->palFrame->layout()->addWidget(this->trn2Widget); - this->ui->palFrame->layout()->addWidget(this->trn1Widget); + this->ui->palFrame->layout()->addWidget(this->trnWidget); + this->ui->palFrame->layout()->addWidget(this->trnUniqueWidget); // Configuration update triggers refresh of the palette widgets QObject::connect(&this->settingsDialog, &SettingsDialog::configurationSaved, this->palWidget, &PaletteWidget::reloadConfig); - QObject::connect(&this->settingsDialog, &SettingsDialog::configurationSaved, this->trn1Widget, &PaletteWidget::reloadConfig); - QObject::connect(&this->settingsDialog, &SettingsDialog::configurationSaved, this->trn2Widget, &PaletteWidget::reloadConfig); + QObject::connect(&this->settingsDialog, &SettingsDialog::configurationSaved, this->trnUniqueWidget, &PaletteWidget::reloadConfig); + QObject::connect(&this->settingsDialog, &SettingsDialog::configurationSaved, this->trnWidget, &PaletteWidget::reloadConfig); QObject::connect(&this->settingsDialog, &SettingsDialog::configurationSaved, this->palWidget, &PaletteWidget::refresh); // Palette and translation file selection // When a .pal or .trn file is selected in the PaletteWidget update the pal or trn QObject::connect(this->palWidget, &PaletteWidget::pathSelected, this, &MainWindow::setPal); - QObject::connect(this->trn1Widget, &PaletteWidget::pathSelected, this, &MainWindow::setTrn1); - QObject::connect(this->trn2Widget, &PaletteWidget::pathSelected, this, &MainWindow::setTrn2); + QObject::connect(this->trnUniqueWidget, &PaletteWidget::pathSelected, this, &MainWindow::setTrnUnique); + QObject::connect(this->trnWidget, &PaletteWidget::pathSelected, this, &MainWindow::setTrn); // Refresh PAL/TRN view chain - QObject::connect(this->palWidget, &PaletteWidget::refreshed, this->trn1Widget, &PaletteWidget::refresh); - QObject::connect(this->trn1Widget, &PaletteWidget::refreshed, this->trn2Widget, &PaletteWidget::refresh); + QObject::connect(this->palWidget, &PaletteWidget::refreshed, this->trnUniqueWidget, &PaletteWidget::refresh); + QObject::connect(this->trnUniqueWidget, &PaletteWidget::refreshed, this->trnWidget, &PaletteWidget::refresh); // Translation color selection - QObject::connect(this->palWidget, &PaletteWidget::colorsSelected, this->trn2Widget, &PaletteWidget::checkTranslationsSelection); - QObject::connect(this->trn2Widget, &PaletteWidget::colorsSelected, this->trn1Widget, &PaletteWidget::checkTranslationsSelection); - QObject::connect(this->trn2Widget, &PaletteWidget::displayAllRootColors, this->palWidget, &PaletteWidget::temporarilyDisplayAllColors); - QObject::connect(this->trn1Widget, &PaletteWidget::displayAllRootColors, this->trn2Widget, &PaletteWidget::temporarilyDisplayAllColors); - QObject::connect(this->trn2Widget, &PaletteWidget::displayRootInformation, this->palWidget, &PaletteWidget::displayInfo); - QObject::connect(this->trn1Widget, &PaletteWidget::displayRootInformation, this->trn2Widget, &PaletteWidget::displayInfo); - QObject::connect(this->trn2Widget, &PaletteWidget::displayRootBorder, this->palWidget, &PaletteWidget::displayBorder); - QObject::connect(this->trn1Widget, &PaletteWidget::displayRootBorder, this->trn2Widget, &PaletteWidget::displayBorder); - QObject::connect(this->trn2Widget, &PaletteWidget::clearRootInformation, this->palWidget, &PaletteWidget::clearInfo); - QObject::connect(this->trn1Widget, &PaletteWidget::clearRootInformation, this->trn2Widget, &PaletteWidget::clearInfo); - QObject::connect(this->trn2Widget, &PaletteWidget::clearRootBorder, this->palWidget, &PaletteWidget::clearBorder); - QObject::connect(this->trn1Widget, &PaletteWidget::clearRootBorder, this->trn2Widget, &PaletteWidget::clearBorder); + QObject::connect(this->palWidget, &PaletteWidget::colorsSelected, this->trnWidget, &PaletteWidget::checkTranslationsSelection); + QObject::connect(this->trnWidget, &PaletteWidget::colorsSelected, this->trnUniqueWidget, &PaletteWidget::checkTranslationsSelection); + QObject::connect(this->trnWidget, &PaletteWidget::displayAllRootColors, this->palWidget, &PaletteWidget::temporarilyDisplayAllColors); + QObject::connect(this->trnUniqueWidget, &PaletteWidget::displayAllRootColors, this->trnWidget, &PaletteWidget::temporarilyDisplayAllColors); + QObject::connect(this->trnWidget, &PaletteWidget::displayRootInformation, this->palWidget, &PaletteWidget::displayInfo); + QObject::connect(this->trnUniqueWidget, &PaletteWidget::displayRootInformation, this->trnWidget, &PaletteWidget::displayInfo); + QObject::connect(this->trnWidget, &PaletteWidget::displayRootBorder, this->palWidget, &PaletteWidget::displayBorder); + QObject::connect(this->trnUniqueWidget, &PaletteWidget::displayRootBorder, this->trnWidget, &PaletteWidget::displayBorder); + QObject::connect(this->trnWidget, &PaletteWidget::clearRootInformation, this->palWidget, &PaletteWidget::clearInfo); + QObject::connect(this->trnUniqueWidget, &PaletteWidget::clearRootInformation, this->trnWidget, &PaletteWidget::clearInfo); + QObject::connect(this->trnWidget, &PaletteWidget::clearRootBorder, this->palWidget, &PaletteWidget::clearBorder); + QObject::connect(this->trnUniqueWidget, &PaletteWidget::clearRootBorder, this->trnWidget, &PaletteWidget::clearBorder); if (isTileset) { this->levelCelView = new LevelCelView(); @@ -619,13 +619,13 @@ void MainWindow::openFile(const OpenAsParam ¶ms) // Refresh CEL view if a PAL or TRN is modified QObject::connect(this->palWidget, &PaletteWidget::modified, this->levelCelView, &LevelCelView::displayFrame); - QObject::connect(this->trn1Widget, &PaletteWidget::modified, this->levelCelView, &LevelCelView::displayFrame); - QObject::connect(this->trn2Widget, &PaletteWidget::modified, this->levelCelView, &LevelCelView::displayFrame); + QObject::connect(this->trnUniqueWidget, &PaletteWidget::modified, this->levelCelView, &LevelCelView::displayFrame); + QObject::connect(this->trnWidget, &PaletteWidget::modified, this->levelCelView, &LevelCelView::displayFrame); // Select color when level CEL view clicked QObject::connect(this->levelCelView, &LevelCelView::colorIndexClicked, this->palWidget, &PaletteWidget::selectColor); - QObject::connect(this->levelCelView, &LevelCelView::colorIndexClicked, this->trn1Widget, &PaletteWidget::selectColor); - QObject::connect(this->levelCelView, &LevelCelView::colorIndexClicked, this->trn2Widget, &PaletteWidget::selectColor); + QObject::connect(this->levelCelView, &LevelCelView::colorIndexClicked, this->trnUniqueWidget, &PaletteWidget::selectColor); + QObject::connect(this->levelCelView, &LevelCelView::colorIndexClicked, this->trnWidget, &PaletteWidget::selectColor); // Refresh palette widgets when frame, subtile of tile is changed QObject::connect(this->levelCelView, &LevelCelView::frameRefreshed, this->palWidget, &PaletteWidget::refresh); @@ -633,8 +633,8 @@ void MainWindow::openFile(const OpenAsParam ¶ms) // Initialize palette widgets this->palHits = new D1PalHits(this->gfx, this->min, this->til); this->palWidget->initialize(this->pal, this->levelCelView, this->palHits); - this->trn1Widget->initialize(this->pal, this->trn1, this->levelCelView, this->palHits); - this->trn2Widget->initialize(this->trn1->getResultingPalette(), this->trn2, this->levelCelView, this->palHits); + this->trnUniqueWidget->initialize(this->pal, this->trnUnique, this->levelCelView, this->palHits); + this->trnWidget->initialize(this->trnUnique->getResultingPalette(), this->trn, this->levelCelView, this->palHits); this->levelCelView->displayFrame(); } @@ -645,13 +645,13 @@ void MainWindow::openFile(const OpenAsParam ¶ms) // Refresh CEL view if a PAL or TRN is modified QObject::connect(this->palWidget, &PaletteWidget::modified, this->celView, &CelView::displayFrame); - QObject::connect(this->trn1Widget, &PaletteWidget::modified, this->celView, &CelView::displayFrame); - QObject::connect(this->trn2Widget, &PaletteWidget::modified, this->celView, &CelView::displayFrame); + QObject::connect(this->trnUniqueWidget, &PaletteWidget::modified, this->celView, &CelView::displayFrame); + QObject::connect(this->trnWidget, &PaletteWidget::modified, this->celView, &CelView::displayFrame); // Select color when CEL view clicked QObject::connect(this->celView, &CelView::colorIndexClicked, this->palWidget, &PaletteWidget::selectColor); - QObject::connect(this->celView, &CelView::colorIndexClicked, this->trn1Widget, &PaletteWidget::selectColor); - QObject::connect(this->celView, &CelView::colorIndexClicked, this->trn2Widget, &PaletteWidget::selectColor); + QObject::connect(this->celView, &CelView::colorIndexClicked, this->trnUniqueWidget, &PaletteWidget::selectColor); + QObject::connect(this->celView, &CelView::colorIndexClicked, this->trnWidget, &PaletteWidget::selectColor); // Refresh palette widgets when frame QObject::connect(this->celView, &CelView::frameRefreshed, this->palWidget, &PaletteWidget::refresh); @@ -659,8 +659,8 @@ void MainWindow::openFile(const OpenAsParam ¶ms) // Initialize palette widgets this->palHits = new D1PalHits(this->gfx); this->palWidget->initialize(this->pal, this->celView, this->palHits); - this->trn1Widget->initialize(this->pal, this->trn1, this->celView, this->palHits); - this->trn2Widget->initialize(this->trn1->getResultingPalette(), this->trn2, this->celView, this->palHits); + this->trnUniqueWidget->initialize(this->pal, this->trnUnique, this->celView, this->palHits); + this->trnWidget->initialize(this->trnUnique->getResultingPalette(), this->trn, this->celView, this->palHits); this->celView->displayFrame(); } @@ -743,23 +743,23 @@ void MainWindow::openPalFiles(QStringList filePaths, PaletteWidget *widget) if (!firstFound.isEmpty()) { this->palWidget->selectPath(firstFound); } - } else if (widget == this->trn1Widget) { + } else if (widget == this->trnUniqueWidget) { for (QString path : filePaths) { - if (this->loadTrn1(path) && firstFound.isEmpty()) { + if (this->loadTrnUnique(path) && firstFound.isEmpty()) { firstFound = path; } } if (!firstFound.isEmpty()) { - this->trn1Widget->selectPath(firstFound); + this->trnUniqueWidget->selectPath(firstFound); } - } else if (widget == this->trn2Widget) { + } else if (widget == this->trnWidget) { for (QString path : filePaths) { - if (this->loadTrn2(path) && firstFound.isEmpty()) { + if (this->loadTrn(path) && firstFound.isEmpty()) { firstFound = path; } } if (!firstFound.isEmpty()) { - this->trn2Widget->selectPath(firstFound); + this->trnWidget->selectPath(firstFound); } } @@ -957,13 +957,13 @@ bool MainWindow::isOkToQuit() } } - for (D1Trn *translation : this->trn1s) { + for (D1Trn *translation : this->trnsUnique) { if (!QuestionDiscardChanges(translation->isModified(), translation->getFilePath())) { return false; } } - for (D1Trn *translation : this->trn2s) { + for (D1Trn *translation : this->trns) { if (!QuestionDiscardChanges(translation->isModified(), translation->getFilePath())) { return false; } @@ -1004,18 +1004,18 @@ void MainWindow::closeAllElements() delete this->celView; delete this->levelCelView; delete this->palWidget; - delete this->trn1Widget; - delete this->trn2Widget; + delete this->trnUniqueWidget; + delete this->trnWidget; delete this->gfx; qDeleteAll(this->pals); this->pals.clear(); - qDeleteAll(this->trn1s); - this->trn1s.clear(); + qDeleteAll(this->trnsUnique); + this->trnsUnique.clear(); - qDeleteAll(this->trn2s); - this->trn2s.clear(); + qDeleteAll(this->trns); + this->trns.clear(); delete this->min; delete this->til; @@ -1433,7 +1433,7 @@ void MainWindow::on_actionClose_PAL_triggered() this->palWidget->selectPath(D1Pal::DEFAULT_PATH); } -void MainWindow::on_actionNew_Translation_1_triggered() +void MainWindow::on_actionNew_Unique_Translation_triggered() { QString trnFilePath = this->fileDialog(FILE_DIALOG_MODE::SAVE_CONF, "New Translation File", "TRN Files (*.trn *.TRN)"); @@ -1465,36 +1465,36 @@ void MainWindow::on_actionNew_Translation_1_triggered() return; } - if (this->trn1s.contains(path)) - delete this->trn1s[path]; - this->trn1s[path] = newTrn; - this->trn1Widget->addPath(path, name); - this->trn1Widget->selectPath(path); + if (this->trnsUnique.contains(path)) + delete this->trnsUnique[path]; + this->trnsUnique[path] = newTrn; + this->trnUniqueWidget->addPath(path, name); + this->trnUniqueWidget->selectPath(path); } -void MainWindow::on_actionOpen_Translation_1_triggered() +void MainWindow::on_actionOpen_Unique_Translation_triggered() { QString trnFilePath = this->fileDialog(FILE_DIALOG_MODE::OPEN, "Load Translation File", "TRN Files (*.trn *.TRN)"); - if (!trnFilePath.isEmpty() && this->loadTrn1(trnFilePath)) { - this->trn1Widget->selectPath(trnFilePath); + if (!trnFilePath.isEmpty() && this->loadTrnUnique(trnFilePath)) { + this->trnUniqueWidget->selectPath(trnFilePath); } } -void MainWindow::on_actionSave_Translation_1_triggered() +void MainWindow::on_actionSave_Unique_Translation_triggered() { - QString selectedPath = this->trn1Widget->getSelectedPath(); + QString selectedPath = this->trnUniqueWidget->getSelectedPath(); if (selectedPath == D1Trn::IDENTITY_PATH) { - this->on_actionSave_Translation_1_as_triggered(); + this->on_actionSave_Unique_Translation_as_triggered(); } else { - if (!this->trn1->save(selectedPath)) { + if (!this->trnUnique->save(selectedPath)) { QMessageBox::critical(this, "Error", "Could not save TRN file."); return; } } } -void MainWindow::on_actionSave_Translation_1_as_triggered() +void MainWindow::on_actionSave_Unique_Translation_as_triggered() { QString trnFilePath = this->fileDialog(FILE_DIALOG_MODE::SAVE_CONF, "Save Translation File as...", "TRN Files (*.trn *.TRN)"); @@ -1514,7 +1514,7 @@ void MainWindow::on_actionSave_Translation_1_as_triggered() return; } - if (!this->trn1->save(trnFilePath)) { + if (!this->trnUnique->save(trnFilePath)) { QMessageBox::critical(this, "Error", "Could not save TRN file."); return; } @@ -1526,29 +1526,29 @@ void MainWindow::on_actionSave_Translation_1_as_triggered() return; } - if (this->trn1s.contains(path)) - delete this->trn1s[path]; - this->trn1s[path] = newTrn; - this->trn1Widget->addPath(path, name); - this->trn1Widget->selectPath(path); + if (this->trnsUnique.contains(path)) + delete this->trnsUnique[path]; + this->trnsUnique[path] = newTrn; + this->trnUniqueWidget->addPath(path, name); + this->trnUniqueWidget->selectPath(path); } -void MainWindow::on_actionClose_Translation_1_triggered() +void MainWindow::on_actionClose_Unique_Translation_triggered() { - QString selectedPath = this->trn1Widget->getSelectedPath(); + QString selectedPath = this->trnUniqueWidget->getSelectedPath(); if (selectedPath == D1Trn::IDENTITY_PATH) return; - if (this->trn1s.contains(selectedPath)) { - delete this->trn1s[selectedPath]; - this->trn1s.remove(selectedPath); + if (this->trnsUnique.contains(selectedPath)) { + delete this->trnsUnique[selectedPath]; + this->trnsUnique.remove(selectedPath); } - this->trn1Widget->removePath(selectedPath); - this->trn1Widget->selectPath(D1Trn::IDENTITY_PATH); + this->trnUniqueWidget->removePath(selectedPath); + this->trnUniqueWidget->selectPath(D1Trn::IDENTITY_PATH); } -void MainWindow::on_actionNew_Translation_2_triggered() +void MainWindow::on_actionNew_Translation_triggered() { QString trnFilePath = this->fileDialog(FILE_DIALOG_MODE::SAVE_CONF, "New Translation File", "TRN Files (*.trn *.TRN)"); @@ -1568,7 +1568,7 @@ void MainWindow::on_actionNew_Translation_2_triggered() return; } - D1Trn *newTrn = new D1Trn(this->trn1->getResultingPalette()); + D1Trn *newTrn = new D1Trn(this->trnUnique->getResultingPalette()); if (!newTrn->load(D1Trn::IDENTITY_PATH)) { delete newTrn; QMessageBox::critical(this, "Error", "Could not load TRN file."); @@ -1580,36 +1580,36 @@ void MainWindow::on_actionNew_Translation_2_triggered() return; } - if (this->trn2s.contains(path)) - delete this->trn2s[path]; - this->trn2s[path] = newTrn; - this->trn2Widget->addPath(path, name); - this->trn2Widget->selectPath(path); + if (this->trns.contains(path)) + delete this->trns[path]; + this->trns[path] = newTrn; + this->trnWidget->addPath(path, name); + this->trnWidget->selectPath(path); } -void MainWindow::on_actionOpen_Translation_2_triggered() +void MainWindow::on_actionOpen_Translation_triggered() { QString trnFilePath = this->fileDialog(FILE_DIALOG_MODE::OPEN, "Load Translation File", "TRN Files (*.trn *.TRN)"); - if (!trnFilePath.isEmpty() && this->loadTrn2(trnFilePath)) { - this->trn2Widget->selectPath(trnFilePath); + if (!trnFilePath.isEmpty() && this->loadTrn(trnFilePath)) { + this->trnWidget->selectPath(trnFilePath); } } -void MainWindow::on_actionSave_Translation_2_triggered() +void MainWindow::on_actionSave_Translation_triggered() { - QString selectedPath = this->trn2Widget->getSelectedPath(); + QString selectedPath = this->trnWidget->getSelectedPath(); if (selectedPath == D1Trn::IDENTITY_PATH) { - this->on_actionSave_Translation_2_as_triggered(); + this->on_actionSave_Translation_as_triggered(); } else { - if (!this->trn2->save(selectedPath)) { + if (!this->trn->save(selectedPath)) { QMessageBox::critical(this, "Error", "Could not save TRN file."); return; } } } -void MainWindow::on_actionSave_Translation_2_as_triggered() +void MainWindow::on_actionSave_Translation_as_triggered() { QString trnFilePath = this->fileDialog(FILE_DIALOG_MODE::SAVE_CONF, "Save Translation File as...", "TRN Files (*.trn *.TRN)"); @@ -1629,38 +1629,38 @@ void MainWindow::on_actionSave_Translation_2_as_triggered() return; } - if (!this->trn2->save(trnFilePath)) { + if (!this->trn->save(trnFilePath)) { QMessageBox::critical(this, "Error", "Could not save TRN file."); return; } - D1Trn *newTrn = new D1Trn(this->trn1->getResultingPalette()); + D1Trn *newTrn = new D1Trn(this->trnUnique->getResultingPalette()); if (!newTrn->load(path)) { delete newTrn; QMessageBox::critical(this, "Error", "Could not load TRN file."); return; } - if (this->trn2s.contains(path)) - delete this->trn2s[path]; - this->trn2s[path] = newTrn; - this->trn2Widget->addPath(path, name); - this->trn2Widget->selectPath(path); + if (this->trns.contains(path)) + delete this->trns[path]; + this->trns[path] = newTrn; + this->trnWidget->addPath(path, name); + this->trnWidget->selectPath(path); } -void MainWindow::on_actionClose_Translation_2_triggered() +void MainWindow::on_actionClose_Translation_triggered() { - QString selectedPath = this->trn2Widget->getSelectedPath(); + QString selectedPath = this->trnWidget->getSelectedPath(); if (selectedPath == D1Trn::IDENTITY_PATH) return; - if (this->trn2s.contains(selectedPath)) { - delete this->trn2s[selectedPath]; - this->trn2s.remove(selectedPath); + if (this->trns.contains(selectedPath)) { + delete this->trns[selectedPath]; + this->trns.remove(selectedPath); } - this->trn2Widget->removePath(selectedPath); - this->trn2Widget->selectPath(D1Trn::IDENTITY_PATH); + this->trnWidget->removePath(selectedPath); + this->trnWidget->selectPath(D1Trn::IDENTITY_PATH); } #if defined(Q_OS_WIN) diff --git a/source/mainwindow.h b/source/mainwindow.h index 2b8c668f..f6cb7beb 100644 --- a/source/mainwindow.h +++ b/source/mainwindow.h @@ -49,8 +49,8 @@ class MainWindow : public QMainWindow { ~MainWindow(); void setPal(QString); - void setTrn1(QString); - void setTrn2(QString); + void setTrn(QString); + void setTrnUnique(QString); void openFile(const OpenAsParam ¶ms); void openImageFiles(IMAGE_FILE_MODE mode, QStringList filePaths, bool append); @@ -74,8 +74,8 @@ class MainWindow : public QMainWindow { private: void updateWindow(); bool loadPal(QString palFilePath); - bool loadTrn1(QString trnfilePath); - bool loadTrn2(QString trnfilePath); + bool loadTrn(QString trnfilePath); + bool loadTrnUnique(QString trnfilePath); void addFrames(bool append); void addSubtiles(bool append); @@ -136,17 +136,17 @@ private slots: void on_actionSave_PAL_as_triggered(); void on_actionClose_PAL_triggered(); - void on_actionNew_Translation_1_triggered(); - void on_actionOpen_Translation_1_triggered(); - void on_actionSave_Translation_1_triggered(); - void on_actionSave_Translation_1_as_triggered(); - void on_actionClose_Translation_1_triggered(); + void on_actionNew_Unique_Translation_triggered(); + void on_actionOpen_Unique_Translation_triggered(); + void on_actionSave_Unique_Translation_triggered(); + void on_actionSave_Unique_Translation_as_triggered(); + void on_actionClose_Unique_Translation_triggered(); - void on_actionNew_Translation_2_triggered(); - void on_actionOpen_Translation_2_triggered(); - void on_actionSave_Translation_2_triggered(); - void on_actionSave_Translation_2_as_triggered(); - void on_actionClose_Translation_2_triggered(); + void on_actionNew_Translation_triggered(); + void on_actionOpen_Translation_triggered(); + void on_actionSave_Translation_triggered(); + void on_actionSave_Translation_as_triggered(); + void on_actionClose_Translation_triggered(); void on_actionAbout_triggered(); void on_actionAbout_Qt_triggered(); @@ -172,25 +172,25 @@ private slots: QPointer levelCelView; QPointer palWidget; - QPointer trn1Widget; - QPointer trn2Widget; + QPointer trnWidget; + QPointer trnUniqueWidget; OpenAsDialog openAsDialog = OpenAsDialog(this); SettingsDialog settingsDialog = SettingsDialog(this); ExportDialog exportDialog = ExportDialog(this); QPointer pal; - QPointer trn1; - QPointer trn2; + QPointer trn; + QPointer trnUnique; QPointer gfx; QPointer min; QPointer til; QPointer sol; QPointer amp; - QMap pals; // key: path, value: pointer to palette - QMap trn1s; // key: path, value: pointer to translation - QMap trn2s; // key: path, value: pointer to translation + QMap pals; // key: path, value: pointer to palette + QMap trns; // key: path, value: pointer to translation + QMap trnsUnique; // key: path, value: pointer to translation // Palette hits are instantiated in main window to make them available to the three PaletteWidgets QPointer palHits; diff --git a/source/mainwindow.ui b/source/mainwindow.ui index 57046246..07cbb75c 100644 --- a/source/mainwindow.ui +++ b/source/mainwindow.ui @@ -170,17 +170,17 @@ - - - - - + + + + + - - - - - + + + + + @@ -275,7 +275,7 @@ Ctrl+P - + Open Unique Translation... @@ -283,7 +283,7 @@ Ctrl+U - + Open Translation... @@ -373,22 +373,22 @@ Save Palette As... - + Save Translation - + Save Tanslation As... - + Save Unique Translation - + Save Unique Translation As... @@ -403,22 +403,22 @@ Close Palette - + Close Translation - + Close Unique Translation - + New Translation - + New Unique Translation