File indexing completed on 2024-06-16 05:24:49

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2011 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_CHARSETCONVERSIONVIEW_HPP
0010 #define KASTEN_CHARSETCONVERSIONVIEW_HPP
0011 
0012 // Okteta core
0013 #include <Okteta/Byte>
0014 // Qt
0015 #include <QWidget>
0016 
0017 namespace Okteta {
0018 class ByteArrayComboBox;
0019 }
0020 class KComboBox;
0021 class QCheckBox;
0022 class QAction;
0023 template <class Key, class T> class QMap;
0024 
0025 namespace Kasten {
0026 
0027 class CharsetConversionTool;
0028 
0029 class CharsetConversionView : public QWidget
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034     explicit CharsetConversionView(CharsetConversionTool* tool, QWidget* parent = nullptr);
0035     ~CharsetConversionView() override;
0036 
0037 public:
0038     CharsetConversionTool* tool() const;
0039 
0040 private Q_SLOTS: // gui
0041     void onDefaultByteEditChanged(const QByteArray& byteArray);
0042     void onConvertButtonClicked();
0043 
0044 private Q_SLOTS: // tool
0045     void onApplyableChanged(bool isApplyable);
0046     void onConversionDone(bool success, int convertedBytesCount,
0047                           const QMap<Okteta::Byte, int>& failedPerByteCount);
0048 
0049 private:
0050     CharsetConversionTool* mTool;
0051 
0052     KComboBox* mDirectionComboBox;
0053     KComboBox* mOtherCharSetComboBox;
0054     QCheckBox* mSubstituteMissingCharCheckBox;
0055     Okteta::ByteArrayComboBox* mSubstituteByteEdit;
0056     QAction* mConvertAction;
0057 };
0058 
0059 inline CharsetConversionTool* CharsetConversionView::tool() const { return mTool; }
0060 
0061 }
0062 
0063 #endif