ProjectExplorer: Move ProcessHandle to Utils for further re-use

Also, use qint64 instead of quint64, as this is what Qt uses.

Keep 0 for invalid PIDs, even if arguably -1 would be better,
but Qt uses 0, too.

Don't move 'toString', instead inline it into the only
caller, keeping translations intact.

Task-number: QTCREATORBUG-17596
Change-Id: Ie9411ea1d2031a5ab0a99bcb3ff48ee430afe254
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2017-01-16 15:53:53 +01:00
parent 135000fc9b
commit 3e8a1ea7ad
9 changed files with 144 additions and 65 deletions

View File

@@ -629,7 +629,10 @@ void AppOutputPane::enableButtons(const RunControl *rc, bool isRunning)
m_stopAction->setEnabled(isRunning);
if (isRunning && debuggerPlugin() && rc->applicationProcessHandle().isValid()) {
m_attachButton->setEnabled(true);
m_attachButton->setToolTip(msgAttachDebuggerTooltip(rc->applicationProcessHandle().toString()));
Utils::ProcessHandle h = rc->applicationProcessHandle();
QString tip = h.isValid() ? RunControl::tr("PID %1").arg(h.pid())
: RunControl::tr("Invalid");
m_attachButton->setToolTip(msgAttachDebuggerTooltip(tip));
} else {
m_attachButton->setEnabled(false);
m_attachButton->setToolTip(msgAttachDebuggerTooltip());