19 QVBoxLayout *mainLayout =
new QVBoxLayout(
this);
21 enableCheckBox =
new QCheckBox(
"Enable Multi-Pass Shader Processing",
this);
24 QLabel *infoLabel =
new QLabel(
"Multi-pass rendering applies multiple shaders in sequence.\n"
25 "Each shader processes the output of the previous shader.",
27 infoLabel->setWordWrap(
true);
28 mainLayout->addWidget(infoLabel);
29 QGroupBox *shaderGroup =
new QGroupBox(
"Shader Pass Selection",
this);
30 QVBoxLayout *shaderMainLayout =
new QVBoxLayout(shaderGroup);
31 QHBoxLayout *searchLayout =
new QHBoxLayout();
32 QLabel *searchLabel =
new QLabel(
"Search:",
this);
36 searchLayout->addWidget(searchLabel);
38 shaderMainLayout->addLayout(searchLayout);
40 QHBoxLayout *comboLayout =
new QHBoxLayout();
41 QLabel *availableLabel =
new QLabel(
"Available Shaders:",
this);
43 shaderComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
49 proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
50 proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
53 comboLayout->addWidget(availableLabel);
55 shaderMainLayout->addLayout(comboLayout);
57 QHBoxLayout *buttonLayout =
new QHBoxLayout();
58 addButton =
new QPushButton(
"Add →",
this);
60 insertButton->setToolTip(
"Replace the selected pass with the available shader.");
62 upButton =
new QPushButton(
"↑ Up",
this);
71 shaderMainLayout->addLayout(buttonLayout);
73 QLabel *selectedLabel =
new QLabel(
"Shader Pass Order (processed in sequence):",
this);
74 shaderMainLayout->addWidget(selectedLabel);
80 QHBoxLayout *fileButtonLayout =
new QHBoxLayout();
81 saveButton =
new QPushButton(
"Save List...",
this);
82 loadButton =
new QPushButton(
"Load List...",
this);
85 fileButtonLayout->addStretch();
86 shaderMainLayout->addLayout(fileButtonLayout);
88 mainLayout->addWidget(shaderGroup);
90 QHBoxLayout *dialogButtonLayout =
new QHBoxLayout();
91 okButton =
new QPushButton(
"OK",
this);
94 dialogButtonLayout->addStretch();
95 dialogButtonLayout->addWidget(
okButton);
98 mainLayout->addLayout(dialogButtonLayout);
109 connect(
okButton, &QPushButton::clicked,
this, &QDialog::accept);
110 connect(
cancelButton, &QPushButton::clicked,
this, &QDialog::reject);
113 connect(
selectedShadersList, &QListWidget::itemDoubleClicked,
this, [
this](QListWidgetItem *item) {
118 connect(
enableCheckBox, &QCheckBox::toggled,
this, [
this](
bool checked) {
294 QMessageBox::information(
this,
"Empty List",
"Add shaders to the pass list before saving.");
298 QSettings appSettings(
"LostSideDead");
299 QString lastDir = appSettings.value(
"lastShaderPassDir",
"").toString();
300 QString filePath = QFileDialog::getSaveFileName(
this,
"Save Shader Pass List", lastDir,
"Text Files (*.txt);;All Files (*)");
301 if (filePath.isEmpty())
304 appSettings.setValue(
"lastShaderPassDir", QFileInfo(filePath).absolutePath());
306 QFile file(filePath);
307 if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
308 QMessageBox::critical(
this,
"Error",
"Could not save file: " + filePath);
312 QTextStream out(&file);
317 QMessageBox::information(
this,
"Saved",
"Shader pass list saved to: " + filePath);
321 QSettings appSettings(
"LostSideDead");
322 QString lastDir = appSettings.value(
"lastShaderPassDir",
"").toString();
323 QString filePath = QFileDialog::getOpenFileName(
this,
"Load Shader Pass List", lastDir,
"Text Files (*.txt);;All Files (*)");
324 if (filePath.isEmpty())
327 appSettings.setValue(
"lastShaderPassDir", QFileInfo(filePath).absolutePath());
329 QFile file(filePath);
330 if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
331 QMessageBox::critical(
this,
"Error",
"Could not open file: " + filePath);
336 QTextStream in(&file);
338 int skippedCount = 0;
339 while (!in.atEnd()) {
340 QString line = in.readLine().trimmed();
344 QListWidgetItem *item =
new QListWidgetItem(line);
354 QString msg =
"Loaded " + QString::number(loadedCount) +
" shader(s).";
355 if (skippedCount > 0)
356 msg +=
"\n" + QString::number(skippedCount) +
" shader(s) not found and skipped.";
357 QMessageBox::information(
this,
"Shader Pass List Loaded", msg);