]> git.sesse.net Git - kdenlive/commitdiff
text changeable in editor
authorMarco Gittler <marco@gitma.de>
Tue, 26 Feb 2008 18:43:06 +0000 (18:43 +0000)
committerMarco Gittler <marco@gitma.de>
Tue, 26 Feb 2008 18:43:06 +0000 (18:43 +0000)
svn path=/branches/KDE4/; revision=1950

src/graphicsscenerectmove.cpp
src/titlewidget.cpp
src/titlewidget.h
src/widgets/titlewidget_ui.ui

index 362956a3826b0b1f7c72ab7598f0a9dcfe0a6c6f..dccdbb9660ace7e47b10b7251514634c21be0548 100644 (file)
@@ -15,7 +15,7 @@ GraphicsSceneRectMove::GraphicsSceneRectMove(QObject *parent):QGraphicsScene(par
 
 void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e){
 
-       if (selected && selected->type()==3 &&button==1){
+       if (selected && selected->type()==3 && button==1){
                
                QGraphicsRectItem *gi=(QGraphicsRectItem*)selected;
                QRectF newrect=gi->rect();
@@ -84,6 +84,7 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e){
                        if (resizeMode!=NoResize)
                                selected=gi;
                }
+               break;
        }
        switch (resizeMode){
                case TopLeft:
index c6f79360eada55e5ad88c08d9743ccaf934245ac..993aa9ae7d91cf692595b9f62ed3997518ad6ccf 100644 (file)
@@ -3,6 +3,7 @@
 #include <QGraphicsView>
 #include <KDebug>
 #include <QGraphicsItem>
+int settingUp=false;
 
 TitleWidget::TitleWidget (QDialog *parent):QDialog(parent){
        setupUi(this);
@@ -11,7 +12,16 @@ TitleWidget::TitleWidget (QDialog *parent):QDialog(parent){
        connect (kcolorbutton, SIGNAL ( clicked()), this, SLOT( slotChangeBackground()) ) ;
        connect (horizontalSlider, SIGNAL ( valueChanged(int) ), this, SLOT( slotChangeBackground()) ) ;
        connect (ktextedit, SIGNAL(textChanged()), this , SLOT (textChanged()));
+       connect (fontColorButton, SIGNAL ( clicked()), this, SLOT( textChanged()) ) ;
+       connect (kfontrequester, SIGNAL ( fontSelected(const QFont &)), this, SLOT( textChanged()) ) ;
+       connect(textAlpha, SIGNAL( valueChanged(int) ), this, SLOT (textChanged()));
+       //connect (ktextedit, SIGNAL(selectionChanged()), this , SLOT (textChanged()));
        
+       connect(rectFAlpha, SIGNAL( valueChanged(int) ), this, SLOT (rectChanged()));
+       connect(rectBAlpha, SIGNAL( valueChanged(int) ), this, SLOT (rectChanged()));
+       connect(rectFColor, SIGNAL( clicked() ), this, SLOT (rectChanged()));
+       connect(rectBColor, SIGNAL( clicked() ), this, SLOT (rectChanged()));
+       connect(rectLineWidth, SIGNAL( valueChanged(int) ), this, SLOT (rectChanged()));
        GraphicsSceneRectMove *scene=new GraphicsSceneRectMove(this);
        
        
@@ -40,7 +50,6 @@ void TitleWidget::slotNewRect(){
        
        QGraphicsRectItem * ri=graphicsView->scene()->addRect(-50,-50,100,100);
        ri->setFlags(QGraphicsItem::ItemIsMovable|QGraphicsItem::ItemIsSelectable);
-
 }
 void TitleWidget::slotNewText(){
        QGraphicsTextItem *tt=graphicsView->scene()->addText("Text here");
@@ -55,18 +64,32 @@ void TitleWidget::slotNewText(){
 
 void TitleWidget::selectionChanged(){
        QList<QGraphicsItem*> l=graphicsView->scene()->selectedItems();
-       if (l.size()>0){
+       if (l.size()==1){
                kDebug() << (l[0])->type();
                if ((l[0])->type()==8  ){
+                       QGraphicsTextItem* i=((QGraphicsTextItem*)l[0]);
                        if (l[0]->hasFocus() )
-                       ktextedit->setHtml(((QGraphicsTextItem*)l[0])->toHtml());
+                       ktextedit->setHtml(i->toHtml());
                        toolBox->setCurrentIndex(1);
                }else
                if ((l[0])->type()==3){
-                       
+                       settingUp=true;
+                       QGraphicsRectItem *rec=((QGraphicsRectItem*)l[0]);
                        toolBox->setCurrentIndex(2);
-               }else{
-                       toolBox->setCurrentIndex(0);
+                       rectFAlpha->setValue(rec->pen().color().alpha());
+                       rectBAlpha->setValue(rec->brush().isOpaque() ? rec->brush().color().alpha() : 0);
+                       kDebug() << rec->brush().color().alpha();
+                       QColor fcol=rec->pen().color();
+                       QColor bcol=rec->brush().color();
+                       //fcol.setAlpha(255);
+                       //bcol.setAlpha(255);
+                       rectFColor->setColor(fcol);
+                       rectBColor->setColor(bcol);
+                       settingUp=false;
+                       rectLineWidth->setValue(rec->pen().width());
+               }
+               else{
+                       //toolBox->setCurrentIndex(0);
                }
        }
 }
@@ -79,12 +102,24 @@ void TitleWidget::slotChangeBackground(){
 
 void TitleWidget::textChanged(){
        QList<QGraphicsItem*> l=graphicsView->scene()->selectedItems();
-       if (l.size()>0 && (l[0])->type()==8 && ktextedit->hasFocus()/*textitem*/){
-               
+       if (l.size()==1 && (l[0])->type()==8 && !l[0]->hasFocus()){
                ((QGraphicsTextItem*)l[0])->setHtml(ktextedit->toHtml());
        }
 }
-
+void TitleWidget::rectChanged(){
+       QList<QGraphicsItem*> l=graphicsView->scene()->selectedItems();
+       if (l.size()==1 && (l[0])->type()==3 && !settingUp){
+               QGraphicsRectItem *rec=(QGraphicsRectItem*)l[0];
+               QColor f=rectFColor->color();
+               f.setAlpha(rectFAlpha->value());
+               QPen penf(f);
+               penf.setWidth(rectLineWidth->value());
+               rec->setPen(penf);
+               QColor b=rectBColor->color();
+               b.setAlpha(rectBAlpha->value());
+               rec->setBrush(QBrush(b));
+       }
+}
 
 #include "moc_titlewidget.cpp"
 
index b19ce754fc8618da07e2891886d333eacac834c1..ec5cb52e2e49679f6f46da80a0fc5a975d036bf6 100644 (file)
@@ -14,6 +14,7 @@ public slots:
        void slotChangeBackground();
        void selectionChanged();
        void textChanged();
+       void rectChanged();
 };
 
 
index 7e7412ec877794c353f752c44b37b4439b885e11..d54966ca36403a3591a27acdbbc995d850fdb142 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>718</width>
-    <height>406</height>
+    <width>918</width>
+    <height>564</height>
    </rect>
   </property>
   <property name="windowTitle" >
   </property>
   <layout class="QGridLayout" >
    <item row="0" column="0" >
-    <layout class="QVBoxLayout" >
-     <item>
+    <layout class="QGridLayout" >
+     <item row="0" column="0" >
+      <layout class="QHBoxLayout" >
+       <item>
+        <widget class="QPushButton" name="newRectButton" >
+         <property name="text" >
+          <string>New Rect</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="newTextButton" >
+         <property name="text" >
+          <string>New Text</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QLabel" name="label_12" >
+         <property name="text" >
+          <string>Z-Index:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QSpinBox" name="spinBox" />
+       </item>
+      </layout>
+     </item>
+     <item row="1" column="0" >
       <layout class="QHBoxLayout" >
        <item>
         <widget class="QGraphicsView" name="graphicsView" />
        </item>
        <item>
         <widget class="QToolBox" name="toolBox" >
+         <property name="sizePolicy" >
+          <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
          <property name="currentIndex" >
-          <number>2</number>
+          <number>1</number>
          </property>
          <widget class="QWidget" name="Background" >
           <property name="geometry" >
@@ -31,7 +78,7 @@
             <x>0</x>
             <y>0</y>
             <width>94</width>
-            <height>65</height>
+            <height>69</height>
            </rect>
           </property>
           <attribute name="label" >
              </item>
             </layout>
            </item>
+           <item row="1" column="0" >
+            <spacer>
+             <property name="orientation" >
+              <enum>Qt::Vertical</enum>
+             </property>
+             <property name="sizeHint" >
+              <size>
+               <width>20</width>
+               <height>400</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
           </layout>
          </widget>
          <widget class="QWidget" name="Text" >
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>286</width>
-            <height>136</height>
+            <width>441</width>
+            <height>366</height>
            </rect>
           </property>
           <attribute name="label" >
                 </widget>
                </item>
                <item>
-                <widget class="KColorButton" name="kcolorbutton_2" />
+                <widget class="KColorButton" name="fontColorButton" />
+               </item>
+               <item>
+                <widget class="QSlider" name="textAlpha" >
+                 <property name="orientation" >
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                </widget>
                </item>
                <item>
                 <spacer>
                  </property>
                 </spacer>
                </item>
-               <item>
-                <widget class="QPushButton" name="newTextButton" >
-                 <property name="text" >
-                  <string>New Text</string>
-                 </property>
-                </widget>
-               </item>
               </layout>
              </item>
              <item>
                 </widget>
                </item>
                <item>
-                <widget class="KFontRequester" name="kfontrequester" />
+                <spacer>
+                 <property name="orientation" >
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                 <property name="sizeHint" >
+                  <size>
+                   <width>40</width>
+                   <height>20</height>
+                  </size>
+                 </property>
+                </spacer>
                </item>
               </layout>
              </item>
+             <item>
+              <widget class="KFontRequester" name="kfontrequester" />
+             </item>
              <item>
               <widget class="KTextEdit" name="ktextedit" />
              </item>
+             <item>
+              <spacer>
+               <property name="orientation" >
+                <enum>Qt::Vertical</enum>
+               </property>
+               <property name="sizeHint" >
+                <size>
+                 <width>20</width>
+                 <height>40</height>
+                </size>
+               </property>
+              </spacer>
+             </item>
             </layout>
            </item>
           </layout>
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>322</width>
-            <height>295</height>
+            <width>152</width>
+            <height>229</height>
            </rect>
           </property>
           <attribute name="label" >
           <layout class="QGridLayout" >
            <item row="0" column="0" >
             <layout class="QVBoxLayout" >
-             <item>
-              <widget class="QPushButton" name="newRectButton" >
-               <property name="text" >
-                <string>New Rect</string>
-               </property>
-              </widget>
-             </item>
              <item>
               <widget class="QGroupBox" name="groupBox" >
                <property name="title" >
-                <string>Foreground</string>
+                <string>Border</string>
                </property>
                <layout class="QGridLayout" >
                 <item row="0" column="0" >
                  <layout class="QGridLayout" >
                   <item row="0" column="0" >
-                   <widget class="QCheckBox" name="checkBox" >
-                    <property name="text" >
-                     <string>show</string>
-                    </property>
-                   </widget>
-                  </item>
-                  <item row="0" column="1" colspan="2" >
-                   <widget class="KColorButton" name="kcolorbutton_5" />
-                  </item>
-                  <item row="1" column="0" >
                    <widget class="QLabel" name="label_3" >
                     <property name="text" >
                      <string>Alpha</string>
                     </property>
                    </widget>
                   </item>
-                  <item rowspan="2" row="1" column="2" >
+                  <item row="0" column="1" >
                    <widget class="QLabel" name="label_4" >
                     <property name="text" >
                      <string>Linewidth</string>
                     </property>
                    </widget>
                   </item>
-                  <item rowspan="2" row="2" column="0" colspan="2" >
-                   <widget class="QSlider" name="horizontalSlider_3" >
+                  <item row="1" column="0" >
+                   <widget class="QSlider" name="rectFAlpha" >
+                    <property name="maximum" >
+                     <number>255</number>
+                    </property>
                     <property name="orientation" >
                      <enum>Qt::Horizontal</enum>
                     </property>
                    </widget>
                   </item>
-                  <item row="3" column="2" >
-                   <widget class="QSpinBox" name="spinBox" />
+                  <item row="1" column="1" >
+                   <widget class="QSpinBox" name="rectLineWidth" />
+                  </item>
+                  <item row="2" column="0" >
+                   <widget class="QLabel" name="label_11" >
+                    <property name="text" >
+                     <string>Color</string>
+                    </property>
+                   </widget>
+                  </item>
+                  <item row="2" column="1" >
+                   <widget class="KColorButton" name="rectFColor" />
                   </item>
                  </layout>
                 </item>
                 <item row="0" column="0" >
                  <layout class="QGridLayout" >
                   <item row="0" column="0" >
-                   <widget class="QCheckBox" name="checkBox_2" >
+                   <widget class="QLabel" name="label" >
                     <property name="text" >
-                     <string>show</string>
+                     <string>Alpha:</string>
                     </property>
                    </widget>
                   </item>
                   <item row="0" column="1" >
-                   <widget class="KColorButton" name="kcolorbutton_6" />
+                   <widget class="QLabel" name="label_2" >
+                    <property name="text" >
+                     <string>Color</string>
+                    </property>
+                   </widget>
                   </item>
                   <item row="1" column="0" >
-                   <widget class="QLabel" name="label" >
-                    <property name="text" >
-                     <string>Alpha:</string>
+                   <widget class="QSlider" name="rectBAlpha" >
+                    <property name="maximum" >
+                     <number>255</number>
+                    </property>
+                    <property name="orientation" >
+                     <enum>Qt::Horizontal</enum>
                     </property>
                    </widget>
                   </item>
                   <item row="1" column="1" >
-                   <widget class="QLabel" name="label_2" >
+                   <widget class="KColorButton" name="rectBColor" />
+                  </item>
+                 </layout>
+                </item>
+                <item row="1" column="0" >
+                 <spacer>
+                  <property name="orientation" >
+                   <enum>Qt::Vertical</enum>
+                  </property>
+                  <property name="sizeHint" >
+                   <size>
+                    <width>20</width>
+                    <height>400</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+               </layout>
+              </widget>
+             </item>
+            </layout>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="Seite" >
+          <property name="geometry" >
+           <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>214</width>
+            <height>202</height>
+           </rect>
+          </property>
+          <attribute name="label" >
+           <string>Start-/EndViewport</string>
+          </attribute>
+          <layout class="QGridLayout" >
+           <item row="0" column="0" >
+            <layout class="QVBoxLayout" >
+             <item>
+              <widget class="QGroupBox" name="groupBox_3" >
+               <property name="title" >
+                <string>StartViewport</string>
+               </property>
+               <layout class="QGridLayout" >
+                <item row="0" column="0" >
+                 <layout class="QGridLayout" >
+                  <item row="0" column="0" >
+                   <widget class="QLabel" name="label_8" >
                     <property name="text" >
-                     <string>Linewidth</string>
+                     <string>X:</string>
                     </property>
                    </widget>
                   </item>
-                  <item row="2" column="0" >
-                   <widget class="QSlider" name="horizontalSlider_4" >
-                    <property name="orientation" >
-                     <enum>Qt::Horizontal</enum>
+                  <item row="0" column="1" >
+                   <widget class="QLabel" name="label_9" >
+                    <property name="text" >
+                     <string>Y:</string>
                     </property>
                    </widget>
                   </item>
-                  <item row="2" column="1" >
-                   <widget class="QSpinBox" name="spinBox_2" />
+                  <item row="0" column="2" >
+                   <widget class="QLabel" name="label_10" >
+                    <property name="text" >
+                     <string>Size:</string>
+                    </property>
+                   </widget>
+                  </item>
+                  <item row="1" column="0" >
+                   <widget class="QSpinBox" name="spinBox_3" />
+                  </item>
+                  <item row="1" column="1" >
+                   <widget class="QSpinBox" name="spinBox_4" />
+                  </item>
+                  <item row="1" column="2" >
+                   <widget class="QSpinBox" name="spinBox_5" />
+                  </item>
+                 </layout>
+                </item>
+               </layout>
+              </widget>
+             </item>
+             <item>
+              <widget class="QGroupBox" name="groupBox_4" >
+               <property name="title" >
+                <string>EndViewport</string>
+               </property>
+               <layout class="QGridLayout" >
+                <item row="0" column="0" >
+                 <layout class="QVBoxLayout" >
+                  <item>
+                   <layout class="QGridLayout" >
+                    <item row="0" column="0" >
+                     <widget class="QLabel" name="label_5" >
+                      <property name="text" >
+                       <string>X:</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item row="0" column="1" >
+                     <widget class="QLabel" name="label_6" >
+                      <property name="text" >
+                       <string>Y:</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item row="0" column="2" >
+                     <widget class="QLabel" name="label_7" >
+                      <property name="text" >
+                       <string>Size:</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item row="1" column="0" >
+                     <widget class="QSpinBox" name="spinBox_6" />
+                    </item>
+                    <item row="1" column="1" >
+                     <widget class="QSpinBox" name="spinBox_7" />
+                    </item>
+                    <item row="1" column="2" >
+                     <widget class="QSpinBox" name="spinBox_8" />
+                    </item>
+                   </layout>
+                  </item>
+                  <item>
+                   <spacer>
+                    <property name="orientation" >
+                     <enum>Qt::Vertical</enum>
+                    </property>
+                    <property name="sizeHint" >
+                     <size>
+                      <width>20</width>
+                      <height>400</height>
+                     </size>
+                    </property>
+                   </spacer>
                   </item>
                  </layout>
                 </item>
        </item>
       </layout>
      </item>
-     <item>
+     <item row="2" column="0" >
       <widget class="QDialogButtonBox" name="buttonBox" >
        <property name="orientation" >
         <enum>Qt::Horizontal</enum>
    <slot>accept()</slot>
    <hints>
     <hint type="sourcelabel" >
-     <x>248</x>
-     <y>254</y>
+     <x>253</x>
+     <y>558</y>
     </hint>
     <hint type="destinationlabel" >
      <x>157</x>
    <slot>reject()</slot>
    <hints>
     <hint type="sourcelabel" >
-     <x>316</x>
-     <y>260</y>
+     <x>321</x>
+     <y>558</y>
     </hint>
     <hint type="destinationlabel" >
      <x>286</x>
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>kfontrequester</sender>
+   <signal>fontSelected(QFont)</signal>
+   <receiver>ktextedit</receiver>
+   <slot>setCurrentFont(QFont)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>715</x>
+     <y>184</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>713</x>
+     <y>240</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fontColorButton</sender>
+   <signal>changed(QColor)</signal>
+   <receiver>ktextedit</receiver>
+   <slot>setColor(QColor)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>599</x>
+     <y>120</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>621</x>
+     <y>256</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>