forked from qt-creator/qt-creator
MiniTargetSelector: If the project's displayname is non unique show path
Task-number: QTCREATORBUG-8329 Change-Id: Ia256c09a634ff4794b67007e5013680a8a740201 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <utils/stylehelper.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/tooltip/tooltip.h>
|
||||
#include <utils/tooltip/tipcontents.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/imode.h>
|
||||
@@ -87,6 +89,12 @@ bool FancyToolButton::event(QEvent *e)
|
||||
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
}
|
||||
break;
|
||||
case QEvent::ToolTip:
|
||||
{
|
||||
QHelpEvent *he = static_cast<QHelpEvent *>(e);
|
||||
Utils::ToolTip::instance()->show(mapToGlobal(he->pos()), Utils::TextContent(toolTip()), this);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return QToolButton::event(e);
|
||||
}
|
||||
|
||||
@@ -1371,6 +1371,7 @@ void MiniProjectTargetSelector::mousePressEvent(QMouseEvent *e)
|
||||
void MiniProjectTargetSelector::updateActionAndSummary()
|
||||
{
|
||||
QString projectName;
|
||||
QString fileName; // contains the path if projectName is not unique
|
||||
QString targetName;
|
||||
QString targetToolTipText;
|
||||
QString buildConfig;
|
||||
@@ -1381,6 +1382,12 @@ void MiniProjectTargetSelector::updateActionAndSummary()
|
||||
Project *project = ProjectExplorerPlugin::instance()->startupProject();
|
||||
if (project) {
|
||||
projectName = project->displayName();
|
||||
foreach (Project *p, ProjectExplorerPlugin::instance()->session()->projects()) {
|
||||
if (p != project && p->displayName() == projectName) {
|
||||
fileName = project->document()->fileName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Target *target = project->activeTarget()) {
|
||||
targetName = project->activeTarget()->displayName();
|
||||
@@ -1406,6 +1413,8 @@ void MiniProjectTargetSelector::updateActionAndSummary()
|
||||
m_projectAction->setIcon(targetIcon);
|
||||
QStringList lines;
|
||||
lines << tr("<b>Project:</b> %1").arg(projectName);
|
||||
if (!fileName.isEmpty())
|
||||
lines << tr("<b>Path:</b> %1").arg(fileName);
|
||||
if (!targetName.isEmpty())
|
||||
lines << tr("<b>Kit:</b> %1").arg(targetName);
|
||||
if (!buildConfig.isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user