on xenial help sign in
Make unity8 and unity8-dash handle termination signals
1da77eaAlbert Astals Cid
src/CMakeLists.txt+1
@@ -23,6 +23,7 @@ set(SOURCE_FILES
23 ShellApplication.cpp
23 ShellApplication.cpp
24 ShellView.cpp
24 ShellView.cpp
25 UnityCommandLineParser.cpp
25 UnityCommandLineParser.cpp
26+ UnixSignalHandler.cpp
26 ${QML_FILES} # This is to make qml and image files appear in the IDE's project tree
27 ${QML_FILES} # This is to make qml and image files appear in the IDE's project tree
27)
28)
28
29
src/Dash/CMakeLists.txt+1
@@ -1,6 +1,7 @@
1set(DASH_SRCS
1set(DASH_SRCS
2 main.cpp
2 main.cpp
3 ../CachingNetworkManagerFactory.cpp
3 ../CachingNetworkManagerFactory.cpp
4+ ../UnixSignalHandler.cpp
4)
5)
5
6
6if (ENABLE_TOUCH_EMULATION)
7if (ENABLE_TOUCH_EMULATION)
src/Dash/main.cpp+6
@@ -32,6 +32,7 @@
32 #include "../MouseTouchAdaptor.h"
32 #include "../MouseTouchAdaptor.h"
33#endif
33#endif
34#include "../CachingNetworkManagerFactory.h"
34#include "../CachingNetworkManagerFactory.h"
35+#include "../UnixSignalHandler.h"
35
36
36int main(int argc, const char *argv[])
37int main(int argc, const char *argv[])
37{
38{
@@ -116,6 +117,11 @@ int main(int argc, const char *argv[])
116 view->setSource(source);
117 view->setSource(source);
117 view->show();
118 view->show();
118
119
120+ UnixSignalHandler signalHandler([]{
121+ QGuiApplication::exit(0);
122+ });
123+ signalHandler.setupUnixSignalHandlers();
124+
119 int result = application->exec();
125 int result = application->exec();
120
126
121 delete view;
127 delete view;
tools/unix-signal-handler.cpp → src/UnixSignalHandler.cpprenamed+1−1
@@ -16,7 +16,7 @@
16 * Author: Marcus Tomlinson <marcus.tomlinson@canonical.com>
16 * Author: Marcus Tomlinson <marcus.tomlinson@canonical.com>
17 */
17 */
18
18
19−#include "unix-signal-handler.h"
19+#include "UnixSignalHandler.h"
20
20
21#include <QDebug>
21#include <QDebug>
22
22
tools/unix-signal-handler.h → src/UnixSignalHandler.hrenamed

The content is the same.

src/main.cpp+6
@@ -17,6 +17,7 @@
17// local
17// local
18#include "ShellApplication.h"
18#include "ShellApplication.h"
19#include "qmldebuggerutils.h"
19#include "qmldebuggerutils.h"
20+#include "UnixSignalHandler.h"
20
21
21int main(int argc, const char *argv[])
22int main(int argc, const char *argv[])
22{
23{
@@ -32,6 +33,11 @@ int main(int argc, const char *argv[])
32
33
33 ShellApplication *application = new ShellApplication(argc, (char**)argv, isMirServer);
34 ShellApplication *application = new ShellApplication(argc, (char**)argv, isMirServer);
34
35
36+ UnixSignalHandler signalHandler([]{
37+ QGuiApplication::exit(0);
38+ });
39+ signalHandler.setupUnixSignalHandlers();
40+
35 int result = application->exec();
41 int result = application->exec();
36
42
37 application->destroyResources();
43 application->destroyResources();
tools/CMakeLists.txt+1−1
@@ -1,7 +1,7 @@
1add_executable(${SCOPE_TOOL}
1add_executable(${SCOPE_TOOL}
2 scopetool.cpp
2 scopetool.cpp
3 registry-tracker.cpp
3 registry-tracker.cpp
4− unix-signal-handler.cpp
4+ ../src/UnixSignalHandler.cpp
5 )
5 )
6
6
7qt5_use_modules(${SCOPE_TOOL} Qml Quick)
7qt5_use_modules(${SCOPE_TOOL} Qml Quick)
tools/scopetool.cpp+1−1
@@ -32,7 +32,7 @@
32// local
32// local
33#include <paths.h>
33#include <paths.h>
34#include "registry-tracker.h"
34#include "registry-tracker.h"
35−#include "unix-signal-handler.h"
35+#include "../src/UnixSignalHandler.h"
36
36
37
37
38int main(int argc, char *argv[])
38int main(int argc, char *argv[])