Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tooltips for each of the models. #41

Merged
merged 1 commit into from
Apr 10, 2017

Conversation

nwrogers
Copy link
Contributor

Tooltips include one for each column header and one for each row of
data.

Fixes: #29

case Binary:
return tr("The name of the executable the symbol resides in. May be empty when debug information is missing.");
case SelfCost:
return tr("The number of CPU cycles directly used by this symbol while inside the function.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number of samples directly attributed to this symbol.

case SelfCost:
return tr("The number of CPU cycles directly used by this symbol while inside the function.");
case InclusiveCost:
return tr("The number of CPU cycles used by this symbol both directly and indirectly. The inclusive cost includes the costs of all functions called by this symbol plus it's self cost.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number of samples attributed to this symbol, both directly and indirectly. This includes the costs of all functions called by this symbol plus its self cost.

case InclusiveCost:
return tr("The number of CPU cycles used by this symbol both directly and indirectly. The inclusive cost includes the costs of all functions called by this symbol plus it's self cost.");
case Callers:
return tr("Callers Tooltip");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the "Tooltip" here and below

@@ -107,10 +124,13 @@ QVariant CallerCalleeModel::cell(Columns column, int role, const Data::Symbol& s
return QVariant::fromValue(entry.callers);
} else if (role == SourceMapRole) {
return QVariant::fromValue(entry.sourceMap);
} else if (role == Qt::ToolTipRole) {
QString toolTip = formatSymbolBinaryString(symbol.symbol, symbol.binary) + QLatin1String("\n") +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use a template enclosed in tr here, i.e. something like:

tr("%1\ninclusive cost: %2\nself cost: %3").arg(...).arg(...);

case Binary:
return QObject::tr("The name of the executable the symbol resides in. May be empty when debug information is missing.");
case Cost:
return QObject::tr("The number of CPU cycles used by this symbol.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...of samples...

@@ -41,6 +41,25 @@ BottomUpModel::BottomUpModel(QObject* parent)

BottomUpModel::~BottomUpModel() = default;

namespace {
QString formatSymbolBinaryString(const QString& symbol, const QString& binary)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above, don't duplicate this, share it in a header

case Binary:
return tr("The name of the executable the symbol resides in. May be empty when debug information is missing.");
case Cost:
return tr("The number of CPU cycles used by this symbol.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

samples

@@ -69,6 +102,13 @@ QVariant BottomUpModel::displayData(const Data::BottomUp* row, Columns column)
return {};
}

QVariant BottomUpModel::displayToolTip(const Data::BottomUp* row, quint64 sampleCount)
{
QString toolTip = formatSymbolBinaryString(row->symbol.symbol, row->symbol.binary) + QLatin1String("\n") +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tr() template

case Binary:
return tr("The name of the executable the symbol resides in. May be empty when debug information is missing.");
case InclusiveCost:
return tr("The number of CPU cycles used by this symbol both directly and indirectly. The inclusive cost includes the costs of all functions called by this symbol plus it's self cost.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

samples

case InclusiveCost:
return tr("The number of CPU cycles used by this symbol both directly and indirectly. The inclusive cost includes the costs of all functions called by this symbol plus it's self cost.");
case SelfCost:
return tr("The number of CPU cycles directly used by this symbol while inside the function.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

samples

@nwrogers nwrogers force-pushed the TooltipsForModels branch 2 times, most recently from 6cdaea7 to ed0cea5 Compare April 3, 2017 15:07
Copy link
Member

@milianw milianw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some little nitpicks, otherwise lgtm

case Binary:
return QObject::tr("The name of the executable the symbol resides in. May be empty when debug information is missing.");
case Cost:
return QObject::tr("The number of CPU samples used by this symbol.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the same string as above/below, i.e. no CPU, and "attributed to"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also mention that this is inclusive cost here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this sound good: "The number of samples attributed to this symbol, both directly and indirectly. This is the symbols inclusive cost."?

case Binary:
return tr("The name of the executable the symbol resides in. May be empty when debug information is missing.");
case Cost:
return tr("The number of CPU samples used by this symbol.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito, no CPU, use "attributed to"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also mention that this is inclusive cost

case Location:
return QObject::tr("The source file name and line number where the cost was measured. May be empty when debug information is missing.");
case Cost:
return QObject::tr("The number of samples attributed to this code location.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this "...directly attributed to"

@milianw
Copy link
Member

milianw commented Apr 10, 2017

ping?

} else if (role == Qt::ToolTipRole) {
switch (column) {
case Symbol:
return tr("The symbol's function name. May be empty when debug information is missing.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are the native speaker, but isn't it "The symbols function name", i.e. without the apostroph?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The symbol's function name." is correct. The apostrophe is used to show possession. i.e. "This is the function name of the symbol." is equal to "The symbol's function name."

{
switch (column) {
case Symbol:
return tr("The symbol's function name. May be empty when debug information is missing.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here again: apostrophe or not?

{
switch (column) {
case Symbol:
return tr("The symbol's function name. May be empty when debug information is missing.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apostrophe or not?

case Binary:
return tr("The name of the executable the symbol resides in. May be empty when debug information is missing.");
case Cost:
return tr("The symbols inclusive cost, i.e. the number of samples attributed to this symbol, both directly and indirectly.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note how there's no apostrophe here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "The symbol's inclusive cost"

Tooltips include one for each column header and one for each row of
data.

Fixes: KDAB#29
Copy link
Member

@milianw milianw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@milianw milianw merged commit 89d6d1f into KDAB:master Apr 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants