From a2c68a538de6809c544df899184bda75f5400ae2 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Fri, 27 Mar 2009 12:25:58 +0100
Subject: [PATCH] debugger: remove reference to dumper build step from debugger
 UI

---
 src/plugins/debugger/debuggeractions.cpp | 30 ++++++++++-----------
 src/plugins/debugger/debuggeractions.h   |  9 +++----
 src/plugins/debugger/debuggerplugin.cpp  | 20 +++++++-------
 src/plugins/debugger/dumperoptionpage.ui | 34 +++++++++++-------------
 src/plugins/debugger/gdbengine.cpp       | 25 +++++++----------
 src/plugins/debugger/gdbengine.h         |  2 +-
 src/plugins/debugger/watchwindow.cpp     |  2 +-
 7 files changed, 54 insertions(+), 68 deletions(-)

diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp
index c054f19ea06..d766f987ef6 100644
--- a/src/plugins/debugger/debuggeractions.cpp
+++ b/src/plugins/debugger/debuggeractions.cpp
@@ -64,6 +64,7 @@ DebuggerSettings::~DebuggerSettings()
     
 void DebuggerSettings::insertItem(int code, SavedAction *item)
 {
+    QTC_ASSERT(!m_items.contains(code), return);
     m_items[code] = item;
 }
 
@@ -240,11 +241,6 @@ DebuggerSettings *theDebuggerSettings()
     item->setText(QObject::tr("Use tooltips when debugging"));
     item->setCheckable(true);
 
-    item = new SavedAction(instance);
-    instance->insertItem(ListSourceFiles, item);
-    item->setText(QObject::tr("List source files"));
-    item->setCheckable(true);
-
 
     //
     // Settings
@@ -272,30 +268,30 @@ DebuggerSettings *theDebuggerSettings()
     item->setSettingsKey("DebugMode", "UseToolTips");
 
     item = new SavedAction(instance);
-    instance->insertItem(UseDumpers, item);
-    item->setSettingsKey("DebugMode", "UseCustomDumpers");
-    item->setText(QObject::tr("Use custom dumpers"));
+    instance->insertItem(DisplayRawData, item);
+    item->setSettingsKey("DebugMode", "DisplayRawData");
+    item->setText(QObject::tr("Display raw data"));
     item->setCheckable(true);
 
     item = new SavedAction(instance);
-    instance->insertItem(BuildDumpersOnTheFly, item);
+    instance->insertItem(UseDefaultDumperLocation, item);
     item->setDefaultValue(true);
-    item->setSettingsKey("DebugMode", "BuildDumpersOnTheFly");
+    item->setSettingsKey("DebugMode", "UseDefaultDumperLocation");
     item->setCheckable(true);
 
     item = new SavedAction(instance);
-    instance->insertItem(UseQtDumpers, item);
-    item->setSettingsKey("DebugMode", "UseQtDumpers");
+    instance->insertItem(UseCustomDumperLocation, item);
+    item->setSettingsKey("DebugMode", "CustomDumperLocation");
     item->setCheckable(true);
 
     item = new SavedAction(instance);
-    instance->insertItem(UsePrebuiltDumpers, item);
-    item->setSettingsKey("DebugMode", "UsePrebuiltDumpers");
+    instance->insertItem(DisplayRawData, item);
+    item->setSettingsKey("DebugMode", "DisplayRawData");
     item->setCheckable(true);
 
     item = new SavedAction(instance);
-    instance->insertItem(PrebuiltDumpersLocation, item);
-    item->setSettingsKey("DebugMode", "PrebuiltDumpersLocation");
+    instance->insertItem(CustomDumperLocation, item);
+    item->setSettingsKey("DebugMode", "CustomDumperLocation");
 
     item = new SavedAction(instance);
     instance->insertItem(TerminalApplication, item);
@@ -305,6 +301,8 @@ DebuggerSettings *theDebuggerSettings()
     item = new SavedAction(instance);
     instance->insertItem(ListSourceFiles, item);
     item->setSettingsKey("DebugMode", "ListSourceFiles");
+    item->setText(QObject::tr("List source files"));
+    item->setCheckable(true);
 
     item = new SavedAction(instance);
     instance->insertItem(SkipKnownFrames, item);
diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h
index d49b7993b9d..5e6b986820f 100644
--- a/src/plugins/debugger/debuggeractions.h
+++ b/src/plugins/debugger/debuggeractions.h
@@ -87,11 +87,10 @@ enum DebuggerActionCode
     CollapseItem,
 
     RecheckDumpers,
-    UsePrebuiltDumpers,
-    UseQtDumpers,
-    PrebuiltDumpersLocation,
-    BuildDumpersOnTheFly,
-    UseDumpers,
+    DisplayRawData,
+    UseCustomDumperLocation,
+    UseDefaultDumperLocation,
+    CustomDumperLocation,
     DebugDumpers,
 
     // Source List
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 5fabcee1821..6477f969bbe 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -362,26 +362,24 @@ QWidget *DumperOptionPage::createPage(QWidget *parent)
     m_ui.dumperLocationChooser->setInitialBrowsePathBackup(
         Core::ICore::instance()->resourcePath() + "../../lib");
 
-    connect(m_ui.radioButtonUsePrebuiltDumpers, SIGNAL(toggled(bool)),
+    connect(m_ui.radioButtonUseCustomDumperLocation, SIGNAL(toggled(bool)),
         m_ui.dumperLocationChooser, SLOT(setEnabled(bool)));
 
     m_group.clear();
-    m_group.insert(theDebuggerAction(UseQtDumpers),
-        m_ui.radioButtonUseQtDumpers);
-    m_group.insert(theDebuggerAction(UsePrebuiltDumpers),
-        m_ui.radioButtonUsePrebuiltDumpers);
-    m_group.insert(theDebuggerAction(BuildDumpersOnTheFly),
-        m_ui.radioButtonBuildDumpersOnTheFly);
-    m_group.insert(theDebuggerAction(PrebuiltDumpersLocation),
+    m_group.insert(theDebuggerAction(DisplayRawData),
+        m_ui.radioButtonDisplayRawData);
+    m_group.insert(theDebuggerAction(UseCustomDumperLocation),
+        m_ui.radioButtonUseCustomDumperLocation);
+    m_group.insert(theDebuggerAction(UseDefaultDumperLocation),
+        m_ui.radioButtonUseDefaultDumperLocation);
+    m_group.insert(theDebuggerAction(CustomDumperLocation),
         m_ui.dumperLocationChooser);
 
-    m_group.insert(theDebuggerAction(UseDumpers),
-        m_ui.checkBoxUseDumpers);
     m_group.insert(theDebuggerAction(DebugDumpers),
         m_ui.checkBoxDebugDumpers);
 
     m_ui.dumperLocationChooser->
-        setEnabled(theDebuggerAction(UsePrebuiltDumpers)->value().toBool());
+        setEnabled(theDebuggerAction(UseCustomDumperLocation)->value().toBool());
 
 #ifndef QT_DEBUG
 #if 0
diff --git a/src/plugins/debugger/dumperoptionpage.ui b/src/plugins/debugger/dumperoptionpage.ui
index ce65d701f46..874ff24e184 100644
--- a/src/plugins/debugger/dumperoptionpage.ui
+++ b/src/plugins/debugger/dumperoptionpage.ui
@@ -20,27 +20,20 @@
       <string>Location of data dumper helper library</string>
      </property>
      <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0">
-       <widget class="QRadioButton" name="radioButtonUseQtDumpers">
-        <property name="text">
-         <string>Use Qt dumpers</string>
-        </property>
-       </widget>
-      </item>
       <item row="1" column="0">
-       <widget class="QRadioButton" name="radioButtonBuildDumpersOnTheFly">
+       <widget class="QRadioButton" name="radioButtonUseDefaultDumperLocation">
         <property name="toolTip">
-         <string>This is the slowest but safest option.</string>
+         <string>This will load a dumper library</string>
         </property>
         <property name="text">
-         <string>Build and load data dumpers on-the-fly</string>
+         <string>Use dumpers from default location</string>
         </property>
        </widget>
       </item>
       <item row="2" column="0">
-       <widget class="QRadioButton" name="radioButtonUsePrebuiltDumpers">
+       <widget class="QRadioButton" name="radioButtonUseCustomDumperLocation">
         <property name="text">
-         <string>Load pre-built data dumpers</string>
+         <string>Use dumpers from custom location</string>
         </property>
        </widget>
       </item>
@@ -74,6 +67,16 @@
         </item>
        </layout>
       </item>
+      <item row="0" column="0">
+       <widget class="QRadioButton" name="radioButtonDisplayRawData">
+        <property name="toolTip">
+         <string>This will disable nice display of Qt and Standard Library objects in the Locals&amp;Watchers view</string>
+        </property>
+        <property name="text">
+         <string>Do not use data dumpers</string>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
@@ -100,13 +103,6 @@
      </property>
     </widget>
    </item>
-   <item row="1" column="0">
-    <widget class="QCheckBox" name="checkBoxUseDumpers">
-     <property name="text">
-      <string>Use data dumpers</string>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
  <customwidgets>
diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp
index fa4e9330444..857c220f5d8 100644
--- a/src/plugins/debugger/gdbengine.cpp
+++ b/src/plugins/debugger/gdbengine.cpp
@@ -210,8 +210,8 @@ void GdbEngine::initializeConnections()
         q, SLOT(showApplicationOutput(QString)),
         Qt::QueuedConnection);
 
-    connect(theDebuggerAction(UseDumpers), SIGNAL(valueChanged(QVariant)),
-        this, SLOT(setUseDumpers(QVariant)));
+    connect(theDebuggerAction(DisplayRawData), SIGNAL(valueChanged(QVariant)),
+        this, SLOT(setDisplayRawData(QVariant)));
     connect(theDebuggerAction(DebugDumpers), SIGNAL(valueChanged(QVariant)),
         this, SLOT(setDebugDumpers(QVariant)));
     connect(theDebuggerAction(RecheckDumpers), SIGNAL(triggered()),
@@ -1077,7 +1077,7 @@ void GdbEngine::handleAqcuiredInferior()
     #if defined(Q_OS_MAC)
     sendCommand("info pid", GdbInfoProc, QVariant(), NeedsStop);
     #endif
-    if (theDebuggerBoolSetting(UseDumpers))
+    if (theDebuggerBoolSetting(ListSourceFiles))
         reloadSourceFiles();
     tryLoadCustomDumpers();
 
@@ -2849,7 +2849,7 @@ static void setWatchDataSAddress(WatchData &data, const GdbMi &mi)
         data.saddr = mi.data();
 }
 
-void GdbEngine::setUseDumpers(const QVariant &on)
+void GdbEngine::setDisplayRawData(const QVariant &on)
 {
     qDebug() << "SWITCHING ON/OFF DUMPER DEBUGGING:" << on;
     // FIXME: a bit too harsh, but otherwise the treeview sometimes look funny
@@ -2860,7 +2860,7 @@ void GdbEngine::setUseDumpers(const QVariant &on)
 
 bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
 {
-    if (!theDebuggerBoolSetting(UseDumpers))
+    if (theDebuggerBoolSetting(DisplayRawData))
         return false;
 
     if (q->startMode() == AttachCore) {
@@ -3989,17 +3989,12 @@ void GdbEngine::assignValueInDebugger(const QString &expression, const QString &
 
 QString GdbEngine::dumperLibraryName() const
 {
-    if (theDebuggerAction(UsePrebuiltDumpers)->value().toBool())
-        return theDebuggerAction(PrebuiltDumpersLocation)->value().toString();
-    if (theDebuggerAction(UseQtDumpers)->value().toBool())
+    if (theDebuggerAction(UseCustomDumperLocation)->value().toBool())
+        return theDebuggerAction(CustomDumperLocation)->value().toString();
+    if (theDebuggerAction(UseDefaultDumperLocation)->value().toBool())
         return q->m_dumperLib;
-#if defined(Q_OS_WIN)
-    return q->m_buildDir + "/qtc-gdbmacros/debug/gdbmacros.dll";
-#elif defined(Q_OS_MAC)
-    return q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.dylib";
-#else // generic UNIX
-    return q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.so";
-#endif
+    QTC_ASSERT(false, /**/);
+    return QString();
 }
 
 void GdbEngine::tryLoadCustomDumpers()
diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h
index 49b823e957b..07d2ee195df 100644
--- a/src/plugins/debugger/gdbengine.h
+++ b/src/plugins/debugger/gdbengine.h
@@ -131,7 +131,7 @@ private:
     void loadAllSymbols();
 
     Q_SLOT void setDebugDumpers(const QVariant &on);
-    Q_SLOT void setUseDumpers(const QVariant &on);
+    Q_SLOT void setDisplayRawData(const QVariant &on);
 
     //
     // Own stuff
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index e10d39319b6..816274d5431 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -177,7 +177,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
 
     menu.addSeparator();
     menu.addAction(theDebuggerAction(RecheckDumpers));
-    menu.addAction(theDebuggerAction(UseDumpers));
+    menu.addAction(theDebuggerAction(DisplayRawData));
     menu.addSeparator();
     menu.addAction(theDebuggerAction(SettingsDialog));
 
-- 
GitLab