diff options
| author | Robert Bieber <robby@bieberphoto.com> | 2010-07-23 07:31:53 +0000 |
|---|---|---|
| committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-23 07:31:53 +0000 |
| commit | e6fd3d0318d0f53c51cf4cc87ccdc8f9741957e7 (patch) | |
| tree | da29255f5c33ae915c28a1dbff5525fdf912fbe6 /utils/themeeditor/qtfindreplacedialog/varianteditor.cpp | |
| parent | b21b7714209230cbadab1e709c6778c4cc214437 (diff) | |
| download | rockbox-e6fd3d0318d0f53c51cf4cc87ccdc8f9741957e7.zip rockbox-e6fd3d0318d0f53c51cf4cc87ccdc8f9741957e7.tar.gz rockbox-e6fd3d0318d0f53c51cf4cc87ccdc8f9741957e7.tar.bz2 rockbox-e6fd3d0318d0f53c51cf4cc87ccdc8f9741957e7.tar.xz | |
Theme Editor: Switched back to Lorenzo Bettini's find/replace dialog (with some modifications) as he changed the license to LGPL v2.1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27528 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/qtfindreplacedialog/varianteditor.cpp')
| -rw-r--r-- | utils/themeeditor/qtfindreplacedialog/varianteditor.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/utils/themeeditor/qtfindreplacedialog/varianteditor.cpp b/utils/themeeditor/qtfindreplacedialog/varianteditor.cpp new file mode 100644 index 0000000..9b3e063 --- /dev/null +++ b/utils/themeeditor/qtfindreplacedialog/varianteditor.cpp @@ -0,0 +1,53 @@ +/* + * Copyright 2010, Robert Bieber + * Licensed under the LGPLv2.1, see the COPYING file for more information + */ + +#include <QPushButton> +#include <QTextEdit> +#include <QPlainTextEdit> + +#include "varianteditor.h" + +VariantEditor::VariantEditor(QPlainTextEdit *plainTextEdit) + : plainTextEdit(plainTextEdit), textEdit(0), type(Plain) +{ +} + +VariantEditor::VariantEditor(QTextEdit *textEdit) + : plainTextEdit(0), textEdit(textEdit), type(Rich) +{ +} + +void VariantEditor::connectToSetEnabled(QPushButton *button) +{ + if(type == Rich) + QObject::connect(textEdit, SIGNAL(copyAvailable(bool)), + button, SLOT(setEnabled(bool))); + else + QObject::connect(plainTextEdit, SIGNAL(copyAvailable(bool)), + button, SLOT(setEnabled(bool))); +} + +QTextDocument* VariantEditor::document() +{ + return type == Rich ? textEdit->document() : plainTextEdit->document(); +} + +void VariantEditor::setTextCursor(const QTextCursor& cursor) +{ + if(type == Rich) + textEdit->setTextCursor(cursor); + else + plainTextEdit->setTextCursor(cursor); +} + +bool VariantEditor::find(const QString& exp, QTextDocument::FindFlags flags) +{ + return type == Rich ? textEdit->find(exp, flags) : plainTextEdit->find(exp, flags); +} + +QTextCursor VariantEditor::textCursor() const +{ + return type == Rich ? textEdit->textCursor() : plainTextEdit->textCursor(); +} |