added node properties dialog

Incomplete, but probably useful
This commit is contained in:
itsmattkc
2021-07-23 18:22:02 -07:00
parent b630aa88a4
commit cdc8df1dc5
6 changed files with 156 additions and 3 deletions
+1
View File
@@ -23,6 +23,7 @@ add_subdirectory(diskcache)
add_subdirectory(export)
add_subdirectory(footagerelink)
add_subdirectory(keyframeproperties)
add_subdirectory(nodeproperties)
add_subdirectory(preferences)
add_subdirectory(progress)
add_subdirectory(rendercancel)
+22
View File
@@ -0,0 +1,22 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2021 Olive Team
#
# 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}
dialog/nodeproperties/nodepropertiesdialog.cpp
dialog/nodeproperties/nodepropertiesdialog.h
PARENT_SCOPE
)
@@ -0,0 +1,74 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
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 "nodepropertiesdialog.h"
#include <QDialogButtonBox>
#include <QHBoxLayout>
#include "core.h"
#include "widget/nodeview/nodeviewundo.h"
namespace olive {
NodePropertiesDialog::NodePropertiesDialog(Node *node, const rational &timebase, QWidget *parent) :
QDialog(parent),
node_(node)
{
setWindowTitle(tr("Node Properties"));
QVBoxLayout *layout = new QVBoxLayout(this);
QHBoxLayout *label_layout = new QHBoxLayout();
label_layout->setMargin(0);
layout->addLayout(label_layout);
label_layout->addWidget(new QLabel(tr("Name:")));
label_edit_ = new QLineEdit();
label_edit_->setText(node->GetLabel());
label_layout->addWidget(label_edit_);
NodeParamViewItem *item = new NodeParamViewItem(node);
item->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
item->SetTimebase(timebase);
item->setTitleBarWidget(new QWidget());
layout->addWidget(item);
layout->addStretch();
QDialogButtonBox *btns = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(btns, &QDialogButtonBox::accepted, this, &NodePropertiesDialog::accept);
connect(btns, &QDialogButtonBox::rejected, this, &NodePropertiesDialog::reject);
layout->addWidget(btns);
}
void NodePropertiesDialog::accept()
{
if (label_edit_->text() != node_->GetLabel()) {
NodeRenameCommand* rename_command = new NodeRenameCommand();
rename_command->AddNode(node_, label_edit_->text());
Core::instance()->undo_stack()->push(rename_command);
}
QDialog::accept();
}
}
@@ -0,0 +1,52 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
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 NODEPROPERTIESDIALOG_H
#define NODEPROPERTIESDIALOG_H
#include <QDialog>
#include "widget/nodeparamview/nodeparamviewitem.h"
namespace olive {
class NodePropertiesDialog : public QDialog
{
Q_OBJECT
public:
NodePropertiesDialog(Node *node, const rational &timebase, QWidget *parent = nullptr);
NodePropertiesDialog(const QVector<Node *> &node, const rational &timebase, QWidget *parent = nullptr) :
NodePropertiesDialog(node.first(), timebase, parent)
{
}
public slots:
virtual void accept() override;
private:
Node *node_;
QLineEdit *label_edit_;
};
}
#endif // NODEPROPERTIESDIALOG_H
@@ -30,6 +30,7 @@
#include "common/define.h"
#include "core.h"
#include "dialog/nodeproperties/nodepropertiesdialog.h"
#include "dialog/sequence/sequence.h"
#include "projectexplorerundo.h"
#include "task/precache/precachetask.h"
@@ -439,11 +440,12 @@ void ProjectExplorer::ShowItemPropertiesDialog()
// FIXME: Support for multiple items
if (dynamic_cast<Footage*>(sel)) {
Core::instance()->LabelNodes({static_cast<Footage*>(sel)});
NodePropertiesDialog npd(sel, static_cast<Footage*>(sel)->GetVideoParams().time_base(), this);
npd.exec();
} else if (dynamic_cast<Folder*>(sel)) {
Core::instance()->LabelNodes({static_cast<Folder*>(sel)});
Core::instance()->LabelNodes(context_menu_items_);
} else if (dynamic_cast<Sequence*>(sel)) {
+3 -1
View File
@@ -28,6 +28,7 @@
#include "core.h"
#include "common/range.h"
#include "common/timecodefunctions.h"
#include "dialog/nodeproperties/nodepropertiesdialog.h"
#include "dialog/sequence/sequence.h"
#include "node/block/transition/transition.h"
#include "tool/add.h"
@@ -992,7 +993,8 @@ void TimelineWidget::ShowContextMenu()
nodes.append(i);
}
Core::instance()->LabelNodes(nodes);
NodePropertiesDialog npd(nodes, timebase(), this);
npd.exec();
});
}