From 67fb2a23eee89c03df4a9da4c700019af3ad9d86 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Sun, 9 Sep 2018 02:20:49 +0300 Subject: [PATCH] Fix tab layout --- UEFITool/uefitool.cpp | 55 ++++++++++++++++++------------------------- UEFITool/uefitool.h | 12 ++++++++-- UEFITool/uefitool.ui | 44 +++------------------------------- 3 files changed, 36 insertions(+), 75 deletions(-) diff --git a/UEFITool/uefitool.cpp b/UEFITool/uefitool.cpp index 356b2bf..8c40693 100644 --- a/UEFITool/uefitool.cpp +++ b/UEFITool/uefitool.cpp @@ -75,7 +75,7 @@ version(tr(PROGRAM_VERSION)) setAcceptDrops(true); // Disable Builder tab - ui->messagesTabWidget->setTabEnabled(6, false); + ui->messagesTabWidget->setTabEnabled(TAB_BUILDER, false); // Set current directory currentDir = "."; @@ -112,12 +112,11 @@ void UEFITool::init() ui->fitTableWidget->setRowCount(0); ui->fitTableWidget->setColumnCount(0); ui->infoEdit->clear(); - ui->bootGuardEdit->clear(); - ui->txtEdit->clear(); - ui->messagesTabWidget->setTabEnabled(1, false); - ui->messagesTabWidget->setTabEnabled(2, false); - ui->messagesTabWidget->setTabEnabled(3, false); - ui->messagesTabWidget->setTabEnabled(4, false); + ui->secEdit->clear(); + ui->messagesTabWidget->setTabEnabled(TAB_FIT, false); + ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, false); + ui->messagesTabWidget->setTabEnabled(TAB_SEARCH, false); + ui->messagesTabWidget->setTabEnabled(TAB_BUILDER, false); // Set window title setWindowTitle(tr("UEFITool %1").arg(version)); @@ -1050,7 +1049,7 @@ void UEFITool::showParserMessages() ui->parserMessagesListWidget->addItem(item); } - ui->messagesTabWidget->setCurrentIndex(0); + ui->messagesTabWidget->setCurrentIndex(TAB_PARSER); ui->parserMessagesListWidget->scrollToBottom(); } @@ -1068,7 +1067,8 @@ void UEFITool::showFinderMessages() ui->finderMessagesListWidget->addItem(item); } - ui->messagesTabWidget->setCurrentIndex(3); + ui->messagesTabWidget->setTabEnabled(TAB_SEARCH, true); + ui->messagesTabWidget->setCurrentIndex(TAB_SEARCH); ui->finderMessagesListWidget->scrollToBottom(); } @@ -1086,8 +1086,8 @@ void UEFITool::showBuilderMessages() ui->builderMessagesListWidget->addItem(item); } - ui->messagesTabWidget->setTabEnabled(6, true); - ui->messagesTabWidget->setCurrentIndex(6); + ui->messagesTabWidget->setTabEnabled(TAB_BUILDER, true); + ui->messagesTabWidget->setCurrentIndex(TAB_BUILDER); ui->builderMessagesListWidget->scrollToBottom(); } @@ -1193,8 +1193,7 @@ void UEFITool::readSettings() ui->finderMessagesListWidget->setFont(currentFont); ui->builderMessagesListWidget->setFont(currentFont); ui->fitTableWidget->setFont(currentFont); - ui->bootGuardEdit->setFont(currentFont); - ui->txtEdit->setFont(currentFont); + ui->secEdit->setFont(currentFont); ui->structureTreeView->setFont(currentFont); searchDialog->ui->guidEdit->setFont(currentFont); searchDialog->ui->hexEdit->setFont(currentFont); @@ -1228,14 +1227,14 @@ void UEFITool::showFitTable() std::vector, UModelIndex> > fitTable = ffsParser->getFitTable(); if (fitTable.empty()) { // Disable FIT tab - ui->messagesTabWidget->setTabEnabled(1, false); - // Disable BootGuard tab - ui->messagesTabWidget->setTabEnabled(2, false); + ui->messagesTabWidget->setTabEnabled(TAB_FIT, false); + // Disable Security tab + ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, false); return; } // Enable FIT tab - ui->messagesTabWidget->setTabEnabled(1, true); + ui->messagesTabWidget->setTabEnabled(TAB_FIT, true); // Set up the FIT table ui->fitTableWidget->clear(); @@ -1258,22 +1257,14 @@ void UEFITool::showFitTable() ui->fitTableWidget->resizeColumnsToContents(); ui->fitTableWidget->resizeRowsToContents(); - ui->messagesTabWidget->setCurrentIndex(1); + ui->messagesTabWidget->setCurrentIndex(TAB_FIT); - // Get BootGuard info - UString bgInfo = ffsParser->getBootGuardInfo(); - if (!bgInfo.isEmpty()) { - ui->messagesTabWidget->setTabEnabled(2, true); - ui->bootGuardEdit->setPlainText(bgInfo); - ui->messagesTabWidget->setCurrentIndex(2); - } - - // Get TXT ACM info - UString txtInfo = ffsParser->getTxtInfo(); - if (!txtInfo.isEmpty()) { - ui->messagesTabWidget->setTabEnabled(3, true); - ui->txtEdit->setPlainText(txtInfo); - ui->messagesTabWidget->setCurrentIndex(3); + // Get BootGuard and TXT ACM info + UString secInfo = ffsParser->getBootGuardInfo(); + secInfo += ffsParser->getTxtInfo(); + if (!secInfo.isEmpty()) { + ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, true); + ui->secEdit->setPlainText(secInfo); } } diff --git a/UEFITool/uefitool.h b/UEFITool/uefitool.h index 63103a7..2fb0208 100644 --- a/UEFITool/uefitool.h +++ b/UEFITool/uefitool.h @@ -125,8 +125,8 @@ private slots: void writeSettings(); void loadGuidDatabase(); - void unloadGuidDatabase(); - void loadDefaultGuidDatabase(); + void unloadGuidDatabase(); + void loadDefaultGuidDatabase(); void generateReport(); void currentTabChanged(int index); @@ -163,6 +163,14 @@ private: void showFinderMessages(); void showFitTable(); void showBuilderMessages(); + + enum { + TAB_PARSER, + TAB_FIT, + TAB_SECURITY, + TAB_SEARCH, + TAB_BUILDER + }; }; #endif // UEFITOOL_H diff --git a/UEFITool/uefitool.ui b/UEFITool/uefitool.ui index 62e4de1..896431e 100644 --- a/UEFITool/uefitool.ui +++ b/UEFITool/uefitool.ui @@ -203,12 +203,12 @@ - + true - BootGuard + Security @@ -227,45 +227,7 @@ 5 - - - false - - - false - - - true - - - - - - - - true - - - TXT - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - + false