VectorSearch/QVectorSearch/mainwindow.h

58 lines
1.4 KiB
C
Raw Normal View History

2024-03-19 20:42:32 +00:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
2024-03-20 09:47:05 +00:00
#include "finder.h"
2024-03-21 07:55:44 +00:00
#include "word_list.h"
2024-03-19 20:42:32 +00:00
#include <QMainWindow>
2024-03-20 09:47:05 +00:00
#include <QStandardItemModel>
2024-03-20 09:16:46 +00:00
#include <QStringListModel>
2024-03-20 20:45:06 +00:00
#include <filesystem>
2024-03-19 20:42:32 +00:00
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
class MainWindow : public QMainWindow {
Q_OBJECT
2024-03-20 09:16:46 +00:00
private:
2024-03-21 07:55:44 +00:00
WordList word_list_;
2024-03-20 09:16:46 +00:00
QStringListModel result_model_;
2024-03-20 09:47:05 +00:00
QStandardItemModel search_algorithms_;
2024-03-20 20:45:06 +00:00
QStandardItemModel word_list_sources_;
2024-03-20 14:20:46 +00:00
std::unique_ptr<Finder> finder_;
bool incremental_search_;
2024-03-20 09:16:46 +00:00
2024-03-19 20:42:32 +00:00
public:
MainWindow(QWidget *parent = nullptr, bool enableIncrementalSearch = false,
bool enableDevMode = false);
2024-03-19 20:42:32 +00:00
~MainWindow();
/// Show additional widgets
void setDevMode(bool enable);
2024-03-20 09:16:46 +00:00
private:
2024-03-20 09:47:05 +00:00
void setupAlgorithmSelector();
2024-03-20 20:45:06 +00:00
void setupWordListSourceSelector();
void setupWordList();
2024-03-20 09:47:05 +00:00
void generateWordList();
2024-03-20 20:45:06 +00:00
void loadWordList(std::filesystem::path path);
2024-03-20 09:47:05 +00:00
void search(const QString &search_term);
2024-03-20 14:20:46 +00:00
void createSelectedFinder();
void showResults(const WordRefList &results);
2024-03-22 09:59:13 +00:00
void clearResults();
2024-03-20 09:47:05 +00:00
private slots:
void on_searchInput_textChanged(const QString &search_term);
void on_searchAlgorithmSelector_currentIndexChanged(int);
2024-03-20 20:45:06 +00:00
void on_wordListSourceSelector_currentIndexChanged(int);
void on_wordListSizeSelector_valueChanged(int);
2024-03-21 19:56:30 +00:00
void on_searchInput_returnPressed();
2024-03-20 09:16:46 +00:00
2024-03-19 20:42:32 +00:00
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H