looqs/gui/searchworker.h

45 satır
888 B
C
Ham Normal Görünüm Geçmiş

#ifndef SEARCHWORKER_H
#define SEARCHWORKER_H
#include <QObject>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QString>
#include <QVector>
#include "../shared/searchresult.h"
class SearchWorker : public QObject
{
2018-09-02 12:27:23 +02:00
class Command
{
public:
QString key;
QString value;
Command(QString key = "", QString value = "")
{
this->key = key;
this->value = value;
}
};
Q_OBJECT
private:
2018-09-02 12:27:23 +02:00
QVector<Command> tokenize(QString expression);
QString createSql(const Command &cmd);
QString makeSql(const QVector<Command> &tokens);
QSqlDatabase db;
public:
SearchWorker();
SearchWorker(const QString &dbpath);
bool checkParanthesis(QString expression);
public slots:
2018-09-02 12:27:23 +02:00
void search(const QString &query);
signals:
void searchResultsReady(const QVector<SearchResult> &results);
void searchCancelled();
void searchError(QString e);
};
#endif // SEARCHWORKER_H