File indexing completed on 2024-06-23 05:48:53

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2006-2009 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_PODTABLEVIEW_HPP
0010 #define KASTEN_PODTABLEVIEW_HPP
0011 
0012 // lib
0013 #include "abstractdifferentsizedialog.hpp"
0014 // Qt
0015 #include <QWidget>
0016 
0017 class KComboBox;
0018 class QTreeView;
0019 class QCheckBox;
0020 class QModelIndex;
0021 
0022 namespace Kasten {
0023 
0024 class PODDelegate;
0025 class PODTableModel;
0026 class PODDecoderTool;
0027 
0028 class PODTableView : public QWidget
0029                    , public AbstractDifferentSizeDialog
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034     explicit PODTableView(PODDecoderTool* tool, QWidget* parent = nullptr);
0035     ~PODTableView() override;
0036 
0037 public:
0038     PODDecoderTool* tool() const;
0039 
0040 public: // QObject API
0041     bool eventFilter(QObject* object, QEvent* event) override;
0042 
0043 public: // AbstractDifferentSizeDialog API
0044     Answer query(int newValueSize, int oldValueSize, int sizeLeft) override;
0045 
0046 private Q_SLOTS:
0047     void onCurrentRowChanged(const QModelIndex& current, const QModelIndex& previous);
0048     void onCustomContextMenuRequested(QPoint pos);
0049     void editData();
0050     void copyToClipboard();
0051     void selectBytesInView();
0052 
0053 private:
0054     PODDecoderTool* mTool;
0055 
0056     PODTableModel* mPODTableModel;
0057 
0058     QTreeView* mPODTableView;
0059     PODDelegate* mPODDelegate;
0060     KComboBox* mByteOrderSelection;
0061     QCheckBox* mUnsignedAsHexCheck;
0062 
0063     QWidget* mPODTableViewFocusChild = nullptr;
0064 };
0065 
0066 inline PODDecoderTool* PODTableView::tool() const { return mTool; }
0067 
0068 }
0069 
0070 #endif