]> git.sesse.net Git - kdenlive/blob - src/titlewidget.h
Many improvements to title clips (recreate when missing, fix text selection visible...
[kdenlive] / src / titlewidget.h
1 /***************************************************************************
2                           titlewidget.h  -  description
3                              -------------------
4     begin                : Feb 28 2008
5     copyright            : (C) 2008 by Marco Gittler
6     email                : g.marco@freenet.de
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 #ifndef TITLEWIDGET_H
19 #define TITLEWIDGET_H
20
21
22 #include <QDialog>
23
24 #include <QMap>
25
26 #include "ui_titlewidget_ui.h"
27 #include "titledocument.h"
28 #include "renderer.h"
29 #include "graphicsscenerectmove.h"
30
31
32
33 class Transform {
34 public:
35     Transform() {
36         scalex = 1.0;
37         scaley = 1.0;
38         rotate = 0.0;
39     }
40     double scalex, scaley;
41     double rotate;
42 };
43
44 class TitleWidget : public QDialog , public Ui::TitleWidget_UI {
45     Q_OBJECT
46
47 public:
48     TitleWidget(KUrl url, QString projectPath, Render *render, QWidget *parent = 0);
49     QDomDocument xml();
50     void setXml(QDomDocument doc);
51     static QStringList getFreeTitleInfo(const KUrl &projectUrl);
52     static QString getTitleResourceFromName(const KUrl &projectUrl, const QString &titleName);
53
54 protected:
55     virtual void resizeEvent(QResizeEvent * event);
56
57 private:
58     QGraphicsPolygonItem *startViewport, *endViewport;
59     GraphicsSceneRectMove *m_scene;
60     void initViewports();
61     QMap<QGraphicsItem*, Transform > transformations;
62     TitleDocument m_titledocument;
63     QGraphicsRectItem *m_frameBorder;
64     QGraphicsPixmapItem *m_frameImage;
65     int m_frameWidth;
66     int m_frameHeight;
67     Render *m_render;
68     int m_count;
69     QAction *m_buttonRect;
70     QAction *m_buttonText;
71     QAction *m_buttonImage;
72     QAction *m_buttonCursor;
73     QAction *m_buttonSave;
74     QAction *m_buttonLoad;
75     /** project path for storing title clips */
76     QString m_projectPath;
77
78 public slots:
79     void slotNewText(QGraphicsTextItem *tt);
80     void slotNewRect(QGraphicsRectItem *rect);
81     void slotChangeBackground();
82     void selectionChanged();
83     void textChanged();
84     void rectChanged();
85     void fontBold();
86     void setupViewports();
87     void zIndexChanged(int);
88     void itemScaled(int);
89     void itemRotate(int);
90     void itemHCenter();
91     void itemVCenter();
92     void saveTitle(KUrl url = KUrl());
93     void loadTitle();
94     QPixmap renderedPixmap();
95
96 private slots:
97     void slotAdjustSelectedItem();
98     void slotUpdateZoom(int pos);
99     void slotZoom(bool up);
100     void slotAdjustZoom();
101     void slotZoomOneToOne();
102     void slotUpdateText();
103     void displayBackgroundFrame();
104     void setCurrentItem(QGraphicsItem *item);
105     void slotTextTool();
106     void slotRectTool();
107     void slotSelectTool();
108     void slotImageTool();
109 };
110
111
112 #endif