1
0
Fork 0
forked from len0rd/rockbox

regtoosl/qeditor: remove unused code

Change-Id: I79ad3151d6a500903786b3467c271b43741f8fee
Reviewed-on: http://gerrit.rockbox.org/1021
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
This commit is contained in:
Amaury Pouly 2014-10-22 17:57:51 +02:00
parent 88053b8832
commit edaeee168d
2 changed files with 0 additions and 118 deletions

View file

@ -745,100 +745,6 @@ bool MyTextEditor::IsModified()
return m_edit->document()->isModified();
}
/**
* MySwitchableTextEditor
*/
MySwitchableTextEditor::MySwitchableTextEditor(QWidget *parent)
:QWidget(parent)
{
QVBoxLayout *layout = new QVBoxLayout(this);
m_edit = new MyTextEditor(this);
m_label = new QLabel(this);
m_label->setTextFormat(Qt::RichText);
m_label->setAlignment(Qt::AlignTop);
m_line = new QLineEdit(this);
layout->addWidget(m_label);
layout->addWidget(m_edit);
layout->addWidget(m_line);
setLayout(layout);
m_editor_mode = false;
m_line_mode = false;
UpdateVisibility();
}
void MySwitchableTextEditor::SetEditorMode(bool edit)
{
if(edit == m_editor_mode)
return;
QString text = GetTextHtml();
m_editor_mode = edit;
UpdateVisibility();
SetTextHtml(text);
}
QString MySwitchableTextEditor::GetTextHtml()
{
if(m_editor_mode)
return m_line_mode ? m_line->text() : m_edit->GetTextHtml();
else
return m_label->text();
}
void MySwitchableTextEditor::SetTextHtml(const QString& text)
{
if(m_editor_mode)
{
if(m_line_mode)
m_line->setText(text);
else
m_edit->SetTextHtml(text);
}
else
m_label->setText(text);
}
MyTextEditor *MySwitchableTextEditor::GetEditor()
{
return m_edit;
}
void MySwitchableTextEditor::SetLineMode(bool en)
{
if(m_line_mode == en)
return;
QString text = GetTextHtml();
m_line_mode = en;
SetTextHtml(text);
UpdateVisibility();
}
QLineEdit *MySwitchableTextEditor::GetLineEdit()
{
return m_line;
}
void MySwitchableTextEditor::UpdateVisibility()
{
m_label->setVisible(!m_editor_mode);
m_edit->setVisible(m_editor_mode && !m_line_mode);
m_line->setVisible(m_editor_mode && m_line_mode);
}
QLabel *MySwitchableTextEditor::GetLabel()
{
return m_label;
}
bool MySwitchableTextEditor::IsModified()
{
if(!m_editor_mode)
return false;
return m_line_mode ? m_line->isModified() : m_edit->IsModified();
}
/**
* BackendSelector
*/