text: added crude basic rich text dialog
To be expanded upon...
This commit is contained in:
@@ -26,6 +26,8 @@ set(OLIVE_SOURCES
|
||||
widget/nodeparamview/nodeparamviewitem.cpp
|
||||
widget/nodeparamview/nodeparamviewkeyframecontrol.h
|
||||
widget/nodeparamview/nodeparamviewkeyframecontrol.cpp
|
||||
widget/nodeparamview/nodeparamviewrichtext.h
|
||||
widget/nodeparamview/nodeparamviewrichtext.cpp
|
||||
widget/nodeparamview/nodeparamviewundo.h
|
||||
widget/nodeparamview/nodeparamviewundo.cpp
|
||||
widget/nodeparamview/nodeparamviewwidgetbridge.h
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 "nodeparamviewrichtext.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "dialog/richtext/richtext.h"
|
||||
#include "ui/icons/icons.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
NodeParamViewRichText::NodeParamViewRichText(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
|
||||
line_edit_ = new QLineEdit();
|
||||
connect(line_edit_, &QLineEdit::textEdited, this, &NodeParamViewRichText::textEdited);
|
||||
layout->addWidget(line_edit_);
|
||||
|
||||
QPushButton* edit_btn = new QPushButton();
|
||||
edit_btn->setIcon(icon::ToolEdit);
|
||||
layout->addWidget(edit_btn);
|
||||
connect(edit_btn, &QPushButton::clicked, this, &NodeParamViewRichText::ShowRichTextDialog);
|
||||
}
|
||||
|
||||
void NodeParamViewRichText::ShowRichTextDialog()
|
||||
{
|
||||
RichTextDialog d(line_edit_->text(), this);
|
||||
if (d.exec() == QDialog::Accepted) {
|
||||
line_edit_->setText(d.text());
|
||||
emit textEdited(d.text());
|
||||
}
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
@@ -0,0 +1,61 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 NODEPARAMVIEWRICHTEXT_H
|
||||
#define NODEPARAMVIEWRICHTEXT_H
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QWidget>
|
||||
|
||||
#include "common/define.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
class NodeParamViewRichText : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
NodeParamViewRichText(QWidget* parent = nullptr);
|
||||
|
||||
QString text() const
|
||||
{
|
||||
return line_edit_->text();
|
||||
}
|
||||
|
||||
public slots:
|
||||
void setText(const QString &s)
|
||||
{
|
||||
line_edit_->setText(s);
|
||||
}
|
||||
|
||||
signals:
|
||||
void textEdited(const QString &);
|
||||
|
||||
private:
|
||||
QLineEdit* line_edit_;
|
||||
|
||||
private slots:
|
||||
void ShowRichTextDialog();
|
||||
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
#endif // NODEPARAMVIEWRICHTEXT_H
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QFontComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QVector2D>
|
||||
#include <QVector3D>
|
||||
#include <QVector4D>
|
||||
@@ -30,6 +29,7 @@
|
||||
#include "core.h"
|
||||
#include "node/node.h"
|
||||
#include "nodeparamviewarraywidget.h"
|
||||
#include "nodeparamviewrichtext.h"
|
||||
#include "nodeparamviewundo.h"
|
||||
#include "project/item/sequence/sequence.h"
|
||||
#include "undo/undostack.h"
|
||||
@@ -146,9 +146,9 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
||||
}
|
||||
case NodeParam::kText:
|
||||
{
|
||||
QLineEdit* line_edit = new QLineEdit();
|
||||
NodeParamViewRichText* line_edit = new NodeParamViewRichText();
|
||||
widgets_.append(line_edit);
|
||||
connect(line_edit, &QLineEdit::textEdited, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
connect(line_edit, &NodeParamViewRichText::textEdited, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kBoolean:
|
||||
@@ -336,8 +336,8 @@ void NodeParamViewWidgetBridge::WidgetCallback()
|
||||
}
|
||||
case NodeParam::kText:
|
||||
{
|
||||
// Sender is a QLineEdit
|
||||
SetInputValue(static_cast<QLineEdit*>(sender())->text(), 0);
|
||||
// Sender is a NodeParamViewRichText
|
||||
SetInputValue(static_cast<NodeParamViewRichText*>(sender())->text(), 0);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kBoolean:
|
||||
@@ -456,10 +456,8 @@ void NodeParamViewWidgetBridge::UpdateWidgetValues()
|
||||
}
|
||||
case NodeParam::kText:
|
||||
{
|
||||
QLineEdit* e = static_cast<QLineEdit*>(widgets_.first());
|
||||
int pos = e->cursorPosition();
|
||||
NodeParamViewRichText* e = static_cast<NodeParamViewRichText*>(widgets_.first());
|
||||
e->setText(input_->get_value_at_time(node_time).toString());
|
||||
e->setCursorPosition(pos);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kBoolean:
|
||||
|
||||
Reference in New Issue
Block a user