Changeset View
Changeset View
Standalone View
Standalone View
src/core/printthread.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 46 | QList<QCommandLineOption> options = { | |||
---|---|---|---|---|---|
50 | {QCommandLineOption(QStringLiteral("print speed"))}, | 50 | {QCommandLineOption(QStringLiteral("print speed"))}, | ||
51 | {QCommandLineOption(QStringLiteral("fan speed"))}, | 51 | {QCommandLineOption(QStringLiteral("fan speed"))}, | ||
52 | {QCommandLineOption(QStringLiteral("flow rate"))}, | 52 | {QCommandLineOption(QStringLiteral("flow rate"))}, | ||
53 | {QCommandLineOption(QStringLiteral("message"))}, | 53 | {QCommandLineOption(QStringLiteral("message"))}, | ||
54 | {QCommandLineOption(QStringLiteral("command"))} | 54 | {QCommandLineOption(QStringLiteral("command"))} | ||
55 | }; //!<@param options: injectable commands. | 55 | }; //!<@param options: injectable commands. | ||
56 | }; | 56 | }; | ||
57 | 57 | | |||
58 | PrintThread::PrintThread(AtCore *parent, QString fileName) : d(new PrintThreadPrivate) | 58 | PrintThread::PrintThread(AtCore *parent, const QString &fileName) : d(new PrintThreadPrivate) | ||
59 | { | 59 | { | ||
60 | d->core = parent; | 60 | d->core = parent; | ||
61 | d->state = d->core->state(); | 61 | d->state = d->core->state(); | ||
62 | d->file = new QFile(fileName); | 62 | d->file = new QFile(fileName); | ||
63 | d->file->open(QFile::ReadOnly); | 63 | d->file->open(QFile::ReadOnly); | ||
64 | d->totalSize = d->file->bytesAvailable(); | 64 | d->totalSize = d->file->bytesAvailable(); | ||
65 | d->stillSize = d->totalSize; | 65 | d->stillSize = d->totalSize; | ||
66 | d->gcodestream = new QTextStream(d->file); | 66 | d->gcodestream = new QTextStream(d->file); | ||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 169 | ( | |||
171 | newState == AtCore::STATES::STOP | 171 | newState == AtCore::STATES::STOP | ||
172 | ) | 172 | ) | ||
173 | ) { | 173 | ) { | ||
174 | qCDebug(PRINT_THREAD) << "Serial not connected !"; | 174 | qCDebug(PRINT_THREAD) << "Serial not connected !"; | ||
175 | return; | 175 | return; | ||
176 | } | 176 | } | ||
177 | if (newState != d->state) { | 177 | if (newState != d->state) { | ||
178 | qCDebug(PRINT_THREAD) << QStringLiteral("State changed from [%1] to [%2]") | 178 | qCDebug(PRINT_THREAD) << QStringLiteral("State changed from [%1] to [%2]") | ||
179 | .arg(QVariant::fromValue(d->state).value<QString>(), | 179 | .arg(QVariant::fromValue(d->state).toString(), | ||
180 | QVariant::fromValue(newState).value<QString>()); | 180 | QVariant::fromValue(newState).toString()); | ||
181 | disconnect(d->core, &AtCore::stateChanged, this, &PrintThread::setState); | 181 | disconnect(d->core, &AtCore::stateChanged, this, &PrintThread::setState); | ||
182 | d->state = newState; | 182 | d->state = newState; | ||
183 | emit stateChanged(d->state); | 183 | emit stateChanged(d->state); | ||
184 | connect(d->core, &AtCore::stateChanged, this, &PrintThread::setState, Qt::QueuedConnection); | 184 | connect(d->core, &AtCore::stateChanged, this, &PrintThread::setState, Qt::QueuedConnection); | ||
185 | } | 185 | } | ||
186 | } | 186 | } | ||
187 | 187 | | |||
188 | void PrintThread::injectCommand(QString &command) | 188 | void PrintThread::injectCommand(QString &command) | ||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |