#include <KChartGlobal>
#include <KChartLineAttributes>
+#ifdef NO_K_LIB
+#include "noklib.h"
+#else
#include <KFormat>
#include <KLocalizedString>
+#endif
#include <QBrush>
#include <QDebug>
const QString time = Util::formatTime(data.timeStamp);
auto byteCost = [cost]() -> QString
{
- KFormat format;
- const auto formatted = format.formatByteSize(cost, 1, KFormat::JEDECBinaryDialect);
+ const auto formatted = Util::formatByteSize(cost, 1);
if (cost > 1024) {
return i18nc("%1: the formatted byte size, e.g. \"1.2KB\", %2: the raw byte size, e.g. \"1300\"",
"%1 (%2 bytes)", formatted, cost);
#include <KChartHeaderFooter>
#include <KChartLegend>
+#ifdef NO_K_LIB
+#include "noklib.h"
+#else
#include <KColorScheme>
#include <KFormat>
#include <KLocalizedString>
+#endif
#include "chartmodel.h"
#include "chartproxy.h"
const QString customizedLabel(const QString& label) const override
{
- KFormat format(QLocale::system());
- return format.formatByteSize(label.toDouble(), 1, KFormat::JEDECBinaryDialect);
+//!! KFormat format(QLocale::system());
+ return Util::formatByteSize(label.toDouble(), 1);
}
};
}
totalPlotter->setModel(totalProxy);
totalPlotter->setType(Plotter::Stacked);
+#ifdef NO_K_LIB
+ QPalette pal;
+ const QPen foreground(pal.color(QPalette::Active, QPalette::Foreground));
+#else
KColorScheme scheme(QPalette::Active, KColorScheme::Window);
const QPen foreground(scheme.foreground().color());
+#endif
auto bottomAxis = new TimeAxis(totalPlotter);
auto axisTextAttributes = bottomAxis->textAttributes();
axisTextAttributes.setPen(foreground);
#ifndef HEAPTRACK_GUI_CONFIG_H
#define HEAPTRACK_GUI_CONFIG_H
-#ifndef NO_K_LIB
+#ifndef NO_K_CHART
#define KChart_FOUND 1
#endif
#include <KChartGlobal>
+#ifdef NO_K_LIB
+#include "noklib.h"
+#else
#include <KFormat>
#include <KLocalizedString>
+#endif
#include <QBrush>
#include <QColor>
#include <KChartHeaderFooter>
#include <KChartLegend>
+#ifdef NO_K_LIB
+#include "noklib.h"
+#else
#include <KColorScheme>
#include <KFormat>
#include <KLocalizedString>
+#endif
+
+#include "util.h"
#include "histogrammodel.h"
const QString customizedLabel(const QString& label) const override
{
- KFormat format(QLocale::system());
- return format.formatByteSize(label.toDouble(), 1, KFormat::JEDECBinaryDialect);
+//!! KFormat format(QLocale::system());
+ return Util::formatByteSize(label.toDouble(), 1);
}
};
{
m_total->setAntiAliasing(true);
+#ifdef NO_K_LIB
+ QPalette pal;
+ const QPen foreground(pal.color(QPalette::Active, QPalette::Foreground));
+#else
KColorScheme scheme(QPalette::Active, KColorScheme::Window);
QPen foreground(scheme.foreground().color());
+#endif
auto bottomAxis = new CartesianAxis(m_total);
auto axisTextAttributes = bottomAxis->textAttributes();
axisTextAttributes.setPen(foreground);
bottomUpModelFilterOutLeaves->setSummary(data);
topDownModel->setSummary(data);
callerCalleeModel->setSummary(data);
-#ifndef NO_K_LIB
- KFormat format;
-#endif
QString textLeft;
QString textCenter;
QString textRight;
}
stream << '\n';
stream << '\n';
-#ifndef NO_K_LIB
- KFormat format;
-#endif
const auto allocatedFraction =
QString::number(double(row->cost.allocated) * 100. / m_maxCost.cost.allocated, 'g', 3);
const auto peakFraction = QString::number(double(row->cost.peak) * 100. / m_maxCost.cost.peak, 'g', 3);
}
}
-QString Util::formatByteSize(int64_t size, int precision)
+QString Util::formatByteSize(double size, int precision)
{
#ifndef NO_K_LIB
static KFormat format;
QString result;
if (divider > 1)
{
- result = QString::number(size / (double)divider, 'f', precision);
+ size /= divider;
}
- else
+ else if ((int32_t)size == size)
{
- result = QString::number(size);
+ precision = 0;
}
+ result = QString::number(size, 'f', precision);
result += ' ';
result += suffix;
return result;
QString formatTime(qint64 ms);
-QString formatByteSize(int64_t size, int precision = 1);
+QString formatByteSize(double size, int precision = 1);
}
INCLUDEPATH += $$PWD/analyze/gui
win32 {
- CONFIG += NO_K_LIB
- DEFINES += NO_K_LIB
+ CONFIG += NO_K_LIB NO_K_CHART
+ DEFINES += NO_K_LIB NO_K_CHART
INCLUDEPATH += $$(BOOST_LIB)
LIBS += -L$$(BOOST_LIB)/stage/lib
}
QT += KIOWidgets
QT += KItemModels
- QT += KChart
QT += ThreadWeaver
+}
+
+!NO_K_CHART {
+ QT += KChart
SOURCES += \
analyze/gui/chartmodel.cpp \