1 // copyright (c) 2017-2021 hors<horsicq@gmail.com> 2 // 3 // Permission is hereby granted, free of charge, to any person obtaining a copy 4 // of this software and associated documentation files (the "Software"), to deal 5 // in the Software without restriction, including without limitation the rights 6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 // copies of the Software, and to permit persons to whom the Software is 8 // furnished to do so, subject to the following conditions: 9 10 // The above copyright notice and this permission notice shall be included in all 11 // copies or substantial portions of the Software. 12 13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 // SOFTWARE. 20 // 21 #ifndef DEXWIDGET_H 22 #define DEXWIDGET_H 23 24 #include "../formatwidget.h" 25 #include "dialogsectionheader.h" 26 #include "dexsectionheaderwidget.h" 27 #include "dex_defs.h" 28 #include "dexprocessdata.h" 29 30 namespace Ui 31 { 32 class DEXWidget; 33 } 34 35 class DEXWidget : public FormatWidget 36 { 37 Q_OBJECT 38 39 public: 40 DEXWidget(QWidget *pParent=nullptr); 41 DEXWidget(QIODevice *pDevice,FW_DEF::OPTIONS options,QWidget *pParent=nullptr); 42 ~DEXWidget(); 43 void setShortcuts(XShortcuts *pShortcuts); 44 virtual void clear(); 45 virtual void cleanup(); 46 virtual void reload(); 47 48 protected: 49 virtual SV _setValue(QVariant vValue,int nStype,int nNdata,int nVtype,int nPosition,qint64 nOffset); 50 virtual void setReadonly(bool bState); 51 virtual void blockSignals(bool bState); 52 virtual void adjustHeaderTable(int nType,QTableWidget *pTableWidget); 53 virtual QString typeIdToString(int nType); 54 55 private slots: 56 virtual void reloadData(); 57 void widgetValueChanged(quint64 nValue); 58 void on_treeWidgetNavi_currentItemChanged(QTreeWidgetItem *pCurrent,QTreeWidgetItem *pPrevious); 59 void on_checkBoxReadonly_toggled(bool bChecked); 60 bool createSectionTable(int nType,QTableWidget *pTableWidget,const FW_DEF::HEADER_RECORD *pHeaderRecord,int nNumberOfRecords); 61 void on_pushButtonReload_clicked(); 62 void enableButton(); 63 void on_tableWidget_Header_currentCellChanged(int nCurrentRow,int nCurrentColumn,int nPreviousRow,int nPreviousColumn); 64 void on_lineEditFilterStrings_textChanged(const QString &sString); 65 void on_lineEditFilterTypes_textChanged(const QString &sString); 66 void on_toolButtonPrev_clicked(); 67 void on_toolButtonNext_clicked(); 68 69 private: 70 // TODO rename 71 enum CB 72 { 73 CB_Dex_Header_magic=0, 74 CB_Dex_Header_version, 75 CB_Dex_Header_endian_tag, 76 __CB_size 77 }; 78 79 enum INV 80 { 81 INV_link=0, 82 INV_map, 83 INV_string_ids, 84 INV_type_ids, 85 INV_proto_ids, 86 INV_field_ids, 87 INV_method_ids, 88 INV_class_defs, 89 INV_data, 90 __INV_size 91 }; 92 93 Ui::DEXWidget *ui; 94 95 XLineEditHEX *g_lineEdit_HEADER[N_DEX_HEADER::__data_size]; 96 97 XComboBoxEx *g_comboBox[__CB_size]; 98 InvWidget *g_invWidget[__INV_size]; 99 100 SubDevice *g_subDevice[SDEX::__TYPE_size]; 101 QStandardItemModel *g_tvModel[SDEX::__TYPE_size]; 102 103 QSortFilterProxyModel *g_pFilterStrings; 104 QSortFilterProxyModel *g_pFilterTypes; 105 }; 106 107 #endif // DEXWIDGET_H 108