Skip to content

Commit

Permalink
Add WebGal support
Browse files Browse the repository at this point in the history
  • Loading branch information
Shengjie Xu committed Oct 28, 2024
1 parent fa5c713 commit 3dd0e16
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
22 changes: 21 additions & 1 deletion mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ MainWindow::MainWindow(QWidget *parent)
ui->renpyTemplateSelectionWidget->setIsOutputInsteadofInput(false);
ui->renpyTemplateSelectionWidget->setFieldName(tr(u8"RenPy 工程模板目录"));

ui->webgalOutputDirWidget->setDirectoryMode(true);
ui->webgalOutputDirWidget->setIsOutputInsteadofInput(true);
ui->webgalOutputDirWidget->setFieldName(tr(u8"WebGal 输出目录"));
ui->webgalOutputDirWidget->setDefaultName("game");

ui->webgalTemplateSelectionWidget->setDirectoryMode(true);
ui->webgalTemplateSelectionWidget->setIsOutputInsteadofInput(false);
ui->webgalTemplateSelectionWidget->setFieldName(tr(u8"WebGal 工程模板目录"));

ui->pluginSelectionWidget->setDirectoryMode(true);
ui->pluginSelectionWidget->setFieldName(tr(u8"插件目录"));

Expand Down Expand Up @@ -100,6 +109,9 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->renpyOutputDirWidget, &FileSelectionWidget::filePathUpdated, this, &MainWindow::settingsChanged);
connect(ui->renpyUseTemplateCheckBox, &QCheckBox::stateChanged, this, &MainWindow::settingsChanged);
connect(ui->renpyTemplateSelectionWidget, &FileSelectionWidget::filePathUpdated, this, &MainWindow::settingsChanged);
connect(ui->webgalOutputDirWidget, &FileSelectionWidget::filePathUpdated, this, &MainWindow::settingsChanged);
connect(ui->webgalUseTemplateCheckBox, &QCheckBox::stateChanged, this, &MainWindow::settingsChanged);
connect(ui->webgalTemplateSelectionWidget, &FileSelectionWidget::filePathUpdated, this, &MainWindow::settingsChanged);
connect(ui->mainExecutableSelectionWidget, &FileSelectionWidget::filePathUpdated, this, &MainWindow::settingsChanged);
connect(ui->languageCheckBox, &QCheckBox::stateChanged, this, &MainWindow::settingsChanged);
connect(ui->languageComboBox, &QComboBox::currentIndexChanged, this, &MainWindow::settingsChanged);
Expand Down Expand Up @@ -155,7 +167,7 @@ void MainWindow::search_exe()
for (const QString& candidate : curdir.entryList(QDir::Files | QDir::Executable, QDir::NoSort)) {
if (candidate == selfName)
continue;
if (candidate.startsWith("preppipe_cli")) {
if (candidate.startsWith("preppipe")) {
ui->mainExecutableSelectionWidget->setCurrentPath(candidate);
return;
}
Expand Down Expand Up @@ -397,6 +409,14 @@ void MainWindow::settingsChanged()
args.append("--renpy-export-templatedir");
populatePath(ui->renpyTemplateSelectionWidget);
}
} else if (ui->outputSelectionTabWidget->currentWidget() == ui->webgalOutputTab) {
args.append("--webgal-codegen");
args.append("--webgal-export");
populatePath(ui->webgalOutputDirWidget);
if (ui->webgalUseTemplateCheckBox->isChecked()) {
args.append("--webgal-export-templatedir");
populatePath(ui->webgalTemplateSelectionWidget);
}
}

if (!isExecutableSpecified) {
Expand Down
31 changes: 29 additions & 2 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<item row="2" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -160,6 +160,33 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="webgalOutputTab">
<attribute name="title">
<string>WebGal</string>
</attribute>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>输出到 game 目录</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="FileSelectionWidget" name="webgalOutputDirWidget" native="true"/>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="webgalUseTemplateCheckBox">
<property name="text">
<string>使用模板</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="FileSelectionWidget" name="webgalTemplateSelectionWidget" native="true"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -495,7 +522,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down

0 comments on commit 3dd0e16

Please sign in to comment.