Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interaction improvements #143

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/crawlerwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,17 @@ void CrawlerWidget::searchBackward()
activeView()->searchBackward();
}

void CrawlerWidget::ignoreCaseChangeHandler( int state )
{
// Advise the parent the checkboxes have been changed (for maintaining default config)
emit ignoreCaseChanged( state );

// Restart the search
if ( !searchLineEdit->currentText().isEmpty() ) {
replaceCurrentSearch( searchLineEdit->currentText() );
}
}

void CrawlerWidget::searchRefreshChangedHandler( int state )
{
searchState_.setAutorefresh( state == Qt::Checked );
Expand Down Expand Up @@ -777,6 +788,10 @@ void CrawlerWidget::setup()
connect( logData_, SIGNAL( fileChanged( LogData::MonitoredFileStatus ) ),
this, SLOT( fileChangedHandler( LogData::MonitoredFileStatus ) ) );

// Auto refresh changed, update search results
connect( ignoreCaseCheck, SIGNAL( stateChanged( int ) ),
this, SLOT( ignoreCaseChangeHandler( int ) ) );

// Search auto-refresh
connect( searchRefreshCheck, SIGNAL( stateChanged( int ) ),
this, SLOT( searchRefreshChangedHandler( int ) ) );
Expand All @@ -785,8 +800,6 @@ void CrawlerWidget::setup()
// (for maintaining default config)
connect( searchRefreshCheck, SIGNAL( stateChanged( int ) ),
this, SIGNAL( searchRefreshChanged( int ) ) );
connect( ignoreCaseCheck, SIGNAL( stateChanged( int ) ),
this, SIGNAL( ignoreCaseChanged( int ) ) );
}

// Create a new search using the text passed, replace the currently
Expand Down
3 changes: 3 additions & 0 deletions src/crawlerwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ class CrawlerWidget : public QSplitter,
void searchForward();
void searchBackward();

// Called when the checkbox for case insensitivity is changed
void ignoreCaseChangeHandler( int state );

// Called when the checkbox for search auto-refresh is changed
void searchRefreshChangedHandler( int state );

Expand Down
22 changes: 13 additions & 9 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,15 +787,19 @@ void MainWindow::keyPressEvent( QKeyEvent* keyEvent )
{
LOG(logDEBUG4) << "keyPressEvent received";

switch ( (keyEvent->text())[0].toLatin1() ) {
case '/':
displayQuickFindBar( QuickFindMux::Forward );
break;
case '?':
displayQuickFindBar( QuickFindMux::Backward );
break;
default:
keyEvent->ignore();
if (keyEvent->key() == Qt::Key_Escape) {
quickFindWidget_.userClose();
} else {
switch ( (keyEvent->text())[0].toLatin1() ) {
case '/':
displayQuickFindBar( QuickFindMux::Forward );
break;
case '?':
displayQuickFindBar( QuickFindMux::Backward );
break;
default:
keyEvent->ignore();
}
}

if ( !keyEvent->isAccepted() )
Expand Down
5 changes: 5 additions & 0 deletions src/quickfindwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ void QuickFindWidget::userActivate()
editQuickFind_->setFocus( Qt::ShortcutFocusReason );
}

void QuickFindWidget::userClose()
{
closeHandler();
}

//
// SLOTS
//
Expand Down
3 changes: 3 additions & 0 deletions src/quickfindwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ class QuickFindWidget : public QWidget
// when requested by the user (the widget won't timeout)
void userActivate();

// Close the widget (called when pressing the escape key)
void userClose();

public slots:
// Instructs the widget to change the pattern displayed
void changeDisplayedPattern( const QString& newPattern );
Expand Down