merged with master
This commit is contained in:
@@ -30,9 +30,7 @@
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
|
||||
#include "ui/checkboxex.h"
|
||||
#include "ui/icons.h"
|
||||
|
||||
#include "global/debug.h"
|
||||
|
||||
CollapsibleWidget::CollapsibleWidget(QWidget* parent) : QWidget(parent) {
|
||||
@@ -47,7 +45,7 @@ CollapsibleWidget::CollapsibleWidget(QWidget* parent) : QWidget(parent) {
|
||||
title_bar->setAutoFillBackground(true);
|
||||
title_bar_layout = new QHBoxLayout(title_bar);
|
||||
title_bar_layout->setMargin(5);
|
||||
enabled_check = new CheckboxEx(title_bar);
|
||||
enabled_check = new QCheckBox(title_bar);
|
||||
enabled_check->setChecked(true);
|
||||
header = new QLabel(title_bar);
|
||||
collapse_button = new QPushButton(title_bar);
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <QFrame>
|
||||
#include <QIcon>
|
||||
|
||||
#include "ui/checkboxex.h"
|
||||
|
||||
class CollapsibleWidgetHeader : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -56,7 +54,7 @@ public:
|
||||
bool IsExpanded();
|
||||
bool IsSelected();
|
||||
protected:
|
||||
CheckboxEx* enabled_check;
|
||||
QCheckBox* enabled_check;
|
||||
CollapsibleWidgetHeader* title_bar;
|
||||
QWidget* contents;
|
||||
private:
|
||||
|
||||
+54
-8
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "texteditex.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QDebug>
|
||||
|
||||
#include "dialogs/texteditdialog.h"
|
||||
@@ -27,13 +28,58 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
TextEditEx::TextEditEx(QWidget *parent, bool enable_rich_text) :
|
||||
QTextEdit(parent),
|
||||
QWidget(parent),
|
||||
enable_rich_text_(enable_rich_text)
|
||||
{
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(text_edit_menu()));
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
connect(this, SIGNAL(textChanged()), this, SLOT(queue_text_modified()));
|
||||
text_editor_ = new QTextEdit();
|
||||
connect(text_editor_, SIGNAL(textChanged()), this, SLOT(queue_text_modified()));
|
||||
layout->addWidget(text_editor_);
|
||||
|
||||
QPushButton* edit_button = new QPushButton(tr("Edit Text"));
|
||||
layout->addWidget(edit_button);
|
||||
connect(edit_button, SIGNAL(clicked(bool)), this, SLOT(open_text_edit()));
|
||||
|
||||
/*
|
||||
text_editor_->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(text_editor_, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(text_edit_menu()));
|
||||
*/
|
||||
}
|
||||
|
||||
void TextEditEx::setUndoRedoEnabled(bool e)
|
||||
{
|
||||
text_editor_->setUndoRedoEnabled(e);
|
||||
}
|
||||
|
||||
QTextDocument *TextEditEx::document()
|
||||
{
|
||||
return text_editor_->document();
|
||||
}
|
||||
|
||||
QTextCursor TextEditEx::textCursor()
|
||||
{
|
||||
return text_editor_->textCursor();
|
||||
}
|
||||
|
||||
void TextEditEx::setTextCursor(const QTextCursor &cursor)
|
||||
{
|
||||
text_editor_->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
void TextEditEx::setTextHeight(int h)
|
||||
{
|
||||
text_editor_->setFixedHeight(h);
|
||||
}
|
||||
|
||||
void TextEditEx::setHtml(const QString &text)
|
||||
{
|
||||
text_editor_->setHtml(text);
|
||||
}
|
||||
|
||||
void TextEditEx::setPlainText(const QString &text)
|
||||
{
|
||||
text_editor_->setPlainText(text);
|
||||
}
|
||||
|
||||
void TextEditEx::text_edit_menu() {
|
||||
@@ -45,21 +91,21 @@ void TextEditEx::text_edit_menu() {
|
||||
}
|
||||
|
||||
void TextEditEx::open_text_edit() {
|
||||
const QString& current_text = (enable_rich_text_) ? toHtml() : toPlainText();
|
||||
const QString& current_text = (enable_rich_text_) ? text_editor_->toHtml() : text_editor_->toPlainText();
|
||||
|
||||
TextEditDialog ted(olive::MainWindow, current_text, enable_rich_text_);
|
||||
ted.exec();
|
||||
QString result = ted.get_string();
|
||||
if (!result.isEmpty()) {
|
||||
if (enable_rich_text_) {
|
||||
setHtml(result);
|
||||
text_editor_->setHtml(result);
|
||||
} else {
|
||||
setPlainText(result);
|
||||
text_editor_->setPlainText(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TextEditEx::queue_text_modified()
|
||||
{
|
||||
emit textModified(enable_rich_text_ ? toHtml() : toPlainText());
|
||||
emit textModified(enable_rich_text_ ? text_editor_->toHtml() : text_editor_->toPlainText());
|
||||
}
|
||||
|
||||
+13
-1
@@ -22,11 +22,21 @@
|
||||
#define TEXTEDITEX_H
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
class TextEditEx : public QTextEdit {
|
||||
class TextEditEx : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextEditEx(QWidget* parent = nullptr, bool enable_rich_text = true);
|
||||
|
||||
void setUndoRedoEnabled(bool e);
|
||||
QTextDocument* document();
|
||||
QTextCursor textCursor();
|
||||
void setTextCursor(const QTextCursor &cursor);
|
||||
void setTextHeight(int h);
|
||||
public slots:
|
||||
void setHtml(const QString &text);
|
||||
void setPlainText(const QString &text);
|
||||
signals:
|
||||
void textModified(const QString& s);
|
||||
private slots:
|
||||
@@ -34,6 +44,8 @@ private slots:
|
||||
void open_text_edit();
|
||||
void queue_text_modified();
|
||||
private:
|
||||
QTextEdit* text_editor_;
|
||||
|
||||
bool enable_rich_text_;
|
||||
};
|
||||
|
||||
|
||||
+18
-3
@@ -328,11 +328,26 @@ double TimelineHeader::get_zoom() {
|
||||
|
||||
void TimelineHeader::delete_markers() {
|
||||
if (selected_markers.size() > 0) {
|
||||
|
||||
// Send command to delete selected markers
|
||||
DeleteMarkerAction* dma = new DeleteMarkerAction(viewer->marker_ref);
|
||||
for (int i=0;i<selected_markers.size();i++) {
|
||||
dma->markers.append(selected_markers.at(i));
|
||||
}
|
||||
dma->markers.append(selected_markers);
|
||||
olive::UndoStack.push(dma);
|
||||
|
||||
// remove any indices for the selected markers that no longer exist
|
||||
for (int i=0;i<selected_markers.size();i++) {
|
||||
if (selected_markers.at(i) >= viewer->marker_ref->size()) {
|
||||
selected_markers.removeAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
// if we removed all the indices, re-select the last marker in the array so something is always selected
|
||||
// (allows users to hold delete when deleting markers)
|
||||
if (selected_markers.isEmpty() && !viewer->marker_ref->isEmpty()) {
|
||||
selected_markers.append(viewer->marker_ref->size() - 1);
|
||||
}
|
||||
|
||||
update_parents();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
#include "global/debug.h"
|
||||
#include "effects/effect.h"
|
||||
#include "effects/internal/solideffect.h"
|
||||
#include "effects/internal/texteffect.h"
|
||||
|
||||
#define MAX_TEXT_WIDTH 20
|
||||
#define TRANSITION_BETWEEN_RANGE 40
|
||||
@@ -1022,7 +1021,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
switch (panel_timeline->creating_object) {
|
||||
case ADD_OBJ_TITLE:
|
||||
c->set_name(tr("Title"));
|
||||
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_TEXT, EFFECT_TYPE_EFFECT)));
|
||||
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_RICHTEXT, EFFECT_TYPE_EFFECT)));
|
||||
break;
|
||||
case ADD_OBJ_SOLID:
|
||||
c->set_name(tr("Solid Color"));
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ void ViewerWidget::frame_update() {
|
||||
}
|
||||
|
||||
// render the audio
|
||||
compose_audio(viewer, viewer->seq.get(), viewer->get_playback_speed(), viewer->WaitingForPlayWake());
|
||||
olive::rendering::compose_audio(viewer, viewer->seq.get(), viewer->get_playback_speed(), viewer->WaitingForPlayWake());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user