File indexing completed on 2024-04-21 04:51:21
0001 /* 0002 SPDX-FileCopyrightText: 2008 Jean-Baptiste Mardelle <jb@kdenlive.org> 0003 0004 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <KConfigDialog> 0010 #include <KProcess> 0011 #include <QMap> 0012 #include <QListWidget> 0013 0014 #include "ui_configcapture_ui.h" 0015 #include "ui_configcolors_ui.h" 0016 #include "ui_configenv_ui.h" 0017 #include "ui_configjogshuttle_ui.h" 0018 #include "ui_configmisc_ui.h" 0019 #include "ui_configproject_ui.h" 0020 #include "ui_configproxy_ui.h" 0021 #include "ui_configsdl_ui.h" 0022 #include "ui_configspeech_ui.h" 0023 #include "ui_configtimeline_ui.h" 0024 #include "ui_configtools_ui.h" 0025 #include "ui_configtranscode_ui.h" 0026 0027 #include "pythoninterfaces/speechtotext.h" 0028 #include "encodingprofilesdialog.h" 0029 0030 class ProfileWidget; 0031 class GuideCategories; 0032 class KJob; 0033 0034 class SpeechList : public QListWidget 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 SpeechList(QWidget *parent = nullptr); 0040 0041 protected: 0042 QStringList mimeTypes() const override; 0043 void dropEvent(QDropEvent *event) override; 0044 0045 Q_SIGNALS: 0046 void getDictionary(const QUrl url); 0047 }; 0048 0049 class KdenliveSettingsDialog : public KConfigDialog 0050 { 0051 Q_OBJECT 0052 0053 public: 0054 KdenliveSettingsDialog(QMap<QString, QString> mappable_actions, bool gpuAllowed, QWidget *parent = nullptr); 0055 ~KdenliveSettingsDialog() override; 0056 void showPage(Kdenlive::ConfigPage page, int option); 0057 void checkProfile(); 0058 /** @brief update kdenlive settings for external app path if they were changed outside config dialog */ 0059 void updateExternalApps(); 0060 0061 protected: 0062 void showHelp() override; 0063 0064 protected Q_SLOTS: 0065 void updateSettings() override; 0066 void updateWidgets() override; 0067 bool hasChanged() override; 0068 void accept() override; 0069 0070 private Q_SLOTS: 0071 void slotCheckShuttle(int state = 0); 0072 void slotUpdateShuttleDevice(int ix = 0); 0073 void slotEditImageApplication(); 0074 void slotEditAudioApplication(); 0075 void slotEditGlaxnimateApplication(); 0076 void slotReadAudioDevices(); 0077 void slotUpdateGrabRegionStatus(); 0078 void slotCheckAlsaDriver(); 0079 void slotCheckAudioBackend(); 0080 void slotAddTranscode(); 0081 void slotDeleteTranscode(); 0082 /** @brief Update current transcoding profile. */ 0083 void slotUpdateTranscodingProfile(); 0084 /** @brief Enable / disable the update profile button. */ 0085 void slotEnableTranscodeUpdate(); 0086 /** @brief Update display of current transcoding profile parameters. */ 0087 void slotSetTranscodeProfile(); 0088 void slotShuttleModified(); 0089 void slotDialogModified(); 0090 void slotEnableCaptureFolder(int ix); 0091 void slotEnableLibraryFolder(); 0092 void slotEnableVideoFolder(int ix); 0093 void slotUpdatev4lDevice(); 0094 void slotUpdatev4lCaptureProfile(); 0095 void slotEditVideo4LinuxProfile(); 0096 void slotReloadBlackMagic(); 0097 void slotReloadShuttleDevices(); 0098 void loadExternalProxyProfiles(); 0099 void slotParseVoskDictionaries(); 0100 void getDictionary(const QUrl &sourceUrl = QUrl()); 0101 void removeDictionary(); 0102 void downloadModelFinished(KJob* job); 0103 void processArchive(const QString &path); 0104 void doShowSpeechMessage(const QString &message, int messageType); 0105 /** @brief Check required python dependencies for speech engine */ 0106 void slotCheckSttConfig(); 0107 /** @brief fill list of connected monitors */ 0108 void fillMonitorData(); 0109 0110 private: 0111 KPageWidgetItem *m_pageMisc; 0112 KPageWidgetItem *m_pageEnv; 0113 KPageWidgetItem *m_pageTimeline; 0114 KPageWidgetItem *m_pageTools; 0115 KPageWidgetItem *m_pageCapture; 0116 KPageWidgetItem *m_pageJog; 0117 KPageWidgetItem *m_pagePlay; 0118 KPageWidgetItem *m_pageTranscode; 0119 KPageWidgetItem *m_pageProject; 0120 KPageWidgetItem *m_pageColors; 0121 KPageWidgetItem *m_pageSpeech; 0122 Ui::ConfigEnv_UI m_configEnv; 0123 Ui::ConfigMisc_UI m_configMisc; 0124 Ui::ConfigColors_UI m_configColors; 0125 Ui::ConfigTimeline_UI m_configTimeline; 0126 Ui::ConfigTools_UI m_configTools; 0127 Ui::ConfigCapture_UI m_configCapture; 0128 Ui::ConfigJogShuttle_UI m_configShuttle; 0129 Ui::ConfigSdl_UI m_configSdl; 0130 Ui::ConfigTranscode_UI m_configTranscode; 0131 Ui::ConfigProject_UI m_configProject; 0132 Ui::ConfigProxy_UI m_configProxy; 0133 Ui::ConfigSpeech_UI m_configSpeech; 0134 SpeechList *m_speechListWidget; 0135 GuideCategories *m_guidesCategories; 0136 ProfileWidget *m_pw; 0137 KProcess m_readProcess; 0138 bool m_modified; 0139 bool m_shuttleModified; 0140 bool m_voskUpdated; 0141 SpeechToText *m_stt; 0142 SpeechToText *m_sttWhisper; 0143 QMap<QString, QString> m_mappable_actions; 0144 QVector<QComboBox *> m_shuttle_buttons; 0145 EncodingTimelinePreviewProfilesChooser *m_tlPreviewProfiles; 0146 EncodingProfilesChooser *m_proxyProfiles; 0147 EncodingProfilesChooser *m_decklinkProfiles; 0148 EncodingProfilesChooser *m_v4lProfiles; 0149 EncodingProfilesChooser *m_grabProfiles; 0150 void initDevices(); 0151 void loadTranscodeProfiles(); 0152 void saveTranscodeProfiles(); 0153 void loadCurrentV4lProfileInfo(); 0154 void saveCurrentV4lProfile(); 0155 void setupJogshuttleBtns(const QString &device); 0156 /** @brief Fill a combobox with the found blackmagic devices */ 0157 static bool getBlackMagicDeviceList(QComboBox *devicelist, bool force = false); 0158 static bool getBlackMagicOutputDeviceList(QComboBox *devicelist, bool force = false); 0159 /** @brief Init QtMultimedia audio record settings */ 0160 bool initAudioRecDevice(); 0161 void initMiscPage(); 0162 void initProjectPage(); 0163 void initProxyPage(); 0164 void initTimelinePage(); 0165 void initEnviromentPage(); 0166 void initColorsPage(); 0167 /** @brief Init Speech to text settings */ 0168 void initSpeechPage(); 0169 void initCapturePage(); 0170 void initJogShuttlePage(); 0171 void initSdlPage(bool gpuAllowed); 0172 void initTranscodePage(); 0173 /** @brief Launch pytonh scripts to check speech engine dependencies */ 0174 void checkSpeechDependencies(); 0175 0176 Q_SIGNALS: 0177 void customChanged(); 0178 void doResetConsumer(bool fullReset); 0179 void updateCaptureFolder(); 0180 void updateLibraryFolder(); 0181 /** @brief Screengrab method changed between fullsceen and region, update rec monitor */ 0182 void updateFullScreenGrab(); 0183 /** @brief A settings changed that requires a Kdenlive restart, trigger it */ 0184 void restartKdenlive(bool resetConfig = false); 0185 void checkTabPosition(); 0186 /** @brief Switch between merged / separate channels for audio thumbs */ 0187 void audioThumbFormatChanged(); 0188 /** @brief An important timeline property changed, prepare for a reset */ 0189 void resetView(); 0190 /** @brief Monitor background color changed, update monitors */ 0191 void updateMonitorBg(); 0192 /** @brief Trigger parsing of the speech models folder */ 0193 void parseDictionaries(); 0194 /** @brief audio volume or rec channels changed, update audio monitor view */ 0195 void resetAudioMonitoring(); 0196 };