File indexing completed on 2024-06-16 05:25:08

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2008-2009, 2012 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_VIEWSTATUSCONTROLLER_HPP
0010 #define KASTEN_VIEWSTATUSCONTROLLER_HPP
0011 
0012 // Kasten gui
0013 #include <Kasten/AbstractXmlGuiController>
0014 // Okteta gui
0015 #include <Okteta/OffsetFormat>
0016 // Okteta core
0017 #include <Okteta/Address>
0018 
0019 class KComboBox;
0020 class KSqueezedTextLabel;
0021 class QLabel;
0022 class QString;
0023 
0024 namespace Kasten {
0025 
0026 class ByteArrayView;
0027 class ToggleButton;
0028 class StatusBar;
0029 class AbstractModelSelection;
0030 
0031 class ViewStatusController : public AbstractXmlGuiController
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     explicit ViewStatusController(StatusBar* statusBar);
0037 
0038 public: // AbstractXmlGuiController API
0039     void setTargetModel(AbstractModel* model) override;
0040 
0041 private:
0042     void fixWidths(int offsetCoding);
0043 
0044 private Q_SLOTS:
0045     void setOverwriteMode(bool overwrite);
0046     void setValueCoding(int valueCoding);
0047     void setCharCoding(int charCoding);
0048 
0049     void onCursorPositionChanged(Okteta::Address offset);
0050     void onSelectedDataChanged(const Kasten::AbstractModelSelection* modelSelection);
0051     void onOffsetCodingChanged(int offsetCoding);
0052     void onValueCodingChanged(int valueCoding);
0053     void onCharCodecChanged(const QString& charCodecName);
0054 
0055 private:
0056     ByteArrayView* mByteArrayView = nullptr;
0057 
0058     StatusBar* mStatusBar;
0059     QLabel* mOffsetLabel;
0060     QLabel* mSelectionLabel;
0061     ToggleButton* mOverwriteModeToggleButton;
0062     KComboBox* mValueCodingComboBox;
0063     KComboBox* mCharCodingComboBox;
0064 
0065     Okteta::OffsetFormat::print mPrintFunction;
0066     Okteta::Address mStartOffset;
0067 };
0068 
0069 }
0070 
0071 #endif