1#ifndef MACHINETRANSLATOR_H
5#define MACHINETRANSLATOR_H
17class QNetworkAccessManager;
28 void stop()
noexcept { m_stopped =
true; }
29 void start()
noexcept;
30 void setUrl(
const QString &url);
40 std::atomic_bool m_stopped =
false;
41 std::atomic_int m_session = 0;
42 std::unique_ptr<QNetworkRequest> m_request;
43 std::unique_ptr<QNetworkAccessManager> m_manager;
44 std::unique_ptr<TranslationProtocol> m_translator;
45 QQueue<Batch> m_pendingBatches;
46 int m_inFlightCount = 0;
49 void translateBatch(
Batch b);
50 void translationReceived(QNetworkReply *reply,
Batch b,
int session);
51 void processNextBatches();
55 static constexpr int s_maxTries = 6;
56 static constexpr int s_maxConcurrentBatches = 6;
DataModelIterator(TranslationType type, const DataModel *model=0, int groupNo=0, int messageNo=0)
MessageItem * current() const
GroupItem * groupItem(int index, TranslationType type) const
~MachineTranslationDialog()
void setDataModel(MultiDataModel *dm)
void translationFailed(QList< const TranslatorMessage * >)
void setUrl(const QString &url)
void translate(const Messages &messages, const QString &userContext=QString())
void activateTranslationModel(const QString &modelName)
void modelsReceived(QStringList models)
const TranslatorMessage & message() const
Combined button and popup list for selecting options.