changeset 21044:43b498b8c38c

always restore breakpoints of an editor file after saving * file-editor-tab.cc (save_file): always restore the breakpoints without checking preferences or asking the user; (notice_settings): no more preferences for restoring the breakpoints * file-editor-tab.h: removed obsolete class varaibale * settings-dialog.cc (settings_dialog, write_changed_settings): no more references for restoring breakpoints * settings-dialog.ui: removed tab for debugger settings
author Torsten <ttl@justmail.de>
date Thu, 07 Jan 2016 20:56:34 +0100
parents e2fdbdd00ef9
children 8190fe6dc3fd
files libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/settings-dialog.cc libgui/src/settings-dialog.ui
diffstat 4 files changed, 2 insertions(+), 187 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc
+++ b/libgui/src/m-editor/file-editor-tab.cc
@@ -1633,66 +1633,8 @@
     }
 
   // Attempt to restore the breakpoints if that is desired.
-  if (! list.isEmpty ())
-    {
-      bool restore_breakpoints;
-      if (_breakpoint_filesave_behavior == "RESTORE")
-        restore_breakpoints = true;
-      else if (_breakpoint_filesave_behavior == "DISCARD")
-        restore_breakpoints = false;
-      else
-        {
-          // ask user
-          QMessageBox *dlgBox = new QMessageBox (QMessageBox::Question,
-                                  tr ("Octave Editor"),
-                                  tr ("Would you like to restore adjusted breakpoints?"),
-                                  QMessageBox::Yes | QMessageBox::No, this);
-
-          // add checkbox whether to store the result in the settings
-          QCheckBox *checkBox = new QCheckBox ("Don't ask again.");
-          checkBox->setCheckState (Qt::Unchecked);
-          QVBoxLayout *extra = new QVBoxLayout (dlgBox);
-          extra->addWidget (checkBox);
-          QGridLayout *dialog_layout = dynamic_cast<QGridLayout*> (dlgBox->layout ());
-          dialog_layout->addLayout (extra,dialog_layout->rowCount (),0,
-                                    1,dialog_layout->columnCount ());
-
-          // shoe the dialog
-          dlgBox->exec ();
-
-          // evaluate result
-          QMessageBox::StandardButton clicked = dlgBox->standardButton (dlgBox->clickedButton ());
-          restore_breakpoints = (clicked == QMessageBox::Yes);
-
-          if (checkBox->checkState () == Qt::Checked)
-            {
-              // User no longer wants to be asked so save the setting for
-              // this object...
-              if (restore_breakpoints)
-                _breakpoint_filesave_behavior = "RESTORE";
-              else
-                _breakpoint_filesave_behavior = "DISCARD";
-
-              // ...and on disc (and Preferences...)
-              QSettings *settings = resource_manager::get_settings ();
-              if (settings)
-                {
-                  settings->setValue ("debugger/breakpoint_filesave_behavior",
-                                      _breakpoint_filesave_behavior);
-                  settings->sync ();
-                }
-            }
-
-          delete dlgBox;
-
-        }
-
-      if (restore_breakpoints)
-        {
-          for (int i = 0; i < list.length (); i++)
-            handle_request_add_breakpoint (list.value (i) + 1);
-        }
-    }
+  for (int i = 0; i < list.length (); i++)
+    handle_request_add_breakpoint (list.value (i) + 1);
 }
 
 void
@@ -2103,9 +2045,6 @@
   _long_title = settings->value ("editor/longWindowTitle", false).toBool ();
   update_window_title (_edit_area->isModified ());
 
-  _breakpoint_filesave_behavior = settings->value ("debugger/breakpoint_filesave_behavior", "ASK").
-                                                    toString ();
-
   _edit_area->setEdgeColumn (
               settings->value ("editor/long_line_column",80).toInt ());
   if (settings->value ("editor/long_line_marker",true).toBool ())
--- a/libgui/src/m-editor/file-editor-tab.h
+++ b/libgui/src/m-editor/file-editor-tab.h
@@ -272,8 +272,6 @@
   bool _always_reload_changed_files;
   bool _smart_indent;
 
-  QString _breakpoint_filesave_behavior;
-
   QFileSystemWatcher _file_system_watcher;
 
   find_dialog *_find_dialog;
--- a/libgui/src/settings-dialog.cc
+++ b/libgui/src/settings-dialog.cc
@@ -308,14 +308,6 @@
   ui->general_icon_graphic-> setChecked (widget_icon_set == "GRAPHIC");
   ui->general_icon_letter-> setChecked (widget_icon_set == "LETTER");
 
-  // how breakpoints should behave when file is saved
-  QString breakpoint_filesave_behavior =
-      settings->value ("debugger/breakpoint_filesave_behavior", "ASK").toString ();
-  ui->debugger_filesave_ask->setChecked (true);  // the default (if invalid set)
-  ui->debugger_filesave_ask->setChecked (breakpoint_filesave_behavior == "ASK");
-  ui->debugger_filesave_restore->setChecked (breakpoint_filesave_behavior == "RESTORE");
-  ui->debugger_filesave_discard->setChecked (breakpoint_filesave_behavior == "DISCARD");
-
   // custom title bar of dock widget
   QVariant default_var = QColor (255,255,255);
   QColor bg_color = settings->value ("Dockwidgets/title_bg_color",
@@ -720,15 +712,6 @@
 settings_dialog::write_changed_settings (bool closing)
 {
   QSettings *settings = resource_manager::get_settings ();
-  // FIXME: what should happen if settings is 0?
-
-  // how breakpoints should be treated when file is saved
-  QString breakpoint_filesave_behavior = "ASK";
-  if (ui->debugger_filesave_restore->isChecked ())
-    breakpoint_filesave_behavior = "RESTORE";
-  else if (ui->debugger_filesave_discard->isChecked ())
-    breakpoint_filesave_behavior = "DISCARD";
-  settings->setValue ("debugger/breakpoint_filesave_behavior", breakpoint_filesave_behavior);
 
   // the icon set
   QString widget_icon_set = "NONE";
--- a/libgui/src/settings-dialog.ui
+++ b/libgui/src/settings-dialog.ui
@@ -1499,111 +1499,6 @@
        </item>
       </layout>
      </widget>
-     <widget class="QWidget" name="tab_debugger">
-      <attribute name="title">
-       <string>Debugger</string>
-      </attribute>
-      <layout class="QVBoxLayout" name="vlayout_dbg_00">
-       <item>
-        <widget class="QScrollArea" name="scrollArea_8">
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="widgetResizable">
-          <bool>true</bool>
-         </property>
-         <widget class="QWidget" name="scrollAreaWidgetContents_9">
-          <property name="geometry">
-           <rect>
-            <x>0</x>
-            <y>0</y>
-            <width>658</width>
-            <height>571</height>
-           </rect>
-          </property>
-          <layout class="QVBoxLayout" name="vlayout_dbg_01">
-           <item>
-            <layout class="QVBoxLayout" name="vlayout_dbg_02">
-             <item>
-              <layout class="QGridLayout" name="glayout_dbg_01">
-               <item row="4" column="0">
-                <widget class="QGroupBox" name="groupbox_dbg_01">
-                 <property name="sizePolicy">
-                  <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-                   <horstretch>0</horstretch>
-                   <verstretch>0</verstretch>
-                  </sizepolicy>
-                 </property>
-                 <property name="title">
-                  <string>Breakpoint Retention Upon Saving File</string>
-                 </property>
-                 <widget class="QRadioButton" name="debugger_filesave_ask">
-                  <property name="geometry">
-                   <rect>
-                    <x>10</x>
-                    <y>20</y>
-                    <width>273</width>
-                    <height>21</height>
-                   </rect>
-                  </property>
-                  <property name="text">
-                   <string>Ask whether breakpoints should be restored</string>
-                  </property>
-                 </widget>
-                 <widget class="QRadioButton" name="debugger_filesave_restore">
-                  <property name="geometry">
-                   <rect>
-                    <x>10</x>
-                    <y>40</y>
-                    <width>231</width>
-                    <height>21</height>
-                   </rect>
-                  </property>
-                  <property name="text">
-                   <string>Automatically restore breakpoints</string>
-                  </property>
-                 </widget>
-                 <widget class="QRadioButton" name="debugger_filesave_discard">
-                  <property name="geometry">
-                   <rect>
-                    <x>10</x>
-                    <y>60</y>
-                    <width>231</width>
-                    <height>21</height>
-                   </rect>
-                  </property>
-                  <property name="text">
-                   <string>Discard breakpoints</string>
-                  </property>
-                 </widget>
-                </widget>
-               </item>
-              </layout>
-             </item>
-            </layout>
-           </item>
-           <item>
-            <spacer name="vspacer_dbg_01">
-             <property name="orientation">
-              <enum>Qt::Vertical</enum>
-             </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>20</width>
-               <height>40</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-          </layout>
-         </widget>
-        </widget>
-       </item>
-      </layout>
-     </widget>
      <widget class="QWidget" name="tab_terminal">
       <attribute name="title">
        <string>Terminal</string>