Merge remote-tracking branch 'origin/kcrash'

This commit is contained in:
Adriaan de Groot 2017-11-13 13:18:53 +01:00
commit e8e284f724
5 changed files with 75 additions and 0 deletions

View File

@ -113,12 +113,24 @@ set( QT_VERSION 5.6.0 )
find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core Gui Widgets LinguistTools Svg Quick QuickWidgets )
find_package( YAMLCPP 0.5.1 REQUIRED )
find_package( PolkitQt5-1 REQUIRED )
find_package(ECM 5.18 NO_MODULE)
if( ECM_FOUND )
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
endif()
option( INSTALL_CONFIG "Install configuration files" ON )
option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON )
option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF )
option( WITH_KF5Crash "Enable crash reporting with KCrash." ON )
option( BUILD_TESTING "Build the testing tree." ON )
find_package( KF5 5.18 COMPONENTS CoreAddons Crash OPTIONAL )
if( KF5Crash_DIR ) # Why not a _FOUND mechanism?
find_package( KF5 5.18 COMPONENTS CoreAddons REQUIRED )
else()
set( WITH_KF5Crash OFF )
endif()
if( BUILD_TESTING )
enable_testing()
endif ()
@ -277,6 +289,7 @@ add_subdirectory( src )
add_feature_info(Python ${WITH_PYTHON} "Python job modules")
add_feature_info(PythonQt ${WITH_PYTHONQT} "Python view modules")
add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration")
add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash")
feature_summary(WHAT ALL)

View File

@ -49,6 +49,13 @@ SET_TARGET_PROPERTIES(calamares_bin
RUNTIME_OUTPUT_NAME calamares
)
if( WITH_KF5Crash )
set( LINK_LIBRARIES
KF5::CoreAddons
KF5::Crash
)
endif()
target_link_libraries( calamares_bin
PRIVATE
${CALAMARES_LIBRARIES}

View File

@ -19,11 +19,17 @@
#include "CalamaresApplication.h"
#include "CalamaresConfig.h"
#include "kdsingleapplicationguard/kdsingleapplicationguard.h"
#include "utils/CalamaresUtils.h"
#include "utils/Logger.h"
#include "CalamaresConfig.h"
#ifdef WITH_KCRASH
#include <KF5/KCrash/KCrash>
#include <KF5/KCoreAddons/KAboutData>
#endif
#include <QCommandLineParser>
#include <QDebug>
#include <QDir>
@ -33,6 +39,22 @@ main( int argc, char* argv[] )
{
CalamaresApplication a( argc, argv );
#ifdef WITH_KCRASH
KAboutData aboutData( "calamares",
"Calamares",
a.applicationVersion(),
"The universal system installer",
KAboutLicense::GPL_V3,
QString(),
QString(),
"https://calamares.io",
"https://calamares.io/bugs" );
KAboutData::setApplicationData( aboutData );
KCrash::initialize();
KCrash::setCrashHandler();
// TODO: umount anything in /tmp/calamares-... as an emergency save function
#endif
QCommandLineParser parser;
parser.setApplicationDescription( "Distribution-independent installer framework" );
parser.addHelpOption();

View File

@ -10,6 +10,12 @@
//cmakedefines for CMake variables (e.g. for optdepends) go here
#cmakedefine WITH_PYTHON
#cmakedefine WITH_KF5Crash
#ifdef WITH_KF5Crash
#define WITH_KCRASH
#endif
#cmakedefine WITH_PYTHONQT
#endif // CALAMARESCONFIG_H

View File

@ -115,6 +115,33 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="toolsTab">
<attribute name="title">
<string>Tools</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QPushButton" name="crashButton">
<property name="text">
<string notr="true">Crash now</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>