goldendict-ng/ankiconnector.h
Ren Tatsumoto 01c661b575
Allow adding "ankisearch:" links in external programs. (#412)
* Add ankisearch link

* auto indent

* use raw string

* refuse to run if ankiconnect is not enabled

---------

Co-authored-by: GenjiFujimoto <dratschuk.d@gmail.com>
2023-03-22 10:04:54 +08:00

31 lines
675 B
C++

#ifndef ANKICONNECTOR_H
#define ANKICONNECTOR_H
#include "config.hh"
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QObject>
class AnkiConnector : public QObject
{
Q_OBJECT
public:
explicit AnkiConnector( QObject * parent, Config::Class const & cfg );
void sendToAnki( QString const & word, QString const & text, QString const & sentence );
void ankiSearch( QString const & word);
private:
QNetworkAccessManager * mgr;
Config::Class const & cfg;
void postToAnki( QString const & postData );
public :
signals:
void errorText( QString const & );
private slots:
void finishedSlot(QNetworkReply * reply);
};
#endif // ANKICONNECTOR_H