void KoSliderCombo::keyPressEvent(QKeyEvent *e)
{
- if (e->key() == Qt::Key_Up) setValue(value() + d->slider->singleStep() * maximum() / 256 + 0.5);
- else if (e->key() == Qt::Key_Down) setValue(value() - d->slider->singleStep() * maximum() / 256 - 0.5);
+ if (e->key() == Qt::Key_Up) setValue(value() + d->slider->singleStep() * (maximum() - minimum()) / 256 + 0.5);
+ else if (e->key() == Qt::Key_Down) setValue(value() - d->slider->singleStep() * (maximum() - minimum()) / 256 - 0.5);
else QComboBox::keyPressEvent(e);
}
void KoSliderCombo::wheelEvent(QWheelEvent *e)
{
- if (e->delta() > 0) setValue(value() + d->slider->singleStep() * maximum() / 256 + 0.5);
- else setValue(value() - d->slider->singleStep() * maximum() / 256 - 0.5);
+ if (e->delta() > 0) setValue(value() + d->slider->singleStep() * (maximum() - minimum()) / 256 + 0.5);
+ else setValue(value() - d->slider->singleStep() * (maximum() - minimum()) / 256 - 0.5);
}
void KoSliderCombo::KoSliderComboPrivate::lineEditFinished()
{
qreal value = thePublic->currentText().toDouble();
slider->blockSignals(true);
- slider->setValue(int((value - minimum) * 256 / maximum + 0.5));
+ slider->setValue(int((value - minimum) * 256 / (maximum - minimum) + 0.5));
slider->blockSignals(false);
emit thePublic->valueChanged(value, true);
}
void KoSliderCombo::KoSliderComboPrivate::sliderValueChanged(int slidervalue)
{
- thePublic->setEditText(KGlobal::locale()->formatNumber(minimum + maximum*slidervalue/256, decimals));
+ thePublic->setEditText(KGlobal::locale()->formatNumber(minimum + (maximum - minimum)*slidervalue/256, decimals));
qreal value = thePublic->currentText().toDouble();
emit thePublic->valueChanged(value, false);
value = d->maximum;
setEditText(KGlobal::locale()->formatNumber(value, d->decimals));
d->slider->blockSignals(true);
- d->slider->setValue(int((value - d->minimum) * 256 / d->maximum + 0.5));
+ d->slider->setValue(int((value - d->minimum) * 256 / (d->maximum - d->minimum) + 0.5));
d->slider->blockSignals(false);
emit valueChanged(value, true);
}
textOutline->setDecimals(0);
textOutline->setValue(0);
textOutline->setToolTip(i18n("Outline width"));
+
+ backgroundAlpha->setMinimum(0);
+ backgroundAlpha->setMaximum(255);
+ backgroundAlpha->setDecimals(0);
+ backgroundAlpha->setValue(0);
+ backgroundAlpha->setToolTip(i18n("Background color opacity"));
+
+ itemrotate->setMinimum(-360);
+ itemrotate->setMaximum(360);
+ itemrotate->setDecimals(0);
+ itemrotate->setValue(0);
+ itemrotate->setToolTip(i18n("Rotation"));
itemzoom->setSuffix(i18n("%"));
m_frameWidth = render->renderWidth();
//TODO: get default title duration instead of hardcoded one
title_duration->setText(m_tc.getTimecode(GenTime(5000 / 1000.0)));
- connect(kcolorbutton, SIGNAL(clicked()), this, SLOT(slotChangeBackground())) ;
- connect(horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(slotChangeBackground())) ;
+ connect(backgroundColor, SIGNAL(clicked()), this, SLOT(slotChangeBackground())) ;
+ connect(backgroundAlpha, SIGNAL(valueChanged(qreal, bool)), this, SLOT(slotChangeBackground())) ;
connect(fontColorButton, SIGNAL(clicked()), this, SLOT(slotUpdateText())) ;
connect(textOutlineColor, SIGNAL(clicked()), this, SLOT(slotUpdateText())) ;
connect(zValue, SIGNAL(valueChanged(int)), this, SLOT(zIndexChanged(int)));
connect(itemzoom, SIGNAL(valueChanged(int)), this, SLOT(itemScaled(int)));
- connect(itemrotate, SIGNAL(valueChanged(int)), this, SLOT(itemRotate(int)));
+ connect(itemrotate, SIGNAL(valueChanged(qreal, bool)), this, SLOT(itemRotate(qreal)));
connect(itemhcenter, SIGNAL(clicked()), this, SLOT(itemHCenter()));
connect(itemvcenter, SIGNAL(clicked()), this, SLOT(itemVCenter()));
connect(itemtop, SIGNAL(clicked()), this, SLOT(itemTop()));
zoom_slider->setToolTip(i18n("Zoom"));
buttonRealSize->setToolTip(i18n("Original size (1:1)"));
buttonFitZoom->setToolTip(i18n("Fit zoom"));
- kcolorbutton->setToolTip(i18n("Select background color"));
- horizontalSlider->setToolTip(i18n("Background Transparency"));
+ backgroundColor->setToolTip(i18n("Select background color"));
+ backgroundAlpha->setToolTip(i18n("Background Transparency"));
itemhcenter->setIcon(KIcon("kdenlive-align-hor"));
itemhcenter->setToolTip(i18n("Align item horizontally"));
void TitleWidget::slotChangeBackground()
{
- QColor color = kcolorbutton->color();
- color.setAlpha(horizontalSlider->value());
+ QColor color = backgroundColor->color();
+ color.setAlpha(backgroundAlpha->value());
m_frameBorder->setBrush(QBrush(color));
}
}
}
-void TitleWidget::itemRotate(int val)
+void TitleWidget::itemRotate(qreal val)
{
QList<QGraphicsItem*> l = graphicsView->scene()->selectedItems();
if (l.size() == 1) {
Transform x = m_transformations[l.at(0)];
- x.rotate = (double)val;
+ x.rotate = val;
QTransform qtrans;
qtrans.scale(x.scalex, x.scaley);
qtrans.rotate(x.rotate);
}
// mbd: Update the GUI color selectors to match the stuff from the loaded document
QColor background_color = m_titledocument.getBackgroundColor();
- horizontalSlider->blockSignals(true);
- kcolorbutton->blockSignals(true);
- horizontalSlider->setValue(background_color.alpha());
+ backgroundAlpha->blockSignals(true);
+ backgroundColor->blockSignals(true);
+ backgroundAlpha->setValue(background_color.alpha());
background_color.setAlpha(255);
- kcolorbutton->setColor(background_color);
- horizontalSlider->blockSignals(false);
- kcolorbutton->blockSignals(false);
+ backgroundColor->setColor(background_color);
+ backgroundAlpha->blockSignals(false);
+ backgroundColor->blockSignals(false);
/*startViewportX->setValue(m_startViewport->data(0).toInt());
startViewportY->setValue(m_startViewport->data(1).toInt());
titleConfig.writeEntry("rect_background_alpha", rectBAlpha->value());
titleConfig.writeEntry("rect_line_width", rectLineWidth->value());
- titleConfig.writeEntry("background_color", kcolorbutton->color());
- titleConfig.writeEntry("background_alpha", horizontalSlider->value());
+ titleConfig.writeEntry("background_color", backgroundColor->color());
+ titleConfig.writeEntry("background_alpha", backgroundAlpha->value());
//! \todo Not sure if I should sync - it is probably safe to do it
config->sync();
rectBAlpha->setValue(titleConfig.readEntry("rect_background_alpha", rectBAlpha->value()));
rectLineWidth->setValue(titleConfig.readEntry("rect_line_width", rectLineWidth->value()));
- kcolorbutton->setColor(titleConfig.readEntry("background_color", kcolorbutton->color()));
- horizontalSlider->setValue(titleConfig.readEntry("background_alpha", horizontalSlider->value()));
+ backgroundColor->setColor(titleConfig.readEntry("background_color", backgroundColor->color()));
+ backgroundAlpha->setValue(titleConfig.readEntry("background_alpha", backgroundAlpha->value()));
}
void TitleWidget::adjustFrameSize()
</property>
</widget>
</item>
- <item row="3" column="1">
- <widget class="KIntSpinBox" name="itemrotate">
- <property name="minimum">
- <number>-360</number>
- </property>
- <property name="maximum">
- <number>360</number>
- </property>
- </widget>
- </item>
<item row="4" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<string>Background</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="0" colspan="2">
- <widget class="KColorButton" name="kcolorbutton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="2" column="0">
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
</property>
+ </spacer>
+ </item>
+ <item row="0" column="0">
+ <widget class="KColorButton" name="backgroundColor">
<property name="color">
<color>
<red>0</red>
</property>
</widget>
</item>
- <item row="3" column="1">
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QSlider" name="horizontalSlider">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximum">
- <number>255</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
+ <item row="0" column="1">
+ <widget class="KoSliderCombo" name="backgroundAlpha"/>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
+ <item row="3" column="1">
+ <widget class="KoSliderCombo" name="itemrotate"/>
+ </item>
</layout>
</widget>
</widget>