Compare commits
No commits in common. "532e52cc7f035fefb6fd435e9f9b7dcc85f08487" and "e4c643880aaa4ddaed1e401e82d3403eb44716c8" have entirely different histories.
532e52cc7f
...
e4c643880a
|
@ -3,12 +3,10 @@
|
||||||
|
|
||||||
#include "finder.h"
|
#include "finder.h"
|
||||||
#include "word_list.h"
|
#include "word_list.h"
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QStringListModel>
|
#include <QStringListModel>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -28,17 +26,14 @@ private:
|
||||||
bool incremental_search_enabled_;
|
bool incremental_search_enabled_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Create a new MainWindow.
|
|
||||||
*
|
|
||||||
* @param[in] enableIncrementalSearch Run search while typing.
|
|
||||||
* @param[in] enableDevMode Show additional widgets to configure search.
|
|
||||||
*/
|
|
||||||
MainWindow(QWidget *parent = nullptr, bool enableIncrementalSearch = false,
|
MainWindow(QWidget *parent = nullptr, bool enableIncrementalSearch = false,
|
||||||
bool enableDevMode = false);
|
bool enableDevMode = false);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
private:
|
/// Show additional widgets
|
||||||
void setDevMode(bool enable);
|
void setDevMode(bool enable);
|
||||||
|
|
||||||
|
private:
|
||||||
void setupAlgorithmSelector();
|
void setupAlgorithmSelector();
|
||||||
void setupWordListSourceSelector();
|
void setupWordListSourceSelector();
|
||||||
void setupWordList();
|
void setupWordList();
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#include "word_list.h"
|
#include "word_list.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <initializer_list>
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
WordList &WordList::multiply(size_t factor) {
|
WordList &WordList::multiply(size_t factor) {
|
||||||
|
@ -28,12 +26,12 @@ WordList &WordList::shuffle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
WordList WordList::oneCap() {
|
WordList WordList::oneCap() {
|
||||||
const static std::string charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
const static std::string charset_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
WordList word_list;
|
WordList word_list;
|
||||||
word_list.reserve(charset.length());
|
word_list.reserve(charset_.length());
|
||||||
|
|
||||||
for (const auto char_1 : charset) {
|
for (auto char_1 : charset_) {
|
||||||
word_list.emplace_back(std::initializer_list<char>({char_1}));
|
word_list.emplace_back(std::initializer_list<char>({char_1}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,15 +39,15 @@ WordList WordList::oneCap() {
|
||||||
};
|
};
|
||||||
|
|
||||||
WordList WordList::fourCaps() {
|
WordList WordList::fourCaps() {
|
||||||
const static std::string charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
const static std::string charset_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
WordList word_list;
|
WordList word_list;
|
||||||
word_list.reserve(std::pow(charset.length(), 4));
|
word_list.reserve(std::pow(charset_.length(), 4));
|
||||||
|
|
||||||
for (const auto char_1 : charset) {
|
for (auto char_1 : charset_) {
|
||||||
for (const auto char_2 : charset) {
|
for (auto char_2 : charset_) {
|
||||||
for (const auto char_3 : charset) {
|
for (auto char_3 : charset_) {
|
||||||
for (const auto char_4 : charset) {
|
for (auto char_4 : charset_) {
|
||||||
word_list.emplace_back(
|
word_list.emplace_back(
|
||||||
std::initializer_list<char>({char_1, char_2, char_3, char_4}));
|
std::initializer_list<char>({char_1, char_2, char_3, char_4}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue