forked from qt-creator/qt-creator
Utils: Rework CheckableMessageBox
Remove function overloads, thes are hard to read, to use and to extend. I'd even argue this should be a plain default ctor and a few setters + exec(), pretty much like Process::start() nowadays. Move "decider" magic into a structure that can be filled ad-hoc outside checkablemessagebox.cpp paving the ground for: ...removing aspect dependency from CheckableMessageBox, Instead, add a convenience function to BoolAspect. Arguably, the latter is not needed and could be done on the user side. Use pointers instead of mutable references for in-out parameter. Makes the "specialness" visible on the user side. Pass ICore::settings() centrally as done elsewhere to reduce line noise on the user side. Change-Id: Ibb366353d1ea35401723fd05ce05672617a0a8fd Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -2716,17 +2716,14 @@ Context CppDebuggerEngine::languageContext() const
|
||||
void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
|
||||
{
|
||||
static const QString warnOnInappropriateDebuggerKey = "DebuggerWarnOnInappropriateDebugger";
|
||||
QtcSettings *coreSettings = Core::ICore::settings();
|
||||
|
||||
const bool warnOnRelease = debuggerSettings()->warnOnReleaseBuilds.value()
|
||||
&& rp.toolChainAbi.osFlavor() != Abi::AndroidLinuxFlavor;
|
||||
bool warnOnInappropriateDebugger = false;
|
||||
QString detailedWarning;
|
||||
auto shouldAskAgain = CheckableMessageBox::make_decider(coreSettings,
|
||||
warnOnInappropriateDebuggerKey);
|
||||
switch (rp.toolChainAbi.binaryFormat()) {
|
||||
case Abi::PEFormat: {
|
||||
if (CheckableMessageBox::shouldAskAgain(shouldAskAgain)) {
|
||||
if (CheckableDecider(warnOnInappropriateDebuggerKey).shouldAskAgain()) {
|
||||
QString preferredDebugger;
|
||||
if (rp.toolChainAbi.osFlavor() == Abi::WindowsMSysFlavor) {
|
||||
if (rp.cppEngineType == CdbEngineType)
|
||||
@@ -2766,7 +2763,7 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
|
||||
break;
|
||||
}
|
||||
case Abi::ElfFormat: {
|
||||
if (CheckableMessageBox::shouldAskAgain(shouldAskAgain)) {
|
||||
if (CheckableDecider(warnOnInappropriateDebuggerKey).shouldAskAgain()) {
|
||||
if (rp.cppEngineType == CdbEngineType) {
|
||||
warnOnInappropriateDebugger = true;
|
||||
detailedWarning = Tr::tr(
|
||||
@@ -2879,7 +2876,7 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
|
||||
"Examining symbols and setting breakpoints by file name and line number "
|
||||
"may fail.\n")
|
||||
+ '\n' + detailedWarning,
|
||||
shouldAskAgain);
|
||||
warnOnInappropriateDebuggerKey);
|
||||
} else if (warnOnRelease) {
|
||||
AsynchronousMessageBox::information(Tr::tr("Warning"),
|
||||
Tr::tr("This does not seem to be a \"Debug\" build.\n"
|
||||
|
||||
Reference in New Issue
Block a user