Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

@@ -27,6 +27,8 @@ public:
void retranslate() override final;
private:
NGL::INGLLogger &m_logger;
void fillJournal();
private slots:
@@ -17,7 +17,7 @@ ScreenRecorder::ScreenRecorder(QObject *parent)
: QObject(parent)
, m_logger(getLogger(QStringLiteral("ScreenRecorder")))
{
connect(this, &ScreenRecorder::newTime, this, [this](qint64 _t1){ DEBUG_LOG() << "newTime: " << _t1; });
connect(this, &ScreenRecorder::newTime, this, [this](qint64 _t1){ DEBUG_LOG(m_logger) << "newTime: " << _t1; });
}
@@ -34,7 +34,7 @@ void ScreenRecorder::cut()
}
catch (const QString &msg)
{
ERROR_LOG() << "Cutting recording of topic '" << tr->topicName() << "', id: " << tr->topicId() << " failed! " << msg;
ERROR_LOG(m_logger) << "Cutting recording of topic '" << tr->topicName() << "', id: " << tr->topicId() << " failed! " << msg;
m_failedExportTopicIds += tr->topicId();
}
}
@@ -54,7 +54,7 @@ void ScreenRecorder::save(const QString &tmpDirPath)
}
catch (const QString &msg)
{
ERROR_LOG() << "Saving recording of topic '" << tr->topicName() << "', id: " << tr->topicId() << " failed! " << msg;
ERROR_LOG(m_logger) << "Saving recording of topic '" << tr->topicName() << "', id: " << tr->topicId() << " failed! " << msg;
m_failedExportTopicIds += tr->topicId();
}
}
@@ -81,14 +81,14 @@ void ScreenRecorder::addTopicsForScreen(Screen *screen, const std::vector<TopicI
connect(topicRecorder, &TopicRecorder::exportFailed, this, [this, id]() { emit topicExportFailed(id); });
connect(topicRecorder, &TopicRecorder::exportFailed, this, [this, name, id]()
{
ERROR_LOG() << "Export failed for topic '" << name << "', id: " << id;
ERROR_LOG(m_logger) << "Export failed for topic '" << name << "', id: " << id;
m_failedExportTopicIds += id;
});
m_topicRecorder.append(topicRecorder);
}
DEBUG_LOG() << "Added " << topicItems.size() << " TopicRecorder.";
DEBUG_LOG(m_logger) << "Added " << topicItems.size() << " TopicRecorder.";
}
@@ -117,7 +117,7 @@ void ScreenRecorder::setCurrentTime(qint64 currentTime)
void ScreenRecorder::clear()
{
DEBUG_LOG() << "Clearing TopicRecorder.";
DEBUG_LOG(m_logger) << "Clearing TopicRecorder.";
for (TopicRecorder *currentTopicRecorder : std::as_const(m_topicRecorder))
{
@@ -130,12 +130,12 @@ void ScreenRecorder::clear()
void ScreenRecorder::waitForFinishedRecording()
{
DEBUG_LOG() << "Waiting for TopicRecorder to finish ...";
DEBUG_LOG(m_logger) << "Waiting for TopicRecorder to finish ...";
for (TopicRecorder *currentTopicRecorder : std::as_const(m_topicRecorder))
currentTopicRecorder->waitForFinishedRecording();
DEBUG_LOG() << "... all TopicRecorder finished.";
DEBUG_LOG(m_logger) << "... all TopicRecorder finished.";
}
}
@@ -49,6 +49,8 @@ signals:
void cancel();
private:
NGL::INGLLogger &m_logger;
QVector<TopicRecorder *> m_topicRecorder;
QSet<int> m_failedExportTopicIds;
};
@@ -33,7 +33,7 @@ void ScreenShotter::addTopicsForScreen(Screen *screen, const std::vector<TopicIt
const double topicY = currentTopicItem.topicData().y;
const double topicW = currentTopicItem.topicData().w;
const double topicH = currentTopicItem.topicData().h;
ERROR_LOG() << "ScreenShotter::addTopicsForScreen: x: " << topicX << ", y: " << topicY << ", w: " << topicW << ", h: " << topicH;
ERROR_LOG(m_logger) << "ScreenShotter::addTopicsForScreen: x: " << topicX << ", y: " << topicY << ", w: " << topicW << ", h: " << topicH;
TopicShotter *topicShotter = new TopicShotter(id, name, screen, 0, startTime, stopTime, topicX, topicY,
topicW, topicH, (!currentTopicItem.parentChannel().isEmpty()),
currentTopicItem.description(), this);
@@ -42,14 +42,14 @@ void ScreenShotter::addTopicsForScreen(Screen *screen, const std::vector<TopicIt
connect(topicShotter, &TopicShotter::exportFailed, this, [this, id]() { emit topicExportFailed(id); });
connect(topicShotter, &TopicShotter::exportFailed, this, [this, name, id]()
{
ERROR_LOG() << "Export failed for topic '" << name << "', id: " << id;
ERROR_LOG(m_logger) << "Export failed for topic '" << name << "', id: " << id;
m_failedExportTopicIds += id;
});
m_topicShotter.append(topicShotter);
}
DEBUG_LOG() << "Added " << topicItems.size() << " TopicShotter.";
DEBUG_LOG(m_logger) << "Added " << topicItems.size() << " TopicShotter.";
}
void ScreenShotter::saveRecordings(const QString &tmpDirPath)
@@ -65,7 +65,7 @@ void ScreenShotter::saveRecordings(const QString &tmpDirPath)
}
catch (const QString &msg)
{
ERROR_LOG() << "Saving screenshot of topic '" << tr->topicName() << "', id: " << tr->topicId() << " failed! " << msg;
ERROR_LOG(m_logger) << "Saving screenshot of topic '" << tr->topicName() << "', id: " << tr->topicId() << " failed! " << msg;
m_failedExportTopicIds += tr->topicId();
}
}
@@ -36,6 +36,8 @@ signals:
void topicExportFailed(const int failedTopicId);
private:
NGL::INGLLogger &m_logger;
QVector<TopicShotter *> m_topicShotter;
QSet<int> m_failedExportTopicIds;
};
@@ -218,7 +218,7 @@ private:
if (!m_exerciseSession->interfaceFromGui<TopicEditorInterface>(topicEditorIfc))
{
ERROR_LOG() << "getTopicEditorIfc failed: Cannot add topic type "
ERROR_LOG(m_logger) << "getTopicEditorIfc failed: Cannot add topic type "
<< TopicEditorBase::topicTypeString(topicType)
<< " because topic editor ifc is missing.";
return nullptr;
@@ -234,7 +234,7 @@ private:
if (!m_replaySession->interfaceFromGui<TopicReplayInterface>(topicReplayFactory))
{
ERROR_LOG() << "getTopicIfcFactory failed: Cannot add topic type "
ERROR_LOG(m_logger) << "getTopicIfcFactory failed: Cannot add topic type "
<< TopicEditorBase::topicTypeString(topicType)
<< " because topic ifc factory is missing.";
return nullptr;
@@ -164,8 +164,8 @@ int ScriptModel::addItem(const QString &trackName, TopicItem &&_topicItem, qint6
return lambda(m_screen2TrackId, std::move(_topicItem));
}
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed for item with trackName = " << trackName << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed for item with trackName = " << trackName << " failed"; }
return -1;
}
@@ -216,8 +216,8 @@ std::vector<TopicItem> ScriptModel::topicItems() const
for (const ItemPtr &_itemPtr: _trackPtr->items())
ret.push_back(static_cast<const TopicItem &>(*_itemPtr.get()).copy());
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed"; }
return ret;
}
@@ -243,11 +243,11 @@ std::vector<TopicItem> ScriptModel::topicItemsByTrackId(int trackId) const
}
catch (const QString &errMsg)
{
ERROR_LOG() << Q_FUNC_INFO << " " << errMsg;
ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg;
}
catch (...)
{
ERROR_LOG() << Q_FUNC_INFO << " failed";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed";
}
return ret;
@@ -279,8 +279,8 @@ QVector<int> ScriptModel::mainTopicItemIds() const
for (const ItemPtr &_itemPtr: _screen2Track.items())
ret.append(_itemPtr->id());
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed"; }
return ret;
}
@@ -344,8 +344,8 @@ QVector<int> ScriptModel::filterTopicItemIds() const
for (const ItemPtr &_itemPtr: _trackPtr->items())
ret.append(_itemPtr->id());
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed"; }
return ret;
}
@@ -363,8 +363,8 @@ QVector<int> ScriptModel::filterTopicItemIds(int _topicItemId) const
if (_trackPtr->isItemsBetween(_topicItem.startTime(), end, {}))
ret += _trackPtr->itemIdsBetween(_topicItem.startTime(), end, false, true);
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed"; }
return ret;
}
@@ -402,8 +402,8 @@ qint64 ScriptModel::firstTopicStart() const
firstStart = std::min(firstStart, time);
}
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed"; }
return firstStart == LLONG_MAX ? -1 : firstStart;
}
@@ -428,8 +428,8 @@ qint64 ScriptModel::lastTopicEnd() const
if (time != -1)
lastEnd = std::max(lastEnd, time);
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed"; }
return lastEnd;
}
@@ -460,7 +460,7 @@ bool ScriptModel::isMainTrack(int _trackId) const
{
return track(_trackId).parentId() == m_rootTrack.id();
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " " << errMsg; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg; }
catch (...) {}
return false;
}
@@ -476,7 +476,7 @@ bool ScriptModel::isFilterTrack(int _trackId) const
{
return track(_trackId).parentId() != m_rootTrack.id();
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " " << errMsg; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg; }
catch (...) {}
return false;
}
@@ -676,12 +676,12 @@ bool ScriptModel::import(const QVector<PresentationContent> &contents) noexcept(
}
catch (const QString &errMsg)
{
ERROR_LOG() << Q_FUNC_INFO << " failed: " << errMsg;
ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed: " << errMsg;
return false;
}
catch (...)
{
ERROR_LOG() << Q_FUNC_INFO << " failed";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed";
return false;
}
}
@@ -706,12 +706,12 @@ bool ScriptModel::import(const QVector<PresentationContent> &contents) noexcept(
}
catch (const QString &errMsg)
{
ERROR_LOG() << Q_FUNC_INFO << " failed: " << errMsg;
ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed: " << errMsg;
return false;
}
catch (...)
{
ERROR_LOG() << Q_FUNC_INFO << " failed";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed";
return false;
}
@@ -763,8 +763,8 @@ void ScriptModel::insertTopicItem(int _trackId, TopicItem &&__topicItem)
if (isFilterTrack(_topicTrack.id()))
_topicItem.setParentChannel(static_cast<const TopicTrack &>(track(_topicTrack.parentId())).internalName());
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed"; }
}
@@ -926,8 +926,8 @@ bool ScriptModel::canDropItem(const Item &_item, int _trackId, qint64 start) con
return !isTopicItemBlocked(_topicItem, static_cast<const TopicTrack &>(track(_trackId)), start, _topicItem.duration());
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed: " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed"; }
return false;
}
@@ -980,8 +980,8 @@ bool ScriptModel::canMoveItem(const Item &_item, qint64 start) const
static_cast<const TopicItem &>(_item), static_cast<const TopicTrack &>(track(_item.parentTrackId())), start, _item.duration()
);
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed for item with id = " << _item.id(); }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed for item with id = " << _item.id(); }
return false;
}
@@ -1050,8 +1050,8 @@ bool ScriptModel::canResizeItem(const Item &_item, qint64 start, int duration) c
static_cast<const TopicItem &>(_item), static_cast<const TopicTrack &>(track(_item.parentTrackId())), start, duration
);
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed for item with id = " << _item.id(); }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed for item with id = " << _item.id(); }
return false;
}
@@ -1068,7 +1068,7 @@ void ScriptModel::copyToClipboard(const QVector<int> &_itemIds) noexcept(false)
_topicItemPtr->m_parentTrackId = _topicItem.m_parentTrackId;
minTime = std::min(minTime, _topicItem.startTime());
m_clipboard.push_back(std::move(_topicItemPtr));
DEBUG_LOG() << Q_FUNC_INFO << " copied item with id = " << _topicItem.id() << " to clipboard";
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " copied item with id = " << _topicItem.id() << " to clipboard";
};
for (int _topicItemId : _itemIds)
@@ -1181,8 +1181,8 @@ void ScriptModel::pasteFromClipboard(qint64 time) noexcept(false)
_topicItem.setTopicId(_itemId);
_topicItem.topicData().startTime = _topicItem.startTime() / 1000LL;
}
catch (const QString &errMsg) { ERROR_LOG() << "adding item failed: " << errMsg; }
catch (...) { ERROR_LOG() << "adding item failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << "adding item failed: " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << "adding item failed"; }
}
m_clipboard.clear();
@@ -1214,12 +1214,12 @@ ScriptModel::PasteTestResult ScriptModel::canPasteFromClipboard(qint64 time) con
}
catch (const QString &errMsg)
{
ERROR_LOG() << "checking for collision failed: " << errMsg;
ERROR_LOG(m_logger) << "checking for collision failed: " << errMsg;
return PasteTestResult::No;
}
catch (...)
{
ERROR_LOG() << "checking for collision failed";
ERROR_LOG(m_logger) << "checking for collision failed";
return PasteTestResult::No;
}
}
@@ -1386,7 +1386,7 @@ bool ScriptModel::canDropTopicType(TopicType _topicType, int _trackId) const
}
return true;
}
catch (const QString &errMsg) { ERROR_LOG() << errMsg; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << errMsg; }
catch (...) {}
return false;
}
@@ -1469,8 +1469,8 @@ bool ScriptModel::isTopicItemBlocked(const TopicItem &_topicItem, const TopicTra
return false;
}
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed for itemId = " << _topicItem.id() << " and trackId = " << _topicTrack.id(); }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed for itemId = " << _topicItem.id() << " and trackId = " << _topicTrack.id(); }
return false;
}
@@ -1500,8 +1500,8 @@ void ScriptModel::getActualFilterTopicRange(int parentTrackId, TopicItem &_topic
if (_topicItem.startTime() + _topicItem.duration() > _mainTopicAtItemEnd.startTime() + _mainTopicAtItemEnd.duration())
_topicItem.setDuration(_mainTopicAtItemEnd.startTime() + _mainTopicAtItemEnd.duration() - _topicItem.startTime());
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed for parentTrackId = " << parentTrackId; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed for parentTrackId = " << parentTrackId; }
}
@@ -1524,8 +1524,8 @@ void ScriptModel::onInsertTrack(const QModelIndex &idx)
emit dataChanged(idx, idx);
m_dialog->timeline()->view()->expand(idx);
}
catch (const QString &errMsg) { ERROR_LOG() << errMsg; }
catch (...) { ERROR_LOG() << "Adding child track to track with id = " << idx.internalId() << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << errMsg; }
catch (...) { ERROR_LOG(m_logger) << "Adding child track to track with id = " << idx.internalId() << " failed"; }
}
void ScriptModel::onRemoveTrack(const QModelIndex &idx)
@@ -1554,8 +1554,8 @@ void ScriptModel::onRemoveTrack(const QModelIndex &idx)
}
emit dataChanged(parentIndex, parentIndex);
}
catch (const QString &errMsg) { ERROR_LOG() << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG() << Q_FUNC_INFO << " failed"; }
catch (const QString &errMsg) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " " << errMsg; }
catch (...) { ERROR_LOG(m_logger) << Q_FUNC_INFO << " failed"; }
}
}
@@ -117,6 +117,8 @@ public:
bool canDropTopicType(TopicType _topicType, int _trackId) const;
private:
NGL::INGLLogger &m_logger;
bool isTopicItemBlocked(const TopicItem &_topicItem, const TopicTrack &_topicTrack, qint64 start, int duration) const;
void getActualFilterTopicRange(int parentTrackId, TopicItem &_topicItem) const noexcept(false);
@@ -43,6 +43,7 @@ public slots:
void onPrint();
void onColumnWidthChanged();
private:
NGL::INGLLogger &m_logger;
LtsSession::LtsSession *m_session;
std::vector<TopicItem> m_topicItems;
@@ -26,15 +26,14 @@ static QString s_program(L("ffmpeg"));
TopicRecorder::TopicRecorder(const int topicId, const QString &topicName, const Screen *screen, qint32 offset,
qint64 startTime, qint64 stopTime, const double topicX, const double topicY,
const double topicW, const double topicH, QObject *parent)
: QObject(parent)
const double topicW, const double topicH, QObject *parent) : QObject(parent)
, m_recordingProcess(new QProcess(this))
, m_startTime(startTime)
, m_stopTime(stopTime)
, m_topicName(topicName)
, m_topicId(topicId)
, m_length((m_stopTime - (m_startTime - offset)) / 1000)
{
, m_length((m_stopTime - (m_startTime - offset)) / 1000),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
const auto screenGlobalPos = screen->mapToGlobal({0,0});
const auto screenGeo = screen->geometry();
@@ -53,20 +52,20 @@ TopicRecorder::TopicRecorder(const int topicId, const QString &topicName, const
const qint32 inputW = (qint32)(fullscreen ? screenW : screenW * topicW);
const qint32 inputH = (qint32)(fullscreen ? screenH : screenH * topicH);
ERROR_LOG() << "TopicRecorder: fullscreen? " << fullscreen;
ERROR_LOG() << "TopicRecorder: topic - x: " << topicX << ", y: " << topicY << ", w: " << topicW << ", h: " << topicH;
ERROR_LOG() << "TopicRecorder: screen - x: " << screenX << ", y: " << screenY << ", w: " << screenW << ", h: " << screenH;
ERROR_LOG() << "TopicRecorder: input - x: " << inputX << ", y: " << inputY << ", w: " << inputW << ", h: " << inputH;
ERROR_LOG(m_logger) << "TopicRecorder: fullscreen? " << fullscreen;
ERROR_LOG(m_logger) << "TopicRecorder: topic - x: " << topicX << ", y: " << topicY << ", w: " << topicW << ", h: " << topicH;
ERROR_LOG(m_logger) << "TopicRecorder: screen - x: " << screenX << ", y: " << screenY << ", w: " << screenW << ", h: " << screenH;
ERROR_LOG(m_logger) << "TopicRecorder: input - x: " << inputX << ", y: " << inputY << ", w: " << inputW << ", h: " << inputH;
if (!m_tmpRecordingFile.open())
throw std::runtime_error(L("Failed to open temporary recording file: %1").arg(m_tmpRecordingFile.errorString()).toStdString());
m_recordingProcess->setProgram(s_program);
m_recordingProcess->setArguments(L("-hide_banner -f x11grab -s %1x%2 -i :0.0+%3,%4 -c:v libx264 -y -map 0 -movflags +faststart -f %5 %6").arg(inputW).arg(inputH).arg(inputX).arg(inputY).arg(s_container).arg(m_tmpRecordingFile.fileName()).split(L(" ")));
ERROR_LOG() << "args: " << m_recordingProcess->arguments().join(L(" "));
connect(m_recordingProcess, &QProcess::readyReadStandardOutput, [this]() { ERROR_LOG() << "REC [ ]: " << QString::fromUtf8(m_recordingProcess->readAllStandardOutput()); });
connect(m_recordingProcess, &QProcess::readyReadStandardError, [this]() { ERROR_LOG() << "REC [!]: " << QString::fromUtf8(m_recordingProcess->readAllStandardError()); });
connect(m_recordingProcess, &QProcess::started, [this]() { ERROR_LOG() << "REC started successfully!"; });
ERROR_LOG(m_logger) << "args: " << m_recordingProcess->arguments().join(L(" "));
connect(m_recordingProcess, &QProcess::readyReadStandardOutput, [this]() { ERROR_LOG(m_logger) << "REC [ ]: " << QString::fromUtf8(m_recordingProcess->readAllStandardOutput()); });
connect(m_recordingProcess, &QProcess::readyReadStandardError, [this]() { ERROR_LOG(m_logger) << "REC [!]: " << QString::fromUtf8(m_recordingProcess->readAllStandardError()); });
connect(m_recordingProcess, &QProcess::started, [this]() { ERROR_LOG(m_logger) << "REC started successfully!"; });
if (!m_tmpCuttingFile.open())
throw std::runtime_error(L("Failed to open temporary cutting file: %1").arg(m_tmpCuttingFile.errorString()).toStdString());
@@ -96,11 +95,11 @@ void TopicRecorder::cut()
cuttingProcess->setProgram(s_program);
cuttingProcess->setArguments(L("-hide_banner -y -sseof -%1 -i %2 -c:v libx264 -f %3 %4").arg(m_length).arg(m_tmpRecordingFile.fileName(), s_container, m_tmpCuttingFile.fileName()).split(L(" ")));
connect(cuttingProcess, &QProcess::readyReadStandardOutput, this, [this, cuttingProcess]() { ERROR_LOG() << "CUT [ ]: " << QString::fromUtf8(cuttingProcess->readAllStandardOutput()); });
connect(cuttingProcess, &QProcess::readyReadStandardError, this, [this, cuttingProcess]() { ERROR_LOG() << "CUT [!]: " << QString::fromUtf8(cuttingProcess->readAllStandardError()); });
connect(cuttingProcess, &QProcess::started, this, [this]() { ERROR_LOG() << "CUT started successfully!"; });
connect(cuttingProcess, &QProcess::readyReadStandardOutput, this, [this, cuttingProcess]() { ERROR_LOG(m_logger) << "CUT [ ]: " << QString::fromUtf8(cuttingProcess->readAllStandardOutput()); });
connect(cuttingProcess, &QProcess::readyReadStandardError, this, [this, cuttingProcess]() { ERROR_LOG(m_logger) << "CUT [!]: " << QString::fromUtf8(cuttingProcess->readAllStandardError()); });
connect(cuttingProcess, &QProcess::started, this, [this]() { ERROR_LOG(m_logger) << "CUT started successfully!"; });
ERROR_LOG() << "start cut";
ERROR_LOG(m_logger) << "start cut";
cuttingProcess->start();
@@ -119,7 +118,7 @@ void TopicRecorder::cut()
}
catch (...)
{
ERROR_LOG() << "cut failed (error) with exitCode=" << cuttingProcess->exitCode() << " and exitStatus=" << (cuttingProcess->exitStatus() == QProcess::ExitStatus::CrashExit ? "Crash" : "Normal Exit");
ERROR_LOG(m_logger) << "cut failed (error) with exitCode=" << cuttingProcess->exitCode() << " and exitStatus=" << (cuttingProcess->exitStatus() == QProcess::ExitStatus::CrashExit ? "Crash" : "Normal Exit");
m_failed = true;
cuttingProcess->deleteLater();
return;
@@ -127,14 +126,14 @@ void TopicRecorder::cut()
if (cuttingProcess->exitCode() != 0)
{
ERROR_LOG() << "cut failed with non-zero exitCode=" << cuttingProcess->exitCode() << " and exitStatus=" << (cuttingProcess->exitStatus() == QProcess::ExitStatus::CrashExit ? "Crash" : "Normal Exit");
ERROR_LOG(m_logger) << "cut failed with non-zero exitCode=" << cuttingProcess->exitCode() << " and exitStatus=" << (cuttingProcess->exitStatus() == QProcess::ExitStatus::CrashExit ? "Crash" : "Normal Exit");
m_failed = true;
cuttingProcess->deleteLater();
return;
}
ERROR_LOG() << "cut done";
ERROR_LOG(m_logger) << "cut done";
cuttingProcess->deleteLater();
}
@@ -173,7 +172,7 @@ void TopicRecorder::onExportFailed(const QProcess::ProcessError error)
void TopicRecorder::onExportFailed(const QString &errorMessage)
{
ERROR_LOG() << "Export failed for topic '" << m_topicName << "': " << errorMessage;
ERROR_LOG(m_logger) << "Export failed for topic '" << m_topicName << "': " << errorMessage;
emit exportFailed(errorMessage);
}
@@ -214,16 +213,16 @@ void TopicRecorder::waitForFinishedRecording()
}
catch (...)
{
ERROR_LOG() << "waitForFinishedRecording: catch!";
ERROR_LOG(m_logger) << "waitForFinishedRecording: catch!";
}
ERROR_LOG() << "waitForFinishedRecording: done waiting!";
ERROR_LOG(m_logger) << "waitForFinishedRecording: done waiting!";
}
void TopicRecorder::onNewTime(qint64 time)
{
ERROR_LOG() << "onNewTime: " << time << ", startTime: " << m_startTime;
ERROR_LOG(m_logger) << "onNewTime: " << time << ", startTime: " << m_startTime;
switch (m_recordingState)
{
@@ -231,9 +230,9 @@ void TopicRecorder::onNewTime(qint64 time)
if (time < m_startTime)
return;
ERROR_LOG() << "onNewTime: started at " << time << " while startTime is " << m_startTime;
ERROR_LOG(m_logger) << "onNewTime: started at " << time << " while startTime is " << m_startTime;
ERROR_LOG() << "Starting \"" << processToString(m_recordingProcess) << "\"";
ERROR_LOG(m_logger) << "Starting \"" << processToString(m_recordingProcess) << "\"";
m_recordingProcess->start();
@@ -244,7 +243,7 @@ void TopicRecorder::onNewTime(qint64 time)
if (time < m_stopTime)
return;
ERROR_LOG() << "Stopping recording for " << m_topicName;
ERROR_LOG(m_logger) << "Stopping recording for " << m_topicName;
m_recordingProcess->terminate();
@@ -261,7 +260,7 @@ void TopicRecorder::onNewTime(qint64 time)
void TopicRecorder::onRecordingProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
m_recordingState = RecordingState::Done;
ERROR_LOG() << "Recording finished for " << m_topicName << ", with exitCode=" << exitCode << " and exitStatus=" << exitStatus;
ERROR_LOG(m_logger) << "Recording finished for " << m_topicName << ", with exitCode=" << exitCode << " and exitStatus=" << exitStatus;
@@ -44,6 +44,8 @@ public Q_SLOTS:
void onNewTime(qint64 time);
private:
NGL::INGLLogger &m_logger;
enum class RecordingState
{
Waiting,
@@ -14,8 +14,7 @@ namespace PresentationManagement
TopicShotter::TopicShotter(const int topicId, const QString &topicName, const Screen *screen, qint32 offset,
qint64 startTime, qint64 stopTime, const double topicX, const double topicY,
const double topicW, const double topicH, const bool isFilterTopic, const QString &desc, QObject *parent)
: QObject(parent)
const double topicW, const double topicH, const bool isFilterTopic, const QString &desc, QObject *parent) : QObject(parent)
, m_startTime(startTime)
, m_topicName(topicName)
, m_topicId(topicId)
@@ -25,8 +24,8 @@ TopicShotter::TopicShotter(const int topicId, const QString &topicName, const Sc
, m_topicW(topicW)
, m_topicH(topicH)
, m_desc(desc)
, m_isFilterTopic(isFilterTopic)
{}
, m_isFilterTopic(isFilterTopic),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
TopicShotter::~TopicShotter()
@@ -48,7 +47,7 @@ void TopicShotter::saveRecording(const QString &saveToPath)
void TopicShotter::onExportFailed(const QString &errorMessage)
{
ERROR_LOG() << "Export failed for topic '" << m_topicName << "': " << errorMessage;
ERROR_LOG(m_logger) << "Export failed for topic '" << m_topicName << "': " << errorMessage;
emit exportFailed(errorMessage);
}
@@ -59,7 +58,7 @@ void TopicShotter::onNewTime(qint64 time)
const qint64 filterTopicDelay = (m_isFilterTopic ? 1000 : 0);
const qint64 startTime = m_startTime + filterTopicDelay + 1000 ;
DEBUG_LOG() << "onNewTime: " << time << ", startTime: " << startTime << ", isFilterTopic? " << m_isFilterTopic << ", desc: " << m_desc;
DEBUG_LOG(m_logger) << "onNewTime: " << time << ", startTime: " << startTime << ", isFilterTopic? " << m_isFilterTopic << ", desc: " << m_desc;
if (time < startTime)
return;
@@ -68,7 +67,7 @@ void TopicShotter::onNewTime(qint64 time)
return;
isStarted = true;
DEBUG_LOG() << "onNewTime: started at " << time << " while startTime is " << startTime;
DEBUG_LOG(m_logger) << "onNewTime: started at " << time << " while startTime is " << startTime;
if (!m_tmpFile.open())
{
@@ -101,7 +100,7 @@ void TopicShotter::onNewTime(qint64 time)
connect(t, &QTimer::timeout, this, [this, inputX, inputY, inputW, inputH, _screen]()
{
const WId winId = m_screen->winId();
DEBUG_LOG() << "## CHEESE! ## grabWindow: x: " << inputX << ", y: " << inputY << ", w: " << inputW << ", h: " << inputH << ", name: " << m_topicName << ", id: " << m_topicId << ", desc: " << m_desc;
DEBUG_LOG(m_logger) << "## CHEESE! ## grabWindow: x: " << inputX << ", y: " << inputY << ", w: " << inputW << ", h: " << inputH << ", name: " << m_topicName << ", id: " << m_topicId << ", desc: " << m_desc;
const QPixmap pix = _screen->grabWindow(winId, inputX, inputY, inputW, inputH);
if (!pix.save(&m_tmpFile, "PNG"))
@@ -41,6 +41,8 @@ private Q_SLOTS:
void onExportFailed(const QString &errorMessage);
private:
NGL::INGLLogger &m_logger;
const qint64 m_startTime;
const QString m_topicName;
QTemporaryFile m_tmpFile;