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