Warning, file /utilities/okteta/kasten/gui/view/bytearrayjanusview.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: 2008-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_BYTEARRAYJANUSVIEW_HPP
0010 #define KASTEN_BYTEARRAYJANUSVIEW_HPP
0011 
0012 // Okteta core
0013 #include <Okteta/AddressRange>
0014 // Qt
0015 #include <QWidget>
0016 
0017 class QHBoxLayout;
0018 class QMimeData;
0019 
0020 namespace Okteta {
0021 class AbstractByteArrayView;
0022 class AbstractByteArrayModel;
0023 
0024 class ByteArrayJanusView : public QWidget
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     enum
0030     {
0031         ColumnViewId = 0,
0032         RowViewId
0033     };
0034 
0035 public:
0036     explicit ByteArrayJanusView(QWidget* parent = nullptr);
0037     ~ByteArrayJanusView() override;
0038 
0039 public:
0040     void setByteArrayModel(AbstractByteArrayModel* byteArrayModel);
0041 
0042     void setZoomLevel(double Level);
0043     double zoomLevel() const;
0044 
0045 public:
0046     void setReadOnly(bool isReadOnly);
0047     bool isReadOnly() const;
0048 
0049 public: // cursor API
0050     void setCursorPosition(Address cursorPosition);
0051     void setSelectionCursorPosition(Address index);
0052     Address cursorPosition() const;
0053     QRect cursorRect() const;
0054 
0055 public: // codings
0056     void setValueCoding(int valueCoding);
0057     void setCharCoding(const QString& charCodingName);
0058     QString charCodingName() const;
0059     int valueCoding() const;
0060 
0061 public:
0062     void setSelection(Address start, Address end);
0063     void selectAll(bool selectAll);
0064     void removeSelectedData();
0065     void pasteData(const QMimeData* data);
0066     void insert(const QByteArray& byteArray);
0067     bool hasSelectedData() const;
0068     QMimeData* selectionAsMimeData() const;
0069     bool canReadData(const QMimeData* data) const;
0070     AddressRange selection() const;
0071 
0072     void setMarking(const AddressRange& marking);
0073     void ensureVisible(const AddressRange& range);
0074 
0075 public: // overwrite
0076     void setOverwriteMode(bool overwriteMode);
0077     bool isOverwriteMode() const;
0078     bool isOverwriteOnly() const;
0079 
0080 public: // elements
0081     void toggleOffsetColumn(bool visible);
0082     void setOffsetCoding(int offsetCoding);
0083     void setVisibleCodings(int columns);
0084     bool offsetColumnVisible() const;
0085     int offsetCoding() const;
0086     int visibleCodings() const;
0087 
0088 public: // table layout
0089     void setLayoutStyle(int layoutStyle);
0090     void setStartOffset(Address startOffset);
0091     void setFirstLineOffset(Address firstLineOffset);
0092     void setNoOfBytesPerLine(int noOfBytesPerLine);
0093     Address startOffset() const;
0094     Address firstLineOffset() const;
0095     int noOfBytesPerLine() const;
0096     int layoutStyle() const;
0097 
0098 public: // layout settings
0099     void setShowsNonprinting(bool showsNonprinting = true);
0100     void setNoOfGroupedBytes(int noOfGroupedBytes);
0101     void setSubstituteChar(QChar substituteChar);
0102     void setUndefinedChar(QChar undefinedChar);
0103     QChar substituteChar() const;
0104     QChar undefinedChar() const;
0105     bool showsNonprinting() const;
0106 
0107     int byteSpacingWidth() const;
0108     int noOfGroupedBytes() const;
0109     int groupSpacingWidth() const;
0110     int binaryGapWidth() const;
0111 
0112 public:
0113     void setViewModus(int viewModus);
0114     int viewModus() const;
0115 
0116     void setViewPos(QPoint pos);
0117     QRect viewRect() const;
0118 
0119     // needed, as the zooming logic currently changes the font for the real view,
0120     // so decouples from font change propagation
0121     void propagateFont(const QFont& font);
0122 
0123 Q_SIGNALS:
0124     void readOnlyChanged(bool);
0125     void overwriteModeChanged(bool overwriteMode);
0126     void hasSelectedDataChanged(bool hasSelectedData);
0127     void selectionChanged(const Okteta::AddressRange& selection);
0128     void cursorPositionChanged(Okteta::Address cursorPosition);
0129     void valueCodingChanged(int valueCoding);
0130     void charCodecChanged(const QString& charCodingName);
0131     void focusChanged(bool hasFocus);
0132     void offsetColumnVisibleChanged(bool visible);
0133     void offsetCodingChanged(int offsetCoding);
0134     void visibleByteArrayCodingsChanged(int columns);
0135     void layoutStyleChanged(int layoutStyle);
0136     void noOfBytesPerLineChanged(int noOfBytesPerLine);
0137     void showsNonprintingChanged(bool showsNonprinting);
0138     void substituteCharChanged(QChar substituteChar);
0139     void undefinedCharChanged(QChar undefinedChar);
0140     void noOfGroupedBytesChanged(int noOfGroupedBytes);
0141     void zoomLevelChanged(double level);
0142     void viewModusChanged(int viewModus);
0143     void viewContextMenuRequested(QPoint pos);
0144 
0145 private:
0146     AbstractByteArrayView* mView = nullptr;
0147     int mViewModus = -1;
0148     QHBoxLayout* mLayout;
0149 };
0150 
0151 inline int ByteArrayJanusView::viewModus()               const { return mViewModus; }
0152 
0153 }
0154 
0155 #endif