@@ -82,7 +82,8 @@ DetailsTab::DetailsTab(PeHandler *peHndl, QWidget *parent)
82
82
fileHdrTree(this ), optionalHdrTree(this ), disasmView(this ),
83
83
hdrsSplitter(this ), secHdrTreeView(&hdrsSplitter), secDiagramSplitter(&hdrsSplitter),
84
84
fileHdrModel(NULL ), optHdrModel(NULL ), secHdrsModel(NULL ), importsModel(NULL ), exportsModel(NULL ), expFuncModel(NULL ),
85
- secDiagramModel(NULL ), disasmModel(NULL ), resourcesModel(NULL ), clrModel(NULL )
85
+ secDiagramModel(NULL ), disasmModel(NULL ), resourcesModel(NULL ), clrModel(NULL ),
86
+ cRichHdrTab(-1 )
86
87
{
87
88
for (int i = 0 ; i < pe::DIR_ENTRIES_COUNT; i++) {
88
89
dirSplitters[i] = NULL ;
@@ -199,17 +200,15 @@ DetailsTab::DetailsTab(PeHandler *peHndl, QWidget *parent)
199
200
cStringsTab = addTab (&stringsBrowseWindow, tr (" Strings" ));
200
201
201
202
cDOSHdrTab = addTab (&dosHdrTree, tr (" DOS Hdr" ));
202
- if (peHndl && peHndl->getPe () && peHndl->getPe ()->getRichHeaderSign ()) {
203
- cRichHdrTab = addTab (&richHdrTree, tr (" Rich Hdr" ));
204
- }
203
+ cRichHdrTab = addTab (&richHdrTree, tr (" Rich Hdr" ));
205
204
cFileHdrsTab = addTab (&fileHdrTree, tr (" File Hdr" ));
206
205
cOptHdrsTab = addTab (&optionalHdrTree, tr (" Optional Hdr" ));
207
206
cSecHdrsTab = addTab (&hdrsSplitter, tr (" Section Hdrs" ));
208
207
209
208
setScaledIcons ();
210
- reloadDirView ();
209
+ reloadTabsView ();
211
210
212
- connect (this ->myPeHndl , SIGNAL (modified ()), this , SLOT (reloadDirView ()) );
211
+ connect (this ->myPeHndl , SIGNAL (modified ()), this , SLOT (reloadTabsView ()) );
213
212
connect (this ->myPeHndl , SIGNAL (pageOffsetModified (offset_t , bufsize_t )), this , SLOT (setDisasmTabText (offset_t )) );
214
213
connect (this ->myPeHndl , SIGNAL (pageOffsetModified (offset_t , bufsize_t )), disasmModel, SLOT (setShownContent (offset_t , bufsize_t )) );
215
214
@@ -468,7 +467,7 @@ void DetailsTab::setDisasmTabText(offset_t raw)
468
467
if (sec2Name.size ())
469
468
secName += " to " + sec2Name;
470
469
}
471
- setTabText (this ->cDisasmTab , tr ( " Disasm" ) + secName);
470
+ setTabText (this ->cDisasmTab , tr (" Disasm" ) + secName);
472
471
}
473
472
474
473
void DetailsTab::shirtTabsAfter (pe::dir_entry dirNum, bool toTheLeft)
@@ -533,8 +532,32 @@ void DetailsTab::manageDirTab(pe::dir_entry dirNum)
533
532
}
534
533
}
535
534
536
- void DetailsTab::reloadDirView ()
535
+ void DetailsTab::manageRichHdrTab ()
537
536
{
537
+ if (!myPeHndl || !m_PE) return ;
538
+
539
+ // add/remove Rich Header tab
540
+ if (m_PE->getRichHeaderSign ()) {
541
+ if (cRichHdrTab == (-1 )) {
542
+ int lastBefore = this ->cDOSHdrTab ;
543
+ int tabIndex = lastBefore + 1 ;
544
+ cRichHdrTab = this ->insertTab (tabIndex, &richHdrTree, tr (" Rich Hdr" ));
545
+ }
546
+ }
547
+ else {
548
+ if (cRichHdrTab != (-1 )) {
549
+ removeTab (cRichHdrTab);
550
+ cRichHdrTab = (-1 );
551
+ }
552
+ }
553
+ }
554
+
555
+ void DetailsTab::reloadTabsView ()
556
+ {
557
+ if (!myPeHndl || !m_PE) return ;
558
+
559
+ manageRichHdrTab ();
560
+
538
561
for (int i = 0 ; i < pe::DIR_ENTRIES_COUNT; i++) {
539
562
manageDirTab (pe::dir_entry (i));
540
563
}
0 commit comments