gui: MainWindow: Set, save and restore ignore patterns

This commit is contained in:
Albert S. 2022-05-31 10:16:53 +02:00
parent c2bd1b526b
commit ae57a22078
2 changed files with 8 additions and 2 deletions

View File

@ -72,6 +72,9 @@ MainWindow::MainWindow(QWidget *parent, QString socketPath) : QMainWindow(parent
QStringList indexPaths = settings.value("indexPaths").toStringList(); QStringList indexPaths = settings.value("indexPaths").toStringList();
ui->lstPaths->addItems(indexPaths); ui->lstPaths->addItems(indexPaths);
QString ignorePatterns = settings.value("ignorePatterns").toString();
ui->txtIgnorePatterns->setText(ignorePatterns);
ui->spinPreviewPage->setValue(1); ui->spinPreviewPage->setValue(1);
ui->spinPreviewPage->setMinimum(1); ui->spinPreviewPage->setMinimum(1);
} }
@ -196,9 +199,12 @@ void MainWindow::startIndexing()
pathSettingsValue.append(path); pathSettingsValue.append(path);
} }
this->indexer->setTargetPaths(paths); this->indexer->setTargetPaths(paths);
QString ignorePatterns = ui->txtIgnorePatterns->text();
this->indexer->setIgnorePattern(ignorePatterns.split(";"));
this->indexer->beginIndexing(); this->indexer->beginIndexing();
QSettings settings; QSettings settings;
settings.setValue("indexPaths", pathSettingsValue); settings.setValue("indexPaths", pathSettingsValue);
settings.setValue("ignorePatterns", ignorePatterns);
ui->btnStartIndexing->setText("Stop indexing"); ui->btnStartIndexing->setText("Stop indexing");
} }

View File

@ -27,7 +27,7 @@
<enum>QTabWidget::South</enum> <enum>QTabWidget::South</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="resultsTab"> <widget class="QWidget" name="resultsTab">
<attribute name="title"> <attribute name="title">
@ -333,7 +333,7 @@
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="6" column="0">
<widget class="QLineEdit" name="lineEdit"/> <widget class="QLineEdit" name="txtIgnorePatterns"/>
</item> </item>
<item row="10" column="0"> <item row="10" column="0">
<widget class="QPushButton" name="btnStartIndexing"> <widget class="QPushButton" name="btnStartIndexing">