set(HEAPTRACK_LIB_VERSION 1.0.0)
set(HEAPTRACK_LIB_SOVERSION 1)
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic")
-
find_package(Boost 1.41.0 REQUIRED COMPONENTS iostreams program_options)
find_package(Threads REQUIRED)
-find_package(Qt5 NO_MODULE QUIET OPTIONAL_COMPONENTS Widgets)
-if(Qt5_FOUND)
- add_subdirectory(gui)
+find_package(Qt5 5.2.0 NO_MODULE OPTIONAL_COMPONENTS Widgets)
+find_package(ECM 1.0.0 NO_MODULE)
+
+include(FeatureSummary)
+
+if(Qt5_FOUND AND ECM_FOUND)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
+ find_package(KF5 OPTIONAL_COMPONENTS CoreAddons I18n ItemModels)
+ if (KF5_FOUND)
+ add_subdirectory(gui)
+ endif()
endif()
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic")
+
add_subdirectory(3rdparty)
check_library_exists (${LIBUNWIND_LIBRARY} unw_backtrace "" HAVE_UNW_BACKTRACE)
install(TARGETS heaptrack_interpret RUNTIME DESTINATION ${LIBEXEC_INSTALL_DIR})
install(TARGETS heaptrack_inject LIBRARY DESTINATION ${LIB_INSTALL_DIR}/heaptrack/)
install(TARGETS heaptrack_preload LIBRARY DESTINATION ${LIB_INSTALL_DIR}/heaptrack/)
+
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
struct AccumulatedTraceData
{
AccumulatedTraceData();
- ~AccumulatedTraceData() = default;
+ virtual ~AccumulatedTraceData() = default;
virtual void handleTimeStamp(size_t newStamp, size_t oldStamp);
virtual void handleAllocation();
mainwindow.ui
)
+include(KDEInstallDirs)
+include(KDECMakeSettings)
+include(KDECompilerSettings)
+include(ECMOptionalAddSubdirectory)
+include(ECMInstallIcons)
+include(ECMAddTests)
+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(heaptrack_gui
${UIFILES}
)
-target_link_libraries(heaptrack_gui Qt5::Widgets ${Boost_LIBRARIES} sharedprint)
+add_definitions(-Wall
+ -DQT_NO_URL_CAST_FROM_STRING
+ -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII
+ -DQT_NO_CAST_FROM_BYTEARRAY
+ -DQT_USE_QSTRINGBUILDER
+)
+
+target_link_libraries(heaptrack_gui
+ Qt5::Widgets
+ KF5::ItemModels
+ ${Boost_LIBRARIES}
+ sharedprint)
install(TARGETS heaptrack_gui RUNTIME DESTINATION "bin")
\ No newline at end of file
#include <ui_mainwindow.h>
-#include <QSortFilterProxyModel>
+#include <KRecursiveFilterProxyModel>
#include <iostream>
using namespace std;
MainWindow::MainWindow(QWidget* parent)
- : m_ui(new Ui::MainWindow)
+ : QMainWindow(parent)
+ , m_ui(new Ui::MainWindow)
, m_model(new Model(this))
{
m_ui->setupUi(this);
- auto proxy = new QSortFilterProxyModel(m_model);
+ auto proxy = new KRecursiveFilterProxyModel(m_model);
proxy->setSourceModel(m_model);
m_ui->results->setModel(proxy);
}
Model::Model(QObject* parent)
+ : QAbstractItemModel(parent)
{
-
}
Model::~Model()
QVariant Model::data(const QModelIndex& index, int role) const
{
- if (index.row() < 0 || index.row() > m_data.mergedAllocations.size()
+ if (index.row() < 0 || static_cast<size_t>(index.row()) > m_data.mergedAllocations.size()
|| index.column() < 0 || index.column() > NUM_COLUMNS)
{
return QVariant();
int Model::rowCount(const QModelIndex& parent) const
{
if (parent.isValid()) {
- if (parent.column() != 0 || parent.row() < 0 || parent.row() >= m_data.mergedAllocations.size()
+ if (parent.column() != 0 || parent.row() < 0 || static_cast<size_t>(parent.row()) >= m_data.mergedAllocations.size()
|| parentRow(parent) != -1)
{
return 0;
if (ip.functionIndex) {
return QString::fromStdString(m_data.prettyFunction(m_data.stringify(ip.functionIndex)));
} else {
- return QLatin1String("0x") + QString::number(ip.instructionPointer, 16);
+ return static_cast<QString>(QLatin1String("0x") + QString::number(ip.instructionPointer, 16));
}
} else if (column == ModuleColumn) {
return QString::fromStdString(m_data.stringify(ip.moduleIndex));
} else if (ip.fileIndex) {
auto file = QString::fromStdString(m_data.stringify(ip.fileIndex));
- return file + QLatin1Char(':') + QString::number(ip.line);
+ return static_cast<QString>(file + QLatin1Char(':') + QString::number(ip.line));
} else {
return QString();
}