2019-04-06 17:16:42 +02:00
|
|
|
#ifndef COMMAND_H
|
|
|
|
#define COMMAND_H
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QThreadStorage>
|
|
|
|
#include <QVariant>
|
2022-04-14 15:03:19 +02:00
|
|
|
#include <QMutex>
|
|
|
|
#include <QWaitCondition>
|
2019-04-10 18:57:27 +02:00
|
|
|
#include "utils.h"
|
2019-04-16 08:54:49 +02:00
|
|
|
#include "sqlitedbservice.h"
|
2022-04-14 15:03:19 +02:00
|
|
|
class Command : public QObject
|
2019-04-06 17:16:42 +02:00
|
|
|
{
|
2022-04-14 15:03:19 +02:00
|
|
|
Q_OBJECT
|
|
|
|
signals:
|
|
|
|
void finishedCmd(int retval);
|
|
|
|
|
2019-04-06 17:16:42 +02:00
|
|
|
protected:
|
2019-04-16 08:54:49 +02:00
|
|
|
SqliteDbService *dbService;
|
2019-04-06 17:16:42 +02:00
|
|
|
QString dbConnectionString;
|
2022-04-14 15:03:19 +02:00
|
|
|
QStringList arguments;
|
|
|
|
|
|
|
|
bool autoFinish = true;
|
2019-04-06 17:16:42 +02:00
|
|
|
|
|
|
|
public:
|
2019-04-16 08:54:49 +02:00
|
|
|
Command(SqliteDbService &dbService)
|
2019-04-06 17:16:42 +02:00
|
|
|
{
|
2019-04-16 08:54:49 +02:00
|
|
|
this->dbService = &dbService;
|
2019-04-06 17:16:42 +02:00
|
|
|
}
|
2022-04-14 15:03:19 +02:00
|
|
|
void setArguments(QStringList arguments)
|
|
|
|
{
|
|
|
|
this->arguments = arguments;
|
|
|
|
}
|
2019-04-06 17:16:42 +02:00
|
|
|
virtual int handle(QStringList arguments) = 0;
|
|
|
|
virtual ~Command(){};
|
2022-04-14 15:03:19 +02:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void execute();
|
2019-04-06 17:16:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // COMMAND_H
|