[nostalgia/core/studio] Remove option for bundled tile sheet palette
This commit is contained in:
parent
350b4ad6c2
commit
362aeef3c7
@ -17,10 +17,6 @@
|
|||||||
|
|
||||||
namespace nostalgia::core {
|
namespace nostalgia::core {
|
||||||
|
|
||||||
static const auto PaletteOption_Bundle = QObject::tr("Bundle");
|
|
||||||
static const auto PaletteOption_New = QObject::tr("External");
|
|
||||||
static const auto PaletteOptions = QStringList{PaletteOption_Bundle, PaletteOption_New};
|
|
||||||
|
|
||||||
ImportTilesheetWizardMainPage::ImportTilesheetWizardMainPage(const studio::Context *ctx) {
|
ImportTilesheetWizardMainPage::ImportTilesheetWizardMainPage(const studio::Context *ctx) {
|
||||||
m_ctx = ctx;
|
m_ctx = ctx;
|
||||||
addLineEdit(tr("&Tile Sheet Name:"), QString(TileSheetName) + "*", "", [this](QString) {
|
addLineEdit(tr("&Tile Sheet Name:"), QString(TileSheetName) + "*", "", [this](QString) {
|
||||||
@ -41,26 +37,13 @@ ImportTilesheetWizardMainPage::ImportTilesheetWizardMainPage(const studio::Conte
|
|||||||
|
|
||||||
ImportTilesheetWizardPalettePage::ImportTilesheetWizardPalettePage(const studio::Context *ctx) {
|
ImportTilesheetWizardPalettePage::ImportTilesheetWizardPalettePage(const studio::Context *ctx) {
|
||||||
m_ctx = ctx;
|
m_ctx = ctx;
|
||||||
auto cb = addComboBox(tr("P&alette:"), Palette, PaletteOptions);
|
addLineEdit(tr("Palette &Name:"), PaletteName);
|
||||||
auto name = addLineEdit(tr("Palette &Name:"), PaletteName);
|
|
||||||
name->setDisabled(true);
|
|
||||||
|
|
||||||
connect(cb, QOverload<int>::of(&QComboBox::currentIndexChanged), [name](int idx) {
|
|
||||||
if (idx == 1) {
|
|
||||||
name->setDisabled(false);
|
|
||||||
} else {
|
|
||||||
name->setDisabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
cb->setCurrentIndex(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ImportTilesheetWizardPalettePage::accept() {
|
int ImportTilesheetWizardPalettePage::accept() {
|
||||||
const auto tilesheetName = field(TileSheetName).toString();
|
const auto tilesheetName = field(TileSheetName).toString();
|
||||||
const auto importPath = field(ImportPath).toString();
|
const auto importPath = field(ImportPath).toString();
|
||||||
const auto tileCount = field(TileCount).toInt();
|
const auto tileCount = field(TileCount).toInt();
|
||||||
const auto palette = field(Palette).toInt();
|
|
||||||
const auto paletteName = field(PaletteName).toString();
|
const auto paletteName = field(PaletteName).toString();
|
||||||
const auto outPath = TileSheetDir + tilesheetName + FileExt_ng;
|
const auto outPath = TileSheetDir + tilesheetName + FileExt_ng;
|
||||||
if (!QFile(importPath).exists()) {
|
if (!QFile(importPath).exists()) {
|
||||||
@ -70,14 +53,12 @@ int ImportTilesheetWizardPalettePage::accept() {
|
|||||||
if (!ng) {
|
if (!ng) {
|
||||||
return OxError(1);
|
return OxError(1);
|
||||||
}
|
}
|
||||||
if (palette != PaletteOptions.indexOf(PaletteOption_Bundle)) {
|
const auto paletteOutPath = PaletteDir + paletteName + FileExt_npal;
|
||||||
const auto outPath = PaletteDir + paletteName + FileExt_npal;
|
core::NostalgiaPalette pal;
|
||||||
core::NostalgiaPalette pal;
|
pal = std::move(ng->pal);
|
||||||
pal = std::move(ng->pal);
|
m_ctx->project->writeObj(paletteOutPath, &pal);
|
||||||
m_ctx->project->writeObj(outPath, &pal);
|
auto defaultPalette = paletteOutPath.toUtf8();
|
||||||
auto defaultPalette = outPath.toUtf8();
|
ng->defaultPalette = defaultPalette.data();
|
||||||
ng->defaultPalette = defaultPalette.data();
|
|
||||||
}
|
|
||||||
m_ctx->project->writeObj(outPath, ng.get());
|
m_ctx->project->writeObj(outPath, ng.get());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user