Exemplo n.º 1
0
void CommonOptionsPageWidget::setGlobalOptions(const GlobalDebuggerOptions &go)
{
    SourcePathMap allPathMap = go.sourcePathMap;
    foreach (auto regExpMap, go.sourcePathRegExpMap)
        allPathMap.insert(regExpMap.first.pattern(), regExpMap.second);

    sourcesMappingWidget->setSourcePathMap(allPathMap);
}
/* Merge settings for an installed Qt (unless another setting
 * is already in the map. */
DebuggerSourcePathMappingWidget::SourcePathMap
    DebuggerSourcePathMappingWidget::mergePlatformQtPath(const DebuggerStartParameters &sp,
                                                         const SourcePathMap &in)
{
    const FileName qmake = BuildableHelperLibrary::findSystemQt(sp.environment);
    // FIXME: Get this from the profile?
    //        We could query the QtVersion for this information directly, but then we
    //        will need to add a dependency on QtSupport to the debugger.
    //
    //        The profile could also get a function to extract the required information from
    //        its information to avoid this dependency (as we do for the environment).
    const QString qtInstallPath = findQtInstallPath(qmake);
    SourcePathMap rc = in;
    const size_t buildPathCount = sizeof(qtBuildPaths)/sizeof(const char *);
    if (qtInstallPath.isEmpty() || buildPathCount == 0)
        return rc;

    for (size_t i = 0; i != buildPathCount; ++i) { // use != to avoid 0<0 which triggers warning on Mac
        const QString buildPath = QString::fromLatin1(qtBuildPaths[i]);
        if (!rc.contains(buildPath)) // Do not overwrite user settings.
            rc.insert(buildPath, qtInstallPath);
    }
    return rc;
}
void DebuggerSourcePathMappingWidget::setSourcePathMap(const SourcePathMap &m)
{
    m_model->setSourcePathMap(m);
    if (!m.isEmpty())
        resizeColumns();
}
Exemplo n.º 4
0
QWidget *CommonOptionsPage::widget()
{
    if (!m_widget) {
        m_widget = new QWidget;

        auto behaviorBox = new QGroupBox(m_widget);
        behaviorBox->setTitle(tr("Behavior"));

        auto checkBoxUseAlternatingRowColors = new QCheckBox(behaviorBox);
        checkBoxUseAlternatingRowColors->setText(tr("Use alternating row colors in debug views"));

        auto checkBoxFontSizeFollowsEditor = new QCheckBox(behaviorBox);
        checkBoxFontSizeFollowsEditor->setToolTip(tr("Changes the font size in the debugger views when the font size in the main editor changes."));
        checkBoxFontSizeFollowsEditor->setText(tr("Debugger font size follows main editor"));

        auto checkBoxUseToolTipsInMainEditor = new QCheckBox(behaviorBox);
        checkBoxUseToolTipsInMainEditor->setText(tr("Use tooltips in main editor while debugging"));

        QString t = tr("Stopping and stepping in the debugger "
                       "will automatically open views associated with the current location.") + QLatin1Char('\n');
        auto checkBoxCloseSourceBuffersOnExit = new QCheckBox(behaviorBox);
        checkBoxCloseSourceBuffersOnExit->setText(tr("Close temporary source views on debugger exit"));
        checkBoxCloseSourceBuffersOnExit->setToolTip(t + tr("Closes automatically opened source views when the debugger exits."));

        auto checkBoxCloseMemoryBuffersOnExit = new QCheckBox(behaviorBox);
        checkBoxCloseMemoryBuffersOnExit->setText(tr("Close temporary memory views on debugger exit"));
        checkBoxCloseMemoryBuffersOnExit->setToolTip(t + tr("Closes automatically opened memory views when the debugger exits."));

        auto checkBoxSwitchModeOnExit = new QCheckBox(behaviorBox);
        checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit"));

        auto checkBoxBringToForegroundOnInterrrupt = new QCheckBox(behaviorBox);
        checkBoxBringToForegroundOnInterrrupt->setText(
                    tr("Bring %1 to foreground when application interrupts")
                    .arg(Core::Constants::IDE_DISPLAY_NAME));

        auto checkBoxShowQmlObjectTree = new QCheckBox(behaviorBox);
        checkBoxShowQmlObjectTree->setToolTip(tr("Shows QML object tree in Locals and Expressions when connected and not stepping."));
        checkBoxShowQmlObjectTree->setText(tr("Show QML object tree"));

        auto checkBoxBreakpointsFullPath = new QCheckBox(behaviorBox);
        checkBoxBreakpointsFullPath->setToolTip(tr("Enables a full file path in breakpoints by default also for GDB."));
        checkBoxBreakpointsFullPath->setText(tr("Set breakpoints using a full absolute path"));

        auto checkBoxRegisterForPostMortem = new QCheckBox(behaviorBox);
        checkBoxRegisterForPostMortem->setToolTip(
                    tr("Registers %1 for debugging crashed applications.")
                    .arg(Core::Constants::IDE_DISPLAY_NAME));
        checkBoxRegisterForPostMortem->setText(
                    tr("Use %1 for post-mortem debugging")
                    .arg(Core::Constants::IDE_DISPLAY_NAME));

        auto checkBoxWarnOnReleaseBuilds = new QCheckBox(behaviorBox);
        checkBoxWarnOnReleaseBuilds->setText(tr("Warn when debugging \"Release\" builds"));
        checkBoxWarnOnReleaseBuilds->setToolTip(tr("Shows a warning when starting the debugger "
                                                   "on a binary with insufficient debug information."));

        auto checkBoxKeepEditorStationaryWhileStepping = new QCheckBox(behaviorBox);
        checkBoxKeepEditorStationaryWhileStepping->setText(tr("Keep editor stationary when stepping"));
        checkBoxKeepEditorStationaryWhileStepping->setToolTip(tr("Scrolls the editor only when it is necessary "
                                                                 "to keep the current line in view, "
                                                                 "instead of keeping the next statement centered at "
                                                                 "all times."));

        auto labelMaximalStackDepth = new QLabel(tr("Maximum stack depth:"), behaviorBox);

        auto spinBoxMaximalStackDepth = new QSpinBox(behaviorBox);
        spinBoxMaximalStackDepth->setSpecialValueText(tr("<unlimited>"));
        spinBoxMaximalStackDepth->setMaximum(999);
        spinBoxMaximalStackDepth->setSingleStep(5);
        spinBoxMaximalStackDepth->setValue(10);

        m_sourceMappingWidget = new DebuggerSourcePathMappingWidget(m_widget);

        auto horizontalLayout = new QHBoxLayout;
        horizontalLayout->addWidget(labelMaximalStackDepth);
        horizontalLayout->addWidget(spinBoxMaximalStackDepth);
        horizontalLayout->addStretch();

        auto gridLayout = new QGridLayout(behaviorBox);
        gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1);
        gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1);
        gridLayout->addWidget(checkBoxCloseSourceBuffersOnExit, 2, 0, 1, 1);
        gridLayout->addWidget(checkBoxCloseMemoryBuffersOnExit, 3, 0, 1, 1);
        gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 4, 0, 1, 1);
        gridLayout->addWidget(checkBoxBreakpointsFullPath, 5, 0, 1, 1);
        gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 6, 0, 1, 1);
        gridLayout->addLayout(horizontalLayout, 7, 0, 1, 2);

        gridLayout->addWidget(checkBoxFontSizeFollowsEditor, 0, 1, 1, 1);
        gridLayout->addWidget(checkBoxSwitchModeOnExit, 1, 1, 1, 1);
        gridLayout->addWidget(checkBoxShowQmlObjectTree, 2, 1, 1, 1);
        gridLayout->addWidget(checkBoxKeepEditorStationaryWhileStepping, 3, 1, 1, 1);
        gridLayout->addWidget(checkBoxRegisterForPostMortem, 4, 1, 1, 1);

        auto verticalLayout = new QVBoxLayout(m_widget);
        verticalLayout->addWidget(behaviorBox);
        verticalLayout->addWidget(m_sourceMappingWidget);
        verticalLayout->addStretch();

        m_group.clear();

        m_group.insert(action(UseAlternatingRowColors),
                       checkBoxUseAlternatingRowColors);
        m_group.insert(action(UseToolTipsInMainEditor),
                       checkBoxUseToolTipsInMainEditor);
        m_group.insert(action(CloseSourceBuffersOnExit),
                       checkBoxCloseSourceBuffersOnExit);
        m_group.insert(action(CloseMemoryBuffersOnExit),
                       checkBoxCloseMemoryBuffersOnExit);
        m_group.insert(action(SwitchModeOnExit),
                       checkBoxSwitchModeOnExit);
        m_group.insert(action(BreakpointsFullPathByDefault),
                       checkBoxBreakpointsFullPath);
        m_group.insert(action(RaiseOnInterrupt),
                       checkBoxBringToForegroundOnInterrrupt);
        m_group.insert(action(ShowQmlObjectTree),
                       checkBoxShowQmlObjectTree);
        m_group.insert(action(WarnOnReleaseBuilds),
                       checkBoxWarnOnReleaseBuilds);
        m_group.insert(action(StationaryEditorWhileStepping),
                       checkBoxKeepEditorStationaryWhileStepping);
        m_group.insert(action(FontSizeFollowsEditor),
                       checkBoxFontSizeFollowsEditor);
        m_group.insert(action(AutoDerefPointers), 0);
        m_group.insert(action(UseToolTipsInLocalsView), 0);
        m_group.insert(action(AlwaysAdjustColumnWidths), 0);
        m_group.insert(action(UseToolTipsInBreakpointsView), 0);
        m_group.insert(action(UseToolTipsInStackView), 0);
        m_group.insert(action(UseAddressInBreakpointsView), 0);
        m_group.insert(action(UseAddressInStackView), 0);
        m_group.insert(action(MaximalStackDepth), spinBoxMaximalStackDepth);
        m_group.insert(action(ShowStdNamespace), 0);
        m_group.insert(action(ShowQtNamespace), 0);
        m_group.insert(action(ShowQObjectNames), 0);
        m_group.insert(action(SortStructMembers), 0);
        m_group.insert(action(LogTimeStamps), 0);
        m_group.insert(action(BreakOnThrow), 0);
        m_group.insert(action(BreakOnCatch), 0);
        if (HostOsInfo::isWindowsHost()) {
            SavedAction *registerAction = action(RegisterForPostMortem);
            m_group.insert(registerAction, checkBoxRegisterForPostMortem);
            connect(registerAction, &QAction::toggled,
                    checkBoxRegisterForPostMortem, &QAbstractButton::setChecked);
        } else {
            checkBoxRegisterForPostMortem->setVisible(false);
        }

        SourcePathMap allPathMap = m_options->sourcePathMap;
        foreach (auto regExpMap, m_options->sourcePathRegExpMap)
            allPathMap.insert(regExpMap.first.pattern(), regExpMap.second);
        m_sourceMappingWidget->setSourcePathMap(allPathMap);
    }