33 lines
797 B
C++
33 lines
797 B
C++
#include "mainwindow.h"
|
|
#include "./ui_mainwindow.h"
|
|
|
|
#include "timer.h"
|
|
#include "word_list_generator.h"
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
|
ui->setupUi(this);
|
|
ui->resultView->setModel(&result_model_);
|
|
|
|
generate_word_list();
|
|
}
|
|
|
|
MainWindow::~MainWindow() { delete ui; }
|
|
|
|
void MainWindow::generate_word_list() {
|
|
Timer timer;
|
|
word_list_ = WordListGenerator().generate();
|
|
timer.stop();
|
|
|
|
std::stringstream status_message;
|
|
status_message << "generated " << word_list_.size() << " words in " << timer;
|
|
ui->mainStatusBar->showMessage(QString::fromStdString(status_message.str()));
|
|
|
|
QStringList words;
|
|
for (auto word : word_list_) {
|
|
words.append(QString::fromStdString(word));
|
|
}
|
|
|
|
result_model_.setStringList(words);
|
|
}
|