mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-13 07:02:31 -05:00
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
This commit is contained in:
parent
b21b771420
commit
e6fd3d0318
19 changed files with 1552 additions and 374 deletions
53
utils/themeeditor/qtfindreplacedialog/varianteditor.cpp
Normal file
53
utils/themeeditor/qtfindreplacedialog/varianteditor.cpp
Normal file
|
|
@ -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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue