Mercurial > octave-nkf
diff libgui/src/shortcut-manager.cc @ 19895:19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Try to wrap long lines to < 80 characters.
Use GNU style and don't indent first brace of function definition.
"case" statement is aligned flush left with brace of switch stmt.
Remove trailing '\' line continuation from the end of #define macros.
Use 2 spaces for indent.
* files-dock-widget.cc, history-dock-widget.cc, main-window.cc, octave-cmd.cc,
octave-dock-widget.cc, octave-gui.cc, resource-manager.cc, settings-dialog.cc,
shortcut-manager.cc, welcome-wizard.cc, workspace-view.cc, cellfun.cc, data.cc,
debug.cc, debug.h, dirfns.cc, error.h, file-io.cc, gl-render.cc, gl-render.h,
gl2ps-renderer.h, graphics.cc, graphics.in.h, help.cc, input.cc, load-path.cc,
load-path.h, lookup.cc, lu.cc, oct-stream.cc, octave-default-image.h,
ordschur.cc, pr-output.cc, qz.cc, strfns.cc, symtab.cc, symtab.h, sysdep.cc,
variables.cc, zfstream.h, __fltk_uigetfile__.cc, __init_fltk__.cc,
__magick_read__.cc, __osmesa_print__.cc, audiodevinfo.cc, ov-classdef.cc,
ov-classdef.h, ov-fcn.h, ov-float.cc, ov-flt-complex.cc, ov-java.cc,
ov-range.cc, ov-re-mat.cc, ov-usr-fcn.h, ov.cc, op-int.h, options-usage.h,
pt-eval.cc, Array-C.cc, Array-fC.cc, Array.cc, Array.h, PermMatrix.cc,
Sparse.cc, chMatrix.h, dSparse.cc, dim-vector.h, bsxfun-decl.h, bsxfun-defs.cc,
oct-norm.cc, Sparse-op-defs.h, oct-inttypes.cc, oct-inttypes.h, main.in.cc,
mkoctfile.in.cc: Cleanup C++ code to follow Octave coding conventions.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 25 Feb 2015 11:55:49 -0800 |
parents | 4197fc428c7d |
children | 62b73798a84f |
line wrap: on
line diff
--- a/libgui/src/shortcut-manager.cc Wed Feb 25 16:23:45 2015 +0100 +++ b/libgui/src/shortcut-manager.cc Wed Feb 25 11:55:49 2015 -0800 @@ -170,13 +170,16 @@ init (tr ("Reset Window Layout"), "main_window:reset", QKeySequence ()); // help - init (tr ("Show Ondisk Documentation"), "main_help:ondisk_doc", QKeySequence ()); - init (tr ("Show Online Documentation"), "main_help:online_doc", QKeySequence ()); + init (tr ("Show Ondisk Documentation"), "main_help:ondisk_doc", + QKeySequence ()); + init (tr ("Show Online Documentation"), "main_help:online_doc", + QKeySequence ()); init (tr ("Report a Bug"), "main_help:report_bug", QKeySequence ()); init (tr ("Octave Packages"), "main_help:packages", QKeySequence ()); init (tr ("Share Code"), "main_help:agora", QKeySequence ()); init (tr ("Contribute to Octave"), "main_help:contribute", QKeySequence ()); - init (tr ("Octave Developer Resources"), "main_help:developer", QKeySequence ()); + init (tr ("Octave Developer Resources"), "main_help:developer", + QKeySequence ()); init (tr ("About Octave"), "main_help:about", QKeySequence ()); // news @@ -273,11 +276,15 @@ QKeySequence ()); // view - init (tr ("Show Line Numbers"), "editor_view:show_line_numbers", QKeySequence ()); - init (tr ("Show White Spaces"), "editor_view:show_white_spaces", QKeySequence ()); + init (tr ("Show Line Numbers"), "editor_view:show_line_numbers", + QKeySequence ()); + init (tr ("Show White Spaces"), "editor_view:show_white_spaces", + QKeySequence ()); init (tr ("Show Line Endings"), "editor_view:show_eol_chars", QKeySequence ()); - init (tr ("Show Indentation Guides"), "editor_view:show_ind_guides", QKeySequence ()); - init (tr ("Show Long Line Marker"), "editor_view:show_long_line", QKeySequence ()); + init (tr ("Show Indentation Guides"), "editor_view:show_ind_guides", + QKeySequence ()); + init (tr ("Show Long Line Marker"), "editor_view:show_long_line", + QKeySequence ()); init (tr ("Zoom In"), "editor_view:zoom_in", QKeySequence::ZoomIn); init (tr ("Zoom Out"), "editor_view:zoom_out", QKeySequence::ZoomOut); #if defined (Q_OS_MAC) @@ -305,15 +312,19 @@ QKeySequence (prefix + Qt::Key_F9) ); // help - init (tr ("Help on Keyword"), "editor_help:help_keyword", QKeySequence::HelpContents); - init (tr ("Document on Keyword"), "editor_help:doc_keyword", QKeySequence (Qt::SHIFT + Qt::Key_F1)); + init (tr ("Help on Keyword"), "editor_help:help_keyword", + QKeySequence::HelpContents); + init (tr ("Document on Keyword"), "editor_help:doc_keyword", + QKeySequence (Qt::SHIFT + Qt::Key_F1)); } void shortcut_manager::init (QString description, QString key, QKeySequence def_sc) { - QKeySequence actual_0 = QKeySequence (_settings->value ("shortcuts/"+key, def_sc).toString ()); - QKeySequence actual_1 = QKeySequence (_settings->value ("shortcuts/"+key+"_1", def_sc).toString ()); + QKeySequence actual_0 + = QKeySequence (_settings->value ("shortcuts/"+key, def_sc).toString ()); + QKeySequence actual_1 + = QKeySequence (_settings->value ("shortcuts/"+key+"_1", def_sc).toString ()); // append the new shortcut to the list shortcut_t shortcut_info; @@ -328,9 +339,11 @@ // insert shortcut prepended by widget in order check for duplicates later QString widget = key.section ('_',0,0); // get widget that uses the shortcut if (! actual_0.isEmpty ()) - _shortcut_hash[widget + ":" + actual_0.toString ()] = _sc.count (); // offset of 1 to avoid 0 + _shortcut_hash[widget + ":" + actual_0.toString ()] = + _sc.count (); // offset of 1 to avoid 0 if (! actual_1.isEmpty ()) - _shortcut_hash[widget + "_1:" + actual_1.toString ()] = _sc.count (); // offset of 1 to avoid 0 + _shortcut_hash[widget + "_1:" + actual_1.toString ()] = + _sc.count (); // offset of 1 to avoid 0 _action_hash[key] = _sc.count (); // offset of 1 to avoid 0 } @@ -419,7 +432,8 @@ // write one or all actual shortcut set(s) into a settings file void -shortcut_manager::do_write_shortcuts (int set, QSettings* settings, bool closing) +shortcut_manager::do_write_shortcuts (int set, QSettings* settings, + bool closing) { if (set) { @@ -440,7 +454,7 @@ settings->setValue("shortcuts/"+_sc.at (i).settings_key, _sc.at (i).actual_sc[0].toString ()); settings->setValue("shortcuts/"+_sc.at (i).settings_key+"_1", - _sc.at (i).actual_sc[1].toString ()); + _sc.at (i).actual_sc[1].toString ()); } if (closing) @@ -477,13 +491,13 @@ { switch (col) { - case 2: - case 4: - _selected_set = col/2 - 1; - break; + case 2: + case 4: + _selected_set = col/2 - 1; + break; - default: - return; + default: + return; } int i = _item_index_hash[item]; @@ -511,7 +525,8 @@ help->setWordWrap (true); box->addWidget (help); - QCheckBox *direct = new QCheckBox (tr ("Enter shortcut directly by performing it")); + QCheckBox *direct = new QCheckBox ( + tr ("Enter shortcut directly by performing it")); direct->setCheckState (Qt::Checked); box->addWidget (direct); @@ -604,7 +619,8 @@ shortcut_t shortcut = _sc.at (_handled_index); if (! shortcut.actual_sc[_selected_set].isEmpty ()) - _shortcut_hash.remove (widget + sep + shortcut.actual_sc[_selected_set].toString ()); + _shortcut_hash.remove (widget + sep + + shortcut.actual_sc[_selected_set].toString ()); shortcut.actual_sc[_selected_set] = _edit_actual->text(); _sc.replace (_handled_index, shortcut); @@ -613,7 +629,7 @@ if (! shortcut.actual_sc[_selected_set].isEmpty ()) _shortcut_hash[widget + sep + shortcut.actual_sc[_selected_set].toString ()] = - _handled_index + 1; + _handled_index + 1; } void @@ -719,13 +735,13 @@ Qt::KeyboardModifiers modifiers = e->modifiers (); - if(modifiers & Qt::ShiftModifier) + if (modifiers & Qt::ShiftModifier) key += Qt::SHIFT; - if(modifiers & Qt::ControlModifier) + if (modifiers & Qt::ControlModifier) key += Qt::CTRL; - if(modifiers & Qt::AltModifier) + if (modifiers & Qt::AltModifier) key += Qt::ALT; - if(modifiers & Qt::MetaModifier) + if (modifiers & Qt::MetaModifier) key += Qt::META; setText (QKeySequence(key));