File indexing completed on 2022-11-22 14:07:10

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 "definitions.h"
0010 #include "ui_profiledialog_ui.h"
0011 #include <mlt++/Mlt.h>
0012 
0013 class KMessageWidget;
0014 
0015 class ProfilesDialog : public QDialog
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     explicit ProfilesDialog(const QString &profileDescription = QString(), QWidget *parent = nullptr);
0021     /** @brief Using this constructor, the dialog only allows editing one profile. */
0022     explicit ProfilesDialog(const QString &profilePath, bool, QWidget *parent = nullptr);
0023     void fillList(const QString &selectedProfile = QString());
0024     bool profileTreeChanged() const;
0025 
0026 protected:
0027     void closeEvent(QCloseEvent *event) override;
0028 
0029 private slots:
0030     void slotUpdateDisplay(QString currentProfilePath = QString());
0031     void slotCreateProfile();
0032     bool slotSaveProfile();
0033     void slotDeleteProfile();
0034     void slotSetDefaultProfile();
0035     void slotProfileEdited();
0036     /** @brief Make sure the profile's width is always a multiple of 8 */
0037     void slotAdjustWidth();
0038     /** @brief Make sure the profile's height is always a multiple of 2 */
0039     void slotAdjustHeight();
0040     void slotScanningChanged(int ix);
0041     void accept() override;
0042     void reject() override;
0043 
0044 private:
0045     Ui::ProfilesDialog_UI m_view;
0046     int m_selectedProfileIndex;
0047     bool m_profileIsModified{false};
0048     bool m_isCustomProfile{false};
0049     /** @brief If we are in single profile editing, should contain the path for this profile. */
0050     QString m_customProfilePath;
0051     /** @brief True if a profile was saved / deleted and profile tree requires a reload. */
0052     bool m_profilesChanged{false};
0053     void saveProfile(const QString &path);
0054     bool askForSave();
0055     void connectDialog();
0056     void showMessage(const QString &text = QString(), KMessageWidget::MessageType type = KMessageWidget::Warning);
0057 };