fixed clip adding
This commit is contained in:
+2
-2
@@ -162,11 +162,11 @@ void Timeline::OpenSequence(SequencePtr s)
|
||||
}
|
||||
|
||||
Timeline* t = new Timeline(olive::MainWindow);
|
||||
panel_timeline.append(t);
|
||||
olive::MainWindow->addDockWidget(Qt::BottomDockWidgetArea, t);
|
||||
olive::MainWindow->tabifyDockWidget(panel_timeline.last(), t);
|
||||
t->SetSequence(s);
|
||||
t->show();
|
||||
t->raise();
|
||||
panel_timeline.append(t);
|
||||
}
|
||||
|
||||
void Timeline::CloseSequence(Sequence *s)
|
||||
|
||||
@@ -82,7 +82,7 @@ void SourcesCommon::show_context_menu(QWidget* parent, const QModelIndexList& it
|
||||
selected_items = items;
|
||||
|
||||
QAction* import_action = menu.addAction(tr("Import..."));
|
||||
QObject::connect(import_action, SIGNAL(triggered(bool)), project_parent, SLOT(import_dialog()));
|
||||
QObject::connect(import_action, SIGNAL(triggered(bool)), olive::Global.get(), SLOT(open_import_dialog()));
|
||||
|
||||
Menu* new_menu = new Menu(tr("New"));
|
||||
menu.addMenu(new_menu);
|
||||
|
||||
+3
-2
@@ -14,7 +14,8 @@ Track::Track(TrackList* parent, Type type) :
|
||||
type_(type),
|
||||
muted_(false),
|
||||
soloed_(false),
|
||||
locked_(false)
|
||||
locked_(false),
|
||||
height_(olive::timeline::kTrackDefaultHeight)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -79,7 +80,7 @@ void Track::AddClip(ClipPtr clip)
|
||||
}
|
||||
|
||||
clips_.append(clip);
|
||||
if (clip->track() != nullptr) {
|
||||
if (clip->track() != nullptr && clip->track() != this) {
|
||||
clip->track()->RemoveClip(clip.get());
|
||||
}
|
||||
clip->set_track(this);
|
||||
|
||||
@@ -6,10 +6,15 @@ TimelineArea::TimelineArea(Timeline* timeline) :
|
||||
alignment_(olive::timeline::kAlignmentTop)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
// LABELS
|
||||
QWidget* label_container = new QWidget();
|
||||
label_container->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
||||
label_container_layout_ = new QVBoxLayout(label_container);
|
||||
label_container_layout_->setMargin(0);
|
||||
label_container_layout_->setSpacing(0);
|
||||
layout->addWidget(label_container);
|
||||
|
||||
// VIEW
|
||||
@@ -35,13 +40,22 @@ void TimelineArea::SetTrackList(Sequence *sequence, Track::Type track_list)
|
||||
|
||||
track_list_ = nullptr;
|
||||
|
||||
labels_.clear();
|
||||
|
||||
} else {
|
||||
|
||||
track_list_ = sequence->GetTrackList(track_list);
|
||||
|
||||
labels_.resize(track_list_->TrackCount());
|
||||
for (int i=0;i<labels_.size();i++) {
|
||||
labels_[i] = std::make_shared<TimelineLabel>();
|
||||
label_container_layout_->addWidget(labels_[i].get());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
view_->SetTrackList(track_list_);
|
||||
|
||||
}
|
||||
|
||||
void TimelineArea::RefreshLabels()
|
||||
|
||||
@@ -12,19 +12,25 @@ TimelineLabel::TimelineLabel() :
|
||||
QLabel* label = new QLabel("Track!");
|
||||
layout->addWidget(label);
|
||||
|
||||
|
||||
mute_button_ = new QPushButton("M");
|
||||
QSize fixed_size(mute_button_->sizeHint().height(), mute_button_->sizeHint().height());
|
||||
fixed_size *= 0.75;
|
||||
mute_button_->setFixedSize(fixed_size);
|
||||
mute_button_->setStyleSheet("QPushButton::checked { background: red; }");
|
||||
mute_button_->setCheckable(true);
|
||||
mute_button_->setFlat(true);
|
||||
layout->addWidget(mute_button_);
|
||||
|
||||
solo_button_ = new QPushButton("S");
|
||||
solo_button_->setFixedSize(fixed_size);
|
||||
solo_button_->setStyleSheet("QPushButton::checked { background: yellow; }");
|
||||
solo_button_->setCheckable(true);
|
||||
solo_button_->setFlat(true);
|
||||
layout->addWidget(solo_button_);
|
||||
|
||||
lock_button_ = new QPushButton("L");
|
||||
lock_button_->setFixedSize(fixed_size);
|
||||
lock_button_->setStyleSheet("QPushButton::checked { background: gray; }");
|
||||
lock_button_->setCheckable(true);
|
||||
lock_button_->setFlat(true);
|
||||
layout->addWidget(lock_button_);
|
||||
}
|
||||
|
||||
|
||||
@@ -2891,7 +2891,12 @@ void TimelineView::paintEvent(QPaintEvent*) {
|
||||
|
||||
Track* track = track_list_->TrackAt(i);
|
||||
|
||||
qDebug() << "track clip cound was" << track->ClipCount();
|
||||
|
||||
for (int j=0;j<track->ClipCount();j++) {
|
||||
|
||||
qDebug() << "going to draw a clip!!!";
|
||||
|
||||
Clip* clip = track->GetClip(j).get();
|
||||
|
||||
QRect clip_rect(ParentTimeline()->getTimelineScreenPointFromFrame(clip->timeline_in()),
|
||||
|
||||
@@ -369,6 +369,7 @@ void AddClipCommand::doRedo() {
|
||||
ClipPtr original = clips_.at(i);
|
||||
|
||||
if (original != nullptr) {
|
||||
qDebug() << "h";
|
||||
original->track()->AddClip(original);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user