stacksmodel.cpp
topproxy.cpp
callercalleemodel.cpp
+ util.cpp
)
set(LIBRARIES
#include <QDebug>
#include <QPen>
+#include "util.h"
+
namespace {
QColor colorForColumn(int column, int columnCount)
{
const auto cost = data.cost[column];
if (role == Qt::ToolTipRole) {
- const QString time = QString::number(double(data.timeStamp) / 1000, 'g', 3) + QLatin1Char('s');
+ const QString time = Util::formatTime(data.timeStamp);
auto byteCost = [cost]() -> QString
{
KFormat format;
#include "chartmodel.h"
#include "chartproxy.h"
+#include "util.h"
using namespace KChart;
const QString customizedLabel(const QString& label) const override
{
- // squeeze large numbers here
- return QString::number(label.toDouble() / 1000, 'g', 2) + QLatin1Char('s');
+ return Util::formatTime(label.toLongLong());
}
};
--- /dev/null
+/*
+ * Copyright 2017 Milian Wolff <mail@milianw.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "util.h"
+
+#include <QString>
+
+QString Util::formatTime(qint64 ms)
+{
+ return QString::number(double(ms) / 1000, 'g', 3) + QLatin1Char('s');
+}
--- /dev/null
+/*
+ * Copyright 2017 Milian Wolff <mail@milianw.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef UTIL_H
+#define UTIL_H
+
+#include <qglobal.h>
+
+class QString;
+
+namespace Util {
+
+QString formatTime(qint64 ms);
+
+}
+
+#endif // UTIL_H