diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 45402fa1f17..233558a4a1f 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -547,10 +547,6 @@ void CdbEngine::setupEngine() { if (debug) qDebug(">setupEngine"); - // Nag to add symbol server and cache - QStringList symbolPaths = stringListSetting(CdbSymbolPaths); - if (CdbSymbolPathListEditor::promptToAddSymbolPaths(&symbolPaths)) - action(CdbSymbolPaths)->setValue(symbolPaths); init(); if (!m_logTime.elapsed()) diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp index 85e8e38d368..3a211a49eac 100644 --- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp +++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp @@ -134,6 +134,11 @@ CdbSymbolPathListEditor::CdbSymbolPathListEditor(QWidget *parent) : addSymbolPath(SymbolCachePath); }); button->setToolTip(tr("Uses a directory to cache symbols used by the debugger.")); + + button = insertButton(lastInsertButtonIndex + 1, tr("Setup Symbol Paths..."), this, [this](){ + setupSymbolPaths(); + }); + button->setToolTip(tr("Configure Symbol paths that are used to locate debug symbol files.")); } bool CdbSymbolPathListEditor::promptCacheDirectory(QWidget *parent, QString *cacheDirectory) @@ -153,6 +158,37 @@ void CdbSymbolPathListEditor::addSymbolPath(CdbSymbolPathListEditor::SymbolPathM insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(cacheDir, mode)); } +void CdbSymbolPathListEditor::setupSymbolPaths() +{ + const QStringList ¤tPaths = pathList(); + const int indexOfSymbolServer = indexOfSymbolPath(currentPaths, SymbolServerPath); + const int indexOfSymbolCache = indexOfSymbolPath(currentPaths, SymbolCachePath); + + QString path; + if (indexOfSymbolServer != -1) + path = currentPaths.at(indexOfSymbolServer); + if (path.isEmpty() && indexOfSymbolCache != -1) + path = currentPaths.at(indexOfSymbolCache); + if (path.isEmpty()) + path = QDir::tempPath() + QDir::separator() + QLatin1String("symbolcache"); + + bool useSymbolServer = true; + bool useSymbolCache = true; + bool addSymbolPaths = SymbolPathsDialog::useCommonSymbolPaths(useSymbolCache, + useSymbolServer, + path); + if (!addSymbolPaths) + return; + + if (useSymbolCache) { + insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(path, SymbolCachePath)); + if (useSymbolServer) + insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(QString(), SymbolServerPath)); + } else if (useSymbolServer) { + insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(path, SymbolServerPath)); + } +} + QString CdbSymbolPathListEditor::symbolPath(const QString &cacheDir, CdbSymbolPathListEditor::SymbolPathMode mode) { @@ -207,61 +243,5 @@ int CdbSymbolPathListEditor::indexOfSymbolPath(const QStringList &paths, return -1; } -bool CdbSymbolPathListEditor::promptToAddSymbolPaths(QStringList *symbolPaths) -{ - const int indexOfSymbolServer = - CdbSymbolPathListEditor::indexOfSymbolPath(*symbolPaths, SymbolServerPath); - const int indexOfSymbolCache = - CdbSymbolPathListEditor::indexOfSymbolPath(*symbolPaths, SymbolCachePath); - - if (!qgetenv("_NT_SYMBOL_PATH").isEmpty() - || (indexOfSymbolServer != -1 && indexOfSymbolCache != -1)) - return false; - - const QString nagSymbolServerKey = QLatin1String("CDB2/NoPromptSymbolCache"); - bool noFurtherNagging = Core::ICore::settings()->value(nagSymbolServerKey, false).toBool(); - if (noFurtherNagging) - return false; - - QString path; - if (indexOfSymbolServer != -1) - path = symbolPaths->at(indexOfSymbolServer); - if (path.isEmpty() && indexOfSymbolCache != -1) - path = symbolPaths->at(indexOfSymbolCache); - if (path.isEmpty()) - path = QDir::tempPath() + QDir::separator() + QLatin1String("symbolcache"); - - bool useSymbolServer = true; - bool useSymbolCache = true; - bool addSymbolPaths = SymbolPathsDialog::useCommonSymbolPaths(useSymbolCache, - useSymbolServer, - path, noFurtherNagging); - Core::ICore::settings()->setValue(nagSymbolServerKey, noFurtherNagging); - if (!addSymbolPaths) - return false; - - // remove old entries - if (indexOfSymbolServer > indexOfSymbolCache) { - symbolPaths->removeAt(indexOfSymbolServer); - if (indexOfSymbolCache != -1) - symbolPaths->removeAt(indexOfSymbolCache); - } else if (indexOfSymbolCache > indexOfSymbolServer) { - symbolPaths->removeAt(indexOfSymbolCache); - if (indexOfSymbolServer != -1) - symbolPaths->removeAt(indexOfSymbolServer); - } - - if (useSymbolCache) { - symbolPaths->push_back(CdbSymbolPathListEditor::symbolPath(path, SymbolCachePath)); - if (useSymbolServer) - symbolPaths->push_back(CdbSymbolPathListEditor::symbolPath(QString(), SymbolServerPath)); - return true; - } else if (useSymbolServer) { - symbolPaths->push_back(CdbSymbolPathListEditor::symbolPath(path, SymbolServerPath)); - return true; - } - return false; -} - } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h index bd99e34303d..81d80c8c0d2 100644 --- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h +++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h @@ -93,11 +93,9 @@ public: // Check for symbol server in list of paths. static int indexOfSymbolPath(const QStringList &paths, SymbolPathMode mode, QString *cacheDir = 0); - // Nag user to add a symbol cache and server to the path list on debugger startup. - static bool promptToAddSymbolPaths(QStringList *symbolPaths); - private: void addSymbolPath(SymbolPathMode mode); + void setupSymbolPaths(); }; } // namespace Internal diff --git a/src/plugins/debugger/shared/symbolpathsdialog.cpp b/src/plugins/debugger/shared/symbolpathsdialog.cpp index d3f44183349..ccb15496c9e 100644 --- a/src/plugins/debugger/shared/symbolpathsdialog.cpp +++ b/src/plugins/debugger/shared/symbolpathsdialog.cpp @@ -64,11 +64,6 @@ QString SymbolPathsDialog::path() const return ui->pathChooser->path(); } -bool SymbolPathsDialog::doNotAskAgain() const -{ - return ui->doNotAskAgain->isChecked(); -} - void SymbolPathsDialog::setUseSymbolCache(bool useSymbolCache) { ui->useLocalSymbolCache->setChecked(useSymbolCache); @@ -84,23 +79,16 @@ void SymbolPathsDialog::setPath(const QString &path) ui->pathChooser->setPath(path); } -void SymbolPathsDialog::setDoNotAskAgain(bool doNotAskAgain) const -{ - ui->doNotAskAgain->setChecked(doNotAskAgain); -} - bool SymbolPathsDialog::useCommonSymbolPaths(bool &useSymbolCache, bool &useSymbolServer, - QString &path, bool &doNotAskAgain) + QString &path) { SymbolPathsDialog dialog; dialog.setUseSymbolCache(useSymbolCache); dialog.setUseSymbolServer(useSymbolServer); dialog.setPath(path); - dialog.setDoNotAskAgain(doNotAskAgain); int ret = dialog.exec(); useSymbolCache = dialog.useSymbolCache(); useSymbolServer = dialog.useSymbolServer(); path = dialog.path(); - doNotAskAgain = dialog.doNotAskAgain(); return ret == QDialog::Accepted; } diff --git a/src/plugins/debugger/shared/symbolpathsdialog.h b/src/plugins/debugger/shared/symbolpathsdialog.h index 001208840ff..b64f10b7359 100644 --- a/src/plugins/debugger/shared/symbolpathsdialog.h +++ b/src/plugins/debugger/shared/symbolpathsdialog.h @@ -57,7 +57,7 @@ public: void setPath(const QString &path); void setDoNotAskAgain(bool doNotAskAgain) const; - static bool useCommonSymbolPaths(bool &useSymbolCache, bool &useSymbolServer, QString &path, bool &doNotAskAgain); + static bool useCommonSymbolPaths(bool &useSymbolCache, bool &useSymbolServer, QString &path); private: Ui::SymbolPathsDialog *ui; diff --git a/src/plugins/debugger/shared/symbolpathsdialog.ui b/src/plugins/debugger/shared/symbolpathsdialog.ui index c74d985f2d6..b9a05860d47 100644 --- a/src/plugins/debugger/shared/symbolpathsdialog.ui +++ b/src/plugins/debugger/shared/symbolpathsdialog.ui @@ -7,7 +7,7 @@ 0 0 537 - 245 + 249 @@ -73,23 +73,6 @@ - - - - Qt::Horizontal - - - - - - - Do not ask again - - - false - - -