Fix tab layout

This commit is contained in:
vit9696 2018-09-09 02:20:49 +03:00
parent 3699a7cebc
commit 67fb2a23ee
3 changed files with 36 additions and 75 deletions

View File

@ -75,7 +75,7 @@ version(tr(PROGRAM_VERSION))
setAcceptDrops(true); setAcceptDrops(true);
// Disable Builder tab // Disable Builder tab
ui->messagesTabWidget->setTabEnabled(6, false); ui->messagesTabWidget->setTabEnabled(TAB_BUILDER, false);
// Set current directory // Set current directory
currentDir = "."; currentDir = ".";
@ -112,12 +112,11 @@ void UEFITool::init()
ui->fitTableWidget->setRowCount(0); ui->fitTableWidget->setRowCount(0);
ui->fitTableWidget->setColumnCount(0); ui->fitTableWidget->setColumnCount(0);
ui->infoEdit->clear(); ui->infoEdit->clear();
ui->bootGuardEdit->clear(); ui->secEdit->clear();
ui->txtEdit->clear(); ui->messagesTabWidget->setTabEnabled(TAB_FIT, false);
ui->messagesTabWidget->setTabEnabled(1, false); ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, false);
ui->messagesTabWidget->setTabEnabled(2, false); ui->messagesTabWidget->setTabEnabled(TAB_SEARCH, false);
ui->messagesTabWidget->setTabEnabled(3, false); ui->messagesTabWidget->setTabEnabled(TAB_BUILDER, false);
ui->messagesTabWidget->setTabEnabled(4, false);
// Set window title // Set window title
setWindowTitle(tr("UEFITool %1").arg(version)); setWindowTitle(tr("UEFITool %1").arg(version));
@ -1050,7 +1049,7 @@ void UEFITool::showParserMessages()
ui->parserMessagesListWidget->addItem(item); ui->parserMessagesListWidget->addItem(item);
} }
ui->messagesTabWidget->setCurrentIndex(0); ui->messagesTabWidget->setCurrentIndex(TAB_PARSER);
ui->parserMessagesListWidget->scrollToBottom(); ui->parserMessagesListWidget->scrollToBottom();
} }
@ -1068,7 +1067,8 @@ void UEFITool::showFinderMessages()
ui->finderMessagesListWidget->addItem(item); ui->finderMessagesListWidget->addItem(item);
} }
ui->messagesTabWidget->setCurrentIndex(3); ui->messagesTabWidget->setTabEnabled(TAB_SEARCH, true);
ui->messagesTabWidget->setCurrentIndex(TAB_SEARCH);
ui->finderMessagesListWidget->scrollToBottom(); ui->finderMessagesListWidget->scrollToBottom();
} }
@ -1086,8 +1086,8 @@ void UEFITool::showBuilderMessages()
ui->builderMessagesListWidget->addItem(item); ui->builderMessagesListWidget->addItem(item);
} }
ui->messagesTabWidget->setTabEnabled(6, true); ui->messagesTabWidget->setTabEnabled(TAB_BUILDER, true);
ui->messagesTabWidget->setCurrentIndex(6); ui->messagesTabWidget->setCurrentIndex(TAB_BUILDER);
ui->builderMessagesListWidget->scrollToBottom(); ui->builderMessagesListWidget->scrollToBottom();
} }
@ -1193,8 +1193,7 @@ void UEFITool::readSettings()
ui->finderMessagesListWidget->setFont(currentFont); ui->finderMessagesListWidget->setFont(currentFont);
ui->builderMessagesListWidget->setFont(currentFont); ui->builderMessagesListWidget->setFont(currentFont);
ui->fitTableWidget->setFont(currentFont); ui->fitTableWidget->setFont(currentFont);
ui->bootGuardEdit->setFont(currentFont); ui->secEdit->setFont(currentFont);
ui->txtEdit->setFont(currentFont);
ui->structureTreeView->setFont(currentFont); ui->structureTreeView->setFont(currentFont);
searchDialog->ui->guidEdit->setFont(currentFont); searchDialog->ui->guidEdit->setFont(currentFont);
searchDialog->ui->hexEdit->setFont(currentFont); searchDialog->ui->hexEdit->setFont(currentFont);
@ -1228,14 +1227,14 @@ void UEFITool::showFitTable()
std::vector<std::pair<std::vector<UString>, UModelIndex> > fitTable = ffsParser->getFitTable(); std::vector<std::pair<std::vector<UString>, UModelIndex> > fitTable = ffsParser->getFitTable();
if (fitTable.empty()) { if (fitTable.empty()) {
// Disable FIT tab // Disable FIT tab
ui->messagesTabWidget->setTabEnabled(1, false); ui->messagesTabWidget->setTabEnabled(TAB_FIT, false);
// Disable BootGuard tab // Disable Security tab
ui->messagesTabWidget->setTabEnabled(2, false); ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, false);
return; return;
} }
// Enable FIT tab // Enable FIT tab
ui->messagesTabWidget->setTabEnabled(1, true); ui->messagesTabWidget->setTabEnabled(TAB_FIT, true);
// Set up the FIT table // Set up the FIT table
ui->fitTableWidget->clear(); ui->fitTableWidget->clear();
@ -1258,22 +1257,14 @@ void UEFITool::showFitTable()
ui->fitTableWidget->resizeColumnsToContents(); ui->fitTableWidget->resizeColumnsToContents();
ui->fitTableWidget->resizeRowsToContents(); ui->fitTableWidget->resizeRowsToContents();
ui->messagesTabWidget->setCurrentIndex(1); ui->messagesTabWidget->setCurrentIndex(TAB_FIT);
// Get BootGuard info // Get BootGuard and TXT ACM info
UString bgInfo = ffsParser->getBootGuardInfo(); UString secInfo = ffsParser->getBootGuardInfo();
if (!bgInfo.isEmpty()) { secInfo += ffsParser->getTxtInfo();
ui->messagesTabWidget->setTabEnabled(2, true); if (!secInfo.isEmpty()) {
ui->bootGuardEdit->setPlainText(bgInfo); ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, true);
ui->messagesTabWidget->setCurrentIndex(2); ui->secEdit->setPlainText(secInfo);
}
// Get TXT ACM info
UString txtInfo = ffsParser->getTxtInfo();
if (!txtInfo.isEmpty()) {
ui->messagesTabWidget->setTabEnabled(3, true);
ui->txtEdit->setPlainText(txtInfo);
ui->messagesTabWidget->setCurrentIndex(3);
} }
} }

View File

@ -163,6 +163,14 @@ private:
void showFinderMessages(); void showFinderMessages();
void showFitTable(); void showFitTable();
void showBuilderMessages(); void showBuilderMessages();
enum {
TAB_PARSER,
TAB_FIT,
TAB_SECURITY,
TAB_SEARCH,
TAB_BUILDER
};
}; };
#endif // UEFITOOL_H #endif // UEFITOOL_H

View File

@ -203,12 +203,12 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="bootGuardTab"> <widget class="QWidget" name="secTab">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<attribute name="title"> <attribute name="title">
<string>BootGuard</string> <string>Security</string>
</attribute> </attribute>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing"> <property name="spacing">
@ -227,45 +227,7 @@
<number>5</number> <number>5</number>
</property> </property>
<item> <item>
<widget class="QPlainTextEdit" name="bootGuardEdit"> <widget class="QPlainTextEdit" name="secEdit">
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="txtTab">
<property name="enabled">
<bool>true</bool>
</property>
<attribute name="title">
<string>TXT</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QPlainTextEdit" name="txtEdit">
<property name="acceptDrops"> <property name="acceptDrops">
<bool>false</bool> <bool>false</bool>
</property> </property>