diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/regtools/qeditor/utils.cpp | 94 | ||||
-rw-r--r-- | utils/regtools/qeditor/utils.h | 24 |
2 files changed, 0 insertions, 118 deletions
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 | |||
@@ -746,100 +746,6 @@ bool MyTextEditor::IsModified() | |||
746 | } | 746 | } |
747 | 747 | ||
748 | /** | 748 | /** |
749 | * MySwitchableTextEditor | ||
750 | */ | ||
751 | MySwitchableTextEditor::MySwitchableTextEditor(QWidget *parent) | ||
752 | :QWidget(parent) | ||
753 | { | ||
754 | QVBoxLayout *layout = new QVBoxLayout(this); | ||
755 | m_edit = new MyTextEditor(this); | ||
756 | m_label = new QLabel(this); | ||
757 | m_label->setTextFormat(Qt::RichText); | ||
758 | m_label->setAlignment(Qt::AlignTop); | ||
759 | m_line = new QLineEdit(this); | ||
760 | |||
761 | layout->addWidget(m_label); | ||
762 | layout->addWidget(m_edit); | ||
763 | layout->addWidget(m_line); | ||
764 | |||
765 | setLayout(layout); | ||
766 | |||
767 | m_editor_mode = false; | ||
768 | m_line_mode = false; | ||
769 | UpdateVisibility(); | ||
770 | } | ||
771 | |||
772 | void MySwitchableTextEditor::SetEditorMode(bool edit) | ||
773 | { | ||
774 | if(edit == m_editor_mode) | ||
775 | return; | ||
776 | QString text = GetTextHtml(); | ||
777 | m_editor_mode = edit; | ||
778 | UpdateVisibility(); | ||
779 | SetTextHtml(text); | ||
780 | } | ||
781 | |||
782 | QString MySwitchableTextEditor::GetTextHtml() | ||
783 | { | ||
784 | if(m_editor_mode) | ||
785 | return m_line_mode ? m_line->text() : m_edit->GetTextHtml(); | ||
786 | else | ||
787 | return m_label->text(); | ||
788 | } | ||
789 | |||
790 | void MySwitchableTextEditor::SetTextHtml(const QString& text) | ||
791 | { | ||
792 | if(m_editor_mode) | ||
793 | { | ||
794 | if(m_line_mode) | ||
795 | m_line->setText(text); | ||
796 | else | ||
797 | m_edit->SetTextHtml(text); | ||
798 | } | ||
799 | else | ||
800 | m_label->setText(text); | ||
801 | } | ||
802 | |||
803 | MyTextEditor *MySwitchableTextEditor::GetEditor() | ||
804 | { | ||
805 | return m_edit; | ||
806 | } | ||
807 | |||
808 | void MySwitchableTextEditor::SetLineMode(bool en) | ||
809 | { | ||
810 | if(m_line_mode == en) | ||
811 | return; | ||
812 | QString text = GetTextHtml(); | ||
813 | m_line_mode = en; | ||
814 | SetTextHtml(text); | ||
815 | UpdateVisibility(); | ||
816 | } | ||
817 | |||
818 | QLineEdit *MySwitchableTextEditor::GetLineEdit() | ||
819 | { | ||
820 | return m_line; | ||
821 | } | ||
822 | |||
823 | void MySwitchableTextEditor::UpdateVisibility() | ||
824 | { | ||
825 | m_label->setVisible(!m_editor_mode); | ||
826 | m_edit->setVisible(m_editor_mode && !m_line_mode); | ||
827 | m_line->setVisible(m_editor_mode && m_line_mode); | ||
828 | } | ||
829 | |||
830 | QLabel *MySwitchableTextEditor::GetLabel() | ||
831 | { | ||
832 | return m_label; | ||
833 | } | ||
834 | |||
835 | bool MySwitchableTextEditor::IsModified() | ||
836 | { | ||
837 | if(!m_editor_mode) | ||
838 | return false; | ||
839 | return m_line_mode ? m_line->isModified() : m_edit->IsModified(); | ||
840 | } | ||
841 | |||
842 | /** | ||
843 | * BackendSelector | 749 | * BackendSelector |
844 | */ | 750 | */ |
845 | BackendSelector::BackendSelector(Backend *backend, QWidget *parent) | 751 | BackendSelector::BackendSelector(Backend *backend, QWidget *parent) |
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: | |||
275 | QToolButton *m_underline_button; | 275 | QToolButton *m_underline_button; |
276 | }; | 276 | }; |
277 | 277 | ||
278 | class MySwitchableTextEditor : public QWidget | ||
279 | { | ||
280 | Q_OBJECT | ||
281 | public: | ||
282 | MySwitchableTextEditor(QWidget *parent = 0); | ||
283 | QString GetTextHtml(); | ||
284 | void SetTextHtml(const QString& text); | ||
285 | void SetEditorMode(bool en); | ||
286 | MyTextEditor *GetEditor(); | ||
287 | QLineEdit *GetLineEdit(); | ||
288 | QLabel *GetLabel(); | ||
289 | void SetLineMode(bool en); | ||
290 | bool IsModified(); | ||
291 | |||
292 | protected: | ||
293 | void UpdateVisibility(); | ||
294 | |||
295 | bool m_editor_mode; | ||
296 | bool m_line_mode; | ||
297 | QLabel *m_label; | ||
298 | MyTextEditor *m_edit; | ||
299 | QLineEdit *m_line; | ||
300 | }; | ||
301 | |||
302 | class BackendSelector : public QWidget | 278 | class BackendSelector : public QWidget |
303 | { | 279 | { |
304 | Q_OBJECT | 280 | Q_OBJECT |