Skip to content

Commit

Permalink
implement history panel
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmattkc committed Mar 12, 2023
1 parent 0beecfa commit 019f095
Show file tree
Hide file tree
Showing 33 changed files with 427 additions and 67 deletions.
6 changes: 3 additions & 3 deletions app/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <QInputDialog>
#include <QMessageBox>
#include <QStyleFactory>
#include "window/mainwindow/mainwindowundo.h"
#ifdef Q_OS_WINDOWS
#include <QtPlatformHeaders/QWindowsWindowFunctions>
#endif
Expand Down Expand Up @@ -450,14 +451,13 @@ void Core::CreateNewSequence()
command->add_child(new NodeAddCommand(active_project, new_sequence));
command->add_child(new FolderAddChild(GetSelectedFolderInActiveProject(), new_sequence));
command->add_child(new NodeSetPositionCommand(new_sequence, new_sequence, Node::Position()));
command->add_child(new OpenSequenceCommand(new_sequence));

// Create and connect default nodes to new sequence
new_sequence->add_default_nodes(command);

Core::instance()->undo_stack()->push(command);

Core::instance()->main_window()->OpenSequence(new_sequence);

} else {

// If the dialog was accepted, ownership goes to the AddItemCommand. But if we get here, just delete
Expand Down Expand Up @@ -575,7 +575,7 @@ void Core::ImportTaskComplete(Task* task)
d.exec();
}

undo_stack_.pushIfHasChildren(command);
undo_stack_.push(command);

main_window_->SelectFootage(import_task->GetImportedFootage());
}
Expand Down
2 changes: 1 addition & 1 deletion app/dialog/configbase/configdialogbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void ConfigDialogBase::accept()
tab->Accept(command);
}

Core::instance()->undo_stack()->pushIfHasChildren(command);
Core::instance()->undo_stack()->push(command);

AcceptEvent();

Expand Down
2 changes: 1 addition & 1 deletion app/dialog/footageproperties/footageproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void FootagePropertiesDialog::accept()
static_cast<StreamProperties*>(stacked_widget_->widget(i))->Accept(command);
}

Core::instance()->undo_stack()->pushIfHasChildren(command);
Core::instance()->undo_stack()->push(command);

QDialog::accept();
}
Expand Down
2 changes: 1 addition & 1 deletion app/dialog/keyframeproperties/keyframeproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void KeyframePropertiesDialog::accept()
}
}

Core::instance()->undo_stack()->pushIfHasChildren(command);
Core::instance()->undo_stack()->push(command);

QDialog::accept();
}
Expand Down
2 changes: 1 addition & 1 deletion app/dialog/markerproperties/markerpropertiesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void MarkerPropertiesDialog::accept()
command->add_child(new MarkerChangeTimeCommand(markers_.front(), TimeRange(in_slider_->GetValue(), out_slider_->GetValue())));
}

Core::instance()->undo_stack()->pushIfHasChildren(command);
Core::instance()->undo_stack()->push(command);

super::accept();
}
Expand Down
2 changes: 1 addition & 1 deletion app/node/gizmo/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void TextGizmo::UpdateInputHtml(const QString &s, const rational &time)
if (input_.IsValid()) {
MultiUndoCommand *command = new MultiUndoCommand();
Node::SetValueAtTime(input_.input(), time, s, input_.track(), command, true);
Core::instance()->undo_stack()->pushIfHasChildren(command);
Core::instance()->undo_stack()->push(command);
}
}

Expand Down
1 change: 1 addition & 0 deletions app/panel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
add_subdirectory(audiomonitor)
add_subdirectory(curve)
add_subdirectory(footageviewer)
add_subdirectory(history)
add_subdirectory(multicam)
add_subdirectory(node)
add_subdirectory(param)
Expand Down
22 changes: 22 additions & 0 deletions app/panel/history/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2023 Olive Studios LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

set(OLIVE_SOURCES
${OLIVE_SOURCES}
panel/history/historypanel.h
panel/history/historypanel.cpp
PARENT_SCOPE
)
40 changes: 40 additions & 0 deletions app/panel/history/historypanel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2023 Olive Studios LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/

#include "historypanel.h"

#include "widget/history/historywidget.h"

namespace olive {

HistoryPanel::HistoryPanel() :
PanelWidget(QStringLiteral("HistoryPanel"))
{
SetWidgetWithPadding(new HistoryWidget(this));

Retranslate();
}

void HistoryPanel::Retranslate()
{
SetTitle(tr("History"));
}

}
41 changes: 41 additions & 0 deletions app/panel/history/historypanel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2023 Olive Studios LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/

#ifndef HISTORYPANEL_H
#define HISTORYPANEL_H

#include "panel/panel.h"

namespace olive {

class HistoryPanel : public PanelWidget
{
Q_OBJECT
public:
HistoryPanel();

protected:
virtual void Retranslate() override;

};

}

#endif // HISTORYPANEL_H
Loading

0 comments on commit 019f095

Please sign in to comment.