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:
parent
88053b8832
commit
edaeee168d
2 changed files with 0 additions and 118 deletions
|
@ -745,100 +745,6 @@ bool MyTextEditor::IsModified()
|
||||||
return m_edit->document()->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
|
* BackendSelector
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -275,30 +275,6 @@ protected:
|
||||||
QToolButton *m_underline_button;
|
QToolButton *m_underline_button;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MySwitchableTextEditor : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
MySwitchableTextEditor(QWidget *parent = 0);
|
|
||||||
QString GetTextHtml();
|
|
||||||
void SetTextHtml(const QString& text);
|
|
||||||
void SetEditorMode(bool en);
|
|
||||||
MyTextEditor *GetEditor();
|
|
||||||
QLineEdit *GetLineEdit();
|
|
||||||
QLabel *GetLabel();
|
|
||||||
void SetLineMode(bool en);
|
|
||||||
bool IsModified();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void UpdateVisibility();
|
|
||||||
|
|
||||||
bool m_editor_mode;
|
|
||||||
bool m_line_mode;
|
|
||||||
QLabel *m_label;
|
|
||||||
MyTextEditor *m_edit;
|
|
||||||
QLineEdit *m_line;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BackendSelector : public QWidget
|
class BackendSelector : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue