X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fprofilesdialog.h;h=a9927babaa901bfda785a0054e3cc248a7cc3885;hb=a5cf56c02b034c973cfaf0bc25c56b69a4d5b32b;hp=d0039b0a5b684d6e1de2b0f9866bc8613b8306a0;hpb=2a223cff6e45c560c28857b72c0cb7e584f9a4ef;p=kdenlive diff --git a/src/profilesdialog.h b/src/profilesdialog.h index d0039b0a..a9927bab 100644 --- a/src/profilesdialog.h +++ b/src/profilesdialog.h @@ -21,28 +21,76 @@ #ifndef PROFILESDIALOG_H #define PROFILESDIALOG_H -#include +#include "definitions.h" #include "ui_profiledialog_ui.h" -class ProfilesDialog : public QDialog { +class ProfilesDialog : public QDialog +{ Q_OBJECT public: ProfilesDialog(QWidget * parent = 0); - static QStringList getProfileNames(); + void fillList(const QString selectedProfile = QString()); static QMap< QString, QString > getSettingsForProfile(const QString profileName); static QMap< QString, QString > getSettingsFromFile(const QString path); + static QString getPathFromDescription(const QString profileDesc); + static MltVideoProfile getVideoProfile(QString name); + static QMap getProfilesInfo(); + static void saveProfile(MltVideoProfile &profile); + static QString existingProfile(MltVideoProfile profile); + static bool existingProfileDescription(const QString &desc); + + /** @brief Check if a given profile matches passed properties: + * @param width The profile frame width + * @param height The profile frame height + * @param fps The profile fps + * @param par The sample aspect ratio + * @param isImage If true, compare width with profile's display width ( = dar * height) + * @param profile The profile to match + * @return true if properties match profile */ + static bool matchProfile(int width, int height, double fps, double par, bool isImage, MltVideoProfile profile); + + /** @brief Find profiles that match parameter properties: + * @param width The profile frame width + * @param height The profile frame height + * @param fps The profile fps + * @param par The sample aspect ratio + * @param useDisplayWidth If true, compare width with profile's display width ( = dar * height) + * @return A string list of the matching profiles description */ + static QMap getProfilesFromProperties(int width, int height, double fps, double par, bool useDisplayWidth = false); + + /** @brief Returns an value from a string by replacing "%width" and "%height" with given profile values: + * @param profile The profile that gives width & height + * @param eval The string to be evaluated, for example: "%width / 2" + * @return the evaluated value */ + static double getStringEval(const MltVideoProfile &profile, QString eval); + + /** @brief Get the descriptive text for given colorspace code (defined by MLT) + * @param colorspace An int as defined in mlt_profile.h + * @return The string description */ + static QString getColorspaceDescription(int colorspace); + +protected: + virtual void closeEvent(QCloseEvent *event); private slots: void slotUpdateDisplay(); + void slotCreateProfile(); + bool slotSaveProfile(); + void slotDeleteProfile(); + void slotSetDefaultProfile(); + void slotProfileEdited(); + virtual void accept(); private: Ui::ProfilesDialog_UI m_view; - QStringList m_mltProfilesList; - QStringList m_customProfilesList; + int m_selectedProfileIndex; + bool m_profileIsModified; bool m_isCustomProfile; + void saveProfile(const QString path); + bool askForSave(); };