decoupled effectfield UI from backend

This commit is contained in:
itsmattkc
2019-03-12 19:33:01 +11:00
parent 0f3d91b7b3
commit 170fe9bd01
73 changed files with 3230 additions and 2971 deletions
+47 -17
View File
@@ -22,41 +22,71 @@
#include <QDebug>
/*
TextEditEx::TextEditEx(QWidget *parent) : QTextEdit(parent) {
setUndoRedoEnabled(false);
connect(this, SIGNAL(textChanged()), this, SLOT(updateInternals()));
connect(this, SIGNAL(updateSelf()), this, SLOT(updateText()));
setUndoRedoEnabled(false);
connect(this, SIGNAL(textChanged()), this, SLOT(updateInternals()));
connect(this, SIGNAL(updateSelf()), this, SLOT(updateText()));
}
const QString& TextEditEx::getPlainTextEx() {
return text;
return text;
}
void TextEditEx::setPlainTextEx(const QString &t) {
previousText = text;
text = t;
emit updateSelf();
previousText = text;
text = t;
emit updateSelf();
}
const QString &TextEditEx::getPreviousValue() {
return previousText;
return previousText;
}
void TextEditEx::updateInternals() {
previousText = text;
text = toPlainText();
previousText = text;
text = toPlainText();
}
void TextEditEx::updateText() {
blockSignals(true);
blockSignals(true);
int pos = textCursor().position();
int pos = textCursor().position();
setPlainText(text);
setPlainText(text);
QTextCursor newCursor(document());
newCursor.setPosition(pos);
setTextCursor(newCursor);
QTextCursor newCursor(document());
newCursor.setPosition(pos);
setTextCursor(newCursor);
blockSignals(false);
blockSignals(false);
}
*/
#include <QMenu>
#include "dialogs/texteditdialog.h"
#include "mainwindow.h"
TextEditEx::TextEditEx(QWidget *parent) : QTextEdit(parent)
{
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(text_edit_menu()));
}
void TextEditEx::text_edit_menu() {
QMenu menu;
menu.addAction(tr("&Edit Text"), this, SLOT(open_text_edit()));
menu.exec(QCursor::pos());
}
void TextEditEx::open_text_edit() {
TextEditDialog ted(olive::MainWindow, this->toHtml());
ted.exec();
QString result = ted.get_string();
if (!result.isEmpty()) {
setHtml(result);
}
}