Warning, file /utilities/okteta/kasten/gui/view/bytearrayview.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 This file is part of the Okteta Kasten module, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2006-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_BYTEARRAYVIEW_HPP 0010 #define KASTEN_BYTEARRAYVIEW_HPP 0011 0012 // lib 0013 #include "oktetakastengui_export.hpp" 0014 // Okteta Kasten core 0015 #include <Kasten/Okteta/ByteArraySelection> 0016 // Kasten gui 0017 #include <Kasten/AbstractView> 0018 #include <Kasten/Zoomable> // TODO: able instead of interface? or else? 0019 #include <Kasten/DataSelectable> 0020 #include <Kasten/SelectedDataWriteable> 0021 // Okteta core 0022 #include <Okteta/AddressRange> 0023 0024 namespace Okteta { 0025 class ByteArrayJanusView; 0026 } 0027 class QRect; 0028 class QPoint; 0029 0030 namespace Kasten { 0031 class ByteArrayViewProfileSynchronizer; 0032 class ByteArrayDocument; 0033 class KCursorProxy; 0034 0035 class OKTETAKASTENGUI_EXPORT ByteArrayView : public AbstractView 0036 , public If::Zoomable 0037 , public If::DataSelectable 0038 , public If::SelectedDataWriteable 0039 { 0040 Q_OBJECT 0041 Q_INTERFACES( 0042 Kasten::If::Zoomable 0043 Kasten::If::DataSelectable 0044 Kasten::If::SelectedDataWriteable 0045 ) 0046 0047 public: 0048 enum 0049 { 0050 ColumnViewId = 0, 0051 RowViewId 0052 }; 0053 0054 public: 0055 ByteArrayView(ByteArrayDocument* document, ByteArrayViewProfileSynchronizer* synchronizer); 0056 ByteArrayView(ByteArrayView* other, ByteArrayViewProfileSynchronizer* synchronizer, 0057 Qt::Alignment alignment = {}); 0058 0059 ~ByteArrayView() override; 0060 0061 public: 0062 // KCursorObject *cursor() const; 0063 0064 public: // AbstractModel API 0065 QString title() const override; 0066 bool isModifiable() const override; 0067 bool isReadOnly() const override; 0068 void setReadOnly(bool isReadOnly) override; 0069 0070 public: // AbstractView API 0071 void setFocus() override; 0072 QWidget* widget() const override; 0073 bool hasFocus() const override; 0074 0075 public: // If::Zoomable API TODO: make all such methods slots? 0076 void setZoomLevel(double Level) override; 0077 double zoomLevel() const override; 0078 Q_SIGNALS: 0079 void zoomLevelChanged(double Level) override; 0080 0081 public: // If::DataSelectable API 0082 void selectAllData(bool selectAll) override; 0083 bool hasSelectedData() const override; 0084 QMimeData* copySelectedData() const override; 0085 const AbstractModelSelection* modelSelection() const override; 0086 // virtual void setSelection(); 0087 Q_SIGNALS: 0088 void hasSelectedDataChanged(bool hasSelectedData) override; 0089 void selectedDataChanged(const Kasten::AbstractModelSelection* modelSelection) override; 0090 0091 public: // If::SelectedDataWriteable API 0092 void insertData(const QMimeData* data) override; 0093 QMimeData* cutSelectedData() override; 0094 void deleteSelectedData() override; 0095 bool canReadData(const QMimeData* data) const override; 0096 0097 public: // cursor API 0098 void setCursorPosition(Okteta::Address cursorPosition); 0099 void setSelectionCursorPosition(Okteta::Address index); 0100 Okteta::Address cursorPosition() const; 0101 Q_SIGNALS: 0102 void cursorPositionChanged(Okteta::Address cursorPosition); 0103 0104 public: // codings 0105 void setValueCoding(int valueCoding); 0106 void setCharCoding(const QString& charCodingName); 0107 QString charCodingName() const; 0108 int valueCoding() const; 0109 Q_SIGNALS: 0110 void charCodecChanged(const QString& charCodingName); 0111 void valueCodingChanged(int valueCoding); 0112 0113 public: 0114 // TODO: see how this can be solved by modelSelection 0115 Okteta::AddressRange selection() const; 0116 void setSelection(Okteta::Address start, Okteta::Address end); 0117 void insert(const QByteArray& byteArray); 0118 QRect cursorRect() const; 0119 0120 public: // overwrite 0121 void setOverwriteMode(bool overwriteMode); 0122 bool isOverwriteMode() const; 0123 bool isOverwriteOnly() const; 0124 Q_SIGNALS: 0125 void overwriteModeChanged(bool overwriteMode); 0126 0127 public: // elements 0128 void toggleOffsetColumn(bool visible); 0129 void setOffsetCoding(int offsetCoding); 0130 void setVisibleByteArrayCodings(int columns); 0131 void setMarking(const Okteta::AddressRange& range, bool ensureVisible = false); 0132 bool offsetColumnVisible() const; 0133 int offsetCoding() const; 0134 int visibleByteArrayCodings() const; 0135 Q_SIGNALS: 0136 void offsetColumnVisibleChanged(bool visible); 0137 void visibleByteArrayCodingsChanged(int columns); 0138 void offsetCodingChanged(int offsetCoding); 0139 0140 public: // table layout 0141 void setLayoutStyle(int layoutStyle); 0142 void setNoOfBytesPerLine(int noOfBytesPerLine); 0143 Okteta::Address startOffset() const; 0144 Okteta::Address firstLineOffset() const; 0145 int noOfBytesPerLine() const; 0146 int layoutStyle() const; 0147 Q_SIGNALS: 0148 void layoutStyleChanged(int layoutStyle); 0149 void noOfBytesPerLineChanged(int noOfBytesPerLine); 0150 0151 public: // layout settings 0152 void setShowsNonprinting(bool showsNonprinting = true); 0153 void setNoOfGroupedBytes(int noOfGroupedBytes); 0154 void setSubstituteChar(QChar substituteChar); 0155 void setUndefinedChar(QChar undefinedChar); 0156 QChar substituteChar() const; 0157 QChar undefinedChar() const; 0158 bool showsNonprinting() const; 0159 0160 int byteSpacingWidth() const; 0161 int noOfGroupedBytes() const; 0162 int groupSpacingWidth() const; 0163 int binaryGapWidth() const; 0164 Q_SIGNALS: 0165 void showsNonprintingChanged(bool showsNonprinting); 0166 void substituteCharChanged(QChar substituteChar); 0167 void undefinedCharChanged(QChar undefinedChar); 0168 void noOfGroupedBytesChanged(int noOfGroupedBytes); 0169 0170 public: 0171 void setViewModus(int viewModus); 0172 int viewModus() const; 0173 Q_SIGNALS: 0174 void viewModusChanged(int viewModus); 0175 0176 Q_SIGNALS: 0177 void viewContextMenuRequested(const QPoint& pos); 0178 0179 public: 0180 ByteArrayViewProfileSynchronizer* synchronizer() const; 0181 0182 private: 0183 OKTETAKASTENGUI_NO_EXPORT void init(); 0184 0185 private Q_SLOTS: 0186 OKTETAKASTENGUI_NO_EXPORT void setFontByGlobalSettings(); 0187 0188 OKTETAKASTENGUI_NO_EXPORT void onSelectionChanged(const Okteta::AddressRange& selection); 0189 0190 private: 0191 Okteta::ByteArrayJanusView* mWidget; 0192 ByteArrayDocument* mDocument; 0193 ByteArraySelection mSelection; 0194 // KCursorProxy *mCursorProxy; 0195 0196 ByteArrayViewProfileSynchronizer* const mByteArrayViewProfileSynchronizer; 0197 }; 0198 0199 } 0200 0201 #endif