From: Milian Wolff Date: Tue, 23 Feb 2016 22:21:09 +0000 (+0100) Subject: Display shorter basename for files in tables by default. X-Git-Tag: submit/tizen/20180620.112952^2~224 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03332f004c2ff2c311aa8c4f23c4bc85d95e1f69;p=sdk%2Ftools%2Fheaptrack.git Display shorter basename for files in tables by default. --- diff --git a/gui/treemodel.cpp b/gui/treemodel.cpp index 24fcede..46b868b 100644 --- a/gui/treemodel.cpp +++ b/gui/treemodel.cpp @@ -48,6 +48,12 @@ const RowData* toParentRow(const QModelIndex& index) return static_cast(index.internalPointer()); } +QString basename(const QString& path) +{ + int idx = path.lastIndexOf(QLatin1Char('/')); + return path.mid(idx + 1); +} + } TreeModel::TreeModel(QObject* parent) @@ -172,12 +178,13 @@ QVariant TreeModel::data(const QModelIndex& index, int role) const return row->location->line; case LocationColumn: if (row->location->file.isEmpty()) { - return i18n("%1 in ?? (%2)", row->location->function, - row->location->module); + return i18n("%1 in ?? (%2)", + basename(row->location->function), + basename(row->location->module)); } else { return i18n("%1 in %2:%3 (%4)", row->location->function, - row->location->file, row->location->line, - row->location->module); + basename(row->location->file), row->location->line, + basename(row->location->module)); } case NUM_COLUMNS: break;