forked from qt-creator/qt-creator
DeviceShare: Initialize Output Pane after clearing
Change-Id: I98ca6791317763a5a148f1fd3138f573600208ab Reviewed-by: Knud Dollereder <knud.dollereder@qt.io>
This commit is contained in:
@@ -217,12 +217,12 @@ void AppOutputParentModel::setupRunControls()
|
|||||||
connect(explorerPlugin,
|
connect(explorerPlugin,
|
||||||
&ProjectExplorer::ProjectExplorerPlugin::runControlStarted,
|
&ProjectExplorer::ProjectExplorerPlugin::runControlStarted,
|
||||||
[this](ProjectExplorer::RunControl *rc) {
|
[this](ProjectExplorer::RunControl *rc) {
|
||||||
initializeRuns(rc);
|
initializeRuns(rc->commandLine().displayName());
|
||||||
connect(rc,
|
connect(rc,
|
||||||
&ProjectExplorer::RunControl::appendMessage,
|
&ProjectExplorer::RunControl::appendMessage,
|
||||||
[this, rc](const QString &out, Utils::OutputFormat format) {
|
[this, rc](const QString &out, Utils::OutputFormat format) {
|
||||||
if (m_runs.empty())
|
if (m_runs.empty())
|
||||||
initializeRuns(rc);
|
initializeRuns(rc->commandLine().displayName());
|
||||||
|
|
||||||
int row = static_cast<int>(m_runs.size()) - 1;
|
int row = static_cast<int>(m_runs.size()) - 1;
|
||||||
emit messageAdded(row, out.trimmed(), colorFromFormat(format));
|
emit messageAdded(row, out.trimmed(), colorFromFormat(format));
|
||||||
@@ -234,31 +234,26 @@ void AppOutputParentModel::setupRunControls()
|
|||||||
connect(&deviceManager,
|
connect(&deviceManager,
|
||||||
&QmlDesigner::DeviceShare::DeviceManager::projectStarted,
|
&QmlDesigner::DeviceShare::DeviceManager::projectStarted,
|
||||||
[this](const QmlDesigner::DeviceShare::DeviceInfo &deviceInfo) {
|
[this](const QmlDesigner::DeviceShare::DeviceInfo &deviceInfo) {
|
||||||
AppOutputParentModel::Run run;
|
initializeRuns("Project started on device " + deviceInfo.deviceId());
|
||||||
run.timestamp = QTime::currentTime().toString().toStdString();
|
|
||||||
run.messages.push_back(
|
|
||||||
{"Project started on device " + deviceInfo.deviceId(), m_messageColor});
|
|
||||||
|
|
||||||
beginResetModel();
|
|
||||||
m_runs.push_back(run);
|
|
||||||
endResetModel();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(&deviceManager,
|
connect(&deviceManager,
|
||||||
&QmlDesigner::DeviceShare::DeviceManager::projectLogsReceived,
|
&QmlDesigner::DeviceShare::DeviceManager::projectLogsReceived,
|
||||||
[this](const QmlDesigner::DeviceShare::DeviceInfo &, const QString &logs) {
|
[this](const QmlDesigner::DeviceShare::DeviceInfo &, const QString &logs) {
|
||||||
if (!m_runs.empty()) {
|
if (m_runs.empty())
|
||||||
|
initializeRuns();
|
||||||
|
|
||||||
int row = static_cast<int>(m_runs.size()) - 1;
|
int row = static_cast<int>(m_runs.size()) - 1;
|
||||||
emit messageAdded(row, logs.trimmed(), m_messageColor);
|
emit messageAdded(row, logs.trimmed(), m_messageColor);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppOutputParentModel::initializeRuns(ProjectExplorer::RunControl *rc)
|
void AppOutputParentModel::initializeRuns(const QString &message)
|
||||||
{
|
{
|
||||||
AppOutputParentModel::Run run;
|
AppOutputParentModel::Run run;
|
||||||
run.timestamp = QTime::currentTime().toString().toStdString();
|
run.timestamp = QTime::currentTime().toString().toStdString();
|
||||||
run.messages.push_back({rc->commandLine().displayName(), m_messageColor});
|
if (!message.isEmpty())
|
||||||
|
run.messages.push_back({message, m_messageColor});
|
||||||
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_runs.push_back(run);
|
m_runs.push_back(run);
|
||||||
|
@@ -108,7 +108,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void setupRunControls();
|
void setupRunControls();
|
||||||
void initializeRuns(ProjectExplorer::RunControl *rc);
|
void initializeRuns(const QString &message = {});
|
||||||
QColor colorFromFormat(Utils::OutputFormat format) const;
|
QColor colorFromFormat(Utils::OutputFormat format) const;
|
||||||
|
|
||||||
QColor m_historyColor = Qt::gray;
|
QColor m_historyColor = Qt::gray;
|
||||||
|
Reference in New Issue
Block a user