From bc7dca220f8851d1a1edf405af4e290633337d08 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 1 Jul 2015 18:04:26 +0200 Subject: [PATCH] QmlProfiler: Remove QmlProfilerTreeView It doesn't really do anything useful. Change-Id: I84472d4baaf291a2daee145ef69ee39a836eff7c Reviewed-by: Joerg Bornemann --- src/plugins/qmlprofiler/qmlprofiler.pro | 2 - src/plugins/qmlprofiler/qmlprofiler.qbs | 1 - .../qmlprofiler/qmlprofilereventview.cpp | 61 +++++++++++- .../qmlprofiler/qmlprofilereventview.h | 37 ++++++-- .../qmlprofiler/qmlprofilertreeview.cpp | 94 ------------------- src/plugins/qmlprofiler/qmlprofilertreeview.h | 73 -------------- 6 files changed, 86 insertions(+), 182 deletions(-) delete mode 100644 src/plugins/qmlprofiler/qmlprofilertreeview.cpp delete mode 100644 src/plugins/qmlprofiler/qmlprofilertreeview.h diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro index b53244a7f92..51dea21a282 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.pro +++ b/src/plugins/qmlprofiler/qmlprofiler.pro @@ -28,7 +28,6 @@ SOURCES += \ qmlprofilertool.cpp \ qmlprofilertracefile.cpp \ qmlprofilertraceview.cpp \ - qmlprofilertreeview.cpp \ qmlprofilerviewmanager.cpp HEADERS += \ @@ -58,7 +57,6 @@ HEADERS += \ qmlprofilertool.h \ qmlprofilertracefile.h \ qmlprofilertraceview.h \ - qmlprofilertreeview.h \ qmlprofilerviewmanager.h RESOURCES += \ diff --git a/src/plugins/qmlprofiler/qmlprofiler.qbs b/src/plugins/qmlprofiler/qmlprofiler.qbs index 9e22e6b423a..488c1e162e0 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.qbs +++ b/src/plugins/qmlprofiler/qmlprofiler.qbs @@ -44,7 +44,6 @@ QtcPlugin { "qmlprofilertool.cpp", "qmlprofilertool.h", "qmlprofilertracefile.cpp", "qmlprofilertracefile.h", "qmlprofilertraceview.cpp", "qmlprofilertraceview.h", - "qmlprofilertreeview.cpp", "qmlprofilertreeview.h", "qmlprofilerviewmanager.cpp", "qmlprofilerviewmanager.h", ] } diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp index 5570e5d153f..5018c063278 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -128,6 +128,57 @@ public: qint64 rangeEnd; }; +static void setViewDefaults(Utils::TreeView *view) +{ + view->setFrameStyle(QFrame::NoFrame); + QHeaderView *header = view->header(); + header->setSectionResizeMode(QHeaderView::Interactive); + header->setDefaultSectionSize(100); + header->setMinimumSectionSize(50); +} + +static QString displayHeader(Fields header) +{ + static const char ctxt[] = "QmlProfiler::Internal::QmlProfilerEventsMainView"; + + switch (header) { + case Callee: + return QCoreApplication::translate(ctxt, "Callee"); + case CalleeDescription: + return QCoreApplication::translate(ctxt, "Callee Description"); + case Caller: + return QCoreApplication::translate(ctxt, "Caller"); + case CallerDescription: + return QCoreApplication::translate(ctxt, "Caller Description"); + case CallCount: + return QCoreApplication::translate(ctxt, "Calls"); + case Details: + return QCoreApplication::translate(ctxt, "Details"); + case Location: + return QCoreApplication::translate(ctxt, "Location"); + case MaxTime: + return QCoreApplication::translate(ctxt, "Longest Time"); + case TimePerCall: + return QCoreApplication::translate(ctxt, "Mean Time"); + case SelfTime: + return QCoreApplication::translate(ctxt, "Self Time"); + case SelfTimeInPercent: + return QCoreApplication::translate(ctxt, "Self Time in Percent"); + case MinTime: + return QCoreApplication::translate(ctxt, "Shortest Time"); + case TimeInPercent: + return QCoreApplication::translate(ctxt, "Time in Percent"); + case TotalTime: + return QCoreApplication::translate(ctxt, "Total Time"); + case Type: + return QCoreApplication::translate(ctxt, "Type"); + case MedianTime: + return QCoreApplication::translate(ctxt, "Median Time"); + default: + return QString(); + } +} + QmlProfilerEventsWidget::QmlProfilerEventsWidget(QWidget *parent, QmlProfilerTool *profilerTool, QmlProfilerViewManager *container, @@ -347,9 +398,10 @@ public: }; QmlProfilerEventsMainView::QmlProfilerEventsMainView(QWidget *parent, - QmlProfilerEventsModelProxy *modelProxy) -: QmlProfilerTreeView(parent), d(new QmlProfilerEventsMainViewPrivate(this)) + QmlProfilerEventsModelProxy *modelProxy) : + Utils::TreeView(parent), d(new QmlProfilerEventsMainViewPrivate(this)) { + setViewDefaults(this); setObjectName(QLatin1String("QmlProfilerEventsTable")); setSortingEnabled(false); @@ -830,9 +882,10 @@ public: }; QmlProfilerEventRelativesView::QmlProfilerEventRelativesView( - QmlProfilerEventRelativesModelProxy *modelProxy, QWidget *parent) - : QmlProfilerTreeView(parent), d(new QmlProfilerEventParentsViewPrivate(this)) + QmlProfilerEventRelativesModelProxy *modelProxy, QWidget *parent) : + Utils::TreeView(parent), d(new QmlProfilerEventParentsViewPrivate(this)) { + setViewDefaults(this); setSortingEnabled(false); d->modelProxy = modelProxy; QStandardItemModel *model = new QStandardItemModel(this); diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.h b/src/plugins/qmlprofiler/qmlprofilereventview.h index 8dfeefab5da..f1c389695ac 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.h +++ b/src/plugins/qmlprofiler/qmlprofilereventview.h @@ -31,16 +31,16 @@ #ifndef QMLPROFILEREVENTVIEW_H #define QMLPROFILEREVENTVIEW_H -#include -#include #include "qmlprofilermodelmanager.h" #include "qmlprofilereventsmodelproxy.h" -#include "qmlprofilertreeview.h" - -#include - #include "qmlprofilerviewmanager.h" +#include +#include +#include + +#include + namespace QmlProfiler { namespace Internal { @@ -56,6 +56,27 @@ enum ItemRole { ColumnRole }; +enum Fields { + Name, + Callee, + CalleeDescription, + Caller, + CallerDescription, + CallCount, + Details, + Location, + MaxTime, + TimePerCall, + SelfTime, + SelfTimeInPercent, + MinTime, + TimeInPercent, + TotalTime, + Type, + MedianTime, + MaxFields +}; + class QmlProfilerEventsWidget : public QWidget { Q_OBJECT @@ -100,7 +121,7 @@ private: QmlProfilerEventsWidgetPrivate *d; }; -class QmlProfilerEventsMainView : public QmlProfilerTreeView +class QmlProfilerEventsMainView : public Utils::TreeView { Q_OBJECT public: @@ -150,7 +171,7 @@ private: }; -class QmlProfilerEventRelativesView : public QmlProfilerTreeView +class QmlProfilerEventRelativesView : public Utils::TreeView { Q_OBJECT public: diff --git a/src/plugins/qmlprofiler/qmlprofilertreeview.cpp b/src/plugins/qmlprofiler/qmlprofilertreeview.cpp deleted file mode 100644 index f8dd1801e64..00000000000 --- a/src/plugins/qmlprofiler/qmlprofilertreeview.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qmlprofilertreeview.h" -#include -#include -#include - -namespace QmlProfiler { -namespace Internal { - -QmlProfilerTreeView::QmlProfilerTreeView(QWidget *parent) - : Utils::TreeView(parent) -{ - setFrameStyle(QFrame::NoFrame); - header()->setSectionResizeMode(QHeaderView::Interactive); - header()->setDefaultSectionSize(100); - header()->setMinimumSectionSize(50); -} - - -// Translate from "old" context to keep 2.8 string freeze -QString QmlProfilerTreeView::displayHeader(Fields header) const -{ - static const char ctxt1[] = "QmlProfiler::Internal::QmlProfilerEventsParentsAndChildrenView"; - static const char ctxt2[] = "QmlProfiler::Internal::QmlProfilerEventsMainView"; - - switch (header) { - case Callee: - return QCoreApplication::translate(ctxt1, "Callee"); - case CalleeDescription: - return QCoreApplication::translate(ctxt1, "Callee Description"); - case Caller: - return QCoreApplication::translate(ctxt1, "Caller"); - case CallerDescription: - return QCoreApplication::translate(ctxt1, "Caller Description"); - case CallCount: - return QCoreApplication::translate(ctxt2, "Calls"); - case Details: - return QCoreApplication::translate(ctxt2, "Details"); - case Location: - return QCoreApplication::translate(ctxt2, "Location"); - case MaxTime: - return QCoreApplication::translate(ctxt2, "Longest Time"); - case TimePerCall: - return QCoreApplication::translate(ctxt2, "Mean Time"); - case SelfTime: - return QCoreApplication::translate(ctxt2, "Self Time"); - case SelfTimeInPercent: - return QCoreApplication::translate(ctxt2, "Self Time in Percent"); - case MinTime: - return QCoreApplication::translate(ctxt2, "Shortest Time"); - case TimeInPercent: - return QCoreApplication::translate(ctxt2, "Time in Percent"); - case TotalTime: - return QCoreApplication::translate(ctxt2, "Total Time"); - case Type: - return QCoreApplication::translate(ctxt2, "Type"); - case MedianTime: - return QCoreApplication::translate(ctxt2, "Median Time"); - default: - return QString(); - } -} - -} // namespace Internal -} // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/qmlprofilertreeview.h b/src/plugins/qmlprofiler/qmlprofilertreeview.h deleted file mode 100644 index a8949df499e..00000000000 --- a/src/plugins/qmlprofiler/qmlprofilertreeview.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QMLPROFILERTREEVIEW -#define QMLPROFILERTREEVIEW - -#include - -namespace QmlProfiler { -namespace Internal { - -class QmlProfilerTreeView : public Utils::TreeView -{ - Q_OBJECT - -protected: - QmlProfilerTreeView(QWidget *parent = 0); - - - enum Fields { - Name, - Callee, - CalleeDescription, - Caller, - CallerDescription, - CallCount, - Details, - Location, - MaxTime, - TimePerCall, - SelfTime, - SelfTimeInPercent, - MinTime, - TimeInPercent, - TotalTime, - Type, - MedianTime, - MaxFields - }; - QString displayHeader(Fields header) const; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILERTREEVIEW