Changeset View
Changeset View
Standalone View
Standalone View
src/debuggerlaunchers.cpp
Show All 33 Lines | |||||
34 | } | 34 | } | ||
35 | 35 | | |||
36 | QString DefaultDebuggerLauncher::name() const | 36 | QString DefaultDebuggerLauncher::name() const | ||
37 | { | 37 | { | ||
38 | return m_debugger.name(); | 38 | return m_debugger.name(); | ||
39 | } | 39 | } | ||
40 | 40 | | |||
41 | void DefaultDebuggerLauncher::start() | 41 | void DefaultDebuggerLauncher::start() | ||
42 | { | 42 | { | ||
43 | if ( static_cast<DebuggerManager*>(parent())->debuggerIsRunning() ) { | 43 | if ( static_cast<DebuggerManager*>(parent())->debuggerIsRunning() ) { | ||
mwolff: could be a separate commit | |||||
44 | qCWarning(DRKONQI_LOG) << "Another debugger is already running"; | 44 | qCWarning(DRKONQI_LOG) << "Another debugger is already running"; | ||
45 | return; | 45 | return; | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | QString str = m_debugger.command(); | 48 | QString str = m_debugger.command(); | ||
49 | Debugger::expandString(str, Debugger::ExpansionUsageShell); | 49 | Debugger::expandString(str, Debugger::ExpansionUsageShell); | ||
50 | 50 | | |||
51 | emit starting(); | 51 | emit starting(); | ||
Show All 19 Lines | |||||
71 | 71 | | |||
72 | void TerminalDebuggerLauncher::start() | 72 | void TerminalDebuggerLauncher::start() | ||
73 | { | 73 | { | ||
74 | DefaultDebuggerLauncher::start(); //FIXME | 74 | DefaultDebuggerLauncher::start(); //FIXME | ||
75 | } | 75 | } | ||
76 | #endif | 76 | #endif | ||
77 | 77 | | |||
78 | 78 | | |||
79 | DBusOldInterfaceLauncher::DBusOldInterfaceLauncher(DebuggerManager *parent) | 79 | DBusInterfaceLauncher::DBusInterfaceLauncher(const QString &name, DBusInterfaceAdaptor *parent) | ||
80 | : AbstractDebuggerLauncher(parent) | 80 | : AbstractDebuggerLauncher(parent), m_name(name) | ||
81 | { | 81 | { | ||
82 | m_adaptor = new DBusOldInterfaceAdaptor(this); | | |||
83 | QDBusConnection::sessionBus().registerObject(QStringLiteral("/krashinfo"), this); | | |||
84 | } | 82 | } | ||
85 | 83 | | |||
86 | QString DBusOldInterfaceLauncher::name() const | 84 | QString DBusInterfaceLauncher::name() const | ||
87 | { | 85 | { | ||
88 | return m_name; | 86 | return m_name; | ||
89 | } | 87 | } | ||
90 | 88 | | |||
91 | void DBusOldInterfaceLauncher::start() | 89 | void DBusInterfaceLauncher::start() | ||
92 | { | 90 | { | ||
93 | emit starting(); | 91 | emit starting(); | ||
94 | emit m_adaptor->acceptDebuggingApplication(); | 92 | emit static_cast<DBusInterfaceAdaptor*>(parent())->acceptDebuggingApplication(m_name); | ||
95 | } | 93 | } | ||
96 | 94 | | |||
97 | 95 | | |||
98 | DBusOldInterfaceAdaptor::DBusOldInterfaceAdaptor(DBusOldInterfaceLauncher *parent) | 96 | DBusInterfaceAdaptor::DBusInterfaceAdaptor(DebuggerManager *parent) | ||
99 | : QDBusAbstractAdaptor(parent) | 97 | : QDBusAbstractAdaptor(parent) | ||
100 | { | 98 | { | ||
101 | Q_ASSERT(parent); | 99 | Q_ASSERT(parent); | ||
100 | | ||||
101 | if (QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.drkonqi-%1").arg(pid()))) { | ||||
102 | QDBusConnection::sessionBus().registerObject(QStringLiteral("/debugger"), parent); | ||||
103 | } | ||||
102 | } | 104 | } | ||
103 | 105 | | |||
104 | int DBusOldInterfaceAdaptor::pid() | 106 | int DBusInterfaceAdaptor::pid() | ||
105 | { | 107 | { | ||
106 | return DrKonqi::crashedApplication()->pid(); | 108 | return DrKonqi::crashedApplication()->pid(); | ||
107 | } | 109 | } | ||
108 | 110 | | |||
109 | void DBusOldInterfaceAdaptor::registerDebuggingApplication(const QString & name) | 111 | void DBusInterfaceAdaptor::registerDebuggingApplication(const QString &name) | ||
110 | { | 112 | { | ||
111 | if ( static_cast<DBusOldInterfaceLauncher*>(parent())->m_name.isEmpty() && !name.isEmpty() ) { | 113 | if (!name.isEmpty() && !m_launchers.contains(name)) { | ||
112 | static_cast<DBusOldInterfaceLauncher*>(parent())->m_name = name; | 114 | auto launcher = new DBusInterfaceLauncher(name, this); | ||
113 | emit static_cast<DBusOldInterfaceLauncher*>(parent())->available(); | 115 | m_launchers.insert(name, launcher); | ||
116 | static_cast<DebuggerManager*>(parent())->addDebugger(launcher, true); | ||||
114 | } | 117 | } | ||
115 | } | 118 | } | ||
116 | 119 | | |||
120 | void DBusInterfaceAdaptor::debuggingFinished(const QString &name) | ||||
121 | { | ||||
122 | auto it = m_launchers.find(name); | ||||
123 | if (it != m_launchers.end()) { | ||||
124 | emit it.value()->finished(); | ||||
125 | } | ||||
126 | } | ||||
117 | 127 | | |||
128 | void DBusInterfaceAdaptor::debuggerClosed(const QString &name) | ||||
129 | { | ||||
130 | auto it = m_launchers.find(name); | ||||
131 | if (it != m_launchers.end()) { | ||||
132 | emit it.value()->invalidated(); | ||||
133 | } | ||||
134 | } |
could be a separate commit