comparison libgui/src/set-path-model.cc @ 27935:f1844e33f621

maint: Use Octave coding conventions in libgui/ directory. * Table.cc, qt-graphics-toolkit.cc, documentation.cc, documentation.h, files-dock-widget.cc, find-files-dialog.cc, gui-preferences-cs.h, gui-preferences-dw.h, gui-preferences-ed.h, gui-preferences-ff.h, gui-preferences-mw.h, gui-preferences-sc.h, history-dock-widget.cc, file-editor-tab.cc, file-editor.cc, find-dialog.cc, octave-qscintilla.cc, main-window.cc, octave-dock-widget.cc, octave-qobject.cc, resource-manager.cc, set-path-dialog.cc, set-path-model.cc, settings-dialog.cc, settings-dialog.h, shortcut-manager.cc, tab-bar.cc, variable-editor.cc, workspace-model.cc, workspace-model.h, workspace-view.cc: Use Octave coding conventions in libgui/ directory.
author Rik <rik@octave.org>
date Sun, 12 Jan 2020 09:33:21 -0800
parents bd51beb6205e
children 1ac5a76ae91d 0a5b15007766
comparison
equal deleted inserted replaced
27934:49a0d90cd2a3 27935:f1844e33f621
112 void set_path_model::revert (void) 112 void set_path_model::revert (void)
113 { 113 {
114 clear (); 114 clear ();
115 115
116 beginInsertRows (QModelIndex (), 0, m_orig_dirs.size () - 1); 116 beginInsertRows (QModelIndex (), 0, m_orig_dirs.size () - 1);
117 m_dirs = m_orig_dirs; 117 m_dirs = m_orig_dirs;
118 endInsertRows (); 118 endInsertRows ();
119 119
120 model_to_path (); 120 model_to_path ();
121 } 121 }
122 122
123 void set_path_model::revert_last (void) 123 void set_path_model::revert_last (void)
124 { 124 {
125 clear (); 125 clear ();
126 126
127 beginInsertRows (QModelIndex (), 0, m_last_dirs.size () - 1); 127 beginInsertRows (QModelIndex (), 0, m_last_dirs.size () - 1);
128 m_dirs = m_last_dirs; 128 m_dirs = m_last_dirs;
129 endInsertRows (); 129 endInsertRows ();
130 130
131 model_to_path (); 131 model_to_path ();
132 } 132 }
133 133
153 for (int i = indices.size () - 1; i >= 0; i--) 153 for (int i = indices.size () - 1; i >= 0; i--)
154 { 154 {
155 const QModelIndex& idx = indices.at (i); 155 const QModelIndex& idx = indices.at (i);
156 156
157 beginRemoveRows (idx, idx.row (), idx.row ()); 157 beginRemoveRows (idx, idx.row (), idx.row ());
158 m_dirs.removeAt (idx.row ()); 158 m_dirs.removeAt (idx.row ());
159 endRemoveRows (); 159 endRemoveRows ();
160 } 160 }
161 161
162 model_to_path (); 162 model_to_path ();
163 } 163 }
174 continue; // already at top position 174 continue; // already at top position
175 175
176 beginMoveRows (idx, idx.row (), idx.row (), 176 beginMoveRows (idx, idx.row (), idx.row (),
177 this->index (idx.row () - 1), idx.row () - 1); 177 this->index (idx.row () - 1), idx.row () - 1);
178 178
179 m_dirs.move (idx.row (), idx.row () - 1); 179 m_dirs.move (idx.row (), idx.row () - 1);
180 180
181 endMoveRows (); 181 endMoveRows ();
182 } 182 }
183 183
184 model_to_path (); 184 model_to_path ();
197 continue; // already at bottom position 197 continue; // already at bottom position
198 198
199 beginMoveRows (idx, idx.row (), idx.row (), 199 beginMoveRows (idx, idx.row (), idx.row (),
200 this->index (idx.row () + 1), idx.row () + 1); 200 this->index (idx.row () + 1), idx.row () + 1);
201 201
202 m_dirs.move (idx.row (), idx.row () + 1); 202 m_dirs.move (idx.row (), idx.row () + 1);
203 203
204 endMoveRows (); 204 endMoveRows ();
205 } 205 }
206 206
207 model_to_path (); 207 model_to_path ();
218 if (idx.row () == i) 218 if (idx.row () == i)
219 continue; // already at target position 219 continue; // already at target position
220 220
221 beginMoveRows (idx, idx.row (), idx.row (), this->index (i), i); 221 beginMoveRows (idx, idx.row (), idx.row (), this->index (i), i);
222 222
223 m_dirs.move (idx.row (), i); 223 m_dirs.move (idx.row (), i);
224 224
225 endMoveRows (); 225 endMoveRows ();
226 } 226 }
227 227
228 model_to_path (); 228 model_to_path ();
241 continue; // already at target position 241 continue; // already at target position
242 242
243 beginMoveRows (idx, idx.row (), idx.row (), 243 beginMoveRows (idx, idx.row (), idx.row (),
244 this->index (target), target); 244 this->index (target), target);
245 245
246 m_dirs.move (idx.row (), target); 246 m_dirs.move (idx.row (), target);
247 247
248 endMoveRows (); 248 endMoveRows ();
249 } 249 }
250 250
251 model_to_path (); 251 model_to_path ();