From edaeee168df5137c451ce777df431633287bad0a Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Wed, 22 Oct 2014 17:57:51 +0200 Subject: regtoosl/qeditor: remove unused code Change-Id: I79ad3151d6a500903786b3467c271b43741f8fee Reviewed-on: http://gerrit.rockbox.org/1021 Reviewed-by: Amaury Pouly --- utils/regtools/qeditor/utils.cpp | 94 ---------------------------------------- utils/regtools/qeditor/utils.h | 24 ---------- 2 files changed, 118 deletions(-) (limited to 'utils/regtools') diff --git a/utils/regtools/qeditor/utils.cpp b/utils/regtools/qeditor/utils.cpp index 1e39903a2c..098a020c8e 100644 --- a/utils/regtools/qeditor/utils.cpp +++ b/utils/regtools/qeditor/utils.cpp @@ -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 */ diff --git a/utils/regtools/qeditor/utils.h b/utils/regtools/qeditor/utils.h index 13b9e896e9..771b671b2c 100644 --- a/utils/regtools/qeditor/utils.h +++ b/utils/regtools/qeditor/utils.h @@ -275,30 +275,6 @@ protected: 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 { Q_OBJECT -- cgit v1.2.3