File indexing completed on 2024-12-01 07:34:41

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 "dialogs/encodingprofilesdialog.h"
0010 #include "guidecategories.h"
0011 
0012 #include <QDialog>
0013 #include <QPushButton>
0014 
0015 #include "ui_projectsettings_ui.h"
0016 
0017 class KdenliveDoc;
0018 class ProfileWidget;
0019 
0020 class ProjectSettings : public QDialog, public Ui::ProjectSettings_UI
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     ProjectSettings(KdenliveDoc *doc, QMap<QString, QString> metadata, QStringList lumas, int videotracks, int audiotracks, int audiochannels, const QString &projectPath,
0026                     bool readOnlyTracks, bool unsavedProject, QWidget *parent = nullptr);
0027     QString selectedProfile() const;
0028     std::pair<int, int> tracks() const;
0029     const QStringList guidesCategories() const;
0030     const QMap<int, int> remapGuidesCategories() const;
0031     int audioChannels() const;
0032     bool enableVideoThumbs() const;
0033     bool enableAudioThumbs() const;
0034     bool useProxy() const;
0035     bool useExternalProxy() const;
0036     bool generateProxy() const;
0037     bool docFolderAsStorageFolder() const;
0038     int proxyMinSize() const;
0039     bool generateImageProxy() const;
0040     int proxyImageMinSize() const;
0041     int proxyImageSize() const;
0042     int proxyResize() const;
0043     QString externalProxyParams() const;
0044     QString proxyParams() const;
0045     QString proxyExtension() const;
0046     QString previewParams() const;
0047     QString previewExtension() const;
0048     const QMap<QString, QString> metadata() const;
0049     static QStringList extractPlaylistUrls(const QString &path);
0050     static QStringList extractSlideshowUrls(const QString &url);
0051     const QString selectedPreview() const;
0052     const QString storageFolder() const;
0053 
0054 public Q_SLOTS:
0055     void accept() override;
0056 
0057 private Q_SLOTS:
0058     void slotUpdateButton(const QString &path);
0059     void slotUpdateFiles(bool cacheOnly = false);
0060     void slotDeleteUnused();
0061     /** @brief Export project data to text file. */
0062     void slotExportToText();
0063     /** @brief Update the displayed proxy parameters when user changes selection. */
0064     void slotUpdateProxyParams();
0065     /** @brief Insert a new metadata field. */
0066     void slotAddMetadataField();
0067     /** @brief Delete current metadata field. */
0068     void slotDeleteMetadataField();
0069     /** @brief Display proxy profiles management dialog. */
0070     void slotManageEncodingProfile();
0071     /** @brief Open editor for metadata item. */
0072     void slotEditMetadata(QTreeWidgetItem *, int);
0073     /** @brief Shows external proxy settings. */
0074     void slotExternalProxyChanged(bool enabled);
0075     void slotExternalProxyProfileChanged(const QString &);
0076     void setExternalProxyProfileData(const QString &profile);
0077 
0078 private:
0079     QPushButton *m_buttonOk;
0080     ProfileWidget *m_pw;
0081     bool m_savedProject;
0082     QStringList m_lumas;
0083     QString m_proxyparameters;
0084     QString m_proxyextension;
0085     bool m_newProject;
0086     /** @brief List of all proxies urls in this project. */
0087     QStringList m_projectProxies;
0088     /** @brief List of all thumbnails used in this project. */
0089     QStringList m_projectThumbs;
0090     QDir m_previewDir;
0091     /** @brief Fill the proxy profiles combobox. */
0092     void loadProxyProfiles();
0093     /** @brief Fill the external proxy profiles combobox. */
0094     void loadExternalProxyProfiles();
0095     QString m_previewparams;
0096     QString m_previewextension;
0097     QString m_initialExternalProxyProfile;
0098     EncodingTimelinePreviewProfilesChooser *m_tlPreviewProfiles;
0099     GuideCategories *m_guidesCategories;
0100     /** @brief Fill the proxy profiles combobox. */
0101     // void loadPreviewProfiles();
0102 
0103 Q_SIGNALS:
0104     /** @brief User deleted proxies, so disable them in project. */
0105     void disableProxies();
0106     void disablePreview();
0107     void refreshProfiles();
0108 };