aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/codecchooser.h
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2022-07-26 23:38:00 +0300
committerOrgad Shaneh <orgads@gmail.com>2022-08-03 12:30:16 +0000
commiteb33d260900e9f2263cb00f06c73a3256b67546b (patch)
treef5000ce731d6d4cd5d11c869df8017398d760565 /src/plugins/texteditor/codecchooser.h
parent4edb2380735d1b5d66aff75c800131dee4f9835e (diff)
TextEditor: Factor out codec chooser
Change-Id: I664f7ba484f379b8d2b8254d4f880c0d37d70ff8 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor/codecchooser.h')
-rw-r--r--src/plugins/texteditor/codecchooser.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/plugins/texteditor/codecchooser.h b/src/plugins/texteditor/codecchooser.h
new file mode 100644
index 00000000000..690850bf01b
--- /dev/null
+++ b/src/plugins/texteditor/codecchooser.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "texteditor_global.h"
+
+#include <QComboBox>
+
+QT_BEGIN_NAMESPACE
+class QTextCodec;
+QT_END_NAMESPACE
+
+namespace TextEditor {
+
+class TEXTEDITOR_EXPORT CodecChooser : public QComboBox
+{
+ Q_OBJECT
+
+public:
+ CodecChooser();
+ QTextCodec *currentCodec() const;
+ QTextCodec *codecAt(int index) const;
+ void setAssignedCodec(QTextCodec *codec, const QString &name);
+ QByteArray assignedCodecName() const;
+
+signals:
+ void codecChanged(QTextCodec *codec);
+
+private:
+ QList<QTextCodec *> m_codecs;
+};
+
+} // namespace TextEditor