- l->setMargin(0);
-
- /*m_buttonDec = new QToolButton(this);
- m_buttonDec->setIcon(KIcon("arrow-left"));
- m_buttonDec->setIconSize(QSize(12, 12));
- m_buttonDec->setObjectName("ButtonDec");
- l->addWidget(m_buttonDec);*/
-
- m_edit = new QLineEdit(this);
- m_edit->setValidator(new QDoubleValidator(m_minimum, m_maximum, m_precision, this));
- m_edit->setAlignment(Qt::AlignCenter);
- m_edit->setEnabled(false);
- l->addWidget(m_edit);
-
- /*m_buttonInc = new QToolButton(this);
- m_buttonInc->setIcon(KIcon("arrow-right"));
- m_buttonInc->setIconSize(QSize(12, 12));
- m_buttonInc->setObjectName("ButtonInc");
- l->addWidget(m_buttonInc);*/
-
- QPalette p = palette();
- KColorScheme scheme(p.currentColorGroup(), KColorScheme::View, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
- QColor bg = scheme.background(KColorScheme::LinkBackground).color();
- QColor fg = scheme.foreground(KColorScheme::LinkText).color();
- QColor editbg = scheme.background(KColorScheme::ActiveBackground).color();
- QColor editfg = scheme.foreground(KColorScheme::ActiveText).color();
- QString stylesheet(QString("QLineEdit { background-color: rgb(%1, %2, %3); border: 1px solid rgb(%1, %2, %3); border-radius: 5px; padding: 0px; color: rgb(%4, %5, %6); } QLineEdit::disabled { color: rgb(%4, %5, %6); }")
- .arg(bg.red()).arg(bg.green()).arg(bg.blue())
- .arg(fg.red()).arg(fg.green()).arg(fg.blue()));
- stylesheet.append(QString("QLineEdit::focus, QLineEdit::enabled { background-color: rgb(%1, %2, %3); color: rgb(%4, %5, %6); }")
- .arg(editbg.red()).arg(editbg.green()).arg(editbg.blue())
- .arg(editfg.red()).arg(editfg.green()).arg(editfg.blue()));
-/* QString stylesheet(QString("QLineEdit { background-color: rgb(%1, %2, %3); border: 1px solid rgb(%1, %2, %3); padding: 2px; padding-bottom: 0px; border-top-left-radius: 7px; border-top-right-radius: 7px; }")
- .arg(bg.red()).arg(bg.green()).arg(bg.blue()));
- stylesheet.append(QString("QLineEdit::focus, QLineEdit::enabled { background-color: rgb(%1, %2, %3); color: rgb(%4, %5, %6); }")
- .arg(textbg.red()).arg(textbg.green()).arg(textbg.blue())
- .arg(textfg.red()).arg(textfg.green()).arg(textfg.blue()));
- QString stylesheet(QString("* { background-color: rgb(%1, %2, %3); margin: 0px; }").arg(bg.red()).arg(bg.green()).arg(bg.blue()));
- stylesheet.append(QString("QLineEdit { border: 0px; height: 100%; } QLineEdit::focus, QLineEdit::enabled { background-color: rgb(%1, %2, %3); color: rgb(%4, %5, %6); }")
- .arg(textbg.red()).arg(textbg.green()).arg(textbg.blue())
- .arg(textfg.red()).arg(textfg.green()).arg(textfg.blue()));
- stylesheet.append(QString("QToolButton { border: 1px solid rgb(%1, %2, %3); }").arg(bg.red()).arg(bg.green()).arg(bg.blue()));
- stylesheet.append(QString("QToolButton#ButtonDec { border-top-left-radius: 5px; border-bottom-left-radius: 5px; }"));
- stylesheet.append(QString("QToolButton#ButtonInc { border-top-right-radius: 5px; border-bottom-right-radius: 5px; }"));*/
- setStyleSheet(stylesheet);
-
- updateMaxWidth();
-
- /*connect(m_buttonDec, SIGNAL(clicked(bool)), this, SLOT(slotValueDec()));
- connect(m_buttonInc, SIGNAL(clicked(bool)), this, SLOT(slotValueInc()));*/
- connect(m_edit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished()));
+ l->setContentsMargins(0, 0, 0, 0);
+ m_label = new CustomLabel(label, showSlider, m_maximum - m_minimum, this);
+ l->addWidget(m_label);
+ if (decimals == 0) {
+ m_label->setMaximum(max - min);
+ m_label->setStep(1);
+ m_intEdit = new QSpinBox(this);
+ m_intEdit->setObjectName("dragBox");
+ m_intEdit->setFocusPolicy(Qt::StrongFocus);
+ if (!suffix.isEmpty()) m_intEdit->setSuffix(suffix);
+ m_intEdit->setKeyboardTracking(false);
+ m_intEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
+ m_intEdit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+ m_intEdit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
+ m_intEdit->setRange((int) m_minimum, (int)m_maximum);
+ l->addWidget(m_intEdit);
+ connect(m_intEdit, SIGNAL(valueChanged(int)), this, SLOT(slotSetValue(int)));
+ connect(m_intEdit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished()));
+ } else {
+ m_doubleEdit = new QDoubleSpinBox(this);
+ m_doubleEdit->setDecimals(decimals);
+ m_doubleEdit->setFocusPolicy(Qt::StrongFocus);
+ m_doubleEdit->setObjectName("dragBox");
+ if (!suffix.isEmpty()) m_doubleEdit->setSuffix(suffix);
+ m_doubleEdit->setKeyboardTracking(false);
+ m_doubleEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
+ m_doubleEdit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+ m_doubleEdit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
+ m_doubleEdit->setRange(m_minimum, m_maximum);
+ double factor = 100;
+ if (m_maximum - m_minimum > 10000) factor = 1000;
+ m_label->setStep(1);
+ m_doubleEdit->setSingleStep((m_maximum - m_minimum) / factor);
+ l->addWidget(m_doubleEdit);
+ connect(m_doubleEdit, SIGNAL(valueChanged(double)), this, SLOT(slotSetValue(double)));
+ connect(m_doubleEdit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished()));
+ }
+
+ connect(m_label, SIGNAL(valueChanged(double,bool)), this, SLOT(setValueFromProgress(double,bool)));
+ connect(m_label, SIGNAL(resetValue()), this, SLOT(slotReset()));
+ setLayout(l);
+ if (m_intEdit)
+ m_label->setMaximumHeight(m_intEdit->sizeHint().height());
+ else
+ m_label->setMaximumHeight(m_doubleEdit->sizeHint().height());
+
+ m_menu = new QMenu(this);
+
+ m_scale = new KSelectAction(i18n("Scaling"), this);
+ m_scale->addAction(i18n("Normal scale"));
+ m_scale->addAction(i18n("Pixel scale"));
+ m_scale->addAction(i18n("Nonlinear scale"));
+ m_scale->setCurrentItem(KdenliveSettings::dragvalue_mode());
+ m_menu->addAction(m_scale);
+
+ m_directUpdate = new QAction(i18n("Direct update"), this);
+ m_directUpdate->setCheckable(true);
+ m_directUpdate->setChecked(KdenliveSettings::dragvalue_directupdate());
+ m_menu->addAction(m_directUpdate);
+
+ QAction *reset = new QAction(KIcon("edit-undo"), i18n("Reset value"), this);
+ connect(reset, SIGNAL(triggered()), this, SLOT(slotReset()));
+ m_menu->addAction(reset);
+
+ if (m_id > -1) {
+ QAction *timeline = new QAction(KIcon("go-jump"), i18n("Show %1 in timeline", label), this);
+ connect(timeline, SIGNAL(triggered()), this, SLOT(slotSetInTimeline()));
+ connect(m_label, SIGNAL(setInTimeline()), this, SLOT(slotSetInTimeline()));
+ m_menu->addAction(timeline);
+ }
+
+ connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotShowContextMenu(QPoint)));
+ connect(m_scale, SIGNAL(triggered(int)), this, SLOT(slotSetScaleMode(int)));
+ connect(m_directUpdate, SIGNAL(triggered(bool)), this, SLOT(slotSetDirectUpdate(bool)));