Skip to content

Commit

Permalink
Some fixes for predefined filters
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed Mar 31, 2021
1 parent 1c8ad2b commit 7ad885f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ui/include/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class MainWindow : public QMainWindow {
void openClipboard();
void openUrl();
void editHighlighters();
void editPredefinedFilters( QString newFilter = "" );
void editPredefinedFilters( const QString& newFilter = {} );
void options();
void about();
void aboutQt();
Expand Down
5 changes: 3 additions & 2 deletions src/ui/include/predefinedfiltersdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class PredefinedFiltersDialog : public QDialog, public Ui::PredefinedFiltersDial
Q_OBJECT

public:
explicit PredefinedFiltersDialog( QWidget* parent = nullptr, QString newFilter = "" );
PredefinedFiltersDialog( QWidget* parent = nullptr );
PredefinedFiltersDialog( const QString& newFilter, QWidget* parent = nullptr );

private slots:
void addFilter() const;
Expand All @@ -64,7 +65,7 @@ class PredefinedFiltersDialog : public QDialog, public Ui::PredefinedFiltersDial
void optionsChanged();

private:
void addFilterFromSearchLine( QString newFilter ) const;
void addFilterFromSearchLine( const QString& newFilter ) const;
void populateFiltersTable() const;
void saveSettings();
void readFiltersTable();
Expand Down
4 changes: 2 additions & 2 deletions src/ui/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,9 +895,9 @@ void MainWindow::editHighlighters()
}

// Opens dialog to configure predefined filters
void MainWindow::editPredefinedFilters( QString newFilter )
void MainWindow::editPredefinedFilters( const QString& newFilter )
{
PredefinedFiltersDialog dialog( this, newFilter );
PredefinedFiltersDialog dialog( newFilter, this );

signalMux_.connect( &dialog, SIGNAL( optionsChanged() ), SLOT( applyConfiguration() ) );

Expand Down
8 changes: 6 additions & 2 deletions src/ui/src/predefinedfiltersdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "log.h"
#include "predefinedfilters.h"

PredefinedFiltersDialog::PredefinedFiltersDialog( QWidget* parent, QString newFilter )
PredefinedFiltersDialog::PredefinedFiltersDialog( QWidget* parent )
: QDialog( parent )
{
setupUi( this );
Expand All @@ -73,7 +73,11 @@ PredefinedFiltersDialog::PredefinedFiltersDialog( QWidget* parent, QString newFi
addFilterButton->setIcon( iconLoader.load( "icons8-plus-16" ) );
removeFilterButton->setIcon( iconLoader.load( "icons8-minus-16" ) );
} );
}

PredefinedFiltersDialog::PredefinedFiltersDialog( const QString& newFilter, QWidget* parent )
: PredefinedFiltersDialog( parent )
{
if ( newFilter != "" ) {
addFilterFromSearchLine( newFilter );
}
Expand Down Expand Up @@ -133,7 +137,7 @@ void PredefinedFiltersDialog::addFilter() const
filtersTableWidget->setRowCount( filtersTableWidget->rowCount() + 1 );
}

void PredefinedFiltersDialog::addFilterFromSearchLine( QString newFilter ) const
void PredefinedFiltersDialog::addFilterFromSearchLine( const QString& newFilter ) const
{
addFilter();

Expand Down

0 comments on commit 7ad885f

Please sign in to comment.