https://bugs.kde.org/show_bug.cgi?id=509977
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from [email protected] --- Here's what an AI spat out: ``` ```cpp diff --git a/src/mainwindow.h b/src/mainwindow.h index e1a93d1..6bd58f9 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -512,6 +512,7 @@ private: void configureNotifications(); + void setSubtitleRenderNotificationEnabled(bool enabled); void slotSeparateAudioChannel(); ``` ```cpp diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c2a3de1..6727bf8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1101,6 +1101,17 @@ void MainWindow::configureNotifications() { KNotifyConfigWidget::configure(this); + + // Add a toggle for subtitle rendering completion notification + bool currentState = KdenliveSettings::notifySubtitleRenderComplete(); + auto *notifyCheckbox = new QCheckBox(i18n("Notify on Subtitle Render Completion"), this); + notifyCheckbox->setChecked(currentState); + connect(notifyCheckbox, &QCheckBox::toggled, this, [&](bool checked) { + setSubtitleRenderNotificationEnabled(checked); + KdenliveSettings::setNotifySubtitleRenderComplete(checked); + }); +} + void MainWindow::setSubtitleRenderNotificationEnabled(bool enabled) { qDebug() << "Subtitle render notification is now " << (enabled ? "enabled" : "disabled"); } ``` ```cpp diff --git a/renderer/renderjob.cpp b/renderer/renderjob.cpp index 3acbd1f..b54a1e4 100644 --- a/renderer/renderjob.cpp +++ b/renderer/renderjob.cpp @@ -385,6 +385,14 @@ void RenderJob::slotCheckSubtitleProcess(int exitCode, QProcess::ExitStatus exi if (exitCode == 0 && exitStatus == QProcess::NormalExit) { // Subtitle rendering completed successfully + if (KdenliveSettings::notifySubtitleRenderComplete()) { + KNotification *notification = new KNotification(QStringLiteral("SubtitleRenderComplete")); + notification->setTitle(i18n("Rendering Complete")); + notification->setText(i18n("Subtitle rendering is finished successfully.")); + notification->setIconName(QStringLiteral("kdenlive")); + notification->sendEvent(); + } } else { // Rendering failed ``` ```ini diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg index 642fe1c..2b4aa09 100644 --- a/src/kdenlivesettings.kcfg +++ b/src/kdenlivesettings.kcfg @@ -150,6 +150,11 @@ <default>false</default> </entry> + <entry name="notifySubtitleRenderComplete" type="Bool"> + <label>Notify when subtitle rendering is complete</label> + <default>false</default> + </entry> ``` This code incorporates: 1. **Subtitle Render Notification Settings** - Added a checkbox in the notification settings UI (`mainwindow.cpp`). 2. **Render Completion Logic** - In `RenderJob::slotCheckSubtitleProcess`, added a conditional to play a notification on successful subtitle rendering completion. 3. **Configuration Storage** - Updated `kdenlivesettings.kcfg` for persisting settings. Save `notifySubtitleRenderComplete` in the settings file and react accordingly in the application logic. ``` -- You are receiving this mail because: You are watching all bug changes.
