feat: make word-list size configurable from ui
This commit is contained in:
parent
48283d0d76
commit
291d8d198e
@ -33,7 +33,7 @@ void MainWindow::setupAlgorithmSelector() {
|
||||
|
||||
void MainWindow::generateWordList() {
|
||||
Timer timer;
|
||||
word_list_ = WordListGenerator::generate();
|
||||
word_list_ = WordListGenerator::generate(ui->wordListSizeSelector->value());
|
||||
timer.stop();
|
||||
|
||||
std::stringstream status_message;
|
||||
@ -91,10 +91,22 @@ void MainWindow::showResults(
|
||||
}
|
||||
|
||||
void MainWindow::on_searchInput_textChanged(const QString &search_term) {
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
search(search_term);
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void MainWindow::on_searchAlgorithmSelector_currentIndexChanged(int) {
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
createSelectedFinder();
|
||||
search(ui->searchInput->displayText());
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void MainWindow::on_wordListSizeSelector_valueChanged(int) {
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
generateWordList();
|
||||
createSelectedFinder();
|
||||
search(ui->searchInput->displayText());
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ private:
|
||||
private slots:
|
||||
void on_searchInput_textChanged(const QString &search_term);
|
||||
void on_searchAlgorithmSelector_currentIndexChanged(int);
|
||||
void on_wordListSizeSelector_valueChanged(int new_value);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
@ -35,6 +35,16 @@
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="searchInput">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
@ -42,6 +52,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="searchAlgorithmSelector"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
@ -55,16 +68,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="searchAlgorithmSelector"/>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Select word-list size</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="searchInput">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="wordListSizeSelector">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Reference in New Issue
Block a user