diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-09-20 08:39:59 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-09-21 06:00:30 +0000 |
commit | 3c8f8f1ffcc0669b0a31aca0f6fa138606bfa061 (patch) | |
tree | 1760c04846023381a990e2d180d13f42dc340bdf /src/tools | |
parent | 6cf573534f49e2bd5ec2aeef97dca4a66002c671 (diff) | |
download | qt-creator-3c8f8f1ffcc0669b0a31aca0f6fa138606bfa061.tar.gz |
qtcdebugger: Extend help text
Factor out a helper function to read out the current debugger.
Display the currently registered debugger and the Qt version used in the
help. Enable copying the message box text.
This offers a convenient way of checking since the debugger settings often
get overwritten by OS or MSVC updates.
Change-Id: If61e30ae22802b71960cb6f3da96100f5fd9e47c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/qtcdebugger/main.cpp | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/src/tools/qtcdebugger/main.cpp b/src/tools/qtcdebugger/main.cpp index 7453c08afc..38507c8539 100644 --- a/src/tools/qtcdebugger/main.cpp +++ b/src/tools/qtcdebugger/main.cpp @@ -35,6 +35,7 @@ #include <QTextStream> #include <QFileInfo> #include <QByteArray> +#include <QSysInfo> #include <QString> #include <QDir> #include <QTime> @@ -138,6 +139,26 @@ static bool parseArguments(const QStringList &args, QString *errorMessage) return true; } +static bool readDebugger(const wchar_t *key, QString *debugger, + QString *errorMessage) +{ + bool success = false; + HKEY handle; + const RegistryAccess::AccessMode accessMode = optIsWow +#ifdef Q_OS_WIN64 + ? RegistryAccess::Registry32Mode +#else + ? RegistryAccess::Registry64Mode +#endif + : RegistryAccess::DefaultAccessMode; + + if (openRegistryKey(HKEY_LOCAL_MACHINE, debuggerRegistryKeyC, false, &handle, accessMode, errorMessage)) { + success = registryReadStringKey(handle, key, debugger, errorMessage); + RegCloseKey(handle); + } + return success; +} + static void usage(const QString &binary, const QString &message = QString()) { QString msg; @@ -170,10 +191,16 @@ static void usage(const QString &binary, const QString &message = QString()) << "<p>On 64-bit systems, do the same for the key <i>HKEY_LOCAL_MACHINE\\" << wCharToQString(debuggerWow32RegistryKeyC) << "</i>, " << "setting the new value to <pre>\"" << QDir::toNativeSeparators(binary) << "\" -wow %ld %ld</pre></p>" << "<p>How to run a command with administrative privileges:</p>" - << "<pre>runas /env /noprofile /user:Administrator \"command arguments\"</pre>" - << "</body></html>"; + << "<pre>runas /env /noprofile /user:Administrator \"command arguments\"</pre>"; + QString currentDebugger; + QString errorMessage; + if (readDebugger(debuggerRegistryValueNameC, ¤tDebugger, &errorMessage)) + str << "<p>Currently registered debugger:</p><pre>" << currentDebugger << "</pre>"; + str << "<p>Qt " << QT_VERSION_STR << ", " << QSysInfo::WordSize + << "bit</p></body></html>"; QMessageBox msgBox(QMessageBox::Information, QLatin1String(titleC), msg, QMessageBox::Ok); + msgBox.setTextInteractionFlags(Qt::TextBrowserInteraction); msgBox.exec(); } @@ -321,22 +348,7 @@ bool startCreatorAsDebugger(bool asClient, QString *errorMessage) bool readDefaultDebugger(QString *defaultDebugger, QString *errorMessage) { - bool success = false; - HKEY handle; - const RegistryAccess::AccessMode accessMode = optIsWow -#ifdef Q_OS_WIN64 - ? RegistryAccess::Registry32Mode -#else - ? RegistryAccess::Registry64Mode -#endif - : RegistryAccess::DefaultAccessMode; - - if (openRegistryKey(HKEY_LOCAL_MACHINE, debuggerRegistryKeyC, false, &handle, accessMode, errorMessage)) { - success = registryReadStringKey(handle, debuggerRegistryDefaultValueNameC, - defaultDebugger, errorMessage); - RegCloseKey(handle); - } - return success; + return readDebugger(debuggerRegistryDefaultValueNameC, defaultDebugger, errorMessage); } bool startDefaultDebugger(QString *errorMessage) |