]> git.sesse.net Git - kdenlive/blob - src/clipproperties.h
const'ify, optimization, fix indent
[kdenlive] / src / clipproperties.h
1 /***************************************************************************
2  *   Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20
21 #ifndef CLIPPROPERTIES_H
22 #define CLIPPROPERTIES_H
23
24 #include "definitions.h"
25 #include "timecode.h"
26 #include "docclipbase.h"
27 #include "ui_clipproperties_ui.h"
28
29 #include <QStyledItemDelegate>
30
31 class PropertiesViewDelegate : public QStyledItemDelegate
32 {
33     Q_OBJECT
34 public:
35     PropertiesViewDelegate(QWidget *parent) : QStyledItemDelegate(parent) {
36         m_height = parent->fontMetrics().height() * 1.2;
37     }
38 protected:
39     QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const {
40         return QSize(QStyledItemDelegate::sizeHint(option, index).width(), m_height);
41     }
42 private:
43     int m_height;
44 };
45
46 class ClipProperties : public QDialog
47 {
48     Q_OBJECT
49
50 public:
51     ClipProperties(DocClipBase *clip, const Timecode &tc, double fps, QWidget * parent = 0);
52     ClipProperties(const QList<DocClipBase *> &cliplist, const Timecode &tc, const QMap<QString, QString> &commonproperties, QWidget * parent);
53     virtual ~ClipProperties();
54     QMap <QString, QString> properties();
55     const QString &clipId() const;
56     bool needsTimelineRefresh() const;
57     bool needsTimelineReload() const;
58     void disableClipId(const QString &id);
59
60 public slots:
61     void slotFillMarkersList(DocClipBase *clip);
62     void slotUpdateAnalysisData(DocClipBase *clip);
63     
64 private slots:
65     void parseFolder(bool reloadThumb = true);
66     void slotAddMarker();
67     void slotEditMarker();
68     void slotDeleteMarker();
69     void slotCheckMaxLength();
70     void slotEnableLuma(int state);
71     void slotEnableLumaFile(int state);
72     void slotUpdateDurationFormat(int ix);
73     void slotApplyProperties();
74     void slotModified();
75     void slotDeleteProxy();
76     void slotOpenUrl(const QString &url);
77     void slotSaveMarkers();
78     void slotLoadMarkers();
79     void slotDeleteAnalysis();
80     void slotGotThumbnail(const QString &id, const QImage &img);
81     void slotSaveAnalysis();
82     void slotLoadAnalysis();
83     void slotReloadVideoProperties();
84     void slotReloadVideoThumb();
85
86 private:
87     Ui::ClipProperties_UI m_view;
88     QMap <QString, QString> m_old_props;
89     DocClipBase *m_clip;
90     Timecode m_tc;
91     double m_fps;
92     /** used to count images in slideshow clip */
93     int m_count;
94     /** some visual properties changed, reload thumbnails */
95     bool m_clipNeedsRefresh;
96     /** clip resource changed, reload it */
97     bool m_clipNeedsReLoad;
98     /** Frame with proxy info / delete button */
99     QFrame* m_proxyContainer;
100     void loadVideoProperties(const QMap<QString, QString> &props);
101
102 signals:
103     void addMarkers(const QString &, QList <CommentedTime>);
104     void deleteProxy(const QString&);
105     void applyNewClipProperties(const QString&, const QMap <QString, QString> &, const QMap <QString, QString> &, bool, bool);
106     void saveMarkers(const QString &id);
107     void loadMarkers(const QString &id);
108     void editAnalysis(const QString &id, const QString &name, const QString &value);
109     void requestThumb(const QString &id, const QList <int>& frames);
110 };
111
112
113 #endif
114