1 // copyright (c) 2019-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 LEWIDGET_H 22 #define LEWIDGET_H 23 24 #include "../formatwidget.h" 25 #include "le_defs.h" 26 #include "leprocessdata.h" 27 #include "lesectionheaderwidget.h" 28 29 namespace Ui 30 { 31 class LEWidget; 32 } 33 34 class LEWidget : public FormatWidget 35 { 36 Q_OBJECT 37 38 public: 39 LEWidget(QWidget *pParent=nullptr); 40 LEWidget(QIODevice *pDevice,FW_DEF::OPTIONS options,QWidget *pParent=nullptr); 41 ~LEWidget(); 42 void setShortcuts(XShortcuts *pShortcuts); 43 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 54 private slots: 55 virtual void reloadData(); 56 void widgetValueChanged(quint64 nValue); 57 void on_treeWidgetNavi_currentItemChanged(QTreeWidgetItem *pCurrent,QTreeWidgetItem *pPrevious); 58 void on_checkBoxReadonly_toggled(bool bChecked); 59 void on_pushButtonReload_clicked(); 60 void enableButton(); 61 void on_tableWidget_DOS_HEADER_currentCellChanged(int nCurrentRow,int nCurrentColumn,int nPreviousRow,int nPreviousColumn); 62 void on_tableWidget_VXD_HEADER_currentCellChanged(int nCurrentRow,int nCurrentColumn,int nPreviousRow,int nPreviousColumn); 63 void on_tableView_Objects_customContextMenuRequested(const QPoint &pos); 64 void on_tableView_Objects_doubleClicked(const QModelIndex &index); 65 void onTableView_Objects_currentRowChanged(const QModelIndex ¤t,const QModelIndex &previous); 66 void on_toolButtonPrev_clicked(); 67 void on_toolButtonNext_clicked(); 68 69 private: 70 enum CB 71 { 72 CB_DOS_HEADER_e_magic=0, 73 CB_VXD_HEADER_e32_magic, 74 CB_VXD_HEADER_e32_cpu, 75 CB_VXD_HEADER_e32_os, 76 __CB_size 77 }; 78 79 enum INV 80 { 81 INV_DOS_HEADER_e_lfanew, 82 __INV_size 83 }; 84 85 Ui::LEWidget *ui; 86 87 XLineEditHEX *g_lineEdit_DOS_HEADER[N_LE_DOS_HEADER::__data_size]; 88 XLineEditHEX *g_lineEdit_VXD_HEADER[N_VXD_HEADER::__data_size]; 89 XComboBoxEx *g_comboBox[__CB_size]; 90 91 InvWidget *g_invWidget[__INV_size]; 92 SubDevice *g_subDevice[SLE::__TYPE_size]; 93 QStandardItemModel *g_tvModel[SLE::__TYPE_size]; 94 }; 95 96 #endif // LEWIDGET_H 97