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

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 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_GOTOOFFSETVIEW_HPP
0010 #define KASTEN_GOTOOFFSETVIEW_HPP
0011 
0012 // Okteta Kasten gui
0013 #include <Kasten/Okteta/AddressComboBox>
0014 // Kasten gui
0015 #include <Kasten/AbstractToolWidget>
0016 
0017 class QPushButton;
0018 
0019 class QCheckBox;
0020 
0021 namespace Kasten {
0022 
0023 class GotoOffsetTool;
0024 
0025 class GotoOffsetView : public AbstractToolWidget
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     enum GotoDirection
0031     {
0032         GotoForward = 0,
0033         GotoBackward = 1,
0034     };
0035 
0036 private:
0037     static inline constexpr char ConfigGroupId[] = "GotoOffsetTool";
0038 
0039     static inline constexpr char OffsetCodingConfigKey[] = "OffsetCoding";
0040     static inline constexpr char FromCursorConfigKey[] = "FromCursor";
0041     static inline constexpr char ExtendSelectionConfigKey[] = "ExtendSelection";
0042     static inline constexpr char DirectionConfigKey[] = "Direction";
0043 
0044     static inline constexpr bool DefaultFromCursor = false;
0045     static inline constexpr bool DefaultExtendSelection = false;
0046     static inline constexpr GotoDirection DefaultDirection = GotoForward;
0047     static inline constexpr Okteta::AddressComboBox::Coding DefaultOffsetCoding = Okteta::AddressComboBox::HexadecimalCoding;
0048 
0049 public:
0050     explicit GotoOffsetView(GotoOffsetTool* tool, QWidget* parent = nullptr);
0051     ~GotoOffsetView() override;
0052 
0053 public:
0054     GotoOffsetTool* tool() const;
0055 
0056 private Q_SLOTS: // gui
0057     void onGotoButtonClicked();
0058     void onFormatChanged(int index);
0059     void onAddressTypeChanged(int addressType);
0060 
0061 private Q_SLOTS: // tool
0062     void onApplyableChanged(bool isApplyable);
0063 
0064 private:
0065     GotoOffsetTool* mTool;
0066 
0067     Okteta::AddressComboBox* mAddressEdit;
0068     QPushButton* mGotoButton;
0069     QCheckBox* mAtCursorCheckBox;
0070     QCheckBox* mExtendSelectionCheckBox;
0071     QCheckBox* mBackwardsCheckBox;
0072 };
0073 
0074 inline GotoOffsetTool* GotoOffsetView::tool() const { return mTool; }
0075 
0076 }
0077 
0078 #endif