#include "chartmodel.h"
+#include "gui_config.h"
+
+#ifdef KChart_FOUND
#include <KChartGlobal>
#include <KChartLineAttributes>
+#endif
#ifdef NO_K_LIB
#include "noklib.h"
#else
{
Q_ASSERT(orientation == Qt::Horizontal || section < columnCount());
if (orientation == Qt::Horizontal) {
+#ifdef KChart_FOUND
if (role == KChart::DatasetPenRole) {
return QVariant::fromValue(m_columnDataSetPens.at(section));
} else if (role == KChart::DatasetBrushRole) {
return QVariant::fromValue(m_columnDataSetBrushes.at(section));
}
-
+#endif
if (role == Qt::DisplayRole || role == Qt::ToolTipRole) {
if (section == 0) {
return i18n("Elapsed Time");
Q_ASSERT(index.column() >= 0 && index.column() < columnCount(index.parent()));
Q_ASSERT(!index.parent().isValid());
+#ifdef KChart_FOUND
if (role == KChart::LineAttributesRole) {
KChart::LineAttributes attributes;
attributes.setDisplayArea(true);
} else if (role == KChart::DatasetBrushRole) {
return QVariant::fromValue(m_columnDataSetBrushes.at(index.column()));
}
+#endif
if (role != Qt::DisplayRole && role != Qt::ToolTipRole) {
return {};
#include <QVBoxLayout>
+#ifdef KChart_FOUND
#include <KChartChart>
#include <KChartPlotter>
#include <KChartGridAttributes>
#include <KChartHeaderFooter>
#include <KChartLegend>
+#endif
#ifdef NO_K_LIB
#include "noklib.h"
#include "chartproxy.h"
#include "util.h"
+#ifdef KChart_FOUND
using namespace KChart;
namespace {
}
};
}
+#endif
ChartWidget::ChartWidget(QWidget* parent)
: QWidget(parent)
+#ifdef KChart_FOUND
, m_chart(new Chart(this))
+#endif
{
auto layout = new QVBoxLayout(this);
+#ifdef KChart_FOUND
layout->addWidget(m_chart);
+#endif
setLayout(layout);
+#ifdef KChart_FOUND
auto* coordinatePlane = dynamic_cast<CartesianCoordinatePlane*>(m_chart->coordinatePlane());
Q_ASSERT(coordinatePlane);
coordinatePlane->setRubberBandZoomingEnabled(true);
coordinatePlane->setAutoAdjustGridToZoom(true);
+#endif
}
ChartWidget::~ChartWidget() = default;
void ChartWidget::setModel(ChartModel* model, bool minimalMode)
{
+#ifdef KChart_FOUND
auto* coordinatePlane = dynamic_cast<CartesianCoordinatePlane*>(m_chart->coordinatePlane());
Q_ASSERT(coordinatePlane);
foreach (auto diagram, coordinatePlane->diagrams()) {
grid.setSubGridVisible(false);
coordinatePlane->setGlobalGridAttributes(grid);
}
+#endif
switch (model->type()) {
case ChartModel::Consumed:
break;
}
+#ifdef KChart_FOUND
{
auto totalPlotter = new Plotter(this);
totalPlotter->setAntiAliasing(true);
plotter->setModel(proxy);
coordinatePlane->addDiagram(plotter);
}
+#endif
}
QSize ChartWidget::sizeHint() const
#ifndef CHARTWIDGET_H
#define CHARTWIDGET_H
+#include "gui_config.h"
+
#include <QWidget>
class ChartModel;
+#ifdef KChart_FOUND
namespace KChart {
class Chart;
}
+#endif
class QAbstractItemModel;
QSize sizeHint() const override;
private:
+#ifdef KChart_FOUND
KChart::Chart* m_chart;
+#endif
};
#endif // CHARTWIDGET_H
#include "histogrammodel.h"
+#include "gui_config.h"
+
+#ifdef KChart_FOUND
#include <KChartGlobal>
+#endif
#ifdef NO_K_LIB
#include "noklib.h"
if (!hasIndex(index.row(), index.column(), index.parent())) {
return {};
}
+#ifdef KChart_FOUND
if (role == KChart::DatasetBrushRole) {
return QVariant::fromValue(QBrush(colorForColumn(index.column(), columnCount())));
} else if (role == KChart::DatasetPenRole) {
return QVariant::fromValue(QPen(Qt::black));
}
+#endif
if (role != Qt::DisplayRole && role != Qt::ToolTipRole) {
return {};
#include "gui_config.h"
-#if KChart_FOUND
+#if USE_CHART
#include "chartmodel.h"
-#include "chartproxy.h"
#include "chartwidget.h"
#include "histogrammodel.h"
+#endif
+#if KChart_FOUND
+//!!#include "chartmodel.h"
+#include "chartproxy.h"
+//!!#include "chartwidget.h"
+//!!#include "histogrammodel.h"
#include "histogramwidget.h"
#endif
addContextMenu(view, TreeModel::LocationRole);
}
-#if KChart_FOUND
+#if USE_CHART
void addChartTab(QTabWidget* tabWidget, const QString& title, ChartModel::Type type, const Parser* parser,
void (Parser::*dataReady)(const ChartData&), MainWindow* window)
{
});
m_ui->messages->hide();
-#if KChart_FOUND
+#if USE_CHART
addChartTab(m_ui->tabWidget, i18n("Consumed"), ChartModel::Consumed, m_parser, &Parser::consumedChartDataAvailable,
this);
&Parser::temporaryChartDataAvailable, this);
}
+#ifdef KChart_FOUND
auto sizesTab = new HistogramWidget(this);
m_ui->tabWidget->addTab(sizesTab, i18n("Sizes"));
m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(sizesTab), false);
sizeHistogramModel->resetData(data);
m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(sizesTab), true);
});
+#endif
}
#endif
INCLUDEPATH += $$PWD/analyze/gui
win32 {
- CONFIG += NO_K_LIB NO_K_CHART
+ CONFIG += NO_K_LIB NO_K_CHART QWT_CHART
DEFINES += NO_K_LIB NO_K_CHART
INCLUDEPATH += $$(BOOST_LIB)
LIBS += -L$$(BOOST_LIB)/stage/lib
unix {
# QMAKE_CXXFLAGS += -std=c++0x
# QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter # disable 'unused parameter' warning
+ DEFINES *= USE_CHART
LIBS += -lboost_program_options -lboost_iostreams -lpthread
}
#CONFIG *= NO_K_LIB
#DEFINES *= NO_K_LIB
+QWT_CHART {
+ # QMAKEFEATURES and QWT_ROOT environment variables must be set (e.g. to d:\Qwt\Qwt-6.2).
+ # This is the directory where qwt.prf and qwt*.pri files reside.
+ CONFIG *= USE_CHART QWT
+ DEFINES *= USE_CHART
+}
+
SOURCES += \
analyze/accumulatedtracedata.cpp \
analyze/gui/gui.cpp \
QT += ThreadWeaver
}
-!NO_K_CHART {
- QT += KChart
-
+USE_CHART {
SOURCES += \
analyze/gui/chartmodel.cpp \
- analyze/gui/chartproxy.cpp \
+# analyze/gui/chartproxy.cpp \
analyze/gui/chartwidget.cpp \
analyze/gui/histogrammodel.cpp \
- analyze/gui/histogramwidget.cpp
+# analyze/gui/histogramwidget.cpp
HEADERS += \
analyze/gui/chartmodel.h \
- analyze/gui/chartproxy.h \
+# analyze/gui/chartproxy.h \
analyze/gui/chartwidget.h \
analyze/gui/histogrammodel.h \
+# analyze/gui/histogramwidget.h
+}
+
+!NO_K_CHART {
+ QT += KChart
+
+ SOURCES += \
+# analyze/gui/chartmodel.cpp \
+ analyze/gui/chartproxy.cpp \
+# analyze/gui/chartwidget.cpp \
+# analyze/gui/histogrammodel.cpp \
+ analyze/gui/histogramwidget.cpp
+
+ HEADERS += \
+# analyze/gui/chartmodel.h \
+ analyze/gui/chartproxy.h \
+# analyze/gui/chartwidget.h \
+# analyze/gui/histogrammodel.h \
analyze/gui/histogramwidget.h
FORMS += \