1#ifndef MACHINETRANSLATOR_H
5#define MACHINETRANSLATOR_H
9#include <QtCore/qmutex.h>
10#include <QtCore/qobject.h>
11#include <QtCore/qqueue.h>
12#include <QtCore/qstring.h>
17class QNetworkAccessManager;
32 void stop()
noexcept { m_stopped =
true; }
33 void start()
noexcept;
34 void setUrl(
const QString &url);
43 void debugLog(
const QByteArray &message,
bool fromLlm);
46 std::atomic_bool m_stopped =
false;
47 std::atomic_int m_session = 0;
48 std::unique_ptr<QNetworkRequest> m_request;
49 std::unique_ptr<QNetworkAccessManager> m_manager;
50 std::unique_ptr<TranslationProtocol> m_translator;
51 QQueue<Batch> m_pendingBatches;
52 int m_inFlightCount = 0;
55 void translateBatch(
Batch b);
56 void translationReceived(QNetworkReply *reply,
Batch b,
int session);
57 void processNextBatches();
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 debugLog(const QByteArray &message, bool fromLlm)
void translate(const Messages &messages, const QString &userContext=QString())
void activateTranslationModel(const QString &modelName)
void setApiType(TranslationApiType type)
void setApiKey(const QString &apiKey)
void modelsReceived(QStringList models)
const TranslatorMessage & message() const
static void setMaxJsonFormatTries(int value)
static void setMaxBatchSize(int value)
static void setTemperature(double value)
static void setMaxConcurrentBatches(int value)
static void setTransferTimeoutMs(int value)
static void setMaxRetries(int value)
static void setOllamaWakeUpTimeoutMs(int value)
static void resetToDefaults()
Combined button and popup list for selecting options.