Add ability to enable and disable cot per song to ui
Some checks failed
Build eismuliplexer for linux / Build (push) Has been cancelled
Some checks failed
Build eismuliplexer for linux / Build (push) Has been cancelled
This commit is contained in:
parent
970ed46892
commit
9d0dc6298c
6 changed files with 131 additions and 134 deletions
|
|
@ -109,6 +109,8 @@ bool AceStep::requestGeneration(SongItem song, QString requestTemplate, QString
|
|||
if (!song.vocalLanguage.isEmpty())
|
||||
requestObj["vocal_language"] = song.vocalLanguage;
|
||||
|
||||
requestObj["use_cot_caption"] = song.cotCaption;
|
||||
|
||||
// Write the request file
|
||||
QFile requestFileHandle(request.requestFilePath);
|
||||
if (!requestFileHandle.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
|
|
|
|||
|
|
@ -698,7 +698,8 @@ bool MainWindow::savePlaylistToJson(const QString &filePath, const QList<SongIte
|
|||
songObj["caption"] = song.caption;
|
||||
songObj["lyrics"] = song.lyrics;
|
||||
songObj["vocalLanguage"] = song.vocalLanguage;
|
||||
songObj["uniqueId"] = static_cast<qint64>(song.uniqueId); // Store as qint64 for JSON compatibility
|
||||
songObj["uniqueId"] = static_cast<qint64>(song.uniqueId);
|
||||
songObj["use_cot_caption"] = song.cotCaption;
|
||||
songsArray.append(songObj);
|
||||
}
|
||||
|
||||
|
|
@ -779,31 +780,20 @@ bool MainWindow::loadPlaylistFromJson(const QString &filePath, QList<SongItem> &
|
|||
SongItem song;
|
||||
|
||||
if (songObj.contains("caption"))
|
||||
{
|
||||
song.caption = songObj["caption"].toString();
|
||||
}
|
||||
|
||||
if (songObj.contains("lyrics"))
|
||||
{
|
||||
song.lyrics = songObj["lyrics"].toString();
|
||||
}
|
||||
|
||||
// Load vocalLanguage if present
|
||||
if (songObj.contains("vocalLanguage"))
|
||||
{
|
||||
song.vocalLanguage = songObj["vocalLanguage"].toString();
|
||||
}
|
||||
|
||||
// Load uniqueId if present (for backward compatibility)
|
||||
if (songObj.contains("uniqueId"))
|
||||
{
|
||||
song.uniqueId = static_cast<uint64_t>(songObj["uniqueId"].toInteger());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Generate new ID for old playlists without uniqueId
|
||||
song.uniqueId = QRandomGenerator::global()->generate64();
|
||||
}
|
||||
|
||||
song.cotCaption = songObj["use_cot_caption"].toBool(true);
|
||||
|
||||
songs.append(song);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,21 +5,16 @@
|
|||
#include "ui_SongDialog.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
SongDialog::SongDialog(QWidget *parent, const QString &caption, const QString &lyrics, const QString &vocalLanguage)
|
||||
SongDialog::SongDialog(QWidget *parent, const QString &caption, const QString &lyrics, const QString &vocalLanguage, bool cotEnabled)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::SongDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Set initial values if provided
|
||||
if (!caption.isEmpty())
|
||||
{
|
||||
ui->captionEdit->setPlainText(caption);
|
||||
}
|
||||
if (!lyrics.isEmpty())
|
||||
{
|
||||
ui->lyricsEdit->setPlainText(lyrics);
|
||||
}
|
||||
|
||||
ui->checkBoxEnhanceCaption->setChecked(cotEnabled);
|
||||
|
||||
// Setup vocal language combo box
|
||||
ui->vocalLanguageCombo->addItem("--", ""); // Unset
|
||||
|
|
@ -110,6 +105,11 @@ QString SongDialog::getVocalLanguage() const
|
|||
return ui->vocalLanguageCombo->currentData().toString();
|
||||
}
|
||||
|
||||
bool SongDialog::getCotEnabled() const
|
||||
{
|
||||
return ui->checkBoxEnhanceCaption->isChecked();
|
||||
}
|
||||
|
||||
void SongDialog::on_okButton_clicked()
|
||||
{
|
||||
// Validate that caption is not empty
|
||||
|
|
|
|||
|
|
@ -20,12 +20,13 @@ class SongDialog : public QDialog
|
|||
|
||||
public:
|
||||
explicit SongDialog(QWidget *parent = nullptr, const QString &caption = "", const QString &lyrics = "",
|
||||
const QString &vocalLanguage = "");
|
||||
const QString &vocalLanguage = "", bool cotEnabled = true);
|
||||
~SongDialog();
|
||||
|
||||
QString getCaption() const;
|
||||
QString getLyrics() const;
|
||||
QString getVocalLanguage() const;
|
||||
bool getCotEnabled() const;
|
||||
|
||||
private slots:
|
||||
void on_okButton_clicked();
|
||||
|
|
|
|||
|
|
@ -7,52 +7,55 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>400</height>
|
||||
<height>410</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Song Details</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="captionLabel">
|
||||
<property name="text">
|
||||
<string>Caption:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignTop</set>
|
||||
<set>Qt::AlignmentFlag::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="captionEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Enter song caption (e.g., "Upbeat pop rock anthem with driving electric guitars")</string>
|
||||
<widget class="QCheckBox" name="checkBoxEnhanceCaption">
|
||||
<property name="text">
|
||||
<string>Enhance Caption</string>
|
||||
</property>
|
||||
<property name="maximumHeight">
|
||||
<number>80</number>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="captionEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lyricsLabel">
|
||||
<property name="text">
|
||||
<string>Lyrics (optional):</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignTop</set>
|
||||
<set>Qt::AlignmentFlag::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="lyricsEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Enter lyrics or leave empty for instrumental music</string>
|
||||
</property>
|
||||
<property name="minimumHeight">
|
||||
<number>150</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="lyricsEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="vocalLanguageLabel">
|
||||
|
|
@ -60,7 +63,7 @@
|
|||
<string>Vocal Language:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignTop</set>
|
||||
<set>Qt::AlignmentFlag::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -76,7 +79,7 @@
|
|||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@ public:
|
|||
uint64_t uniqueId;
|
||||
QString file;
|
||||
QString vocalLanguage;
|
||||
bool cotCaption;
|
||||
QString json;
|
||||
|
||||
inline SongItem(const QString &caption = "", const QString &lyrics = "")
|
||||
: caption(caption), lyrics(lyrics)
|
||||
: caption(caption), lyrics(lyrics), cotCaption(true)
|
||||
{
|
||||
// Generate a unique ID using a cryptographically secure random number
|
||||
uniqueId = QRandomGenerator::global()->generate64();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue