VectorSearch/QVectorSearch/mainwindow.h

58 lines
1.4 KiB
C++

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "finder.h"
#include "word_list.h"
#include <QMainWindow>
#include <QStandardItemModel>
#include <QStringListModel>
#include <filesystem>
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
class MainWindow : public QMainWindow {
Q_OBJECT
private:
WordList word_list_;
QStringListModel result_model_;
QStandardItemModel search_algorithms_;
QStandardItemModel word_list_sources_;
std::unique_ptr<Finder> finder_;
bool incremental_search_;
public:
MainWindow(QWidget *parent = nullptr, bool enableIncrementalSearch = false,
bool enableDevMode = false);
~MainWindow();
/// Show additional widgets
void setDevMode(bool enable);
private:
void setupAlgorithmSelector();
void setupWordListSourceSelector();
void setupWordList();
void generateWordList();
void loadWordList(std::filesystem::path path);
void search(const QString &search_term);
void createSelectedFinder();
void showResults(const WordRefList &results);
void clearResults();
private slots:
void on_searchInput_textChanged(const QString &search_term);
void on_searchAlgorithmSelector_currentIndexChanged(int);
void on_wordListSourceSelector_currentIndexChanged(int);
void on_wordListSizeSelector_valueChanged(int);
void on_searchInput_returnPressed();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H