#include <KUrl>
#include <KIcon>
#include <KCursor>
-#include <KColorScheme>
#include <KMessageBox>
#include <KIO/NetAccess>
setLineWidth(0);
//setCacheMode(QGraphicsView::CacheBackground);
//setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+ setAutoFillBackground(false);
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
-
+ m_activeTrackBrush = KStatefulBrush(KColorScheme::View, KColorScheme::ActiveBackground, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
pixmapCache = new KPixmapCache("kdenlive-thumbs");
KdenliveSettings::setTrackheight(m_tracksHeight);
m_animationTimer = new QTimeLine(800);
}
}
double newHeight = m_tracksHeight * m_document->tracksCount() * matrix().m22();
- m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), newHeight);
+ m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), newHeight - 1);
for (int i = 0; i < m_guides.count(); i++) {
QLineF l = m_guides.at(i)->line();
l.setP2(QPointF(l.x2(), maxHeight));
m_guides.at(i)->setLine(l);
}
- m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight);
+
+ m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight - 1);
setSceneRect(0, 0, sceneRect().width(), m_tracksHeight * m_document->tracksCount());
viewport()->update();
emit tracksChanged();
l.setP2(QPointF(l.x2(), maxHeight));
m_guides.at(i)->setLine(l);
}
- m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight);
+ m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight - 1);
setSceneRect(0, 0, sceneRect().width(), m_tracksHeight * m_document->tracksCount());
m_selectedTrack = qMin(m_selectedTrack, m_document->tracksCount() - 1);
newmatrix = newmatrix.scale(scaleFactor, verticalScale);
m_scene->setScale(scaleFactor, verticalScale);
removeTipAnimation();
- double verticalPos = mapToScene(QPoint(0, viewport()->height() / 2)).y();
bool adjust = false;
if (verticalScale != matrix().m22()) adjust = true;
setMatrix(newmatrix);
if (adjust) {
double newHeight = m_tracksHeight * m_document->tracksCount() * matrix().m22();
- m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), newHeight);
+ m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), newHeight - 1);
for (int i = 0; i < m_guides.count(); i++) {
QLineF l = m_guides.at(i)->line();
l.setP2(QPointF(l.x2(), newHeight));
else
setSceneRect(0, 0, (m_projectDuration + 300), sceneRect().height());
}
+ double verticalPos = mapToScene(QPoint(0, viewport()->height() / 2)).y();
centerOn(QPointF(cursorPos(), verticalPos));
}
void CustomTrackView::drawBackground(QPainter * painter, const QRectF &rect)
{
- //kDebug() << "// DRAW BG: " << rect.width();
painter->setClipRect(rect);
- KColorScheme scheme(palette().currentColorGroup(), KColorScheme::Window);
QPen pen1 = painter->pen();
- pen1.setColor(scheme.shade(KColorScheme::DarkShade));
+ pen1.setColor(palette().dark().color());
painter->setPen(pen1);
double min = rect.left();
double max = rect.right();
painter->drawLine(QPointF(min, 0), QPointF(max, 0));
int maxTrack = m_document->tracksCount();
- QColor lockedColor = scheme.background(KColorScheme::NegativeBackground).color();
+ QColor lockedColor = palette().button().color();
QColor audioColor = palette().alternateBase().color();
- QColor base = scheme.background(KColorScheme::NormalBackground).color();
for (int i = 0; i < maxTrack; i++) {
TrackInfo info = m_document->trackInfoAt(maxTrack - i - 1);
if (info.isLocked || info.type == AUDIOTRACK || i == m_selectedTrack) {
const QRectF track(min, m_tracksHeight * i + 1, max - min, m_tracksHeight - 1);
if (i == m_selectedTrack)
- painter->fillRect(track, scheme.background(KColorScheme::ActiveBackground).color());
+ painter->fillRect(track, m_activeTrackBrush.brush(this));
else
painter->fillRect(track, info.isLocked ? lockedColor : audioColor);
}
painter->drawLine(QPointF(min, m_tracksHeight *(i + 1)), QPointF(max, m_tracksHeight *(i + 1)));
}
- int lowerLimit = m_tracksHeight * maxTrack + 1;
- if (height() > lowerLimit) {
- const QRectF bg(min, lowerLimit, max - min, height() - lowerLimit);
- painter->fillRect(bg, base);
- }
}
bool CustomTrackView::findString(const QString &text)
void CustomTrackView::updatePalette()
{
+ m_activeTrackBrush = KStatefulBrush(KColorScheme::View, KColorScheme::ActiveBackground, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
if (m_cursorLine) {
QPen pen1 = QPen();
pen1.setWidth(1);
pen1.setColor(palette().text().color());
m_cursorLine->setPen(pen1);
}
+ emit tracksChanged();
}
void CustomTrackView::removeTipAnimation()
#include "headertrack.h"
#include "effectslist.h"
+#include "kdenlivesettings.h"
#include <KIcon>
#include <KLocale>
{
setFixedHeight(height);
setupUi(this);
- QColor col = track_number->palette().color(QPalette::Base);
- track_number->setStyleSheet(QString("QLineEdit { background-color: transparent;} QLineEdit:hover{ background-color: rgb(%1, %2, %3);} QLineEdit:focus { background-color: rgb(%1, %2, %3);}").arg(col.red()).arg(col.green()).arg(col.blue()));
+
+ QPalette p = palette();
+ KColorScheme scheme(p.currentColorGroup(), KColorScheme::View, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
+ QColor norm = scheme.shade(scheme.background(KColorScheme::ActiveBackground).color(), KColorScheme::MidShade);
+ p.setColor(QPalette::Button, norm);
+ setPalette(p);
+
+ QColor col = scheme.background().color();
+ QColor col2 = scheme.foreground().color();
+ track_number->setStyleSheet(QString("QLineEdit { background-color: transparent;color: rgb(%4, %5, %6);} QLineEdit:hover{ background-color: rgb(%1, %2, %3);} QLineEdit:focus { background-color: rgb(%1, %2, %3);}").arg(col.red()).arg(col.green()).arg(col.blue()).arg(col2.red()).arg(col2.green()).arg(col2.blue()));
m_name = info.trackName.isEmpty() ? QString::number(m_index) : info.trackName;
track_number->setText(m_name);
updateEffectLabel(info.effectsList.effectNames());
setAcceptDrops(true);
- QPalette p = palette();
- KColorScheme scheme(p.currentColorGroup(), KColorScheme::Window);
- p.setColor(QPalette::Button, scheme.background(KColorScheme::ActiveBackground).color().darker(120));
- setPalette(p);
-
if (m_type == VIDEOTRACK) {
setBackgroundRole(QPalette::AlternateBase);
setAutoFillBackground(true);
m_trackview = new CustomTrackView(doc, m_scene, parent);
m_trackview->scale(1, 1);
m_trackview->setAlignment(Qt::AlignLeft | Qt::AlignTop);
- //m_scene->addRect(QRectF(0, 0, 100, 100), QPen(), QBrush(Qt::red));
m_ruler = new CustomRuler(doc->timecode(), m_trackview);
connect(m_ruler, SIGNAL(zoneMoved(int, int)), this, SIGNAL(zoneMoved(int, int)));
void TrackView::slotRepaintTracks()
{
- QLayoutItem *child;
- for (int i = 0; i < headers_container->layout()->count(); i++) {
- child = headers_container->layout()->itemAt(i);
- if (child->widget() && child->widget()->height() > 5) {
- HeaderTrack *head = static_cast <HeaderTrack *>(child->widget());
- if (head) head->setSelectedIndex(m_trackview->selectedTrack());
- }
+ QList<HeaderTrack *> widgets = findChildren<HeaderTrack *>();
+ for (int i = 0; i < widgets.count(); i++) {
+ if (widgets.at(i)) widgets.at(i)->setSelectedIndex(m_trackview->selectedTrack());
}
}
QFrame *frame = NULL;
for (int i = 0; i < max; i++) {
frame = new QFrame(headers_container);
+ frame->setFrameStyle(QFrame::HLine);
frame->setFixedHeight(1);
- frame->setFrameStyle(QFrame::Plain);
- frame->setFrameShape(QFrame::Box);
- frame->setLineWidth(1);
headers_container->layout()->addWidget(frame);
TrackInfo info = list.at(max - i - 1);
header = new HeaderTrack(i, info, height, headers_container);
headers_container->layout()->addWidget(header);
}
frame = new QFrame(this);
+ frame->setFrameStyle(QFrame::HLine);
frame->setFixedHeight(1);
- frame->setFrameStyle(QFrame::Plain);
- frame->setFrameShape(QFrame::Box);
- frame->setLineWidth(1);
headers_container->layout()->addWidget(frame);
}
void TrackView::adjustTrackHeaders()
{
int height = KdenliveSettings::trackheight() * m_scene->scale().y() - 1;
- QLayoutItem *child;
- for (int i = 0; i < headers_container->layout()->count(); i++) {
- child = headers_container->layout()->itemAt(i);
- if (child->widget() && child->widget()->height() > 5)(static_cast <HeaderTrack *>(child->widget()))->adjustSize(height);
+ QList<HeaderTrack *> widgets = findChildren<HeaderTrack *>();
+ for (int i = 0; i < widgets.count(); i++) {
+ if (widgets.at(i)) widgets.at(i)->adjustSize(height);
}
}