summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/dialogs/codecselector.h
blob: e98c388517a8db2feaeab707141b460ec407f86c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "../core_global.h"

#include <QDialog>
#include <QLabel>
#include <QDialogButtonBox>
#include <QListWidget>
#include <QTextCodec>

namespace Utils { class ListWidget; }
namespace Core { class BaseTextDocument; }

namespace Core {

class CORE_EXPORT CodecSelector : public QDialog
{
    Q_OBJECT

public:

    CodecSelector(QWidget *parent, Core::BaseTextDocument *doc);
    ~CodecSelector() override;

    QTextCodec *selectedCodec() const;

    // Enumeration returned from QDialog::exec()
    enum Result {
        Cancel, Reload, Save
    };

private:
    void updateButtons();
    void buttonClicked(QAbstractButton *button);

    bool m_hasDecodingError;
    bool m_isModified;
    QLabel *m_label;
    Utils::ListWidget *m_listWidget;
    QDialogButtonBox *m_dialogButtonBox;
    QAbstractButton *m_reloadButton;
    QAbstractButton *m_saveButton;
};

} // namespace Core