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

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2007 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_BYTETABLEVIEW_HPP
0010 #define KASTEN_BYTETABLEVIEW_HPP
0011 
0012 // Kasten gui
0013 #include <Kasten/AbstractToolWidget>
0014 
0015 class QSpinBox;
0016 class QTreeView;
0017 class QAction;
0018 class QModelIndex;
0019 
0020 namespace Kasten {
0021 
0022 class ByteTableTool;
0023 
0024 class ByteTableView : public AbstractToolWidget
0025 {
0026     Q_OBJECT
0027 
0028 private:
0029     // TODO: move config store/restore to tool
0030     static inline constexpr int DefaultInsertCount = 1;
0031 
0032     static inline constexpr char ConfigGroupId[] = "ByteTableTool";
0033     static inline constexpr char InsertCountConfigKey[] = "InsertCount";
0034 
0035 public:
0036     explicit ByteTableView(ByteTableTool* tool, QWidget* parent = nullptr);
0037     ~ByteTableView() override;
0038 
0039 public:
0040     ByteTableTool* tool() const;
0041 
0042 public Q_SLOTS:
0043     void onInsertClicked();
0044     void onDoubleClicked(const QModelIndex& index);
0045 
0046 private Q_SLOTS:
0047     void resizeColumnsWidth();
0048     void onInsertCountEditChanged();
0049 
0050 private:
0051     ByteTableTool* mTool;
0052 
0053     QSpinBox* mInsertCountEdit;
0054     QTreeView* mByteTableView;
0055     QAction* mInsertAction;
0056 };
0057 
0058 inline ByteTableTool* ByteTableView::tool() const { return mTool; }
0059 
0060 }
0061 
0062 #endif