]> git.sesse.net Git - kdenlive/commitdiff
first titler test
authorMarco Gittler <marco@gitma.de>
Tue, 26 Feb 2008 00:05:58 +0000 (00:05 +0000)
committerMarco Gittler <marco@gitma.de>
Tue, 26 Feb 2008 00:05:58 +0000 (00:05 +0000)
svn path=/branches/KDE4/; revision=1945

src/CMakeLists.txt
src/projectlist.cpp
src/titlewidget.cpp [new file with mode: 0644]
src/titlewidget.h [new file with mode: 0644]

index 5a5000a6761155c4ced528de5b4b771a07084987..3815962df0f6fa8063bdcc68048a14c367c447b7 100644 (file)
@@ -35,6 +35,7 @@ kde4_add_ui_files(kdenlive_UI
   widgets/listval_ui.ui
   widgets/boolval_ui.ui
   widgets/colorval_ui.ui
+  widgets/titlewidget_ui.ui
 )
  
 set(kdenlive_SRCS 
@@ -80,6 +81,7 @@ set(kdenlive_SRCS
   projectsettings.cpp
   kdenlivesettingsdialog.cpp
   complexparameter.cpp
+  titlewidget.cpp
 )
 
 kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc )
index 43913c75cb1fc874ad1e422fec566983fdec4d02..3d9fb1c3df7af6bdec81207550f7b7d255ba5a74 100644 (file)
@@ -42,7 +42,7 @@
 #include "ui_colorclip_ui.h"
 
 #include "definitions.h"
-//#include "titlewidget.h"
+#include "titlewidget.h"
 
 #include <QtGui>
 
@@ -343,7 +343,7 @@ void ProjectList::slotAddColorClip()
 
 void ProjectList::slotAddTitleClip()
 {
-#if 0
+
        if (!m_commandStack) kDebug()<<"!!!!!!!!!!!!!!!!  NO CMD STK";
        //QDialog *dia = new QDialog;
        
@@ -359,7 +359,6 @@ void ProjectList::slotAddTitleClip()
        }
        delete dia_ui;
        //delete dia;
-#endif
 }
 void ProjectList::setDocument(KdenliveDoc *doc)
 {
diff --git a/src/titlewidget.cpp b/src/titlewidget.cpp
new file mode 100644 (file)
index 0000000..0f0e9a4
--- /dev/null
@@ -0,0 +1,72 @@
+#include "titlewidget.h"
+#include <QGraphicsScene>
+#include <QGraphicsView>
+#include <KDebug>
+#include <QGraphicsItem>
+
+TitleWidget::TitleWidget (QDialog *parent):QDialog(parent){
+       setupUi(this);
+       connect (newTextButton,SIGNAL(clicked()), this, SLOT( slotNewText()));
+       connect (kcolorbutton, SIGNAL ( clicked()), this, SLOT( slotChangeBackground()) ) ;
+       connect (horizontalSlider, SIGNAL ( valueChanged(int) ), this, SLOT( slotChangeBackground()) ) ;
+       connect (ktextedit, SIGNAL(textChanged()), this , SLOT (textChanged()));
+       
+       QGraphicsScene *scene=new QGraphicsScene(this);
+       
+       
+       
+ // a gradient background
+       QRadialGradient *gradient=new QRadialGradient(0, 0, 10);
+       gradient->setSpread(QGradient::RepeatSpread);
+       //scene->setBackgroundBrush(*gradient);
+       
+       graphicsView->setScene(scene);
+       connect (graphicsView->scene(), SIGNAL (selectionChanged()), this , SLOT( selectionChanged()));
+       
+       graphicsView->show();
+       graphicsView->setRenderHint(QPainter::Antialiasing);
+       //graphicsView->setBackgroundBrush(QPixmap(":/images/cheese.jpg"));
+       //graphicsView->setCacheMode(QGraphicsView::CacheBackground);
+       //graphicsView->setDragMode(QGraphicsView::ScrollHandDrag);
+       graphicsView->setInteractive(true);
+       graphicsView->setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Colliding Mice"));
+       graphicsView->resize(400, 300);
+       
+       update();
+}
+
+void TitleWidget::slotNewText(){
+       
+       QGraphicsTextItem *tt=graphicsView->scene()->addText("Text here");
+       tt->setFlags(QGraphicsItem::ItemIsMovable|QGraphicsItem::ItemIsSelectable);
+       tt->setTextInteractionFlags (Qt::TextEditorInteraction);
+       kDebug() << tt->metaObject()->className();
+       /*QGraphicsRectItem * ri=graphicsView->scene()->addRect(-50,-50,100,100);
+       ri->setFlags(QGraphicsItem::ItemIsMovable|QGraphicsItem::ItemIsSelectable);*/
+
+}
+void TitleWidget::selectionChanged(){
+       QList<QGraphicsItem*> l=graphicsView->scene()->selectedItems();
+       if (l.size()>0){
+               if ((l[0])->type()==8){
+                       ktextedit->setHtml(((QGraphicsTextItem*)l[0])->toHtml());
+                       toolBox->setCurrentIndex(1);
+               }
+       }
+}
+
+void TitleWidget::slotChangeBackground(){
+       QColor color=kcolorbutton->color();
+       color.setAlpha(horizontalSlider->value());
+       graphicsView->scene()->setBackgroundBrush(QBrush(color));
+}
+
+void TitleWidget::textChanged(){
+       QList<QGraphicsItem*> l=graphicsView->scene()->selectedItems();
+       if (l.size()>0 && (l[0])->type()==8 /*textitem*/){
+               
+               ((QGraphicsTextItem*)l[0])->setHtml(ktextedit->toHtml());
+       }
+}
+#include "moc_titlewidget.cpp"
+
diff --git a/src/titlewidget.h b/src/titlewidget.h
new file mode 100644 (file)
index 0000000..3f88361
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef TITLEWIDGET_H
+#define TITLEWIDGET_H
+
+#include "ui_titlewidget_ui.h"
+#include <QDialog>
+
+class TitleWidget : public QDialog , public Ui::TitleWidget_UI{
+       Q_OBJECT
+public:
+               TitleWidget(QDialog *parent=0);
+public slots:
+       void slotNewText();
+       void slotChangeBackground();
+       void selectionChanged();
+       void textChanged();
+};
+
+
+#endif