mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
"Clear Filter" button instead of "Show All"
This commit is contained in:
parent
3e8063f80a
commit
9ba324b85f
4 changed files with 37 additions and 17 deletions
|
@ -116,8 +116,8 @@ void BaseLogDialog::handleSearchButton() {
|
|||
}
|
||||
|
||||
void BaseLogDialog::handleSearchTextChanged(QString searchText) {
|
||||
|
||||
QTextCursor cursor = _logTextBox->textCursor();
|
||||
|
||||
if (cursor.hasSelection()) {
|
||||
QString selectedTerm = cursor.selectedText();
|
||||
if (selectedTerm == searchText) {
|
||||
|
@ -139,6 +139,10 @@ void BaseLogDialog::handleSearchTextChanged(QString searchText) {
|
|||
_highlighter->rehighlight();
|
||||
}
|
||||
|
||||
void BaseLogDialog::clearSearch() {
|
||||
_searchTextBox->setText("");
|
||||
}
|
||||
|
||||
void BaseLogDialog::toggleSearchPrev() {
|
||||
QTextCursor searchCursor = _logTextBox->textCursor();
|
||||
if (searchCursor.hasSelection()) {
|
||||
|
|
|
@ -67,6 +67,7 @@ protected:
|
|||
void resizeEvent(QResizeEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
virtual QString getCurrentLog() = 0;
|
||||
void clearSearch();
|
||||
|
||||
private:
|
||||
QPushButton* _searchButton{ nullptr };
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <shared/AbstractLoggerInterface.h>
|
||||
|
||||
const int REVEAL_BUTTON_WIDTH = 122;
|
||||
const int SHOW_ALL_BUTTON_WIDTH = 80;
|
||||
const int CLEAR_FILTER_BUTTON_WIDTH = 80;
|
||||
const int MARGIN_LEFT = 25;
|
||||
const int DEBUG_CHECKBOX_WIDTH = 70;
|
||||
const int INFO_CHECKBOX_WIDTH = 65;
|
||||
|
@ -149,13 +149,12 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : BaseLog
|
|||
_extraDebuggingBox->show();
|
||||
connect(_extraDebuggingBox, &QCheckBox::stateChanged, this, &LogDialog::handleExtraDebuggingCheckbox);
|
||||
|
||||
_showAllButton = new QPushButton("Show All", this);
|
||||
_clearFilterButton = new QPushButton("Clear Filters", this);
|
||||
// set object name for css styling
|
||||
_showAllButton->setObjectName("showAllButton");
|
||||
_showAllButton->show();
|
||||
connect(_showAllButton, &QPushButton::clicked, this, &LogDialog::handleShowAllButton);
|
||||
|
||||
|
||||
_clearFilterButton->setObjectName("showAllButton");
|
||||
_clearFilterButton->show();
|
||||
connect(_clearFilterButton, &QPushButton::clicked, this, &LogDialog::handleClearFilterButton);
|
||||
handleClearFilterButton();
|
||||
}
|
||||
|
||||
void LogDialog::resizeEvent(QResizeEvent* event) {
|
||||
|
@ -164,11 +163,11 @@ void LogDialog::resizeEvent(QResizeEvent* event) {
|
|||
ELEMENT_MARGIN,
|
||||
REVEAL_BUTTON_WIDTH,
|
||||
ELEMENT_HEIGHT);
|
||||
_showAllButton->setGeometry(width() - ELEMENT_MARGIN - SHOW_ALL_BUTTON_WIDTH,
|
||||
_clearFilterButton->setGeometry(width() - ELEMENT_MARGIN - CLEAR_FILTER_BUTTON_WIDTH,
|
||||
THIRD_ROW,
|
||||
SHOW_ALL_BUTTON_WIDTH,
|
||||
CLEAR_FILTER_BUTTON_WIDTH,
|
||||
ELEMENT_HEIGHT);
|
||||
_extraDebuggingBox->setGeometry(width() - ELEMENT_MARGIN - COMBOBOX_WIDTH - ELEMENT_MARGIN - SHOW_ALL_BUTTON_WIDTH,
|
||||
_extraDebuggingBox->setGeometry(width() - ELEMENT_MARGIN - COMBOBOX_WIDTH - ELEMENT_MARGIN - CLEAR_FILTER_BUTTON_WIDTH,
|
||||
THIRD_ROW,
|
||||
COMBOBOX_WIDTH,
|
||||
ELEMENT_HEIGHT);
|
||||
|
@ -178,10 +177,26 @@ void LogDialog::handleRevealButton() {
|
|||
_logger->locateLog();
|
||||
}
|
||||
|
||||
void LogDialog::handleShowAllButton() {
|
||||
_logTextBox->clear();
|
||||
QString log = getCurrentLog();
|
||||
_logTextBox->appendPlainText(log);
|
||||
void LogDialog::handleClearFilterButton() {
|
||||
_logger->setExtraDebugging(false);
|
||||
_extraDebuggingBox->setCheckState(Qt::Unchecked);
|
||||
_logger->setDebugPrint(false);
|
||||
_debugPrintBox->setCheckState(Qt::Unchecked);
|
||||
_logger->setInfoPrint(false);
|
||||
_infoPrintBox->setCheckState(Qt::Unchecked);
|
||||
_logger->setCriticalPrint(true);
|
||||
_criticalPrintBox->setCheckState(Qt::Checked);
|
||||
_logger->setWarningPrint(true);
|
||||
_warningPrintBox->setCheckState(Qt::Checked);
|
||||
_logger->setSuppressPrint(true);
|
||||
_suppressPrintBox->setCheckState(Qt::Checked);
|
||||
_logger->setFatalPrint(true);
|
||||
_fatalPrintBox->setCheckState(Qt::Checked);
|
||||
_logger->setUnknownPrint(true);
|
||||
_unknownPrintBox->setCheckState(Qt::Checked);
|
||||
clearSearch();
|
||||
_filterDropdown->setCurrentIndex(0);
|
||||
printLogFile();
|
||||
}
|
||||
|
||||
void LogDialog::handleExtraDebuggingCheckbox(int state) {
|
||||
|
|
|
@ -40,7 +40,7 @@ private slots:
|
|||
void handleFatalPrintBox(int);
|
||||
void handleUnknownPrintBox(int);
|
||||
void handleFilterDropdownChanged(int);
|
||||
void handleShowAllButton();
|
||||
void handleClearFilterButton();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
|
@ -50,7 +50,7 @@ protected:
|
|||
private:
|
||||
QCheckBox* _extraDebuggingBox;
|
||||
QPushButton* _revealLogButton;
|
||||
QPushButton* _showAllButton;
|
||||
QPushButton* _clearFilterButton;
|
||||
QCheckBox* _debugPrintBox;
|
||||
QCheckBox* _infoPrintBox;
|
||||
QCheckBox* _criticalPrintBox;
|
||||
|
|
Loading…
Reference in a new issue