added text edit dialog to text effect
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#include "texteditdialog.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
TextEditDialog::TextEditDialog(QWidget *parent, const QString &s) :
|
||||
QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Edit Text");
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
setLayout(layout);
|
||||
|
||||
textEdit = new QPlainTextEdit();
|
||||
textEdit->setPlainText(s);
|
||||
layout->addWidget(textEdit);
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
layout->addWidget(buttons);
|
||||
connect(buttons, SIGNAL(accepted()), this, SLOT(save()));
|
||||
connect(buttons, SIGNAL(rejected()), this, SLOT(cancel()));
|
||||
}
|
||||
|
||||
const QString& TextEditDialog::get_string() {
|
||||
return result_str;
|
||||
}
|
||||
|
||||
void TextEditDialog::save() {
|
||||
result_str = textEdit->toPlainText();
|
||||
accept();
|
||||
}
|
||||
|
||||
void TextEditDialog::cancel() {
|
||||
reject();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef TEXTEDITDIALOG_H
|
||||
#define TEXTEDITDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QPlainTextEdit;
|
||||
|
||||
class TextEditDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextEditDialog(QWidget* parent = 0, const QString& s = 0);
|
||||
const QString& get_string();
|
||||
private slots:
|
||||
void save();
|
||||
void cancel();
|
||||
private:
|
||||
QString result_str;
|
||||
QPlainTextEdit* textEdit;
|
||||
};
|
||||
|
||||
#endif // TEXTEDITDIALOG_H
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <QComboBox>
|
||||
#include <QWidget>
|
||||
#include <QtMath>
|
||||
#include <QMenu>
|
||||
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
@@ -19,6 +20,8 @@
|
||||
#include "ui/comboboxex.h"
|
||||
#include "ui/colorbutton.h"
|
||||
#include "ui/fontcombobox.h"
|
||||
#include "dialogs/texteditdialog.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
TextEffect::TextEffect(Clip *c, const EffectMeta* em) :
|
||||
Effect(c, em)
|
||||
@@ -27,6 +30,9 @@ TextEffect::TextEffect(Clip *c, const EffectMeta* em) :
|
||||
//enable_shader = true;
|
||||
|
||||
text_val = add_row("Text")->add_field(EFFECT_FIELD_STRING, "text", 2);
|
||||
QTextEdit* text_widget = static_cast<QTextEdit*>(text_val->ui_element);
|
||||
text_widget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(text_widget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(text_edit_menu()));
|
||||
|
||||
set_font_combobox = add_row("Font")->add_field(EFFECT_FIELD_FONT, "font", 2);
|
||||
|
||||
@@ -198,6 +204,24 @@ void TextEffect::shadow_enable(bool e) {
|
||||
shadow_opacity->set_enabled(e);
|
||||
}
|
||||
|
||||
void TextEffect::text_edit_menu() {
|
||||
QMenu menu;
|
||||
|
||||
menu.addAction("&Edit Text", this, SLOT(open_text_edit()));
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void TextEffect::open_text_edit() {
|
||||
TextEditDialog ted(mainWindow, text_val->get_current_data().toString());
|
||||
ted.exec();
|
||||
QString result = ted.get_string();
|
||||
if (!result.isEmpty()) {
|
||||
text_val->set_current_data(result);
|
||||
text_val->ui_element_change();
|
||||
}
|
||||
}
|
||||
|
||||
void TextEffect::outline_enable(bool e) {
|
||||
outline_color->set_enabled(e);
|
||||
outline_width->set_enabled(e);
|
||||
|
||||
@@ -33,8 +33,10 @@ public:
|
||||
private slots:
|
||||
void outline_enable(bool);
|
||||
void shadow_enable(bool);
|
||||
void text_edit_menu();
|
||||
void open_text_edit();
|
||||
private:
|
||||
QFont font;
|
||||
QFont font;
|
||||
};
|
||||
|
||||
#endif // TEXTEFFECT_H
|
||||
|
||||
@@ -120,7 +120,8 @@ SOURCES += \
|
||||
dialogs/actionsearch.cpp \
|
||||
ui/embeddedfilechooser.cpp \
|
||||
effects/internal/fillleftrighteffect.cpp \
|
||||
effects/internal/voideffect.cpp
|
||||
effects/internal/voideffect.cpp \
|
||||
dialogs/texteditdialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
@@ -210,7 +211,8 @@ HEADERS += \
|
||||
dialogs/actionsearch.h \
|
||||
ui/embeddedfilechooser.h \
|
||||
effects/internal/fillleftrighteffect.h \
|
||||
effects/internal/voideffect.h
|
||||
effects/internal/voideffect.h \
|
||||
dialogs/texteditdialog.h
|
||||
|
||||
FORMS +=
|
||||
|
||||
|
||||
@@ -692,9 +692,7 @@ void Viewer::timer_update() {
|
||||
previous_playhead = seq->playhead;
|
||||
|
||||
seq->playhead = qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
|
||||
|
||||
if (config.seek_also_selects) panel_timeline->select_from_playhead();
|
||||
|
||||
update_parents(config.seek_also_selects);
|
||||
|
||||
long end_frame = get_seq_out();
|
||||
|
||||
@@ -68,10 +68,10 @@ public:
|
||||
QWidget* ui_element;
|
||||
|
||||
void make_key_from_change(ComboAction* ca);
|
||||
public slots:
|
||||
void ui_element_change();
|
||||
private:
|
||||
bool hasKeyframes();
|
||||
private slots:
|
||||
void ui_element_change();
|
||||
signals:
|
||||
void changed();
|
||||
void toggled(bool);
|
||||
|
||||
Reference in New Issue
Block a user