2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2022-07-26 23:38:00 +03:00
|
|
|
|
|
|
|
|
#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:
|
2022-07-27 23:01:13 +03:00
|
|
|
enum class Filter { All, SingleByte };
|
|
|
|
|
explicit CodecChooser(Filter filter = Filter::All);
|
|
|
|
|
void prependNone();
|
2022-07-26 23:38:00 +03:00
|
|
|
QTextCodec *currentCodec() const;
|
|
|
|
|
QTextCodec *codecAt(int index) const;
|
2022-07-27 23:01:13 +03:00
|
|
|
void setAssignedCodec(QTextCodec *codec, const QString &name = {});
|
2022-07-26 23:38:00 +03:00
|
|
|
QByteArray assignedCodecName() const;
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void codecChanged(QTextCodec *codec);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QList<QTextCodec *> m_codecs;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace TextEditor
|