From 2bca3d2cfeff84318fed68dfa1edb24fc6773f70 Mon Sep 17 00:00:00 2001 From: Alexey Chernobaev Date: Wed, 28 Mar 2018 20:44:12 +0300 Subject: conditional "rebranding" from Heaptrack to Tizen Memory Profiler (controlled by SAMSUNG_TIZEN_BRANCH configuration option in pro-file) --- src/analyze/gui/aboutdata.cpp | 24 ++++++++++++++++++------ src/analyze/gui/aboutdata.h | 1 + src/analyze/gui/aboutdialog.cpp | 25 ++++++++++++++++++------- src/analyze/gui/callercalleemodel.cpp | 2 +- src/analyze/gui/gui.cpp | 10 ++++++++-- src/analyze/gui/mainwindow.cpp | 24 ++++++++++++++---------- src/analyze/gui/mainwindow_noklib.ui | 6 +++--- src/analyze/gui/treemodel.cpp | 2 +- src/heaptrack_gui.pro | 11 ++++++++--- 9 files changed, 72 insertions(+), 33 deletions(-) diff --git a/src/analyze/gui/aboutdata.cpp b/src/analyze/gui/aboutdata.cpp index cfb1bdf..c949873 100644 --- a/src/analyze/gui/aboutdata.cpp +++ b/src/analyze/gui/aboutdata.cpp @@ -10,8 +10,18 @@ const QString& AboutData::Organization = "Samsung Electronics"; const QString& AboutData::CopyrightStatement = - i18n("Copyright 2015, Milian Wolff . " \ - "Copyright 2018, Samsung Electronics."); + i18n("Copyright 2015, Milian Wolff. " \ + "Copyright 2018, Samsung Electronics"); + +const QString& AboutData::ComponentName = QStringLiteral("TizenMemoryProfiler"); + +const QString& AboutData::ShortName = QStringLiteral("Tizen Memory Profiler"); + +const QString& AboutData::DisplayName = i18n("Tizen Memory Profiler"); + +const QString& AboutData::Version = QStringLiteral("0.2"); + +const QString& AboutData::ShortDescription = i18n("A visualizer for Tizen Memory Profiler data files"); const QString& AboutData::BugAddress = "TODO"; // TODO!! #else @@ -19,13 +29,15 @@ const QString& AboutData::Organization = "Milian Wolff"; const QString& AboutData::CopyrightStatement = i18n("Copyright 2015, Milian Wolff "); -const QString& AboutData::BugAddress = QStringLiteral("mail@milianw.de"); -#endif - const QString& AboutData::ComponentName = QStringLiteral("heaptrack_gui"); +const QString& AboutData::ShortName = QStringLiteral("heaptrack"); + const QString& AboutData::DisplayName = i18n("Heaptrack GUI"); const QString& AboutData::Version = QStringLiteral("0.1"); -const QString& AboutData::ShortDescription = i18n("A visualizer for heaptrack data files."); +const QString& AboutData::ShortDescription = i18n("A visualizer for heaptrack data files"); + +const QString& AboutData::BugAddress = QStringLiteral("mail@milianw.de"); +#endif diff --git a/src/analyze/gui/aboutdata.h b/src/analyze/gui/aboutdata.h index fd68065..458a78f 100644 --- a/src/analyze/gui/aboutdata.h +++ b/src/analyze/gui/aboutdata.h @@ -8,6 +8,7 @@ class AboutData public: const static QString& Organization; const static QString& ComponentName; + const static QString& ShortName; const static QString& DisplayName; const static QString& Version; const static QString& ShortDescription; diff --git a/src/analyze/gui/aboutdialog.cpp b/src/analyze/gui/aboutdialog.cpp index 61502dd..1a4c99f 100644 --- a/src/analyze/gui/aboutdialog.cpp +++ b/src/analyze/gui/aboutdialog.cpp @@ -18,17 +18,28 @@ AboutDialog::AboutDialog(QWidget *parent) : ui->textEdit->viewport()->setAutoFillBackground(false); ui->textEdit->setHtml(QString( - "

A visualizer for heaptrack data files

" \ - "

Copyright 2015, Milian Wolff " \ - "<mail@milianw.de>

" \ + "

%1 v.%2

" \ + "

%3

") + .arg(AboutData::DisplayName).arg(AboutData::Version) + .arg(AboutData::ShortDescription) + + +#ifdef SAMSUNG_TIZEN_BRANCH + QString( + "

Based on Heaptrack memory profiler created by Milian Wolff " \ + "<mail@milianw.de>

") + +#endif + QString( + "

%4

") + .arg(AboutData::CopyrightStatement) + + QString( "

GNU LESSER GENERAL PUBLIC LICENSE v.2.1

" \ - "

Original author, maintainer: Milian Wolff

" \ - "

Copyright 2018, %1

" \ "

The application is based in part on the work of the Qwt project " \ - "(qwt.sf.net)

" \ + "(qwt.sf.net)

") +#ifdef WINDOWS + + QString( "

Application icon (free for commercial use): Jack Cai " \ "(www.doublejdesign.co.uk)

") - .arg(AboutData::Organization) +#endif ); QFontMetrics fm(ui->textEdit->font()); diff --git a/src/analyze/gui/callercalleemodel.cpp b/src/analyze/gui/callercalleemodel.cpp index ee17565..429f775 100644 --- a/src/analyze/gui/callercalleemodel.cpp +++ b/src/analyze/gui/callercalleemodel.cpp @@ -167,7 +167,7 @@ QVariant CallerCalleeModel::headerData(int section, Qt::Orientation orientation, "called. Function symbol and file " "information " "may be unknown when debug information was missing when " - "heaptrack was run."); + "the memory profiler was run."); case NUM_COLUMNS: break; } diff --git a/src/analyze/gui/gui.cpp b/src/analyze/gui/gui.cpp index 0b6781b..aebab59 100644 --- a/src/analyze/gui/gui.cpp +++ b/src/analyze/gui/gui.cpp @@ -18,6 +18,7 @@ #include #include +#include #ifdef NO_K_LIB #include "noklib.h" @@ -36,7 +37,7 @@ int main(int argc, char** argv) QApplication app(argc, argv); #ifndef NO_K_LIB - KLocalizedString::setApplicationDomain("heaptrack"); + KLocalizedString::setApplicationDomain(AboutData::ShortName); const auto LicenseType = KAboutLicense::LGPL; @@ -105,7 +106,12 @@ int main(int argc, char** argv) + (isShowPrivateClean ? 1 : 0) + (isShowShared ? 1 : 0) != 1) { - qFatal("One of --malloc, --managed, --private_dirty, --private_clean or --shared options is necessary. Please, use exactly only one of the options for each start of GUI."); + const auto msg = "One of --malloc, --managed, --private_dirty, --private_clean or --shared options is necessary. " \ + "Please, use exactly only one of the options for each start of GUI."; + + QMessageBox::critical(nullptr, AboutData::DisplayName + " Error", msg, QMessageBox::Ok); + + qFatal(msg); return 1; } else if (isShowMalloc) diff --git a/src/analyze/gui/mainwindow.cpp b/src/analyze/gui/mainwindow.cpp index 6650160..fff1bf0 100644 --- a/src/analyze/gui/mainwindow.cpp +++ b/src/analyze/gui/mainwindow.cpp @@ -386,8 +386,9 @@ MainWindow::MainWindow(QWidget* parent) Util::formatByteSize(data.CoreCLRPart.peak, 1), Util::formatByteSize(data.nonCoreCLRPart.peak, 1), Util::formatByteSize(data.unknownPart.peak, 1)) - << i18n("
peak RSS (including heaptrack " - "overhead):
%1
", + << i18n("
peak RSS (including %1 " + "overhead):
%2
", + AboutData::ShortName, Util::formatByteSize(data.peakRSS, 1)) << i18n("
total memory leaked:
%1
" "
%2 (CoreCLR), %3 (non-CoreCLR), %4 (unknown)
", @@ -408,8 +409,9 @@ MainWindow::MainWindow(QWidget* parent) Util::formatByteSize(data.nonCoreCLRPart.peak, 1), Util::formatByteSize(data.untrackedPart.peak, 1), Util::formatByteSize(data.unknownPart.peak, 1)) - << i18n("
peak RSS (including heaptrack " - "overhead):
%1
", + << i18n("
peak RSS (including %1 " + "overhead):
%2
", + AboutData::ShortName, Util::formatByteSize(data.peakRSS, 1)) << i18n("
total memory leaked:
%1
" "
%2 (CoreCLR), %3 (non-CoreCLR), %4 (sbrk heap), %5 (unknown)
", @@ -428,8 +430,9 @@ MainWindow::MainWindow(QWidget* parent) "after %2s", Util::formatByteSize(data.cost.peak, 1), peakTimeS) - << i18n("
peak RSS (including heaptrack " - "overhead):
%1
", + << i18n("
peak RSS (including %1 " + "overhead):
%2
", + AboutData::ShortName, Util::formatByteSize(data.peakRSS, 1)) << i18n("
total memory leaked:
%1
", Util::formatByteSize(data.cost.leaked, 1)) @@ -604,7 +607,7 @@ MainWindow::MainWindow(QWidget* parent) m_ui->widget_12->hide(); } - setWindowTitle(i18n("Heaptrack")); + setWindowTitle(AboutData::ShortName); // closing the current file shows the stack page to open a new one #ifdef NO_K_LIB m_openAction = new QAction(i18n("&Open..."), this); @@ -653,11 +656,12 @@ void MainWindow::loadFile(const QString& file, const QString& diffBase) m_closeAction->setEnabled(false); m_ui->loadingLabel->setText(i18n("Loading file %1, please wait...", file)); if (diffBase.isEmpty()) { - setWindowTitle(i18nc("%1: file name that is open", "Heaptrack - %1", QFileInfo(file).fileName())); + setWindowTitle(i18nc("%1: application name; %2: file name that is open", "%1 - %2", + AboutData::ShortName, QFileInfo(file).fileName())); m_diffMode = false; } else { - setWindowTitle(i18nc("%1, %2: file names that are open", "Heaptrack - %1 compared to %2", - QFileInfo(file).fileName(), QFileInfo(diffBase).fileName())); + setWindowTitle(i18nc("%1: application name; %2, %3: file names that are open", "%1 - %2 compared to %3", + AboutData::ShortName, QFileInfo(file).fileName(), QFileInfo(diffBase).fileName())); m_diffMode = true; } m_ui->pages->setCurrentWidget(m_ui->loadingPage); diff --git a/src/analyze/gui/mainwindow_noklib.ui b/src/analyze/gui/mainwindow_noklib.ui index bf66e38..c5a4c97 100644 --- a/src/analyze/gui/mainwindow_noklib.ui +++ b/src/analyze/gui/mainwindow_noklib.ui @@ -50,7 +50,7 @@ - Open Heaptrack Data + Open Memory Profiler Data @@ -68,7 +68,7 @@ - <qt><p>This field specifies the primary heaptrack data file. These files are called <tt>heaptrack.$APP.$PID.gz</tt>. You can produce such a file by profiling your application, e.g. via:</p> + <qt><p>This field specifies the primary memory profiler data file. These files are called <tt>heaptrack.$APP.$PID.gz</tt>. You can produce such a file by profiling your application, e.g. via:</p> <pre><code>heaptrack &lt;yourapplication&gt; ...</code></pre> <p>Or, alternatively, you can attach to a running process via</p> <pre><code>heaptrack --pid $(pidof &lt;yourapplication&gt;)</code></pre></qt> @@ -112,7 +112,7 @@ - <qt>You can optionally specify a second heaptrack data file to compare to. If set, this file will be used as a base and its cost gets subtracted from the primary data costs.</qt> + <qt>You can optionally specify a second memory profiler data file to compare to. If set, this file will be used as a base and its cost gets subtracted from the primary data costs.</qt> diff --git a/src/analyze/gui/treemodel.cpp b/src/analyze/gui/treemodel.cpp index cd8ac2e..3738a89 100644 --- a/src/analyze/gui/treemodel.cpp +++ b/src/analyze/gui/treemodel.cpp @@ -149,7 +149,7 @@ QVariant TreeModel::headerData(int section, Qt::Orientation orientation, int rol "called. Function symbol and file " "information " "may be unknown when debug information was missing when " - "heaptrack was run."); + "the memory profiler was run."); case NUM_COLUMNS: break; } diff --git a/src/heaptrack_gui.pro b/src/heaptrack_gui.pro index c15f064..2a65405 100644 --- a/src/heaptrack_gui.pro +++ b/src/heaptrack_gui.pro @@ -2,7 +2,7 @@ QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -TARGET = heaptrack_gui_qt +TARGET = heaptrack_gui TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS @@ -10,7 +10,12 @@ DEFINES += QT_DEPRECATED_WARNINGS INCLUDEPATH += $$PWD/analyze/gui # build heaptrack for Samsung Tizen OS -DEFINES += SAMSUNG_TIZEN_BRANCH +CONFIG += SAMSUNG_TIZEN_BRANCH + +SAMSUNG_TIZEN_BRANCH { + DEFINES += SAMSUNG_TIZEN_BRANCH + TARGET = TizenMemoryProfiler +} win32 { CONFIG += NO_K_LIB NO_K_CHART @@ -18,7 +23,7 @@ win32 { # comment the next line to not use QWT (i.e. don't show charts) CONFIG += QWT_CHART - DEFINES += NO_K_LIB NO_K_CHART + DEFINES += NO_K_LIB NO_K_CHART WINDOWS INCLUDEPATH += $$(BOOST_LIB) LIBS += -L$$(BOOST_LIB)/stage/lib -- cgit v1.2.3