Mercurial > hg > octave-nkf
changeset 17790:86c6ae5f969e
Use GNU style coding conventions for code in libgui/
* libgui/qterminal/libqterminal/QTerminal.h, libgui/src/color-picker.cc,
libgui/src/color-picker.h, libgui/src/dialog.cc, libgui/src/dialog.h,
libgui/src/documentation-dock-widget.cc, libgui/src/files-dock-widget.cc,
libgui/src/files-dock-widget.h, libgui/src/find-files-dialog.cc,
libgui/src/find-files-dialog.h, libgui/src/find-files-model.cc,
libgui/src/find-files-model.h, libgui/src/history-dock-widget.cc,
libgui/src/history-dock-widget.h, libgui/src/m-editor/file-editor-interface.h,
libgui/src/m-editor/file-editor-tab.cc, libgui/src/m-editor/file-editor-tab.h,
libgui/src/m-editor/file-editor.cc, libgui/src/m-editor/find-dialog.cc,
libgui/src/m-editor/find-dialog.h, libgui/src/m-editor/octave-qscintilla.cc,
libgui/src/main-window.cc, libgui/src/main-window.h,
libgui/src/news-dock-widget.h, libgui/src/octave-dock-widget.cc,
libgui/src/octave-dock-widget.h, libgui/src/octave-gui.cc,
libgui/src/octave-qt-link.cc, libgui/src/octave-qt-link.h,
libgui/src/qtinfo/parser.cc, libgui/src/qtinfo/parser.h,
libgui/src/qtinfo/webinfo.cc, libgui/src/qtinfo/webinfo.h,
libgui/src/resource-manager.cc, libgui/src/settings-dialog.cc,
libgui/src/settings-dialog.h, libgui/src/terminal-dock-widget.cc,
libgui/src/welcome-wizard.cc, libgui/src/workspace-model.cc,
libgui/src/workspace-model.h, libgui/src/workspace-view.cc,
libgui/src/workspace-view.h:
Use GNU style coding conventions for code in libgui/
line wrap: on
line diff
--- a/libgui/qterminal/libqterminal/QTerminal.h +++ b/libgui/qterminal/libqterminal/QTerminal.h @@ -56,11 +56,11 @@ virtual QString selectedText () = 0; enum CursorType - { - UnderlineCursor, - BlockCursor, - IBeamCursor - }; + { + UnderlineCursor, + BlockCursor, + IBeamCursor + }; virtual void setCursorType (CursorType type, bool blinking) { @@ -96,7 +96,7 @@ _paste_action->setEnabled (cb->text().length() > 0); _copy_action->setEnabled (selectedText().length() > 0); - + _contextMenu->move (mapToGlobal (at)); _contextMenu->show (); } @@ -112,12 +112,12 @@ _contextMenu = new QMenu (this); _copy_action = _contextMenu->addAction ( - QIcon (":/actions/icons/editcopy.png"), - tr ("Copy"), this, SLOT (copyClipboard ())); + QIcon (":/actions/icons/editcopy.png"), + tr ("Copy"), this, SLOT (copyClipboard ())); _paste_action = _contextMenu->addAction ( - QIcon (":/actions/icons/editpaste.png"), - tr ("Paste"), this, SLOT (pasteClipboard ())); + QIcon (":/actions/icons/editpaste.png"), + tr ("Paste"), this, SLOT (pasteClipboard ())); _contextMenu->addSeparator (); @@ -142,9 +142,9 @@ private: - QMenu *_contextMenu; - QAction * _copy_action; - QAction * _paste_action; + QMenu *_contextMenu; + QAction * _copy_action; + QAction * _paste_action; }; #endif // QTERMINAL_H
--- a/libgui/src/color-picker.cc +++ b/libgui/src/color-picker.cc @@ -31,9 +31,9 @@ { _color = old_color; setFlat (true); - setFocusPolicy(Qt::NoFocus); // no focus, would changes the color + setFocusPolicy (Qt::NoFocus); // no focus, would changes the color update_button (); - connect(this, SIGNAL (clicked ()), SLOT (select_color ())); + connect (this, SIGNAL (clicked ()), SLOT (select_color ())); } // slot for bitton clicked: selct a new color using QColorDialog @@ -56,12 +56,12 @@ QWidget *p = parentWidget (); QString bordercolor - = p ? p->palette().text().color().name() : QString ("#000000"); + = p ? p->palette ().text ().color ().name () : QString ("#000000"); - QString css = QString("background-color: %1; border: 1px solid %2;") - .arg(_color.name()) - .arg(bordercolor); + QString css = QString ("background-color: %1; border: 1px solid %2;") + .arg (_color.name ()) + .arg (bordercolor); - setStyleSheet(css); + setStyleSheet (css); repaint (); }
--- a/libgui/src/color-picker.h +++ b/libgui/src/color-picker.h @@ -35,7 +35,7 @@ Q_OBJECT public: - color_picker (QColor color = QColor(0,0,0), QWidget *parent = 0); + color_picker (QColor color = QColor (0,0,0), QWidget *parent = 0); QColor color () const { return _color; } private slots:
--- a/libgui/src/dialog.cc +++ b/libgui/src/dialog.cc @@ -46,7 +46,8 @@ QUIWidgetCreator::QUIWidgetCreator (void) : QObject (), dialog_result (-1), dialog_button (), - string_list (new QStringList ()), list_index (new QIntList ()), path_name (new QString ()) + string_list (new QStringList ()), list_index (new QIntList ()), + path_name (new QString ()) { } @@ -264,7 +265,7 @@ mainLayout->addLayout (buttonsLayout); setLayout (mainLayout); if (fixed_layout) - layout()->setSizeConstraint (QLayout::SetFixedSize); + layout ()->setSizeConstraint (QLayout::SetFixedSize); // If empty, make blank rather than use default OS behavior. setWindowTitle (title.isEmpty () ? " " : title); @@ -330,64 +331,64 @@ #define LINE_EDIT_FOLLOWS_PROMPT 0 #if LINE_EDIT_FOLLOWS_PROMPT - // Prompt on left followed by input on right. - QGridLayout *promptInputLayout = new QGridLayout; + // Prompt on left followed by input on right. + QGridLayout *promptInputLayout = new QGridLayout; #else - // Prompt aligned above input. - QVBoxLayout *promptInputLayout = new QVBoxLayout; + // Prompt aligned above input. + QVBoxLayout *promptInputLayout = new QVBoxLayout; #endif - int N_gridrows = prompt.size (); - for (int i = 0; i < N_gridrows; i++) - { - QLabel *label = new QLabel (prompt.at (i)); - QLineEdit *line_edit = new QLineEdit (defaults.at (i)); - if (nr.at (i) > 0) - { - QSize qsize = line_edit->sizeHint (); - int intval = qsize.height () * nr.at (i); - line_edit->setFixedHeight (intval); - if (nc.at (i) > 0) - { - intval = qsize.height () * nc.at (i) / 2; - line_edit->setFixedWidth (intval); - } - } - input_line << line_edit; + int N_gridrows = prompt.size (); + for (int i = 0; i < N_gridrows; i++) + { + QLabel *label = new QLabel (prompt.at (i)); + QLineEdit *line_edit = new QLineEdit (defaults.at (i)); + if (nr.at (i) > 0) + { + QSize qsize = line_edit->sizeHint (); + int intval = qsize.height () * nr.at (i); + line_edit->setFixedHeight (intval); + if (nc.at (i) > 0) + { + intval = qsize.height () * nc.at (i) / 2; + line_edit->setFixedWidth (intval); + } + } + input_line << line_edit; #if LINE_EDIT_FOLLOWS_PROMPT - promptInputLayout->addWidget (label, i + 1, 0); - promptInputLayout->addWidget (line_edit, i + 1, 1); + promptInputLayout->addWidget (label, i + 1, 0); + promptInputLayout->addWidget (line_edit, i + 1, 1); #else - promptInputLayout->addWidget (label); - promptInputLayout->addWidget (line_edit); + promptInputLayout->addWidget (label); + promptInputLayout->addWidget (line_edit); #endif - } + } #undef LINE_EDIT_FOLLOWS_PROMPT - QPushButton *buttonOk = new QPushButton("OK"); - QPushButton *buttonCancel = new QPushButton("Cancel"); - QHBoxLayout *buttonsLayout = new QHBoxLayout; - buttonsLayout->addStretch (1); - buttonsLayout->addWidget (buttonOk); - buttonsLayout->addWidget (buttonCancel); + QPushButton *buttonOk = new QPushButton ("OK"); + QPushButton *buttonCancel = new QPushButton ("Cancel"); + QHBoxLayout *buttonsLayout = new QHBoxLayout; + buttonsLayout->addStretch (1); + buttonsLayout->addWidget (buttonOk); + buttonsLayout->addWidget (buttonCancel); - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addLayout (promptInputLayout); - mainLayout->addSpacing (12); - mainLayout->addLayout (buttonsLayout); - setLayout (mainLayout); + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addLayout (promptInputLayout); + mainLayout->addSpacing (12); + mainLayout->addLayout (buttonsLayout); + setLayout (mainLayout); - // If empty, make blank rather than use default OS behavior. - setWindowTitle (title.isEmpty () ? " " : title); + // If empty, make blank rather than use default OS behavior. + setWindowTitle (title.isEmpty () ? " " : title); - connect (buttonOk, SIGNAL (clicked ()), - this, SLOT (buttonOk_clicked ())); + connect (buttonOk, SIGNAL (clicked ()), + this, SLOT (buttonOk_clicked ())); - connect (buttonCancel, SIGNAL (clicked ()), - this, SLOT (buttonCancel_clicked ())); + connect (buttonCancel, SIGNAL (clicked ()), + this, SLOT (buttonCancel_clicked ())); - connect (this, SIGNAL (finish_input (const QStringList&, int)), - &uiwidget_creator, - SLOT (input_finished (const QStringList&, int))); + connect (this, SIGNAL (finish_input (const QStringList&, int)), + &uiwidget_creator, + SLOT (input_finished (const QStringList&, int))); } @@ -413,7 +414,7 @@ done (QDialog::Rejected); } - + void InputDialog::reject (void) { @@ -423,7 +424,7 @@ FileDialog::FileDialog (const QStringList& name_filters, const QString& title, const QString& filename, const QString& dirname, const QString& multimode) - : QFileDialog() + : QFileDialog () { // Create a NonModal message. setWindowModality (Qt::NonModal); @@ -438,10 +439,10 @@ } else if (multimode == "create") // uiputfile { - setFileMode (QFileDialog::AnyFile); + setFileMode (QFileDialog::AnyFile); setAcceptMode (QFileDialog::AcceptSave); setOption (QFileDialog::DontConfirmOverwrite, false); - setConfirmOverwrite(true); + setConfirmOverwrite (true); } else if (multimode == "dir") // uigetdir { @@ -459,7 +460,7 @@ setNameFilters (name_filters); selectFile (filename); - + connect (this, SIGNAL (finish_input (const QStringList&, const QString&, int)), &uiwidget_creator, @@ -476,7 +477,7 @@ } -void FileDialog::accept(void) +void FileDialog::accept (void) { QStringList string_result; QString path; @@ -495,7 +496,7 @@ QStringList name_filters = nameFilters (); idx = name_filters.indexOf (selectedNameFilter ()) + 1; - + // send the selected info emit finish_input (string_result, path, idx); done (QDialog::Accepted);
--- a/libgui/src/dialog.h +++ b/libgui/src/dialog.h @@ -104,8 +104,8 @@ const QStringList *get_string_list (void) { return string_list; } - bool signal_filedialog (const QStringList& filters, const QString& title, - const QString& filename, const QString& dirname, + bool signal_filedialog (const QStringList& filters, const QString& title, + const QString& filename, const QString& dirname, const QString &multimode) { emit create_filedialog (filters, title, filename, dirname, multimode); @@ -252,7 +252,7 @@ public: explicit FileDialog (const QStringList& filters, - const QString& title, const QString& filename, + const QString& title, const QString& filename, const QString& dirname, const QString& multimode); signals:
--- a/libgui/src/documentation-dock-widget.cc +++ b/libgui/src/documentation-dock-widget.cc @@ -37,8 +37,8 @@ _webinfo = new webinfo (this); setWidget (_webinfo); - connect (p, SIGNAL(show_doc_signal(const QString &)), - this, SLOT(showDoc(const QString &))); + connect (p, SIGNAL (show_doc_signal (const QString &)), + this, SLOT (showDoc (const QString &))); } void
--- a/libgui/src/files-dock-widget.cc +++ b/libgui/src/files-dock-widget.cc @@ -63,7 +63,7 @@ : octave_dock_widget (p) { setObjectName ("FilesDockWidget"); - setWindowIcon (QIcon(":/actions/icons/logo.png")); + setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("File Browser")); setToolTip (tr ("Browse your files.")); @@ -84,53 +84,60 @@ _current_directory = new QComboBox (_navigation_tool_bar); _current_directory->setToolTip (tr ("Enter the path or filename")); - _current_directory->setEditable(true); - _current_directory->setMaxCount(MaxMRUDirs); - _current_directory->setInsertPolicy(QComboBox::NoInsert); - _current_directory->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon); - QSizePolicy sizePol(QSizePolicy::Expanding, QSizePolicy::Preferred); - _current_directory->setSizePolicy(sizePol); + _current_directory->setEditable (true); + _current_directory->setMaxCount (MaxMRUDirs); + _current_directory->setInsertPolicy (QComboBox::NoInsert); + _current_directory->setSizeAdjustPolicy ( + QComboBox::AdjustToMinimumContentsLengthWithIcon); + QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred); + _current_directory->setSizePolicy (sizePol); - QAction *directory_up_action = new QAction (QIcon(":/actions/icons/up.png"), + QAction *directory_up_action = new QAction (QIcon (":/actions/icons/up.png"), "", _navigation_tool_bar); directory_up_action->setToolTip (tr ("Move up one directory")); - _sync_browser_directory_action = new QAction (QIcon(":/actions/icons/reload.png"), - tr("Show octave directory"), _navigation_tool_bar); - _sync_browser_directory_action->setToolTip (tr ("Goto current octave directory")); + _sync_browser_directory_action + = new QAction (QIcon (":/actions/icons/reload.png"), + tr ("Show octave directory"), _navigation_tool_bar); + _sync_browser_directory_action->setToolTip ( + tr ("Goto current octave directory")); _sync_browser_directory_action->setEnabled ("false"); - _sync_octave_directory_action = new QAction (QIcon(":/actions/icons/ok.png"), - tr("Set octave directory"), _navigation_tool_bar); - _sync_octave_directory_action->setToolTip (tr ("Set octave directroy to current browser directory")); + _sync_octave_directory_action + = new QAction (QIcon (":/actions/icons/ok.png"), + tr ("Set octave directory"), _navigation_tool_bar); + _sync_octave_directory_action->setToolTip ( + tr ("Set octave directroy to current browser directory")); _sync_octave_directory_action->setEnabled ("false"); - QToolButton * popdown_button = new QToolButton(); - popdown_button->setToolTip(tr ("Actions on current directory")); - QMenu * popdown_menu = new QMenu(); + QToolButton * popdown_button = new QToolButton (); + popdown_button->setToolTip (tr ("Actions on current directory")); + QMenu * popdown_menu = new QMenu (); popdown_menu->addAction (QIcon (":/actions/icons/home.png"), tr ("Show Home directory"), this, SLOT (popdownmenu_home (bool))); - popdown_menu->addAction(_sync_browser_directory_action); - popdown_menu->addAction(_sync_octave_directory_action); - popdown_button->setMenu(popdown_menu); - popdown_button->setPopupMode(QToolButton::InstantPopup); - popdown_button->setDefaultAction(new QAction(QIcon(":/actions/icons/gear.png"),"", _navigation_tool_bar)); + popdown_menu->addAction (_sync_browser_directory_action); + popdown_menu->addAction (_sync_octave_directory_action); + popdown_button->setMenu (popdown_menu); + popdown_button->setPopupMode (QToolButton::InstantPopup); + popdown_button->setDefaultAction (new QAction ( + QIcon (":/actions/icons/gear.png"), "", + _navigation_tool_bar)); - popdown_menu->addSeparator(); + popdown_menu->addSeparator (); popdown_menu->addAction (QIcon (":/actions/icons/search.png"), tr ("Search directory"), this, SLOT (popdownmenu_search_dir (bool))); - popdown_menu->addSeparator(); - popdown_menu->addAction( tr ("Find Files ..."), - this, SLOT(popdownmenu_findfiles(bool))); - popdown_menu->addSeparator(); - popdown_menu->addAction(QIcon(":/actions/icons/filenew.png"), - tr ("New File"), - this, SLOT(popdownmenu_newfile(bool))); - popdown_menu->addAction(QIcon(":/actions/icons/folder_new.png"), - tr ("New Directory"), - this, SLOT(popdownmenu_newdir(bool))); + popdown_menu->addSeparator (); + popdown_menu->addAction ( tr ("Find Files ..."), + this, SLOT (popdownmenu_findfiles (bool))); + popdown_menu->addSeparator (); + popdown_menu->addAction (QIcon (":/actions/icons/filenew.png"), + tr ("New File"), + this, SLOT (popdownmenu_newfile (bool))); + popdown_menu->addAction (QIcon (":/actions/icons/folder_new.png"), + tr ("New Directory"), + this, SLOT (popdownmenu_newdir (bool))); _navigation_tool_bar->addWidget (_current_directory); _navigation_tool_bar->addAction (directory_up_action); @@ -148,7 +155,7 @@ _file_system_model = new QFileSystemModel (this); _file_system_model->setFilter (QDir::NoDotAndDotDot | QDir::AllEntries); QModelIndex rootPathIndex = _file_system_model->setRootPath ( - curr_dir.absolutePath ()); + curr_dir.absolutePath ()); // Attach the model to the QTreeView and set the root index _file_tree_view = new FileTreeViewer (container); @@ -162,26 +169,31 @@ // get sort column and order as well as cloumn state (order and width) QSettings *settings = resource_manager::get_settings (); - // FIXME -- what should happen if settings is 0? + // FIXME: what should happen if settings is 0? _file_tree_view->sortByColumn ( - settings->value ("filesdockwidget/sort_files_by_column",0).toInt (), - static_cast<Qt::SortOrder>(settings->value ("filesdockwidget/sort_files_by_order",Qt::AscendingOrder).toUInt ()) + settings->value ("filesdockwidget/sort_files_by_column",0).toInt (), + static_cast<Qt::SortOrder> + (settings->value ("filesdockwidget/sort_files_by_order", + Qt::AscendingOrder).toUInt ()) ); - _file_tree_view->header ()->restoreState (settings->value ("filesdockwidget/column_state").toByteArray ()); - - QStringList mru_dirs = settings->value ("filesdockwidget/mru_dir_list").toStringList (); - _current_directory->addItems(mru_dirs); + _file_tree_view->header ()->restoreState ( + settings->value ("filesdockwidget/column_state").toByteArray ()); - _current_directory->setEditText(_file_system_model->fileInfo (rootPathIndex). - absoluteFilePath ()); + QStringList mru_dirs = + settings->value ("filesdockwidget/mru_dir_list").toStringList (); + _current_directory->addItems (mru_dirs); + + _current_directory->setEditText ( + _file_system_model->fileInfo (rootPathIndex). absoluteFilePath ()); connect (_file_tree_view, SIGNAL (doubleClicked (const QModelIndex &)), this, SLOT (item_double_clicked (const QModelIndex &))); // add context menu to tree_view - _file_tree_view->setContextMenuPolicy(Qt::CustomContextMenu); - connect(_file_tree_view, SIGNAL(customContextMenuRequested(const QPoint &)), - this, SLOT(contextmenu_requested(const QPoint &))); + _file_tree_view->setContextMenuPolicy (Qt::CustomContextMenu); + connect (_file_tree_view, + SIGNAL (customContextMenuRequested (const QPoint &)), + this, SLOT (contextmenu_requested (const QPoint &))); // Layout the widgets vertically with the toolbar on top QVBoxLayout *vbox_layout = new QVBoxLayout (); @@ -192,10 +204,11 @@ container->setLayout (vbox_layout); - // TODO: Add right-click contextual menus for copying, pasting, deleting files (and others) + // TODO: Add right-click contextual menus for copying, pasting, + // deleting files (and others). - connect (_current_directory->lineEdit(), SIGNAL (returnPressed ()), - this, SLOT (accept_directory_line_edit ())); + connect (_current_directory->lineEdit (), SIGNAL (returnPressed ()), + this, SLOT (accept_directory_line_edit ())); connect (_current_directory, SIGNAL (activated (const QString &)), this, SLOT (set_current_directory (const QString &))); @@ -207,7 +220,7 @@ _current_directory->setCompleter (completer); setFocusProxy (_current_directory); - + _sync_octave_dir = true; // default, overwirtten with notice_settings () _octave_dir = ""; } @@ -219,13 +232,14 @@ Qt::SortOrder sort_order = _file_tree_view->header ()->sortIndicatorOrder (); settings->setValue ("filesdockwidget/sort_files_by_column", sort_column); settings->setValue ("filesdockwidget/sort_files_by_order", sort_order); - settings->setValue ("filesdockwidget/column_state", _file_tree_view->header ()->saveState ()); + settings->setValue ("filesdockwidget/column_state", + _file_tree_view->header ()->saveState ()); QStringList dirs; - for(int i=0; i< _current_directory->count(); i++) - { - dirs.append(_current_directory->itemText(i)); - } + for (int i=0; i< _current_directory->count (); i++) + { + dirs.append (_current_directory->itemText (i)); + } settings->setValue ("filesdockwidget/mru_dir_list", dirs); settings->sync (); @@ -254,7 +268,9 @@ void files_dock_widget::change_directory_up (void) { - QDir dir = QDir (_file_system_model->filePath (_file_tree_view->rootIndex ())); + QDir dir + = QDir (_file_system_model->filePath (_file_tree_view->rootIndex ())); + dir.cdUp (); display_directory (dir.absolutePath ()); } @@ -262,7 +278,9 @@ void files_dock_widget::do_sync_octave_directory (void) { - QDir dir = QDir (_file_system_model->filePath (_file_tree_view->rootIndex ())); + QDir dir + = QDir (_file_system_model->filePath (_file_tree_view->rootIndex ())); + emit displayed_directory_changed (dir.absolutePath ()); } @@ -293,16 +311,18 @@ _file_system_model->setRootPath (fileInfo.absoluteFilePath ()); _file_system_model->sort (0, Qt::AscendingOrder); if (_sync_octave_dir && set_octave_dir) - process_set_current_dir(fileInfo.absoluteFilePath ()); + process_set_current_dir (fileInfo.absoluteFilePath ()); - // see if its in the list, and if it is, remove it and then, put at top of the list - int index = _current_directory->findText(fileInfo.absoluteFilePath ()); - if(index != -1) - { - _current_directory->removeItem(index); - } - _current_directory->insertItem(0, fileInfo.absoluteFilePath ()); - _current_directory->setCurrentIndex(0); + // see if its in the list, and if it is, + // remove it and then, put at top of the list + int index + = _current_directory->findText (fileInfo.absoluteFilePath ()); + if (index != -1) + { + _current_directory->removeItem (index); + } + _current_directory->insertItem (0, fileInfo.absoluteFilePath ()); + _current_directory->setCurrentIndex (0); } else { @@ -330,34 +350,34 @@ QDesktopServices::openUrl (QUrl::fromLocalFile (file)); } -void +void files_dock_widget::contextmenu_requested (const QPoint& mpos) { - QMenu menu(this); + QMenu menu (this); QModelIndex index = _file_tree_view->indexAt (mpos); //QAbstractItemModel *m = _file_tree_view->model (); - if (index.isValid()) - { - QFileInfo info = _file_system_model->fileInfo(index); + if (index.isValid ()) + { + QFileInfo info = _file_system_model->fileInfo (index); - menu.addAction (QIcon (":/actions/icons/fileopen.png"), tr("Open"), - this, SLOT(contextmenu_open(bool))); + menu.addAction (QIcon (":/actions/icons/fileopen.png"), tr ("Open"), + this, SLOT (contextmenu_open (bool))); - menu.addAction (tr("Open in Default Application"), + menu.addAction (tr ("Open in Default Application"), this, SLOT (contextmenu_open_in_app (bool))); - menu.addAction (tr("Copy Selection to Clipboard"), + menu.addAction (tr ("Copy Selection to Clipboard"), this, SLOT (contextmenu_copy_selection (bool))); if (info.isFile () && info.suffix () == "m") menu.addAction (QIcon (":/actions/icons/artsbuilderexecute.png"), - tr("Run"), this, SLOT(contextmenu_run(bool))); + tr ("Run"), this, SLOT (contextmenu_run (bool))); if (info.isFile ()) - menu.addAction (tr("Load Data"), this, SLOT(contextmenu_load(bool))); + menu.addAction (tr ("Load Data"), this, SLOT (contextmenu_load (bool))); if (info.isDir ()) { @@ -366,26 +386,27 @@ tr ("Set Current Directory"), this, SLOT (contextmenu_setcurrentdir (bool))); menu.addSeparator (); - menu.addAction (tr ("Find Files ..."), this, SLOT(contextmenu_findfiles(bool))); + menu.addAction (tr ("Find Files ..."), this, + SLOT (contextmenu_findfiles (bool))); } - menu.addSeparator(); - menu.addAction (tr ("Rename"), this, SLOT(contextmenu_rename(bool))); - menu.addAction (QIcon(":/actions/icons/editdelete.png"), tr("Delete"), - this, SLOT(contextmenu_delete(bool))); + menu.addSeparator (); + menu.addAction (tr ("Rename"), this, SLOT (contextmenu_rename (bool))); + menu.addAction (QIcon (":/actions/icons/editdelete.png"), tr ("Delete"), + this, SLOT (contextmenu_delete (bool))); - if (info.isDir()) + if (info.isDir ()) { - menu.addSeparator(); + menu.addSeparator (); menu.addAction (QIcon (":/actions/icons/filenew.png"), tr ("New File"), - this, SLOT(contextmenu_newfile(bool))); + this, SLOT (contextmenu_newfile (bool))); menu.addAction (QIcon (":/actions/icons/folder_new.png"), - tr("New Directory"), - this, SLOT(contextmenu_newdir(bool))); + tr ("New Directory"), + this, SLOT (contextmenu_newdir (bool))); } - menu.exec(_file_tree_view->mapToGlobal(mpos)); + menu.exec (_file_tree_view->mapToGlobal (mpos)); } } @@ -397,9 +418,9 @@ QItemSelectionModel *m = _file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); - for( QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++) + for ( QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++) { - item_double_clicked(*it); + item_double_clicked (*it); } } @@ -443,7 +464,7 @@ { QModelIndex index = rows[0]; - QFileInfo info = _file_system_model->fileInfo(index); + QFileInfo info = _file_system_model->fileInfo (index); emit load_file_signal (info.fileName ()); } @@ -459,146 +480,151 @@ { QModelIndex index = rows[0]; - QFileInfo info = _file_system_model->fileInfo(index); + QFileInfo info = _file_system_model->fileInfo (index); emit run_file_signal (info); } } -void +void files_dock_widget::contextmenu_rename (bool) { QItemSelectionModel *m = _file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); - if(rows.size() > 0) + if (rows.size () > 0) { QModelIndex index = rows[0]; - QFileInfo info = _file_system_model->fileInfo(index); - QDir path = info.absoluteDir(); - QString old_name = info.fileName(); + QFileInfo info = _file_system_model->fileInfo (index); + QDir path = info.absoluteDir (); + QString old_name = info.fileName (); bool ok; - QString new_name = QInputDialog::getText (this, tr("Rename file/directory"), - tr("Rename file/directory:\n") + old_name + tr("\n to: "), - QLineEdit::Normal, old_name, &ok); - if(ok && new_name.length()>0) + QString new_name + = QInputDialog::getText (this, tr ("Rename file/directory"), + tr ("Rename file/directory:\n") + + old_name + tr ("\n to: "), + QLineEdit::Normal, old_name, &ok); + if (ok && new_name.length () > 0) { - new_name = path.absolutePath() + "/" + new_name; - old_name = path.absolutePath() + "/" + old_name; - path.rename(old_name, new_name); - _file_system_model->revert(); + new_name = path.absolutePath () + "/" + new_name; + old_name = path.absolutePath () + "/" + old_name; + path.rename (old_name, new_name); + _file_system_model->revert (); } } } -void +void files_dock_widget::contextmenu_delete (bool) { QItemSelectionModel *m = _file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); - for( QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++) + for ( QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++) { QModelIndex index = *it; - QFileInfo info = _file_system_model->fileInfo(index); - - if(QMessageBox::question(this, tr("Delete file/directory"), - tr("Are you sure you want to delete\n") + info.filePath(), - QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes) - { - if(info.isDir()) - { - // see if direcory is empty - QDir path(info.absoluteFilePath()); - QList<QFileInfo> fileLst = path.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot); + QFileInfo info = _file_system_model->fileInfo (index); - if(fileLst.count() != 0) - QMessageBox::warning(this, tr("Delete file/directory"), - tr("Can not delete a directory that is not empty")); - else - _file_system_model->rmdir(index); - } - else - { - _file_system_model->remove(index); - } + if (QMessageBox::question (this, tr ("Delete file/directory"), + tr ("Are you sure you want to delete\n") + + info.filePath (), + QMessageBox::Yes|QMessageBox::No) + == QMessageBox::Yes) + { + if (info.isDir ()) + { + // see if direcory is empty + QDir path (info.absoluteFilePath ()); + QList<QFileInfo> fileLst = path.entryInfoList (QDir::AllEntries | + QDir::NoDotAndDotDot); - _file_system_model->revert(); + if (fileLst.count () != 0) + QMessageBox::warning (this, tr ("Delete file/directory"), + tr ("Can not delete a directory that is not empty")); + else + _file_system_model->rmdir (index); + } + else + { + _file_system_model->remove (index); + } + + _file_system_model->revert (); } } } -void +void files_dock_widget::contextmenu_newfile (bool) { QItemSelectionModel *m = _file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); - if(rows.size() > 0) + if (rows.size () > 0) { QModelIndex index = rows[0]; - QFileInfo info = _file_system_model->fileInfo(index); - QString parent_dir = info.filePath(); + QFileInfo info = _file_system_model->fileInfo (index); + QString parent_dir = info.filePath (); - process_new_file(parent_dir); + process_new_file (parent_dir); } } -void +void files_dock_widget::contextmenu_newdir (bool) { QItemSelectionModel *m = _file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); - if(rows.size() > 0) + if (rows.size () > 0) { QModelIndex index = rows[0]; - QFileInfo info = _file_system_model->fileInfo(index); - QString parent_dir = info.filePath(); + QFileInfo info = _file_system_model->fileInfo (index); + QString parent_dir = info.filePath (); - process_new_dir(parent_dir); + process_new_dir (parent_dir); } } -void +void files_dock_widget::contextmenu_setcurrentdir (bool) { QItemSelectionModel *m = _file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); - if(rows.size() > 0) + if (rows.size () > 0) { QModelIndex index = rows[0]; - QFileInfo info = _file_system_model->fileInfo(index); + QFileInfo info = _file_system_model->fileInfo (index); - if(info.isDir()) + if (info.isDir ()) { - process_set_current_dir(info.absoluteFilePath ()); + process_set_current_dir (info.absoluteFilePath ()); } } } -void +void files_dock_widget::contextmenu_findfiles (bool) { QItemSelectionModel *m = _file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); - if(rows.size() > 0) + if (rows.size () > 0) { QModelIndex index = rows[0]; - QFileInfo info = _file_system_model->fileInfo(index); + QFileInfo info = _file_system_model->fileInfo (index); - if(info.isDir()) + if (info.isDir ()) { - process_find_files(info.absoluteFilePath ()); + process_find_files (info.absoluteFilePath ()); } } } @@ -615,16 +641,22 @@ // file names are always shown, other columns can be hidden by settings _file_tree_view->setColumnHidden (0, false); - _file_tree_view->setColumnHidden (1, !settings->value ("filesdockwidget/showFileSize",false).toBool ()); - _file_tree_view->setColumnHidden (2, !settings->value ("filesdockwidget/showFileType",false).toBool ()); - _file_tree_view->setColumnHidden (3, !settings->value ("filesdockwidget/showLastModified",false).toBool ()); - _file_tree_view->setAlternatingRowColors (settings->value ("filesdockwidget/useAlternatingRowColors",true).toBool ()); + _file_tree_view->setColumnHidden (1, + !settings->value ("filesdockwidget/showFileSize",false).toBool ()); + _file_tree_view->setColumnHidden (2, + !settings->value ("filesdockwidget/showFileType",false).toBool ()); + _file_tree_view->setColumnHidden (3, + !settings->value ("filesdockwidget/showLastModified",false).toBool ()); + _file_tree_view->setAlternatingRowColors ( + settings->value ("filesdockwidget/useAlternatingRowColors",true).toBool ()); if (settings->value ("filesdockwidget/showHiddenFiles",false).toBool ()) { // TODO: React on option for hidden files. } - // enalbe the buttons to sync octave/browser dir only if this is not done by default - _sync_octave_dir = settings->value ("filesdockwidget/sync_octave_directory",false).toBool (); + // enable the buttons to sync octave/browser dir + // only if this is not done by default + _sync_octave_dir + = settings->value ("filesdockwidget/sync_octave_directory",false).toBool (); _sync_octave_directory_action->setEnabled (!_sync_octave_dir); _sync_browser_directory_action->setEnabled (!_sync_octave_dir); @@ -637,9 +669,9 @@ files_dock_widget::popdownmenu_home (bool) { QString dir = qgetenv ("HOME"); - if (dir.isEmpty()) + if (dir.isEmpty ()) dir = QDir::homePath (); - + set_current_directory (dir); } @@ -647,27 +679,28 @@ files_dock_widget::popdownmenu_search_dir (bool) { QString dir = QFileDialog::getExistingDirectory - (this, tr ("Set directory of file browser"),_file_system_model->rootPath(), - QFileDialog::DontUseNativeDialog); + (this, tr ("Set directory of file browser"), + _file_system_model->rootPath (), + QFileDialog::DontUseNativeDialog); set_current_directory (dir); } void files_dock_widget::popdownmenu_findfiles (bool) { - process_find_files(_file_system_model->rootPath()); + process_find_files (_file_system_model->rootPath ()); } void files_dock_widget::popdownmenu_newdir (bool) { - process_new_dir(_file_system_model->rootPath()); + process_new_dir (_file_system_model->rootPath ()); } void files_dock_widget::popdownmenu_newfile (bool) { - process_new_file(_file_system_model->rootPath()); + process_new_file (_file_system_model->rootPath ()); } void @@ -675,15 +708,16 @@ { bool ok; - QString name = QInputDialog::getText (this, tr("Create File"), tr("Create file in\n") + parent_dir, - QLineEdit::Normal, "New File.txt", &ok); - if(ok && name.length()>0) + QString name = QInputDialog::getText (this, tr ("Create File"), + tr ("Create file in\n") + parent_dir, + QLineEdit::Normal, "New File.txt", &ok); + if (ok && name.length () > 0) { name = parent_dir + "/" + name; - QFile file(name); - file.open(QIODevice::WriteOnly); - _file_system_model->revert(); + QFile file (name); + file.open (QIODevice::WriteOnly); + _file_system_model->revert (); } } @@ -692,24 +726,26 @@ { bool ok; - QString name = QInputDialog::getText (this, tr("Create Directory"), tr("Create folder in\n") + parent_dir, - QLineEdit::Normal, "New Directory", &ok); - if(ok && name.length()>0) + QString name = QInputDialog::getText (this, tr ("Create Directory"), + tr ("Create folder in\n") + parent_dir, + QLineEdit::Normal, "New Directory", + &ok); + if (ok && name.length () > 0) { - QDir dir(parent_dir); - dir.mkdir(name); - _file_system_model->revert(); + QDir dir (parent_dir); + dir.mkdir (name); + _file_system_model->revert (); } } -void files_dock_widget::process_set_current_dir(const QString & dir) +void files_dock_widget::process_set_current_dir (const QString & dir) { emit displayed_directory_changed (dir); } -void files_dock_widget::process_find_files(const QString & dir) +void files_dock_widget::process_find_files (const QString & dir) { - emit find_files_signal(dir); + emit find_files_signal (dir); } void @@ -737,7 +773,7 @@ QClipboard *clipboard = QApplication::clipboard (); QString str = clipboard->text (); QLineEdit * edit = _current_directory->lineEdit (); - if (edit && str.length () > 0) + if (edit && str.length () > 0) edit->insert (str); } }
--- a/libgui/src/files-dock-widget.h +++ b/libgui/src/files-dock-widget.h @@ -97,8 +97,8 @@ void contextmenu_findfiles (bool); /* popdown menu options */ - void popdownmenu_newfile(bool); - void popdownmenu_newdir(bool); + void popdownmenu_newfile (bool); + void popdownmenu_newdir (bool); void popdownmenu_search_dir (bool); void popdownmenu_findfiles (bool); void popdownmenu_home (bool); @@ -125,10 +125,10 @@ void find_files_signal (const QString &startdir); private: - void process_new_file(const QString &parent_name); - void process_new_dir(const QString &parent_name); - void process_set_current_dir(const QString &parent_name); - void process_find_files(const QString &dir_name); + void process_new_file (const QString &parent_name); + void process_new_dir (const QString &parent_name); + void process_set_current_dir (const QString &parent_name); + void process_find_files (const QString &dir_name); /** set a new directory or open a file **/ void display_directory (const QString& dir, bool set_octave_dir = true);
--- a/libgui/src/find-files-dialog.cc +++ b/libgui/src/find-files-dialog.cc @@ -42,15 +42,15 @@ #include <QGroupBox> find_files_dialog::find_files_dialog (QWidget * p) - : QDialog (p) + : QDialog (p) { - setWindowTitle (tr("Find Files")); + setWindowTitle (tr ("Find Files")); setWindowIcon (QIcon (":/actions/icons/search.png")); _dir_iterator = 0; _timer = new QTimer (this); - connect(_timer, SIGNAL(timeout()), this, SLOT(look_for_files())); + connect (_timer, SIGNAL (timeout ()), this, SLOT (look_for_files ())); QSettings *settings = resource_manager::get_settings (); @@ -58,77 +58,90 @@ _file_name_edit = new QLineEdit; _file_name_edit->setToolTip (tr ("Enter the filename expression")); - _file_name_edit->setText (settings->value ("findfiles/file_name","*").toString ()); + _file_name_edit->setText (settings->value ("findfiles/file_name", + "*").toString ()); file_name_label->setBuddy (_file_name_edit); QLabel * start_dir_label = new QLabel (tr ("Start in:")); _start_dir_edit = new QLineEdit; - _start_dir_edit->setText (settings->value ("findfiles/start_dir",QDir::currentPath()).toString()); + _start_dir_edit->setText (settings->value ("findfiles/start_dir", + QDir::currentPath ()).toString ()); _start_dir_edit->setToolTip (tr ("Enter the start directory")); start_dir_label->setBuddy (_start_dir_edit); _browse_button = new QPushButton (tr ("Browse...")); _browse_button->setToolTip (tr ("Browse for start directory")); - connect(_browse_button, SIGNAL(clicked()), this, SLOT(browse_folders())); + connect (_browse_button, SIGNAL (clicked ()), this, SLOT (browse_folders ())); _recurse_dirs_check = new QCheckBox (tr ("Recurse directories")); - _recurse_dirs_check->setChecked (settings->value ("findfiles/recurse_dirs", false).toBool()); - _recurse_dirs_check->setToolTip (tr ("Search recursively through directories for matching files")); + _recurse_dirs_check->setChecked (settings->value ("findfiles/recurse_dirs", + false).toBool ()); + _recurse_dirs_check->setToolTip ( + tr ("Search recursively through directories for matching files")); _include_dirs_check = new QCheckBox (tr ("Include directories")); - _include_dirs_check->setChecked (settings->value ("findfiles/include_dirs", false).toBool()); - _include_dirs_check->setToolTip (tr ("Include matching directories in search results")); + _include_dirs_check->setChecked (settings->value ("findfiles/include_dirs", + false).toBool ()); + _include_dirs_check->setToolTip ( + tr ("Include matching directories in search results")); _name_case_check = new QCheckBox (tr ("Name case insensitive")); - _name_case_check->setChecked (settings->value ("findfiles/name_case", false).toBool()); + _name_case_check->setChecked (settings->value ("findfiles/name_case", + false).toBool ()); _name_case_check->setToolTip (tr ("Set matching name is case insensitive")); - _contains_text_check = new QCheckBox (tr("Contains text:")); + _contains_text_check = new QCheckBox (tr ("Contains text:")); _contains_text_check->setToolTip (tr ("Search must match text")); - _contains_text_check->setChecked (settings->value ("findfiles/check_text", false).toBool()); + _contains_text_check->setChecked (settings->value ("findfiles/check_text", + false).toBool ()); _contains_text_edit = new QLineEdit (); _contains_text_edit->setToolTip (tr ("Text to match")); - _contains_text_edit->setText (settings->value ("findfiles/contains_text", "").toString()); + _contains_text_edit->setText (settings->value ("findfiles/contains_text", + "").toString ()); - _content_case_check = new QCheckBox (tr("Text case insensitive")); - _content_case_check->setChecked (settings->value ("findfiles/content_case", false).toBool()); + _content_case_check = new QCheckBox (tr ("Text case insensitive")); + _content_case_check->setChecked (settings->value ("findfiles/content_case", + false).toBool ()); _content_case_check->setToolTip (tr ("Set text content is case insensitive")); - + find_files_model * model = new find_files_model (this); _file_list = new QTableView; _file_list->setWordWrap (false); _file_list->setModel (model); _file_list->setShowGrid (false); - _file_list->setSelectionBehavior(QAbstractItemView::SelectRows); - _file_list->setSelectionMode(QAbstractItemView::SingleSelection); - _file_list->setAlternatingRowColors(true); + _file_list->setSelectionBehavior (QAbstractItemView::SelectRows); + _file_list->setSelectionMode (QAbstractItemView::SingleSelection); + _file_list->setAlternatingRowColors (true); _file_list->setToolTip (tr ("Search results")); _file_list->setSortingEnabled (true); - _file_list->horizontalHeader ()->restoreState (settings->value ("findfiles/column_state").toByteArray ()); + _file_list->horizontalHeader ()->restoreState ( + settings->value ("findfiles/column_state").toByteArray ()); _file_list->horizontalHeader ()->setSortIndicatorShown (true); _file_list->horizontalHeader ()->setClickable (true); _file_list->horizontalHeader ()->setStretchLastSection (true); _file_list->sortByColumn ( - settings->value ("findfiles/sort_files_by_column",0).toInt (), - static_cast<Qt::SortOrder>(settings->value ("findfiles/sort_files_by_order",Qt::AscendingOrder).toUInt ())); + settings->value ("findfiles/sort_files_by_column",0).toInt (), + static_cast<Qt::SortOrder> + (settings->value ("findfiles/sort_files_by_order", + Qt::AscendingOrder).toUInt ())); - connect (_file_list, SIGNAL(doubleClicked(const QModelIndex&)), - this, SLOT(item_double_clicked(const QModelIndex &))); + connect (_file_list, SIGNAL (doubleClicked (const QModelIndex&)), + this, SLOT (item_double_clicked (const QModelIndex &))); _status_bar = new QStatusBar; - _status_bar->showMessage (tr("Idle.")); + _status_bar->showMessage (tr ("Idle.")); - _find_button = new QPushButton (tr("Find")); + _find_button = new QPushButton (tr ("Find")); _find_button->setToolTip (tr ("Start search for matching files")); - connect (_find_button, SIGNAL(clicked()), this, SLOT(start_find())); + connect (_find_button, SIGNAL (clicked ()), this, SLOT (start_find ())); - _stop_button = new QPushButton (tr("Stop")); + _stop_button = new QPushButton (tr ("Stop")); _stop_button->setToolTip (tr ("Stop searching")); _stop_button->setEnabled (false); - connect (_stop_button, SIGNAL(clicked()), this, SLOT(stop_find())); + connect (_stop_button, SIGNAL (clicked ()), this, SLOT (stop_find ())); // layout everything QDialogButtonBox * button_box = new QDialogButtonBox (Qt::Vertical); @@ -141,9 +154,9 @@ this, SLOT (close ())); // name options - QGroupBox * name_group = new QGroupBox(tr("File name/location")); + QGroupBox * name_group = new QGroupBox (tr ("File name/location")); QGridLayout * name_layout = new QGridLayout; - name_group->setLayout(name_layout); + name_group->setLayout (name_layout); name_layout->addWidget (file_name_label,1,1, 1,1); name_layout->addWidget (_file_name_edit,1,2, 1,-1); @@ -158,9 +171,9 @@ name_layout->addWidget (_name_case_check,3,3); // content options - QGroupBox * content_group = new QGroupBox(tr("File contents")); + QGroupBox * content_group = new QGroupBox (tr ("File contents")); QGridLayout * content_layout = new QGridLayout; - content_group->setLayout(content_layout); + content_group->setLayout (content_layout); content_layout->addWidget (_contains_text_check,4,1); content_layout->addWidget (_contains_text_edit,4,2,1,3); content_layout->setColumnStretch (2,1); @@ -178,7 +191,7 @@ setLayout (main_layout); - connect (this, SIGNAL(finished(int)), this, SLOT(handle_done(int))); + connect (this, SIGNAL (finished (int)), this, SLOT (handle_done (int))); } find_files_dialog::~find_files_dialog () @@ -186,64 +199,70 @@ QSettings *settings = resource_manager::get_settings (); int sort_column = _file_list->horizontalHeader ()->sortIndicatorSection (); - Qt::SortOrder sort_order = _file_list->horizontalHeader ()->sortIndicatorOrder (); + Qt::SortOrder sort_order + = _file_list->horizontalHeader ()->sortIndicatorOrder (); settings->setValue ("findfiles/sort_files_by_column", sort_column); settings->setValue ("findfiles/sort_files_by_order", sort_order); - settings->setValue ("findfiles/column_state", _file_list->horizontalHeader ()->saveState ()); + settings->setValue ("findfiles/column_state", + _file_list->horizontalHeader ()->saveState ()); - settings->setValue ("findfiles/file_name", _file_name_edit->text()); + settings->setValue ("findfiles/file_name", _file_name_edit->text ()); - settings->setValue ("findfiles/start_dir", _start_dir_edit->text()); + settings->setValue ("findfiles/start_dir", _start_dir_edit->text ()); - settings->setValue ("findfiles/recurse_dirs", _recurse_dirs_check->text()); - settings->setValue ("findfiles/include_dirs", _include_dirs_check->text()); - settings->setValue ("findfiles/name_case", _name_case_check->text()); + settings->setValue ("findfiles/recurse_dirs", _recurse_dirs_check->text ()); + settings->setValue ("findfiles/include_dirs", _include_dirs_check->text ()); + settings->setValue ("findfiles/name_case", _name_case_check->text ()); - settings->setValue ("findfiles/contains_text", _contains_text_edit->text()); - settings->setValue ("findfiles/check_text", _contains_text_check->isChecked ()); - settings->setValue ("findfiles/content_case", _content_case_check->isChecked ()); + settings->setValue ("findfiles/contains_text", _contains_text_edit->text ()); + settings->setValue ("findfiles/check_text", + _contains_text_check->isChecked ()); + settings->setValue ("findfiles/content_case", + _content_case_check->isChecked ()); settings->sync (); - if(_dir_iterator) + if (_dir_iterator) delete _dir_iterator; } void find_files_dialog::handle_done (int) { - // make sure we stopped processing + // make sure we stopped processing stop_find (); } -void find_files_dialog::set_search_dir(const QString &dir) +void find_files_dialog::set_search_dir (const QString &dir) { - stop_find(); - _start_dir_edit->setText(dir); + stop_find (); + _start_dir_edit->setText (dir); } -void +void find_files_dialog::start_find () { - stop_find(); + stop_find (); - find_files_model *m = static_cast<find_files_model *> (_file_list->model()); - m->clear(); + find_files_model *m = static_cast<find_files_model *> (_file_list->model ()); + m->clear (); QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags; - if (_recurse_dirs_check->isChecked ()) flags |= QDirIterator::Subdirectories; + if (_recurse_dirs_check->isChecked ()) + flags |= QDirIterator::Subdirectories; QDir::Filters filters = QDir::Dirs|QDir::NoDotAndDotDot|QDir::Files; if (!_name_case_check->isChecked ()) filters |= QDir::CaseSensitive; QStringList nameFilters; - nameFilters.append (_file_name_edit->text()); + nameFilters.append (_file_name_edit->text ()); if (_dir_iterator) delete _dir_iterator; - _dir_iterator = new QDirIterator (_start_dir_edit->text(), nameFilters, filters, flags); - - // enable/disable widgets + _dir_iterator = new QDirIterator (_start_dir_edit->text (), nameFilters, + filters, flags); + + // enable/disable widgets _find_button->setEnabled (false); _stop_button->setEnabled (true); _close_button->setEnabled (false); @@ -257,11 +276,11 @@ _content_case_check->setEnabled (false); _contains_text_edit->setEnabled (false); - _status_bar->showMessage (tr("Searching...")); + _status_bar->showMessage (tr ("Searching...")); _timer->start (0); } -void +void find_files_dialog::stop_find () { _timer->stop (); @@ -279,18 +298,18 @@ _content_case_check->setEnabled (true); _contains_text_edit->setEnabled (true); - find_files_model *m = static_cast<find_files_model *> (_file_list->model()); - QString res_str = QString ("%1 matches").arg(m->rowCount()); + find_files_model *m = static_cast<find_files_model *> (_file_list->model ()); + QString res_str = QString ("%1 matches").arg (m->rowCount ()); _status_bar->showMessage (res_str); } -void +void find_files_dialog::browse_folders () { QString dir = - QFileDialog::getExistingDirectory (this, tr ("Set search directory"), - _start_dir_edit->text()); + QFileDialog::getExistingDirectory (this, tr ("Set search directory"), + _start_dir_edit->text ()); if (! dir.isEmpty ()) { @@ -298,43 +317,44 @@ } } -void +void find_files_dialog::item_double_clicked (const QModelIndex &idx) { find_files_model *m = static_cast<find_files_model *> (_file_list->model ()); QFileInfo info = m->fileInfo (idx); - if(idx.column () == 1) + if (idx.column () == 1) { // clicked in directory part - emit dir_selected (info.absolutePath()); + emit dir_selected (info.absolutePath ()); } else { // clicked in filename part - if(info.isDir ()) - emit dir_selected (info.absoluteFilePath()); + if (info.isDir ()) + emit dir_selected (info.absoluteFilePath ()); else - emit file_selected (info.absoluteFilePath()); + emit file_selected (info.absoluteFilePath ()); } } void find_files_dialog::look_for_files () { - if(_dir_iterator && _dir_iterator->hasNext ()) + if (_dir_iterator && _dir_iterator->hasNext ()) { QFileInfo info (_dir_iterator->next ()); - - find_files_model *m = static_cast<find_files_model *> (_file_list->model ()); + + find_files_model *m + = static_cast<find_files_model *> (_file_list->model ()); - if(is_match (info)) + if (is_match (info)) m->addFile (info); - } + } else { - stop_find (); + stop_find (); } } @@ -343,8 +363,8 @@ bool match = true; if (info.isDir ()) { - if(!_include_dirs_check->isChecked ()) match = false; - if(_contains_text_check->isChecked ()) match = false; + if (!_include_dirs_check->isChecked ()) match = false; + if (_contains_text_check->isChecked ()) match = false; } else { @@ -353,7 +373,7 @@ { match = false; - QFile file(info.absoluteFilePath ()); + QFile file (info.absoluteFilePath ()); if (file.open (QIODevice::ReadOnly)) { QTextStream stream (&file); @@ -362,19 +382,19 @@ QString match_str = _contains_text_edit->text (); Qt::CaseSensitivity cs = _content_case_check->isChecked () ? - Qt::CaseInsensitive : Qt::CaseSensitive; + Qt::CaseInsensitive : Qt::CaseSensitive; do { line = stream.readLine (); match = line.contains (match_str, cs); } - while(!line.isNull () && match == false); + while (!line.isNull () && match == false); } } } - return match; + return match; }
--- a/libgui/src/find-files-dialog.h +++ b/libgui/src/find-files-dialog.h @@ -46,7 +46,7 @@ void dir_selected (const QString &fileName); public slots: - void set_search_dir(const QString &dir); + void set_search_dir (const QString &dir); private slots: void start_find (); @@ -54,9 +54,9 @@ void browse_folders (); void look_for_files (); void item_double_clicked (const QModelIndex&); - void handle_done(int); + void handle_done (int); private: - bool is_match(const QFileInfo &info); + bool is_match (const QFileInfo &info); QLineEdit * _start_dir_edit; QLineEdit * _file_name_edit; QPushButton * _stop_button;
--- a/libgui/src/find-files-model.cc +++ b/libgui/src/find-files-model.cc @@ -33,37 +33,38 @@ } QVariant getValue (const QFileInfo &f) const { - QVariant val; - int col = (_sortorder > 0) ? _sortorder : -_sortorder; + QVariant val; + int col = (_sortorder > 0) ? _sortorder : -_sortorder; - switch (col-1) - { - case 0: - val = QVariant (f.fileName()); - break; + switch (col-1) + { + case 0: + val = QVariant (f.fileName ()); + break; - case 1: - val = QVariant (f.absolutePath()); - break; + case 1: + val = QVariant (f.absolutePath ()); + break; - default: - break; - } - return val; + default: + break; + } + return val; } bool lessThan (const QVariant &left, const QVariant &right) const { - return left.toString ().compare (right.toString (), Qt::CaseInsensitive) < 0; + return + left.toString ().compare (right.toString (), Qt::CaseInsensitive) < 0; } bool operator () (const QFileInfo &left, const QFileInfo &right) const { - QVariant leftval = getValue(left); - QVariant rightval = getValue(right); + QVariant leftval = getValue (left); + QVariant rightval = getValue (right); - if (_sortorder > 0) - return lessThan(leftval, rightval); - else - return ! lessThan(leftval, rightval); + if (_sortorder > 0) + return lessThan (leftval, rightval); + else + return ! lessThan (leftval, rightval); } private: int _sortorder; @@ -71,7 +72,7 @@ find_files_model::find_files_model (QObject *p) - : QAbstractListModel(p) + : QAbstractListModel (p) { _columnNames.append (tr ("Filename")); _columnNames.append (tr ("Directory")); @@ -82,86 +83,87 @@ { } -void +void find_files_model::clear () { - beginResetModel(); + beginResetModel (); - _files.clear(); + _files.clear (); endResetModel (); } -void +void find_files_model::addFile (const QFileInfo &info) { beginInsertRows (QModelIndex (), _files.size (), _files.size () ); - QList<QFileInfo>::Iterator it; - find_file_less_than less_than(_sortorder); + QList<QFileInfo>::Iterator it; + find_file_less_than less_than (_sortorder); - for (it=_files.begin ();it!=_files.end ();it++) + for (it=_files.begin (); it!=_files.end (); it++) { if (less_than (info, *it)) break; } _files.insert (it, info); - endInsertRows (); + endInsertRows (); } -int +int find_files_model::rowCount (const QModelIndex &) const { - return _files.size(); + return _files.size (); } -int +int find_files_model::columnCount (const QModelIndex &) const { return _columnNames.size (); } -QVariant +QVariant find_files_model::data (const QModelIndex& idx, int role) const { QVariant retval; if (idx.isValid ()) { - if(role == Qt::DisplayRole) - { - switch (idx.column ()) - { - case 0: - retval = QVariant (_files[idx.row()].fileName()); - break; + if (role == Qt::DisplayRole) + { + switch (idx.column ()) + { + case 0: + retval = QVariant (_files[idx.row ()].fileName ()); + break; - case 1: - retval = QVariant (_files[idx.row()].absolutePath()); - break; + case 1: + retval = QVariant (_files[idx.row ()].absolutePath ()); + break; - default: - break; - } - } - else if(role == Qt:: DecorationRole) - { - switch (idx.column()) - { - case 0: - retval = fileIcon(idx); - default: - break; - } - } + default: + break; + } + } + else if (role == Qt:: DecorationRole) + { + switch (idx.column ()) + { + case 0: + retval = fileIcon (idx); + default: + break; + } + } } return retval; } -QVariant -find_files_model::headerData (int section, Qt::Orientation orientation, int role) const +QVariant +find_files_model::headerData (int section, Qt::Orientation orientation, + int role) const { if (orientation == Qt::Horizontal && role == Qt::DisplayRole) return _columnNames[section]; @@ -172,7 +174,7 @@ void find_files_model::sort (int column, Qt::SortOrder order) { - if(column >= 0) + if (column >= 0) { if (order == Qt::DescendingOrder) _sortorder = -(column+1); @@ -190,13 +192,13 @@ } } -QFileInfo +QFileInfo find_files_model::fileInfo (const QModelIndex & p) const { - if(p.isValid ()) - { - return _files[p.row()]; - } + if (p.isValid ()) + { + return _files[p.row ()]; + } return QFileInfo (); } @@ -204,9 +206,9 @@ find_files_model::fileIcon (const QModelIndex &p) const { QFileIconProvider icon_provider; - if(p.isValid ()) - { - return icon_provider.icon (_files[p.row()]); - } + if (p.isValid ()) + { + return icon_provider.icon (_files[p.row ()]); + } return QIcon (); }
--- a/libgui/src/find-files-model.h +++ b/libgui/src/find-files-model.h @@ -34,16 +34,16 @@ Q_OBJECT public: - find_files_model(QObject *p=0); + find_files_model (QObject *p=0); ~find_files_model (); - void clear(); + void clear (); - void addFile(const QFileInfo &info); + void addFile (const QFileInfo &info); - int rowCount(const QModelIndex & p=QModelIndex()) const; + int rowCount (const QModelIndex & p=QModelIndex ()) const; - int columnCount(const QModelIndex & p=QModelIndex()) const; + int columnCount (const QModelIndex & p=QModelIndex ()) const; QVariant data (const QModelIndex& idx, int role) const;
--- a/libgui/src/history-dock-widget.cc +++ b/libgui/src/history-dock-widget.cc @@ -63,16 +63,20 @@ _history_list_view->setModel (&_sort_filter_proxy_model); _history_list_view->setAlternatingRowColors (true); _history_list_view->setEditTriggers (QAbstractItemView::NoEditTriggers); - _history_list_view->setStatusTip (tr ("Doubleclick a command to transfer it to the terminal.")); + _history_list_view->setStatusTip ( + tr ("Doubleclick a command to transfer it to the terminal.")); _history_list_view->setSelectionMode (QAbstractItemView::ExtendedSelection); - _history_list_view->setContextMenuPolicy(Qt::CustomContextMenu); - connect(_history_list_view, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ctxMenu(const QPoint &))); + _history_list_view->setContextMenuPolicy (Qt::CustomContextMenu); + connect (_history_list_view, + SIGNAL (customContextMenuRequested (const QPoint &)), this, + SLOT (ctxMenu (const QPoint &))); _filter_line_edit = new QLineEdit (this); - _filter_line_edit->setStatusTip (tr ("Enter text to filter the command history.")); + _filter_line_edit->setStatusTip ( + tr ("Enter text to filter the command history.")); QVBoxLayout *vbox_layout = new QVBoxLayout (); - setWindowIcon (QIcon(":/actions/icons/logo.png")); + setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("Command History")); setWidget (new QWidget ()); @@ -91,43 +95,46 @@ setFocusProxy (_filter_line_edit); } -void history_dock_widget::ctxMenu(const QPoint &xpos) { - QMenu menu(this); - menu.addAction(tr("Copy"), this, SLOT(handle_contextmenu_copy(bool))); - menu.addAction(tr("Evaluate"), this, SLOT(handle_contextmenu_evaluate(bool))); - menu.addAction(tr("Create script"), this, SLOT(handle_contextmenu_create_script(bool))); - menu.exec(_history_list_view->mapToGlobal(xpos)); +void history_dock_widget::ctxMenu (const QPoint &xpos) +{ + QMenu menu (this); + menu.addAction (tr ("Copy"), this, SLOT (handle_contextmenu_copy (bool))); + menu.addAction (tr ("Evaluate"), this, + SLOT (handle_contextmenu_evaluate (bool))); + menu.addAction (tr ("Create script"), this, + SLOT (handle_contextmenu_create_script (bool))); + menu.exec (_history_list_view->mapToGlobal (xpos)); } -void history_dock_widget::handle_contextmenu_copy(bool) +void history_dock_widget::handle_contextmenu_copy (bool) { QString text; - QItemSelectionModel *selectionModel = _history_list_view->selectionModel(); - QModelIndexList rows = selectionModel->selectedRows(); + QItemSelectionModel *selectionModel = _history_list_view->selectionModel (); + QModelIndexList rows = selectionModel->selectedRows (); QModelIndexList::iterator it; bool prev_valid_row = false; - for (it = rows.begin(); it != rows.end(); it++) + for (it = rows.begin (); it != rows.end (); it++) { - if ((*it).isValid()) + if ((*it).isValid ()) { if (prev_valid_row) text += "\n"; - text += (*it).data().toString(); + text += (*it).data ().toString (); prev_valid_row = true; } } - QApplication::clipboard()->setText(text); + QApplication::clipboard ()->setText (text); } -void history_dock_widget::handle_contextmenu_evaluate(bool) +void history_dock_widget::handle_contextmenu_evaluate (bool) { - QItemSelectionModel *selectionModel = _history_list_view->selectionModel(); - QModelIndexList rows = selectionModel->selectedRows(); + QItemSelectionModel *selectionModel = _history_list_view->selectionModel (); + QModelIndexList rows = selectionModel->selectedRows (); QModelIndexList::iterator it; - for (it = rows.begin() ; it != rows.end(); it++) + for (it = rows.begin () ; it != rows.end (); it++) { - if ((*it).isValid()) - emit command_double_clicked ((*it).data().toString()); + if ((*it).isValid ()) + emit command_double_clicked ((*it).data ().toString ()); } } @@ -145,7 +152,7 @@ { if (prev_valid_row) text += "\n"; - text += (*it).data().toString(); + text += (*it).data ().toString (); prev_valid_row = true; } } @@ -158,7 +165,7 @@ void history_dock_widget::handle_double_click (QModelIndex modelIndex) { - emit command_double_clicked (modelIndex.data().toString()); + emit command_double_clicked (modelIndex.data ().toString ()); } void @@ -194,9 +201,9 @@ void history_dock_widget::copyClipboard () { - if(_history_list_view->hasFocus()) - handle_contextmenu_copy(true); - if(_filter_line_edit->hasFocus () && _filter_line_edit->hasSelectedText ()) + if (_history_list_view->hasFocus ()) + handle_contextmenu_copy (true); + if (_filter_line_edit->hasFocus () && _filter_line_edit->hasSelectedText ()) { QClipboard *clipboard = QApplication::clipboard (); clipboard->setText ( _filter_line_edit->selectedText ()); @@ -206,11 +213,11 @@ void history_dock_widget::pasteClipboard () { - if(_filter_line_edit->hasFocus ()) + if (_filter_line_edit->hasFocus ()) { QClipboard *clipboard = QApplication::clipboard (); QString str = clipboard->text (); - if (str.length() > 0) + if (str.length () > 0) _filter_line_edit->insert (str); } }
--- a/libgui/src/history-dock-widget.h +++ b/libgui/src/history-dock-widget.h @@ -57,10 +57,10 @@ private slots: void handle_double_click (QModelIndex modelIndex); - void handle_contextmenu_copy(bool flag); - void handle_contextmenu_evaluate(bool flag); - void handle_contextmenu_create_script(bool flag); - void ctxMenu(const QPoint &pos); + void handle_contextmenu_copy (bool flag); + void handle_contextmenu_evaluate (bool flag); + void handle_contextmenu_create_script (bool flag); + void ctxMenu (const QPoint &pos); void copyClipboard (); void pasteClipboard ();
--- a/libgui/src/m-editor/file-editor-interface.h +++ b/libgui/src/m-editor/file-editor-interface.h @@ -31,7 +31,7 @@ { Q_OBJECT - public: +public: file_editor_interface (QWidget *p) : octave_dock_widget (p) {
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -198,7 +198,7 @@ void file_editor_tab::handle_margin_clicked (int margin, int line, - Qt::KeyboardModifiers state) + Qt::KeyboardModifiers state) { if (margin == 1) { @@ -268,8 +268,9 @@ lexer = new QsciLexerDiff (); } else if (_file_name.isEmpty () - || _file_name.at (_file_name.count () - 1) == '/') - { // new, no yet named file: let us assume it is octave + || _file_name.at (_file_name.count () - 1) == '/') + { + // new, no yet named file: let us assume it is octave #if defined (HAVE_LEXER_OCTAVE) lexer = new QsciLexerOctave (); #elif defined (HAVE_LEXER_MATLAB) @@ -279,7 +280,8 @@ #endif } else - { // other or no extension + { + // other or no extension lexer = new QsciLexerBash (); } } @@ -290,12 +292,13 @@ // get path to prepared api info QDesktopServices desktopServices; QString prep_apis_path - = desktopServices.storageLocation (QDesktopServices::HomeLocation) - + "/.config/octave/" + QString(OCTAVE_VERSION) + "/qsci/"; + = desktopServices.storageLocation (QDesktopServices::HomeLocation) + + "/.config/octave/" + QString(OCTAVE_VERSION) + "/qsci/"; _prep_apis_file = prep_apis_path + lexer->lexer () + ".pap"; if (!_lexer_apis->loadPrepared (_prep_apis_file)) - { // no prepared info loaded, prepare and save if possible + { + // no prepared info loaded, prepare and save if possible // create raw apis info QString keyword; @@ -313,7 +316,8 @@ disconnect (_lexer_apis, SIGNAL (apiPreparationFinished ()), 0, 0); // check whether path for prepared info exists or can be created if (QDir("/").mkpath (prep_apis_path)) - { // path exists, apis info can be saved there + { + // path exists, apis info can be saved there connect (_lexer_apis, SIGNAL (apiPreparationFinished ()), this, SLOT (save_apis_info ())); } @@ -721,7 +725,7 @@ if (!_find_dialog) { - _find_dialog = new find_dialog (_edit_area, + _find_dialog = new find_dialog (_edit_area, qobject_cast<QWidget *> (sender ())); connect (_find_dialog, SIGNAL (finished (int)), this, SLOT (handle_find_dialog_finished (int))); @@ -795,7 +799,8 @@ } } //set selection on (un)commented section - _edit_area->setSelection (lineFrom, 0, lineTo, _edit_area->text (lineTo).length ()); + _edit_area->setSelection (lineFrom, 0, lineTo, + _edit_area->text (lineTo).length ()); } else { @@ -863,7 +868,7 @@ QString available_actions; if (_app_closing) - available_actions = tr ("Do you want to save or discard the changes?"); + available_actions = tr ("Do you want to save or discard the changes?"); else { buttons = buttons | QMessageBox::Cancel; // cancel is allowed @@ -900,7 +905,7 @@ // Nothing was modified, just remove from editor. emit tab_remove_request (); } - + return decision; } @@ -972,7 +977,7 @@ // should be performed. if (saveFileName.isEmpty () || saveFileName.at (saveFileName.count () - 1) == '/') - { + { save_file_as (remove_on_success); return; } @@ -1240,9 +1245,9 @@ if (settings->value ("editor/codeCompletion", true).toBool ()) // auto compl. { bool match_keywords = settings->value - ("editor/codeCompletion_keywords",true).toBool (); + ("editor/codeCompletion_keywords",true).toBool (); bool match_document = settings->value - ("editor/codeCompletion_document",true).toBool (); + ("editor/codeCompletion_document",true).toBool (); QsciScintilla::AutoCompletionSource source = QsciScintilla::AcsNone; if (match_keywords) @@ -1250,9 +1255,8 @@ source = QsciScintilla::AcsAll; else source = QsciScintilla::AcsAPIs; - else - if (match_document) - source = QsciScintilla::AcsDocument; + else if (match_document) + source = QsciScintilla::AcsDocument; _edit_area->setAutoCompletionSource (source); _edit_area->setAutoCompletionReplaceWord
--- a/libgui/src/m-editor/file-editor-tab.h +++ b/libgui/src/m-editor/file-editor-tab.h @@ -153,11 +153,11 @@ private: enum editor_markers - { - bookmark, - breakpoint, - debugger_position - }; + { + bookmark, + breakpoint, + debugger_position + }; struct bp_info {
--- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -75,7 +75,10 @@ settings->sync (); for (int index = _tab_widget->count ()-1; index >= 0; index--) - emit fetab_close_request (_tab_widget->widget (index),true); // true: app closing + { + // true: app closing + emit fetab_close_request (_tab_widget->widget (index), true); + } if (_mru_file_menu) delete _mru_file_menu; @@ -213,7 +216,7 @@ } return retval; -} +} void file_editor::request_open_file (const QString& openFileName, int line, @@ -298,13 +301,14 @@ if (QFile::exists (openFileName)) { - // File not readable: create a NonModal message about error. + // File not readable: + // create a NonModal message about error. QMessageBox *msgBox = new QMessageBox (QMessageBox::Critical, - tr ("Octave Editor"), - tr ("Could not open file\n%1\nfor read: %2."). - arg (openFileName).arg (result), - QMessageBox::Ok, this); + tr ("Octave Editor"), + tr ("Could not open file\n%1\nfor read: %2."). + arg (openFileName).arg (result), + QMessageBox::Ok, this); msgBox->setWindowModality (Qt::NonModal); msgBox->setAttribute (Qt::WA_DeleteOnClose); @@ -315,17 +319,19 @@ // File does not exist, should it be crated? QMessageBox *msgBox; int answer; - if (settings->value ("editor/create_new_file",false).toBool ()) + if (settings->value ("editor/create_new_file", + false).toBool ()) { answer = QMessageBox::Yes; } else { - msgBox = new QMessageBox (QMessageBox::Question, - tr ("Octave Editor"), - tr ("File\n%1\ndoes not exist. " - "Do you want to create it?").arg (openFileName), - QMessageBox::Yes | QMessageBox::No, this); + msgBox = new QMessageBox (QMessageBox::Question, + tr ("Octave Editor"), + tr ("File\n%1\ndoes not exist. " + "Do you want to create it?").arg (openFileName), + QMessageBox::Yes + | QMessageBox::No, this); msgBox->setAttribute (Qt::WA_DeleteOnClose); answer = msgBox->exec (); @@ -339,10 +345,10 @@ { // error opening the file msgBox = new QMessageBox (QMessageBox::Critical, - tr ("Octave Editor"), - tr ("Could not open file\n%1\nfor write: %2."). - arg (openFileName).arg (file.errorString ()), - QMessageBox::Ok, this); + tr ("Octave Editor"), + tr ("Could not open file\n%1\nfor write: %2."). + arg (openFileName).arg (file.errorString ()), + QMessageBox::Ok, this); msgBox->setWindowModality (Qt::NonModal); msgBox->setAttribute (Qt::WA_DeleteOnClose); @@ -376,7 +382,8 @@ void -file_editor::check_conflict_save (const QString& saveFileName, bool remove_on_success) +file_editor::check_conflict_save (const QString& saveFileName, + bool remove_on_success) { // Have all file editor tabs signal what their file names are. editor_tab_map.clear (); @@ -542,13 +549,13 @@ void file_editor::request_save_file_as (void) { - emit fetab_save_file_as (_tab_widget->currentWidget ()); + emit fetab_save_file_as (_tab_widget->currentWidget ()); } void file_editor::request_print_file (void) { - emit fetab_print_file (_tab_widget->currentWidget ()); + emit fetab_print_file (_tab_widget->currentWidget ()); } @@ -654,26 +661,26 @@ for (int i = 0; i < num_files; ++i) { QString text = tr ("&%1 %2"). - arg ((i+1) % int (MaxMRUFiles)).arg (_mru_files.at (i)); + arg ((i+1) % int (MaxMRUFiles)).arg (_mru_files.at (i)); _mru_file_actions[i]->setText (text); _mru_file_actions[i]->setData (_mru_files.at (i)); _mru_file_actions[i]->setVisible (true); } - // hide unused mru-menu entries - for (int j = num_files; j < MaxMRUFiles; ++j) - _mru_file_actions[j]->setVisible (false); + // hide unused mru-menu entries + for (int j = num_files; j < MaxMRUFiles; ++j) + _mru_file_actions[j]->setVisible (false); - // delete entries in string-list beyond MaxMRUFiles - while (_mru_files.size () > MaxMRUFiles) - _mru_files.removeLast (); + // delete entries in string-list beyond MaxMRUFiles + while (_mru_files.size () > MaxMRUFiles) + _mru_files.removeLast (); - // save actual mru-list in settings - QSettings *settings = resource_manager::get_settings (); + // save actual mru-list in settings + QSettings *settings = resource_manager::get_settings (); - // FIXME -- what should happen if settings is 0? - settings->setValue ("editor/mru_file_list", _mru_files); - settings->sync (); + // FIXME: what should happen if settings is 0? + settings->setValue ("editor/mru_file_list", _mru_files); + settings->sync (); } void @@ -747,7 +754,7 @@ } } } - check_actions (); + check_actions (); } void @@ -817,7 +824,7 @@ { QWidget *editor_widget = new QWidget (this); - // FIXME -- what was the intended purpose of this unused variable? + // FIXME: what was the intended purpose of this unused variable? // QStyle *editor_style = QApplication::style (); _menu_bar = new QMenuBar (editor_widget); @@ -832,26 +839,26 @@ tr ("&Open File"), _tool_bar); _save_action = new QAction (QIcon (":/actions/icons/filesave.png"), - tr ("&Save File"), _tool_bar); + tr ("&Save File"), _tool_bar); _save_as_action = new QAction (QIcon (":/actions/icons/filesaveas.png"), - tr ("Save File &As"), _tool_bar); + tr ("Save File &As"), _tool_bar); _print_action = new QAction ( QIcon (":/actions/icons/fileprint.png"), tr ("Print"), _tool_bar); _undo_action = new QAction (QIcon (":/actions/icons/undo.png"), - tr ("&Undo"), _tool_bar); + tr ("&Undo"), _tool_bar); _redo_action = new QAction (QIcon (":/actions/icons/redo.png"), - tr ("&Redo"), _tool_bar); + tr ("&Redo"), _tool_bar); _copy_action = new QAction (QIcon (":/actions/icons/editcopy.png"), tr ("&Copy"), _tool_bar); _copy_action->setEnabled (false); _cut_action = new QAction (QIcon (":/actions/icons/editcut.png"), - tr ("Cu&t"), _tool_bar); + tr ("Cu&t"), _tool_bar); _cut_action->setEnabled (false); _paste_action @@ -860,7 +867,8 @@ _next_bookmark_action = new QAction (tr ("&Next Bookmark"), _tool_bar); - _previous_bookmark_action = new QAction (tr ("Pre&vious Bookmark"), _tool_bar); + _previous_bookmark_action = new QAction (tr ("Pre&vious Bookmark"), + _tool_bar); _toggle_bookmark_action = new QAction (tr ("Toggle &Bookmark"), _tool_bar); @@ -886,7 +894,7 @@ = new QAction (tr ("&Uncomment"), _tool_bar); _find_action = new QAction (QIcon (":/actions/icons/search.png"), - tr ("&Find and Replace"), _tool_bar); + tr ("&Find and Replace"), _tool_bar); _run_action = new QAction (QIcon (":/actions/icons/artsbuilderexecute.png"), tr ("Save File And Run"), _tool_bar); @@ -895,12 +903,12 @@ // the mru-list and an empty array of actions QSettings *settings = resource_manager::get_settings (); - // FIXME -- what should happen if settings is 0? + // FIXME: what should happen if settings is 0? _mru_files = settings->value ("editor/mru_file_list").toStringList (); for (int i = 0; i < MaxMRUFiles; ++i) { - _mru_file_actions[i] = new QAction (this); - _mru_file_actions[i]->setVisible (false); + _mru_file_actions[i] = new QAction (this); + _mru_file_actions[i]->setVisible (false); } // some actions are disabled from the beginning @@ -963,19 +971,19 @@ fileMenu->addSeparator (); _close_action = - fileMenu->addAction (QIcon::fromTheme("window-close", - QIcon (":/actions/icons/fileclose.png")), - tr ("&Close"), this, SLOT (request_close_file (bool))); + fileMenu->addAction (QIcon::fromTheme("window-close", + QIcon (":/actions/icons/fileclose.png")), + tr ("&Close"), this, SLOT (request_close_file (bool))); _close_all_action = - fileMenu->addAction (QIcon::fromTheme("window-close", - QIcon (":/actions/icons/fileclose.png")), - tr ("Close All"), - this, SLOT (request_close_all_files (bool))); - _close_others_action = - fileMenu->addAction (QIcon::fromTheme("window-close", - QIcon (":/actions/icons/fileclose.png")), - tr ("Close Other Files"), - this, SLOT (request_close_other_files (bool))); + fileMenu->addAction (QIcon::fromTheme("window-close", + QIcon (":/actions/icons/fileclose.png")), + tr ("Close All"), + this, SLOT (request_close_all_files (bool))); + _close_others_action = + fileMenu->addAction (QIcon::fromTheme("window-close", + QIcon (":/actions/icons/fileclose.png")), + tr ("Close Other Files"), + this, SLOT (request_close_other_files (bool))); fileMenu->addSeparator (); fileMenu->addAction (_print_action); @@ -1004,11 +1012,13 @@ editMenu->addAction (_goto_line_action); editMenu->addSeparator (); _preferences_action = - editMenu->addAction (QIcon (":/actions/icons/configure.png"), - tr ("&Preferences"), this, SLOT (request_preferences (bool))); + editMenu->addAction (QIcon (":/actions/icons/configure.png"), + tr ("&Preferences"), + this, SLOT (request_preferences (bool))); _styles_preferences_action = editMenu->addAction (QIcon (":/actions/icons/configure.png"), - tr ("&Styles Preferences"), this, SLOT (request_styles_preferences (bool))); + tr ("&Styles Preferences"), + this, SLOT (request_styles_preferences (bool))); _menu_bar->addMenu (editMenu); _debug_menu = new QMenu (tr ("&Debug"), _menu_bar); @@ -1024,7 +1034,7 @@ _run_menu->addAction (_run_action); _context_run_action = _run_menu->addAction (QIcon (), tr ("Run &Selection"), - this, SLOT (request_context_run (bool))); + this, SLOT (request_context_run (bool))); _context_run_action->setEnabled (false); _menu_bar->addMenu (_run_menu); @@ -1051,7 +1061,8 @@ // signals connect (this, SIGNAL (request_settings_dialog (const QString&)), - main_win (), SLOT (process_settings_dialog_request (const QString&))); + main_win (), + SLOT (process_settings_dialog_request (const QString&))); connect (main_win (), SIGNAL (new_file_signal (const QString&)), this, SLOT (request_new_file (const QString&))); @@ -1147,13 +1158,14 @@ if (settings->value ("editor/restoreSession", true).toBool ()) { QStringList sessionFileNames - = settings->value ("editor/savedSessionTabs", QStringList ()).toStringList (); + = settings->value ("editor/savedSessionTabs", + QStringList ()).toStringList (); for (int n = 0; n < sessionFileNames.count (); ++n) request_open_file (sessionFileNames.at (n)); } - check_actions (); + check_actions (); } void @@ -1183,7 +1195,7 @@ connect (f, SIGNAL (run_file_signal (const QFileInfo&)), main_win (), SLOT (run_file_in_terminal (const QFileInfo&))); - + connect (f, SIGNAL (execute_command_in_terminal_signal (const QString&)), main_win (), SLOT (execute_command_in_terminal (const QString&))); @@ -1300,20 +1312,20 @@ { QWidget * foc_w = focusWidget (); - if(foc_w && foc_w->inherits ("octave_qscintilla")) - { - request_copy (); - } + if (foc_w && foc_w->inherits ("octave_qscintilla")) + { + request_copy (); + } } void file_editor::pasteClipboard () { QWidget * foc_w = focusWidget (); - if(foc_w && foc_w->inherits ("octave_qscintilla")) - { - request_paste (); - } + if (foc_w && foc_w->inherits ("octave_qscintilla")) + { + request_paste (); + } } void @@ -1322,7 +1334,9 @@ if (set) { _comment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_R); - _uncomment_selection_action->setShortcut (Qt::SHIFT + Qt::ControlModifier + Qt::Key_R); + _uncomment_selection_action->setShortcut (Qt::SHIFT + + Qt::ControlModifier + + Qt::Key_R); _copy_action->setShortcut (QKeySequence::Copy); _cut_action->setShortcut (QKeySequence::Cut);
--- a/libgui/src/m-editor/find-dialog.cc +++ b/libgui/src/m-editor/find-dialog.cc @@ -158,7 +158,7 @@ _find_next_button->setDefault (true); _find_result_available = false; - // move to dialog to side of the parent if there is room on the desktop to do so. + // move dialog to side of the parent if there is room on the desktop to do so. QWidget * desktop = QApplication::desktop (); int xp = p->x () + p->frameGeometry ().width (); int yp= p->y (); @@ -215,9 +215,11 @@ bool do_forward = true; if (_find_result_available) - { // we found a match last time, cursor is at the end of the match + { + // we found a match last time, cursor is at the end of the match if (!forward) - { // backward: go back one position or we will find the same again + { + // backward: go back one position or we will find the same again do_forward = false; _edit_area->getCursorPosition (&line,&col); if (col > 0) @@ -237,18 +239,19 @@ if (_edit_area) { - _find_result_available = _edit_area->findFirst (_search_line_edit->text (), - _regex_check_box->isChecked (), - _case_check_box->isChecked (), - _whole_words_check_box->isChecked (), - do_wrap, - do_forward, - line,col, - true + _find_result_available + = _edit_area->findFirst (_search_line_edit->text (), + _regex_check_box->isChecked (), + _case_check_box->isChecked (), + _whole_words_check_box->isChecked (), + do_wrap, + do_forward, + line,col, + true #ifdef HAVE_QSCI_VERSION_2_6_0 - , true + , true #endif - ); + ); } if (_find_result_available) _from_start_check_box->setChecked (0); @@ -284,7 +287,8 @@ { cs = Qt::CaseInsensitive; } - strDiff = QString::compare(_search_line_edit->text(),_replace_line_edit->text(),cs); + strDiff = QString::compare (_search_line_edit->text(), + _replace_line_edit->text(), cs); // replace all if strings are different if (_edit_area && strDiff ) @@ -307,7 +311,7 @@ void find_dialog::no_matches_message () { - QMessageBox msg_box (QMessageBox::Information, tr ("Find Result"), + QMessageBox msg_box (QMessageBox::Information, tr ("Find Result"), tr ("No more matches found"), QMessageBox::Ok, this); msg_box.exec (); }
--- a/libgui/src/m-editor/find-dialog.h +++ b/libgui/src/m-editor/find-dialog.h @@ -74,7 +74,7 @@ class find_dialog : public QDialog { Q_OBJECT - public: +public: find_dialog (QsciScintilla* edit_area, QWidget *parent = 0); void init_search_text ();
--- a/libgui/src/m-editor/octave-qscintilla.cc +++ b/libgui/src/m-editor/octave-qscintilla.cc @@ -34,14 +34,15 @@ #include "file-editor-tab.h" octave_qscintilla::octave_qscintilla (QWidget *p) - : QsciScintilla (p) + : QsciScintilla (p) { } octave_qscintilla::~octave_qscintilla () { } void -octave_qscintilla::get_global_textcursor_pos (QPoint *global_pos, QPoint *local_pos) +octave_qscintilla::get_global_textcursor_pos (QPoint *global_pos, + QPoint *local_pos) { long position = SendScintilla (QsciScintillaBase::SCI_GETCURRENTPOS); long point_x = SendScintilla @@ -99,16 +100,18 @@ QPoint global_pos, local_pos; if (e->reason () == QContextMenuEvent::Mouse) - { // context menu by mouse + { + // context menu by mouse global_pos = e->globalPos (); // global mouse position local_pos = e->pos (); // local mouse position } else - { // context menu by keyboard or other: get point of text cursor + { + // context menu by keyboard or other: get point of text cursor get_global_textcursor_pos (&global_pos, &local_pos); QRect editor_rect = geometry (); // editor rect mapped to global editor_rect.moveTopLeft - (parentWidget ()->mapToGlobal (editor_rect.topLeft ())); + (parentWidget ()->mapToGlobal (editor_rect.topLeft ())); if (!editor_rect.contains (global_pos)) // is cursor outside editor? global_pos = editor_rect.topLeft (); // yes, take top left corner } @@ -125,11 +128,12 @@ if (!_word_at_cursor.isEmpty ()) { context_menu->addAction (tr ("Help on") + " " + _word_at_cursor, - this, SLOT (contextmenu_help (bool))); - context_menu->addAction (tr ("Documentation on") + " " + _word_at_cursor, - this, SLOT (contextmenu_doc (bool))); + this, SLOT (contextmenu_help (bool))); + context_menu->addAction (tr ("Documentation on") + + " " + _word_at_cursor, + this, SLOT (contextmenu_doc (bool))); context_menu->addAction (tr ("Edit") + " " + _word_at_cursor, - this, SLOT (contextmenu_edit (bool))); + this, SLOT (contextmenu_edit (bool))); } context_menu->addSeparator (); // separator before custom entries if (hasSelectedText ()) @@ -176,7 +180,8 @@ void octave_qscintilla::contextmenu_run (bool) { - QStringList commands = selectedText ().split (QRegExp("[\r\n]"),QString::SkipEmptyParts); + QStringList commands = selectedText ().split (QRegExp("[\r\n]"), + QString::SkipEmptyParts); for (int i = 0; i < commands.size (); i++ ) emit execute_command_in_terminal_signal (commands.at (i)); }
--- a/libgui/src/main-window.cc +++ b/libgui/src/main-window.cc @@ -103,7 +103,7 @@ delete history_window; delete status_bar; delete _workspace_model; - if (find_files_dlg) + if (find_files_dlg) { delete find_files_dlg; find_files_dlg = 0; @@ -147,7 +147,8 @@ main_window::handle_save_workspace_request (void) { QString file = - QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".", 0, 0, QFileDialog::DontUseNativeDialog); + QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".", 0, 0, + QFileDialog::DontUseNativeDialog); if (! file.isEmpty ()) octave_link::post_event (this, &main_window::save_workspace_callback, @@ -160,7 +161,8 @@ QString file = file_arg; if (file.isEmpty ()) - file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".", 0, 0, QFileDialog::DontUseNativeDialog); + file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".", 0, 0, + QFileDialog::DontUseNativeDialog); if (! file.isEmpty ()) octave_link::post_event (this, &main_window::load_workspace_callback, @@ -233,7 +235,7 @@ _cmd_queue->append (command); // queue command _cmd_queue_mutex.unlock (); - if (_cmd_processing.tryAcquire ()) // if callback is not processing, post event + if (_cmd_processing.tryAcquire ()) // if callback not processing, post event octave_link::post_event (this, &main_window::execute_command_callback); } @@ -347,27 +349,30 @@ = settings->value ("DockWidgets/widget_icon_set", "NONE").toString (); static struct - { - QString name; - QString path; - } + { + QString name; + QString path; + } widget_icon_data[] = - { // array of possible icon sets (name, path (complete for NONE)) - // the first entry here is the default! - {"NONE", ":/actions/icons/logo.png"}, - {"GRAPHIC", ":/actions/icons/graphic_logo_"}, - {"LETTER", ":/actions/icons/letter_logo_"}, - {"", ""} // end marker has empty name - }; + { + // array of possible icon sets (name, path (complete for NONE)) + // the first entry here is the default! + {"NONE", ":/actions/icons/logo.png"}, + {"GRAPHIC", ":/actions/icons/graphic_logo_"}, + {"LETTER", ":/actions/icons/letter_logo_"}, + {"", ""} // end marker has empty name + }; int count = 0; int icon_set_found = 0; // default while (!widget_icon_data[count].name.isEmpty ()) - { // while not end of data + { + // while not end of data if (widget_icon_data[count].name == icon_set) - { // data of desired icon set found + { + // data of desired icon set found icon_set_found = count; break; } @@ -387,10 +392,10 @@ } } if (widget_icon_data[icon_set_found].name != "NONE") - _release_notes_icon = widget_icon_data[icon_set_found].path - + "ReleaseWidget.png"; + _release_notes_icon = widget_icon_data[icon_set_found].path + + "ReleaseWidget.png"; else - _release_notes_icon = ":/actions/icons/logo.png"; + _release_notes_icon = ":/actions/icons/logo.png"; int icon_size = settings->value ("toolbar_icon_size",24).toInt (); _main_tool_bar->setIconSize (QSize (icon_size,icon_size)); @@ -441,11 +446,12 @@ main_window::browse_for_directory (void) { QString dir - = QFileDialog::getExistingDirectory (this, tr ("Set working directory"), 0, QFileDialog::DontUseNativeDialog); + = QFileDialog::getExistingDirectory (this, tr ("Set working directory"), 0, + QFileDialog::DontUseNativeDialog); set_current_working_directory (dir); - // FIXME -- on Windows systems, the command window freezes after the + // FIXME: on Windows systems, the command window freezes after the // previous actions. Forcing the focus appears to unstick it. focus_command_window (); @@ -457,7 +463,7 @@ // Change to dir if it is an existing directory. QString xdir = dir.isEmpty () ? "." : dir; - + QFileInfo fileInfo (xdir); if (fileInfo.exists () && fileInfo.isDir ()) @@ -613,14 +619,15 @@ if (!settings) { - qDebug("Error: QSettings pointer from resource manager is NULL."); + qDebug ("Error: QSettings pointer from resource manager is NULL."); return; } set_window_layout (settings); // restore the list of the last directories - QStringList curr_dirs = settings->value ("MainWindow/current_directory_list").toStringList (); + QStringList curr_dirs + = settings->value ("MainWindow/current_directory_list").toStringList (); for (int i=0; i < curr_dirs.size (); i++) { _current_directory_combo_box->addItem (curr_dirs.at (i)); @@ -671,7 +678,7 @@ // show floating widgets after main win to ensure "Octave" in central menu foreach (octave_dock_widget *widget, float_and_visible) - widget->setVisible (true); + widget->setVisible (true); } @@ -681,7 +688,7 @@ QSettings *settings = resource_manager::get_settings (); if (!settings) { - qDebug("Error: QSettings pointer from resource manager is NULL."); + qDebug ("Error: QSettings pointer from resource manager is NULL."); return; } @@ -716,9 +723,9 @@ if (edit && edit->hasSelectedText ()) { QClipboard *clipboard = QApplication::clipboard (); - clipboard->setText (edit->selectedText ()); + clipboard->setText (edit->selectedText ()); } - } + } else emit copyClipboard_signal (); } @@ -733,9 +740,9 @@ QString str = clipboard->text (); if (edit && str.length () > 0) { - edit->insert (str); + edit->insert (str); } - } + } else emit pasteClipboard_signal (); } @@ -778,12 +785,14 @@ const QStringList&)), this, SLOT (handle_create_inputlayout (const QStringList&, const QString&, - const QFloatList&, const QFloatList&, + const QFloatList&, + const QFloatList&, const QStringList&))); connect (&uiwidget_creator, SIGNAL (create_filedialog (const QStringList &,const QString&, - const QString&, const QString&, const QString&)), + const QString&, const QString&, + const QString&)), this, SLOT (handle_create_filedialog (const QStringList &, const QString&, const QString&, const QString&, @@ -846,8 +855,8 @@ void main_window::handle_create_filedialog (const QStringList& filters, - const QString& title, - const QString& filename, + const QString& title, + const QString& filename, const QString& dirname, const QString& multimode) { @@ -921,8 +930,8 @@ addDockWidget (Qt::LeftDockWidgetArea, workspace_window); addDockWidget (Qt::LeftDockWidgetArea, history_window); - int win_x = QApplication::desktop()->width(); - int win_y = QApplication::desktop()->height(); + int win_x = QApplication::desktop ()->width (); + int win_y = QApplication::desktop ()->height (); if (win_x > 960) win_x = 960; @@ -950,7 +959,9 @@ connect (this, SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)), editor_window, - SLOT (handle_update_breakpoint_marker_request (bool, const QString&, int))); + SLOT (handle_update_breakpoint_marker_request (bool, + const QString&, + int))); #endif QDir curr_dir; @@ -1035,7 +1046,8 @@ connect (_octave_qt_link, SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)), this, - SLOT (handle_update_breakpoint_marker_request (bool, const QString&, int))); + SLOT (handle_update_breakpoint_marker_request (bool, const QString&, + int))); connect (_octave_qt_link, SIGNAL (show_doc_signal (const QString &)), @@ -1190,12 +1202,12 @@ = edit_menu->addAction (tr ("Clear Command Window")); QAction *clear_command_history - = edit_menu->addAction(tr ("Clear Command History")); + = edit_menu->addAction (tr ("Clear Command History")); QAction *clear_workspace_action = edit_menu->addAction (tr ("Clear Workspace")); - connect (_find_files_action, SIGNAL (triggered()), + connect (_find_files_action, SIGNAL (triggered ()), this, SLOT (find_files ())); connect (clear_command_window_action, SIGNAL (triggered ()), @@ -1236,17 +1248,20 @@ _debug_menu = p->addMenu (tr ("De&bug")); _debug_step_over = construct_debug_menu_item - (":/actions/icons/db_step.png", tr ("Step"), Qt::Key_F10); + (":/actions/icons/db_step.png", tr ("Step"), + Qt::Key_F10); _debug_step_into = construct_debug_menu_item - (":/actions/icons/db_step_in.png", tr ("Step in"), Qt::Key_F11); + (":/actions/icons/db_step_in.png", tr ("Step in"), + Qt::Key_F11); _debug_step_out = construct_debug_menu_item - (":/actions/icons/db_step_out.png", tr ("Step out"), - Qt::ShiftModifier + Qt::Key_F11); + (":/actions/icons/db_step_out.png", tr ("Step out"), + Qt::ShiftModifier + Qt::Key_F11); _debug_continue = construct_debug_menu_item - (":/actions/icons/db_cont.png", tr ("Continue"), Qt::Key_F5); + (":/actions/icons/db_cont.png", tr ("Continue"), + Qt::Key_F5); _debug_menu->addSeparator (); #ifdef HAVE_QSCINTILLA @@ -1254,8 +1269,8 @@ #endif _debug_quit = construct_debug_menu_item - (":/actions/icons/db_stop.png", tr ("Exit Debug Mode"), - Qt::ShiftModifier + Qt::Key_F5); + (":/actions/icons/db_stop.png", tr ("Exit Debug Mode"), + Qt::ShiftModifier + Qt::Key_F5); connect (_debug_step_over, SIGNAL (triggered ()), this, SLOT (debug_step_over ())); @@ -1296,48 +1311,62 @@ QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier; QAction *show_command_window_action = construct_window_menu_item - (window_menu, tr ("Show Command Window"), true, ctrl_shift + Qt::Key_0); + (window_menu, + tr ("Show Command Window"), true, + ctrl_shift + Qt::Key_0); QAction *show_history_action = construct_window_menu_item - (window_menu, tr ("Show Command History"), true, ctrl_shift + Qt::Key_1); + (window_menu, tr ("Show Command History"), + true, ctrl_shift + Qt::Key_1); QAction *show_file_browser_action = construct_window_menu_item - (window_menu, tr ("Show File Browser"), true, ctrl_shift + Qt::Key_2); + (window_menu, tr ("Show File Browser"), + true, ctrl_shift + Qt::Key_2); QAction *show_workspace_action = construct_window_menu_item - (window_menu, tr ("Show Workspace"), true, ctrl_shift + Qt::Key_3); + (window_menu, tr ("Show Workspace"), true, + ctrl_shift + Qt::Key_3); QAction *show_editor_action = construct_window_menu_item - (window_menu, tr ("Show Editor"), true, ctrl_shift + Qt::Key_4); + (window_menu, tr ("Show Editor"), true, + ctrl_shift + Qt::Key_4); QAction *show_documentation_action = construct_window_menu_item - (window_menu, tr ("Show Documentation"), true, ctrl_shift + Qt::Key_5); + (window_menu, tr ("Show Documentation"), + true, ctrl_shift + Qt::Key_5); QAction *show_news_action = construct_window_menu_item - (window_menu, tr ("Show News Window"), true, ctrl_shift + Qt::Key_6); + (window_menu, tr ("Show News Window"), true, + ctrl_shift + Qt::Key_6); window_menu->addSeparator (); QAction *command_window_action = construct_window_menu_item - (window_menu, tr ("Command Window"), false, ctrl + Qt::Key_0); + (window_menu, tr ("Command Window"), false, + ctrl + Qt::Key_0); QAction *history_action = construct_window_menu_item - (window_menu, tr ("Command History"), false, ctrl + Qt::Key_1); + (window_menu, tr ("Command History"), false, + ctrl + Qt::Key_1); QAction *file_browser_action = construct_window_menu_item - (window_menu, tr ("File Browser"), false, ctrl + Qt::Key_2); + (window_menu, tr ("File Browser"), false, + ctrl + Qt::Key_2); QAction *workspace_action = construct_window_menu_item - (window_menu, tr ("Workspace"), false, ctrl + Qt::Key_3); + (window_menu, tr ("Workspace"), false, + ctrl + Qt::Key_3); QAction *editor_action = construct_window_menu_item - (window_menu, tr ("Editor"), false, ctrl + Qt::Key_4); + (window_menu, tr ("Editor"), false, + ctrl + Qt::Key_4); QAction *documentation_action = construct_window_menu_item - (window_menu, tr ("Documentation"), false, ctrl + Qt::Key_5); + (window_menu, tr ("Documentation"), false, + ctrl + Qt::Key_5); QAction *news_action = construct_window_menu_item - (window_menu, tr ("News"), false, ctrl + Qt::Key_6); + (window_menu, tr ("News"), false, ctrl + Qt::Key_6); window_menu->addSeparator (); @@ -1519,29 +1548,30 @@ _current_directory_combo_box = new QComboBox (this); _current_directory_combo_box->setFixedWidth (current_directory_width); _current_directory_combo_box->setEditable (true); - _current_directory_combo_box->setInsertPolicy(QComboBox::NoInsert); + _current_directory_combo_box->setInsertPolicy (QComboBox::NoInsert); _current_directory_combo_box->setToolTip (tr ("Enter directory name")); - _current_directory_combo_box->setMaxVisibleItems (current_directory_max_visible); + _current_directory_combo_box->setMaxVisibleItems ( + current_directory_max_visible); _current_directory_combo_box->setMaxCount (current_directory_max_count); - QSizePolicy sizePol(QSizePolicy::Expanding, QSizePolicy::Preferred); - _current_directory_combo_box->setSizePolicy(sizePol); + QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred); + _current_directory_combo_box->setSizePolicy (sizePol); // addWidget takes ownership of the objects so there is no // need to delete these upon destroying this main_window. _main_tool_bar->addWidget (new QLabel (tr ("Current Directory: "))); _main_tool_bar->addWidget (_current_directory_combo_box); QAction *current_dir_up = _main_tool_bar->addAction ( - QIcon (":/actions/icons/up.png"), - tr ("One directory up")); + QIcon (":/actions/icons/up.png"), + tr ("One directory up")); QAction *current_dir_search = _main_tool_bar->addAction ( - QIcon (":/actions/icons/search.png"), - tr ("Browse directories")); + QIcon (":/actions/icons/search.png"), + tr ("Browse directories")); connect (_current_directory_combo_box, SIGNAL (activated (QString)), this, SLOT (set_current_working_directory (QString))); - connect (_current_directory_combo_box->lineEdit(), SIGNAL (returnPressed ()), - this, SLOT (accept_directory_line_edit ())); + connect (_current_directory_combo_box->lineEdit (), SIGNAL (returnPressed ()), + this, SLOT (accept_directory_line_edit ())); connect (current_dir_search, SIGNAL (triggered ()), this, SLOT (browse_for_directory ())); @@ -1579,7 +1609,7 @@ /* bool status = */ symbol_table::rename (names.first, names.second); // if (status) - octave_link::set_workspace (true, symbol_table::workspace_info ()); + octave_link::set_workspace (true, symbol_table::workspace_info ()); // else // ; // we need an octave_link action that runs a GUI error option. @@ -1624,7 +1654,7 @@ _cmd_queue_mutex.lock (); // critical path std::string command = _cmd_queue->takeFirst ().toStdString (); if (_cmd_queue->isEmpty ()) - _cmd_processing.release (); // command queue empty, processing will stop + _cmd_processing.release (); // cmd queue empty, processing will stop else repost = true; // not empty, repost at end _cmd_queue_mutex.unlock (); @@ -1709,7 +1739,7 @@ } void -main_window::find_files(const QString &start_dir) +main_window::find_files (const QString &start_dir) { if (! find_files_dlg) @@ -1719,11 +1749,12 @@ connect (find_files_dlg, SIGNAL (finished (int)), this, SLOT (find_files_finished (int))); - connect (find_files_dlg, SIGNAL (dir_selected(const QString &)), - file_browser_window, SLOT(set_current_directory(const QString&))); + connect (find_files_dlg, SIGNAL (dir_selected (const QString &)), + file_browser_window, + SLOT (set_current_directory (const QString&))); - connect (find_files_dlg, SIGNAL (file_selected(const QString &)), - this, SLOT(open_file(const QString &))); + connect (find_files_dlg, SIGNAL (file_selected (const QString &)), + this, SLOT (open_file (const QString &))); find_files_dlg->setWindowModality (Qt::NonModal); } @@ -1733,14 +1764,14 @@ find_files_dlg->show (); } - find_files_dlg->set_search_dir(start_dir); + find_files_dlg->set_search_dir (start_dir); find_files_dlg->activateWindow (); } -void -main_window::find_files_finished(int) +void +main_window::find_files_finished (int) { } @@ -1756,7 +1787,9 @@ _exit_action->setShortcut (QKeySequence::Quit); - _find_files_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_F); + _find_files_action->setShortcut (Qt::ControlModifier + + Qt::ShiftModifier + + Qt::Key_F); } else
--- a/libgui/src/main-window.h +++ b/libgui/src/main-window.h @@ -115,7 +115,8 @@ void open_agora_page (void); void open_contribute_page (void); void open_developer_page (void); - void process_settings_dialog_request (const QString& desired_tab = QString ()); + void process_settings_dialog_request (const QString& desired_tab + = QString ()); void show_about_octave (void); void notice_settings (const QSettings *settings); void prepare_to_exit (void); @@ -128,8 +129,8 @@ void change_directory_up (void); void accept_directory_line_edit (void); - void execute_command_in_terminal(const QString& dir); - void run_file_in_terminal(const QFileInfo& info); + void execute_command_in_terminal (const QString& dir); + void run_file_in_terminal (const QFileInfo& info); void handle_new_figure_request (void); @@ -173,16 +174,16 @@ const QFloatList&, const QFloatList&, const QStringList&); - void handle_create_filedialog (const QStringList &filters, - const QString& title, const QString& filename, + void handle_create_filedialog (const QStringList &filters, + const QString& title, const QString& filename, const QString &dirname, const QString& multimode); void handle_show_doc (const QString &file); - // find files dialog - void find_files(const QString &startdir=QDir::currentPath()); - void find_files_finished(int); + // find files dialog + void find_files (const QString &startdir=QDir::currentPath ()); + void find_files_finished (int); // setting global shortcuts void set_global_shortcuts (bool enable);
--- a/libgui/src/news-dock-widget.h +++ b/libgui/src/news-dock-widget.h @@ -52,22 +52,22 @@ class news_reader : public QObject { Q_OBJECT - + public: news_reader (const QString& xbase_url, const QString& xpage) : QObject (), base_url (xbase_url), page (xpage) { } - + public slots: - void process (void); - + void process (void); + signals: void display_news_signal (const QString& news); void finished (void); - + private: QString base_url;
--- a/libgui/src/octave-dock-widget.cc +++ b/libgui/src/octave-dock-widget.cc @@ -34,7 +34,7 @@ octave_dock_widget::octave_dock_widget (QWidget *p) - : QDockWidget (p) + : QDockWidget (p) { _parent = static_cast<QMainWindow *> (p); // store main window @@ -58,8 +58,8 @@ this, SLOT (change_floating (bool))); QToolButton *dock_button = new QToolButton (this); dock_button->setDefaultAction (_dock_action); - dock_button->setFocusPolicy(Qt::NoFocus); - dock_button->setIconSize(QSize(12,12)); + dock_button->setFocusPolicy (Qt::NoFocus); + dock_button->setIconSize (QSize (12,12)); QAction *close_action = new QAction (QIcon (":/actions/icons/widget-close.png"), "", this ); @@ -68,8 +68,8 @@ this, SLOT (change_visibility (bool))); QToolButton *close_button = new QToolButton (this); close_button->setDefaultAction (close_action); - close_button->setFocusPolicy(Qt::NoFocus); - close_button->setIconSize(QSize(12,12)); + close_button->setFocusPolicy (Qt::NoFocus); + close_button->setIconSize (QSize (12,12)); QHBoxLayout *h_layout = new QHBoxLayout (); h_layout->addStretch (100); @@ -95,8 +95,10 @@ #endif // copy & paste handling - connect (p, SIGNAL (copyClipboard_signal ()), this, SLOT (copyClipboard ())); - connect (p, SIGNAL (pasteClipboard_signal()), this, SLOT (pasteClipboard ())); + connect (p, SIGNAL (copyClipboard_signal ()), + this, SLOT (copyClipboard ())); + connect (p, SIGNAL (pasteClipboard_signal ()), + this, SLOT (pasteClipboard ())); } octave_dock_widget::~octave_dock_widget () @@ -110,7 +112,8 @@ settings->beginGroup ("DockWidgets"); if (!parent ()) - { // widget is floating (windows), save actual floating geometry + { + // widget is floating (windows), save actual floating geometry floating = true; settings->setValue (name+"_floating_geometry", saveGeometry ()); } @@ -141,7 +144,7 @@ { #if defined (Q_OS_WIN32) QHBoxLayout* h_layout = - static_cast<QHBoxLayout *> (titleBarWidget ()->layout ()); + static_cast<QHBoxLayout *> (titleBarWidget ()->layout ()); QLabel *label = new QLabel (title); h_layout->insertWidget (0,label); #endif @@ -170,8 +173,8 @@ _dock_action->setToolTip (tr ("Dock widget")); // restore the last geometry when floating - restoreGeometry (settings->value - ("DockWidgets/" + objectName ()+"_floating_geometry").toByteArray ()); + restoreGeometry (settings->value ("DockWidgets/" + objectName () + + "_floating_geometry").toByteArray ()); #else @@ -198,12 +201,14 @@ settings->sync (); if (dock) - { // add widget to last saved docking area (dock=true is default) + { + // add widget to last saved docking area (dock=true is default) int area = settings->value ("DockWidgets/" + objectName () + "_dock_area", - Qt::TopDockWidgetArea).toInt (); + Qt::TopDockWidgetArea).toInt (); _parent->addDockWidget (static_cast<Qt::DockWidgetArea> (area), this); - // FIXME: restoreGeometry is ignored for docked widgets and its child widget + // FIXME: restoreGeometry is ignored for docked widgets + // and its child widget // restoreGeometry (settings->value // ("DockWidgets/" + objectName ()).toByteArray ()); } @@ -225,9 +230,9 @@ // slot for (un)dock action void octave_dock_widget::change_floating (bool floating) - { +{ #if defined (Q_OS_WIN32) - if (parent()) + if (parent ()) #else if (floating) #endif @@ -251,7 +256,7 @@ QWidget * octave_dock_widget::focusWidget () { - QWidget * w = QApplication::focusWidget (); - if(w && w->focusProxy ()) w = w->focusProxy (); - return w; + QWidget * w = QApplication::focusWidget (); + if (w && w->focusProxy ()) w = w->focusProxy (); + return w; }
--- a/libgui/src/octave-dock-widget.h +++ b/libgui/src/octave-dock-widget.h @@ -58,7 +58,7 @@ QDockWidget::closeEvent (e); } - QWidget * focusWidget(); + QWidget * focusWidget (); public slots:
--- a/libgui/src/octave-gui.cc +++ b/libgui/src/octave-gui.cc @@ -86,30 +86,30 @@ // Custom message handler for filtering some messages from Qt. void message_handler (QtMsgType type, const char *msg) - { - switch (type) - { - case QtDebugMsg: - if (strncmp (msg, "QFileSystemWatcher: skipping native engine",42) != 0) - std::cerr << "Debug: " << msg << std::endl; - break; +{ + switch (type) + { + case QtDebugMsg: + if (strncmp (msg, "QFileSystemWatcher: skipping native engine",42) != 0) + std::cerr << "Debug: " << msg << std::endl; + break; - case QtWarningMsg: - std::cerr << "Warning: " << msg << std::endl; - break; + case QtWarningMsg: + std::cerr << "Warning: " << msg << std::endl; + break; - case QtCriticalMsg: - std::cerr << "Critical: " << msg << std::endl; - break; + case QtCriticalMsg: + std::cerr << "Critical: " << msg << std::endl; + break; - case QtFatalMsg: - std::cerr << "Fatal: " << msg << std::endl; - abort (); + case QtFatalMsg: + std::cerr << "Fatal: " << msg << std::endl; + abort (); - default: - break; - } - } + default: + break; + } +} // If START_GUI is false, we still set up the QApplication so that we // can use Qt widgets for plot windows. @@ -124,7 +124,7 @@ if (start_gui) { // Set the codec for all strings - QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + QTextCodec::setCodecForCStrings (QTextCodec::codecForName ("UTF-8")); // install translators for the gui and qt text QTranslator gui_tr, qt_tr, qsci_tr; @@ -166,8 +166,9 @@ main_window w; w.read_settings (); // get widget settings and window layout w.focus_command_window (); - w.connect_visibility_changed (); // connect signals for changes in - // visibility not before w is shown + w.connect_visibility_changed (); // connect signals for changes + // in visibility not before w + // is shown return application.exec (); } }
--- a/libgui/src/octave-qt-link.cc +++ b/libgui/src/octave-qt-link.cc @@ -114,7 +114,7 @@ uiwidget_creator.wait (); // The GUI has sent a signal and the process has been awakened. - return uiwidget_creator.get_dialog_button().toStdString (); + return uiwidget_creator.get_dialog_button ().toStdString (); } static QStringList @@ -153,10 +153,10 @@ name.replace (QRegExp ("\\(.*\\)"), ""); ext.replace (";", " "); - if (name.length() == 0) + if (name.length () == 0) { // No name field. Build one from the extensions. - name = ext.toUpper() + " Files"; + name = ext.toUpper () + " Files"; } retval.append (name + " (" + ext + ")"); @@ -250,7 +250,8 @@ retval.push_back (it->toStdString ()); retval.push_back (uiwidget_creator.get_dialog_path ()->toStdString ()); - retval.push_back ((QString ("%1").arg (uiwidget_creator.get_dialog_result ())).toStdString ()); + retval.push_back ((QString ("%1").arg ( + uiwidget_creator.get_dialog_result ())).toStdString ()); return retval; } @@ -267,8 +268,8 @@ QString msg = (addpath_option - ? tr ("The file %1 does not exist in the load path. To debug the function you are editing, you must either change to the directory %2 or add that directory to the load path.").arg(qfile).arg(qdir) - : tr ("The file %1 is shadowed by a file with the same name in the load path. To debug the function you are editing, change to the directory %2.").arg(qfile).arg(qdir)); + ? tr ("The file %1 does not exist in the load path. To debug the function you are editing, you must either change to the directory %2 or add that directory to the load path.").arg (qfile).arg (qdir) + : tr ("The file %1 is shadowed by a file with the same name in the load path. To debug the function you are editing, change to the directory %2.").arg (qfile).arg (qdir)); QString title = tr ("Change Directory or Add Directory to Load Path"); @@ -402,7 +403,8 @@ octave_qt_link::do_update_breakpoint (bool insert, const std::string& file, int line) { - emit update_breakpoint_marker_signal (insert, QString::fromStdString (file), line); + emit update_breakpoint_marker_signal (insert, QString::fromStdString (file), + line); } void
--- a/libgui/src/octave-qt-link.h +++ b/libgui/src/octave-qt-link.h @@ -85,7 +85,7 @@ const std::list<std::string>& defaults); std::list<std::string> - do_file_dialog (const filter_list& filter, const std::string& title, + do_file_dialog (const filter_list& filter, const std::string& title, const std::string &filename, const std::string &pathname, const std::string& multimode);
--- a/libgui/src/qtinfo/parser.cc +++ b/libgui/src/qtinfo/parser.cc @@ -166,7 +166,7 @@ while (!io->atEnd ()) { QString text = get_next_node (io); - if(node == get_node_name (text)) + if (node == get_node_name (text)) { return text; } @@ -187,12 +187,14 @@ { io->getChar (&c); if (c) - { // first char is not equal 0 + { + // first char is not equal 0 io->ungetChar (c); line = io->readLine (); } else - { // 0 was read -> image -> text length changes + { + // 0 was read -> image -> text length changes line_buffer = io->readLine (); // image tag that is not needed line = io->readLine (); // firsts line of text message for (i=1; i<line_buffer.size ()+6; i++) // correct the size @@ -233,7 +235,7 @@ { QString firstLine = get_first_line (text); QStringList nodes = firstLine.split (","); - for (int i = 0;i < nodes.size (); i++) + for (int i = 0; i < nodes.size (); i++) { QString node = nodes.at (i).trimmed (); @@ -331,7 +333,8 @@ while ( (i = re.indexIn (text, i)) != -1) { QString t = re.cap (1); - QString bold = "<font style=\"color:SteelBlue;font-weight:bold\">" + t + "</font>"; + QString bold = "<font style=\"color:SteelBlue;font-weight:bold\">" + t + + "</font>"; f = re.matchedLength (); text.replace (i,f,bold); @@ -346,8 +349,10 @@ text.replace ("<", "<"); text.replace (">", ">"); - text.replace ("\n* Menu:", "\n<font style=\"color:DarkRed;font-weight:bold\">Menu:</font>"); - text.replace ("See also:", "<font style=\"color:DarkRed;font-style:italic;font-weight:bold\">See also:</font>"); + text.replace ("\n* Menu:", + "\n<font style=\"color:DarkRed;font-weight:bold\">Menu:</font>"); + text.replace ("See also:", + "<font style=\"color:DarkRed;font-style:italic;font-weight:bold\">See also:</font>"); replace_links (text); replace_colons (text); } @@ -375,8 +380,8 @@ info_to_html (text2); text = text1 + "<a name='" + anchor - + "'/><img src=':/actions/icons/arrow_down.png'><br> " - + text2; + + "'/><img src=':/actions/icons/arrow_down.png'><br> " + + text2; } else { @@ -417,7 +422,7 @@ QRegExp re_files ("([^:]+): (\\d+)\n"); int foundCount = 0; - for(int i = 0; i < _info_files.size (); i++) + for (int i = 0; i < _info_files.size (); i++) { QFileInfo fileInfo = _info_files.at (i); @@ -437,7 +442,8 @@ int pos = 0; QString last_node; - while ((pos = re.indexIn (nodeText, pos)) != -1) { + while ((pos = re.indexIn (nodeText, pos)) != -1) + { QString type = re.cap (1); QString node = re.cap (2); int index = re.cap (3).toInt (); @@ -465,12 +471,13 @@ foundCount++; int pos = 0; - while ( (pos = re_files.indexIn (nodeText, pos)) != -1) { + while ( (pos = re_files.indexIn (nodeText, pos)) != -1) + { QString fileCap = re_files.cap (1).trimmed (); int index = re_files.cap (2).toInt (); info_file_item item; - for (int j = 0;j < _info_files.size (); j++) + for (int j = 0; j < _info_files.size (); j++) { QFileInfo info = _info_files.at (j); if (info.fileName ().startsWith (fileCap)) @@ -586,7 +593,8 @@ int pos = 0; int founds = 0; - for (; founds < words.size () && node_text.indexOf (words.at (founds)) >= 0; founds++) + for (; founds < words.size () + && node_text.indexOf (words.at (founds)) >= 0; founds++) { } if (founds<words.size ()) @@ -595,20 +603,22 @@ } founds = 0; - while ( (pos = re.indexIn (node_text, pos)) != -1 && founds < max_founds) + while ((pos = re.indexIn (node_text, pos)) != -1 + && founds < max_founds) { int line_start, line_end; line_start = node_text.lastIndexOf ("\n", pos); line_end = node_text.indexOf ("\n", pos); - QString line = node_text.mid (line_start, line_end - line_start).trimmed (); + QString line = node_text.mid (line_start, + line_end - line_start).trimmed (); pos += re.matchedLength (); if (founds == 0) { results.append( - "<br>\n<img src=':/actions/icons/bookmark.png' width=10> <a href='" - + QString(QUrl::toPercentEncoding(node,"","'")) + - "'>"); + "<br>\n<img src=':/actions/icons/bookmark.png' width=10> <a href='" + + QString(QUrl::toPercentEncoding(node,"","'")) + + "'>"); results.append (node); results.append ("</a><br>\n"); } @@ -628,13 +638,13 @@ return results; } -QString +QString parser::find_ref (const QString &ref_name) { QString text = ""; QHash<QString,node_position>::iterator it; - for (it=_ref_map.begin ();it!=_ref_map.end ();++it) + for (it=_ref_map.begin (); it!=_ref_map.end (); ++it) { QString k = it.key (); node_position p = it.value ();
--- a/libgui/src/qtinfo/parser.h +++ b/libgui/src/qtinfo/parser.h @@ -39,14 +39,15 @@ * If you make a queue with info files, position will be the number of bytes * from begining to node position.</p> * <p> - * But is not so easy. There is headers, and qtinfo must not take these headers into account. + * But is not so easy. There is headers, and qtinfo must not take these + * headers into account. * </p> * <p> * This class also translates info files to html. * </p> */ class parser - : public QObject + : public QObject { Q_OBJECT @@ -59,13 +60,13 @@ QString find_ref (const QString &name); - /** Checks if this node is reference. If node is reference, it will be returned its position - * in text, else it will be returned -1. + /** Checks if this node is reference. If node is reference, it will be + * returned its position in text, else it will be returned -1. */ int is_ref (const QString& node); - /**Translates text of node to Html. If anchorPos is not -1, then anchor is inserted in that - * position. + /** Translates text of node to Html. If anchorPos is not -1, then anchor is + * inserted in that position. */ QString node_text_to_html (const QString& text, int anchorPos = -1, const QString& anchor = QString ());
--- a/libgui/src/qtinfo/webinfo.cc +++ b/libgui/src/qtinfo/webinfo.cc @@ -76,15 +76,18 @@ _search_line_edit = new QLineEdit(this); #ifdef HAVE_SETPLACEHOLDERTEXT - _search_line_edit->setPlaceholderText (tr ("Type here and press \'Return\' to search")); + _search_line_edit->setPlaceholderText ( + tr ("Type here and press \'Return\' to search")); #endif hbox_layout->addWidget (_search_line_edit); _search_check_box = new QCheckBox (tr ("Global search")); hbox_layout->addWidget (_search_check_box); - connect (_tab_bar, SIGNAL (tabCloseRequested (int)), this, SLOT (close_tab (int))); - connect (_tab_bar, SIGNAL (currentChanged (int)), this, SLOT (current_tab_changed (int))); + connect (_tab_bar, SIGNAL (tabCloseRequested (int)), this, + SLOT (close_tab (int))); + connect (_tab_bar, SIGNAL (currentChanged (int)), this, + SLOT (current_tab_changed (int))); connect (_zoom_in_button, SIGNAL (clicked ()), this, SLOT (zoom_in ())); connect (_zoom_out_button, SIGNAL (clicked ()), this, SLOT (zoom_out ())); connect (_search_line_edit, SIGNAL (returnPressed ()), this, SLOT (search ())); @@ -110,7 +113,7 @@ tab_text.replace("XREF",""); //Check if node has been already opened. - for (int i = 0;i < _tab_bar->count (); i++) + for (int i = 0; i < _tab_bar->count (); i++) { if (tab_text == _tab_bar->tabText (i)) { @@ -161,8 +164,10 @@ _text_browser->setOpenLinks (false); _text_browser->show (); - connect (_text_browser, SIGNAL (anchorClicked (const QUrl &)), this, SLOT (link_clicked (const QUrl &)) ); - disconnect(_tab_bar, SIGNAL (currentChanged(int)), this, SLOT (current_tab_changed (int))); + connect (_text_browser, SIGNAL (anchorClicked (const QUrl &)), this, + SLOT (link_clicked (const QUrl &)) ); + disconnect(_tab_bar, SIGNAL (currentChanged(int)), this, + SLOT (current_tab_changed (int))); int ns = _stacked_widget->addWidget (_text_browser); _stacked_widget->setCurrentIndex (ns); @@ -173,7 +178,8 @@ tab_data.setValue (static_cast<void*> (_text_browser)); _tab_bar->setTabData (nt, tab_data); - connect (_tab_bar, SIGNAL (currentChanged (int)), this, SLOT (current_tab_changed (int))); + connect (_tab_bar, SIGNAL (currentChanged (int)), this, + SLOT (current_tab_changed (int))); if (_text_browser->font () != _font_web) { @@ -207,11 +213,11 @@ else { // not found - load_node("Top"); + load_node("Top"); } - if (_text_browser) - _text_browser->setFocus(); + if (_text_browser) + _text_browser->setFocus(); } void @@ -267,7 +273,7 @@ { QClipboard *clipboard = QApplication::clipboard (); QString str = clipboard->text (); - if (str.length () > 0) + if (str.length () > 0) _search_line_edit->insert (str); } }
--- a/libgui/src/qtinfo/webinfo.h +++ b/libgui/src/qtinfo/webinfo.h @@ -40,8 +40,8 @@ webinfo (QWidget *parent = 0); void set_info_path (const QString& info_path); void load_node (const QString& node_name); - - void load_ref (const QString &ref_name); + + void load_ref (const QString &ref_name); public slots: void link_clicked (const QUrl& link);
--- a/libgui/src/resource-manager.cc +++ b/libgui/src/resource-manager.cc @@ -29,7 +29,7 @@ #include <QFile> #include <QDir> #include <QNetworkProxy> - #include <QLibraryInfo> +#include <QLibraryInfo> #include "error.h" #include "file-ops.h" @@ -89,24 +89,25 @@ { bool loaded; - QString qt_trans_dir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + QString qt_trans_dir + = QLibraryInfo::location (QLibraryInfo::TranslationsPath); QSettings *settings = resource_manager::get_settings (); - // FIXME -- what should happen if settings is 0? + // FIXME: what should happen if settings is 0? // get the locale from the settings QString language = settings->value ("language","SYSTEM").toString (); if (language == "SYSTEM") - language = QLocale::system().name(); // get system wide locale + language = QLocale::system ().name (); // get system wide locale // load the translator file for qt strings - loaded = qt_tr->load("qt_" + language, qt_trans_dir); + loaded = qt_tr->load ("qt_" + language, qt_trans_dir); if (!loaded) // try lower case - qt_tr->load("qt_" + language.toLower (), qt_trans_dir); + qt_tr->load ("qt_" + language.toLower (), qt_trans_dir); // load the translator file for qscintilla settings - loaded = qsci_tr->load("qscintilla_" + language, qt_trans_dir); + loaded = qsci_tr->load ("qscintilla_" + language, qt_trans_dir); if (!loaded) // try lower case - qsci_tr->load("qscintilla_" + language.toLower (), qt_trans_dir); + qsci_tr->load ("qscintilla_" + language.toLower (), qt_trans_dir); // load the translator file for gui strings gui_tr->load (language, get_gui_translation_dir ()); @@ -178,7 +179,7 @@ if (!QFile::exists (settings_file)) { - QDir("/").mkpath (settings_path); + QDir ("/").mkpath (settings_path); QFile::copy (default_qt_settings_file (), settings_file); first_run = true; } @@ -227,7 +228,7 @@ QNetworkProxy::setApplicationProxy (proxy); } -QStringList +QStringList resource_manager::storage_class_names (void) { return workspace_model::storage_class_names (); @@ -239,7 +240,7 @@ return workspace_model::storage_class_default_colors (); } -QStringList +QStringList resource_manager::terminal_color_names (void) { return QTerminal::color_names ();
--- a/libgui/src/settings-dialog.cc +++ b/libgui/src/settings-dialog.cc @@ -57,7 +57,7 @@ ui->setupUi (this); QSettings *settings = resource_manager::get_settings (); - // FIXME -- what should happen if settings is 0? + // FIXME: what should happen if settings is 0? // look for available language files and the actual settings QString qm_dir_name = resource_manager::get_gui_translation_dir (); @@ -65,32 +65,37 @@ QFileInfoList qm_files = qm_dir.entryInfoList (QStringList ("*.qm"), QDir::Files | QDir::Readable, QDir::Name); - for (int i = 0; i < qm_files.length (); i++) // insert available languages + for (int i = 0; i < qm_files.length (); i++) // insert available languages ui->comboBox_language->addItem (qm_files.at (i).baseName ()); - ui->comboBox_language->insertItem (0,tr("System setting")); // System at beginning - ui->comboBox_language->insertSeparator (1); // separator after System + // System at beginning + ui->comboBox_language->insertItem (0,tr ("System setting")); + ui->comboBox_language->insertSeparator (1); // separator after System QString language = settings->value ("language","SYSTEM").toString (); if (language == "SYSTEM") - language = tr("System setting"); + language = tr ("System setting"); int selected = ui->comboBox_language->findText (language); if (selected >= 0) ui->comboBox_language->setCurrentIndex (selected); else ui->comboBox_language->setCurrentIndex (0); // System is default - ui->toolbar_icon_size->setValue (settings->value ("toolbar_icon_size",24).toInt ()); + ui->toolbar_icon_size->setValue (settings->value ("toolbar_icon_size", + 24).toInt ()); // which icon has to be selected QString widget_icon_set = - settings->value ("DockWidgets/widget_icon_set","NONE").toString (); + settings->value ("DockWidgets/widget_icon_set","NONE").toString (); ui->general_icon_octave-> setChecked (true); // the default (if invalid set) ui->general_icon_octave-> setChecked (widget_icon_set == "NONE"); ui->general_icon_graphic-> setChecked (widget_icon_set == "GRAPHIC"); ui->general_icon_letter-> setChecked (widget_icon_set == "LETTER"); - ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor",false).toBool ()); - ui->customFileEditor->setText (settings->value ("customFileEditor").toString ()); - ui->editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers",true).toBool () ); + ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor", + false).toBool ()); + ui->customFileEditor->setText ( + settings->value ("customFileEditor").toString ()); + ui->editor_showLineNumbers->setChecked ( + settings->value ("editor/showLineNumbers",true).toBool () ); QVariant default_var = QColor (240, 240, 240); QColor setting_color = settings->value ("editor/highlight_current_line_color", @@ -101,43 +106,73 @@ _editor_current_line_color->setEnabled (false); connect (ui->editor_highlightCurrentLine, SIGNAL (toggled (bool)), _editor_current_line_color, SLOT (setEnabled (bool))); - ui->editor_highlightCurrentLine->setChecked (settings->value ("editor/highlightCurrentLine",true).toBool () ); + ui->editor_highlightCurrentLine->setChecked ( + settings->value ("editor/highlightCurrentLine",true).toBool () ); - ui->editor_codeCompletion->setChecked (settings->value ("editor/codeCompletion",true).toBool () ); - ui->editor_spinbox_ac_threshold->setValue (settings->value ("editor/codeCompletion_threshold",2).toInt ()); - ui->editor_checkbox_ac_keywords->setChecked (settings->value ("editor/codeCompletion_keywords",true).toBool ()); - ui->editor_checkbox_ac_document->setChecked (settings->value ("editor/codeCompletion_document",false).toBool ()); - ui->editor_checkbox_ac_case->setChecked (settings->value ("editor/codeCompletion_case",true).toBool ()); - ui->editor_checkbox_ac_replace->setChecked (settings->value ("editor/codeCompletion_replace",false).toBool ()); - ui->editor_ws_checkbox->setChecked (settings->value ("editor/show_white_space",false).toBool ()); - ui->editor_ws_indent_checkbox->setChecked (settings->value ("editor/show_white_space_indent",false).toBool ()); - ui->editor_auto_ind_checkbox->setChecked (settings->value ("editor/auto_indent",true).toBool ()); - ui->editor_tab_ind_checkbox->setChecked (settings->value ("editor/tab_indents_line",false).toBool ()); - ui->editor_bs_unind_checkbox->setChecked (settings->value ("editor/backspace_unindents_line",false).toBool ()); - ui->editor_ind_guides_checkbox->setChecked (settings->value ("editor/show_indent_guides",false).toBool ()); - ui->editor_ind_width_spinbox->setValue (settings->value ("editor/indent_width",2).toInt ()); - ui->editor_tab_width_spinbox->setValue (settings->value ("editor/tab_width",2).toInt ()); - ui->editor_longWindowTitle->setChecked (settings->value ("editor/longWindowTitle",false).toBool ()); - ui->editor_restoreSession->setChecked (settings->value ("editor/restoreSession",true).toBool ()); - ui->editor_create_new_file->setChecked (settings->value ("editor/create_new_file",false).toBool ()); - ui->terminal_fontName->setCurrentFont (QFont (settings->value ("terminal/fontName","Courier New").toString()) ); - ui->terminal_fontSize->setValue (settings->value ("terminal/fontSize",10).toInt ()); - ui->showFileSize->setChecked (settings->value ("filesdockwidget/showFileSize",false).toBool()); - ui->showFileType->setChecked (settings->value ("filesdockwidget/showFileType",false).toBool()); - ui->showLastModified->setChecked (settings->value ("filesdockwidget/showLastModified",false).toBool()); - ui->showHiddenFiles->setChecked (settings->value ("filesdockwidget/showHiddenFiles",false).toBool()); - ui->useAlternatingRowColors->setChecked (settings->value ("filesdockwidget/useAlternatingRowColors",true).toBool()); - ui->sync_octave_directory->setChecked (settings->value ("filesdockwidget/sync_octave_directory",true).toBool()); - ui->useProxyServer->setChecked (settings->value ("useProxyServer",false).toBool ()); + ui->editor_codeCompletion->setChecked ( + settings->value ("editor/codeCompletion", true).toBool () ); + ui->editor_spinbox_ac_threshold->setValue ( + settings->value ("editor/codeCompletion_threshold",2).toInt ()); + ui->editor_checkbox_ac_keywords->setChecked ( + settings->value ("editor/codeCompletion_keywords",true).toBool ()); + ui->editor_checkbox_ac_document->setChecked ( + settings->value ("editor/codeCompletion_document",false).toBool ()); + ui->editor_checkbox_ac_case->setChecked ( + settings->value ("editor/codeCompletion_case",true).toBool ()); + ui->editor_checkbox_ac_replace->setChecked ( + settings->value ("editor/codeCompletion_replace",false).toBool ()); + ui->editor_ws_checkbox->setChecked ( + settings->value ("editor/show_white_space", false).toBool ()); + ui->editor_ws_indent_checkbox->setChecked ( + settings->value ("editor/show_white_space_indent",false).toBool ()); + ui->editor_auto_ind_checkbox->setChecked ( + settings->value ("editor/auto_indent", true).toBool ()); + ui->editor_tab_ind_checkbox->setChecked ( + settings->value ("editor/tab_indents_line",false).toBool ()); + ui->editor_bs_unind_checkbox->setChecked ( + settings->value ("editor/backspace_unindents_line",false).toBool ()); + ui->editor_ind_guides_checkbox->setChecked ( + settings->value ("editor/show_indent_guides",false).toBool ()); + ui->editor_ind_width_spinbox->setValue ( + settings->value ("editor/indent_width", 2).toInt ()); + ui->editor_tab_width_spinbox->setValue ( + settings->value ("editor/tab_width", 2).toInt ()); + ui->editor_longWindowTitle->setChecked ( + settings->value ("editor/longWindowTitle",false).toBool ()); + ui->editor_restoreSession->setChecked ( + settings->value ("editor/restoreSession", true).toBool ()); + ui->editor_create_new_file->setChecked ( + settings->value ("editor/create_new_file",false).toBool ()); + ui->terminal_fontName->setCurrentFont (QFont ( + settings->value ("terminal/fontName","Courier New").toString ()) ); + ui->terminal_fontSize->setValue ( + settings->value ("terminal/fontSize", 10).toInt ()); + ui->showFileSize->setChecked ( + settings->value ("filesdockwidget/showFileSize", false).toBool ()); + ui->showFileType->setChecked ( + settings->value ("filesdockwidget/showFileType", false).toBool ()); + ui->showLastModified->setChecked ( + settings->value ("filesdockwidget/showLastModified",false).toBool ()); + ui->showHiddenFiles->setChecked ( + settings->value ("filesdockwidget/showHiddenFiles",false).toBool ()); + ui->useAlternatingRowColors->setChecked ( + settings->value ("filesdockwidget/useAlternatingRowColors",true).toBool ()); + ui->sync_octave_directory->setChecked ( + settings->value ("filesdockwidget/sync_octave_directory",true).toBool ()); + ui->useProxyServer->setChecked ( + settings->value ("useProxyServer", false).toBool ()); ui->proxyHostName->setText (settings->value ("proxyHostName").toString ()); - ui->terminal_cursorBlinking->setChecked (settings->value ("terminal/cursorBlinking",true).toBool ()); - ui->terminal_cursorUseForegroundColor->setChecked (settings->value ("terminal/cursorUseForegroundColor",true).toBool ()); + ui->terminal_cursorBlinking->setChecked ( + settings->value ("terminal/cursorBlinking",true).toBool ()); + ui->terminal_cursorUseForegroundColor->setChecked ( + settings->value ("terminal/cursorUseForegroundColor",true).toBool ()); - QString cursorType = settings->value ("terminal/cursorType","ibeam").toString (); + QString cursorType + = settings->value ("terminal/cursorType", "ibeam").toString (); QStringList items; - items << QString("0") << QString("1") << QString("2"); - ui->terminal_cursorType->addItems(items); + items << QString ("0") << QString ("1") << QString ("2"); + ui->terminal_cursorType->addItems (items); ui->terminal_cursorType->setItemText (0, tr ("IBeam Cursor")); ui->terminal_cursorType->setItemText (1, tr ("Block Cursor")); ui->terminal_cursorType->setItemText (2, tr ("Underline Cursor")); @@ -151,7 +186,8 @@ int currentIndex = 0; QString proxyTypeString = settings->value ("proxyType").toString (); - while ( (currentIndex < ui->proxyType->count ()) && (ui->proxyType->currentText () != proxyTypeString)) + while ( (currentIndex < ui->proxyType->count ()) + && (ui->proxyType->currentText () != proxyTypeString)) { currentIndex++; ui->proxyType->setCurrentIndex (currentIndex); @@ -198,13 +234,15 @@ // which tab is the desired one? if (desired_tab.isEmpty ()) - ui->tabWidget->setCurrentIndex (settings->value("settings/last_tab",0).toInt ()); + ui->tabWidget->setCurrentIndex (settings->value ("settings/last_tab", + 0).toInt ()); else { QHash <QString, QWidget*> tab_hash; tab_hash["editor"] = ui->tab_editor; tab_hash["editor_styles"] = ui->tab_editor_styles; - ui->tabWidget->setCurrentIndex (ui->tabWidget->indexOf (tab_hash.value (desired_tab))); + ui->tabWidget->setCurrentIndex ( + ui->tabWidget->indexOf (tab_hash.value (desired_tab))); } @@ -224,7 +262,7 @@ int actual_style = 0; while (actual_style < MaxStyleNumber && max_style < MaxLexerStyles) { - if ((lexer->description(actual_style)) != "") // valid style + if ((lexer->description (actual_style)) != "") // valid style styles[max_style++] = actual_style; actual_style++; } @@ -235,7 +273,8 @@ settings_dialog::read_lexer_settings (QsciLexer *lexer, QSettings *settings) { lexer->readSettings (*settings); - int styles[MaxLexerStyles]; // array for saving valid styles (enum is not continuous) + int styles[MaxLexerStyles]; // array for saving valid styles + // (enum is not continuous) int max_style = get_valid_lexer_styles (lexer, styles); QGridLayout *style_grid = new QGridLayout (); QVector<QLabel*> description (max_style); @@ -285,17 +324,17 @@ bg_color[i] = new color_picker (dummy_color); else bg_color[i] = new color_picker (lexer->paper (styles[i])); - bg_color[i]->setToolTip - (tr ("Background color, pink (255,0,255) means default")); + bg_color[i]->setToolTip + (tr ("Background color, pink (255,0,255) means default")); } - attrib_font[0+3*i] = new QCheckBox (tr("b")); - attrib_font[1+3*i] = new QCheckBox (tr("i")); - attrib_font[2+3*i] = new QCheckBox (tr("u")); - attrib_font[0+3*i]->setChecked(Qt::Checked && actual_font.bold ()); + attrib_font[0+3*i] = new QCheckBox (tr ("b")); + attrib_font[1+3*i] = new QCheckBox (tr ("i")); + attrib_font[2+3*i] = new QCheckBox (tr ("u")); + attrib_font[0+3*i]->setChecked (Qt::Checked && actual_font.bold ()); attrib_font[0+3*i]->setObjectName (actual_name+"_bold"); - attrib_font[1+3*i]->setChecked(Qt::Checked && actual_font.italic ()); + attrib_font[1+3*i]->setChecked (Qt::Checked && actual_font.italic ()); attrib_font[1+3*i]->setObjectName (actual_name+"_italic"); - attrib_font[2+3*i]->setChecked(Qt::Checked && actual_font.underline ()); + attrib_font[2+3*i]->setChecked (Qt::Checked && actual_font.underline ()); attrib_font[2+3*i]->setObjectName (actual_name+"_underline"); color[i] = new color_picker (lexer->color (styles[i])); color[i]->setObjectName (actual_name+"_color"); @@ -319,15 +358,16 @@ ui->tabs_editor_lexers->addTab (scroll_area,lexer->language ()); ui->tabs_editor_lexers->setCurrentIndex ( - settings->value("settings/last_editor_styles_tab",0).toInt ()); + settings->value ("settings/last_editor_styles_tab",0).toInt ()); } -#endif +#endif void settings_dialog::read_workspace_colors (QSettings *settings) { - QList<QColor> default_colors = resource_manager::storage_class_default_colors (); + QList<QColor> default_colors = + resource_manager::storage_class_default_colors (); QStringList class_names = resource_manager::storage_class_names (); QString class_chars = resource_manager::storage_class_chars (); int nr_of_classes = class_chars.length (); @@ -343,7 +383,8 @@ description[i] = new QLabel (" " + class_names.at (i)); description[i]->setAlignment (Qt::AlignRight); QVariant default_var = default_colors.at (i); - QColor setting_color = settings->value ("workspaceview/color_"+class_chars.mid (i,1), + QColor setting_color = settings->value ("workspaceview/color_" + + class_chars.mid (i,1), default_var).value<QColor> (); color[i] = new color_picker (setting_color); color[i]->setObjectName ("color_"+class_chars.mid (i, 1)); @@ -382,7 +423,8 @@ description[i] = new QLabel (" " + class_names.at (i)); description[i]->setAlignment (Qt::AlignRight); QVariant default_var = default_colors.at (i); - QColor setting_color = settings->value ("terminal/color_"+class_chars.mid (i,1), + QColor setting_color = settings->value ("terminal/color_" + + class_chars.mid (i,1), default_var).value<QColor> (); color[i] = new color_picker (setting_color); color[i]->setObjectName ("terminal_color_"+class_chars.mid (i, 1)); @@ -405,7 +447,7 @@ settings_dialog::write_changed_settings () { QSettings *settings = resource_manager::get_settings (); - // FIXME -- what should happen if settings is 0? + // FIXME: what should happen if settings is 0? // the icon set QString widget_icon_set = "NONE"; @@ -417,50 +459,80 @@ // language QString language = ui->comboBox_language->currentText (); - if (language == tr("System setting")) + if (language == tr ("System setting")) language = "SYSTEM"; settings->setValue ("language", language); // other settings settings->setValue ("toolbar_icon_size", ui->toolbar_icon_size->value ()); - settings->setValue ("useCustomFileEditor", ui->useCustomFileEditor->isChecked ()); + settings->setValue ("useCustomFileEditor", + ui->useCustomFileEditor->isChecked ()); settings->setValue ("customFileEditor", ui->customFileEditor->text ()); - settings->setValue ("editor/showLineNumbers", ui->editor_showLineNumbers->isChecked ()); - settings->setValue ("editor/highlightCurrentLine", ui->editor_highlightCurrentLine->isChecked ()); - settings->setValue ("editor/highlight_current_line_color",_editor_current_line_color->color ()); - settings->setValue ("editor/codeCompletion", ui->editor_codeCompletion->isChecked ()); - settings->setValue ("editor/codeCompletion_threshold", ui->editor_spinbox_ac_threshold->value ()); - settings->setValue ("editor/codeCompletion_keywords", ui->editor_checkbox_ac_keywords->isChecked ()); - settings->setValue ("editor/codeCompletion_document", ui->editor_checkbox_ac_document->isChecked ()); - settings->setValue ("editor/codeCompletion_case", ui->editor_checkbox_ac_case->isChecked ()); - settings->setValue ("editor/codeCompletion_replace", ui->editor_checkbox_ac_replace->isChecked ()); - settings->setValue ("editor/show_white_space", ui->editor_ws_checkbox->isChecked ()); - settings->setValue ("editor/show_white_space_indent", ui->editor_ws_indent_checkbox->isChecked ()); - settings->setValue ("editor/auto_indent", ui->editor_auto_ind_checkbox->isChecked ()); - settings->setValue ("editor/tab_indents_line", ui->editor_tab_ind_checkbox->isChecked ()); - settings->setValue ("editor/backspace_unindents_line", ui->editor_bs_unind_checkbox->isChecked ()); - settings->setValue ("editor/show_indent_guides", ui->editor_ind_guides_checkbox->isChecked ()); - settings->setValue ("editor/indent_width", ui->editor_ind_width_spinbox->value ()); - settings->setValue ("editor/tab_width", ui->editor_tab_width_spinbox->value ()); - settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked()); - settings->setValue ("editor/restoreSession", ui->editor_restoreSession->isChecked ()); - settings->setValue ("editor/create_new_file", ui->editor_create_new_file->isChecked ()); - settings->setValue ("terminal/fontSize", ui->terminal_fontSize->value()); - settings->setValue ("terminal/fontName", ui->terminal_fontName->currentFont().family()); - settings->setValue ("filesdockwidget/showFileSize", ui->showFileSize->isChecked ()); - settings->setValue ("filesdockwidget/showFileType", ui->showFileType->isChecked ()); - settings->setValue ("filesdockwidget/showLastModified", ui->showLastModified->isChecked ()); - settings->setValue ("filesdockwidget/showHiddenFiles", ui->showHiddenFiles->isChecked ()); - settings->setValue ("filesdockwidget/useAlternatingRowColors", ui->useAlternatingRowColors->isChecked ()); - settings->setValue ("filesdockwidget/sync_octave_directory", ui->sync_octave_directory->isChecked ()); + settings->setValue ("editor/showLineNumbers", + ui->editor_showLineNumbers->isChecked ()); + settings->setValue ("editor/highlightCurrentLine", + ui->editor_highlightCurrentLine->isChecked ()); + settings->setValue ("editor/highlight_current_line_color", + _editor_current_line_color->color ()); + settings->setValue ("editor/codeCompletion", + ui->editor_codeCompletion->isChecked ()); + settings->setValue ("editor/codeCompletion_threshold", + ui->editor_spinbox_ac_threshold->value ()); + settings->setValue ("editor/codeCompletion_keywords", + ui->editor_checkbox_ac_keywords->isChecked ()); + settings->setValue ("editor/codeCompletion_document", + ui->editor_checkbox_ac_document->isChecked ()); + settings->setValue ("editor/codeCompletion_case", + ui->editor_checkbox_ac_case->isChecked ()); + settings->setValue ("editor/codeCompletion_replace", + ui->editor_checkbox_ac_replace->isChecked ()); + settings->setValue ("editor/show_white_space", + ui->editor_ws_checkbox->isChecked ()); + settings->setValue ("editor/show_white_space_indent", + ui->editor_ws_indent_checkbox->isChecked ()); + settings->setValue ("editor/auto_indent", + ui->editor_auto_ind_checkbox->isChecked ()); + settings->setValue ("editor/tab_indents_line", + ui->editor_tab_ind_checkbox->isChecked ()); + settings->setValue ("editor/backspace_unindents_line", + ui->editor_bs_unind_checkbox->isChecked ()); + settings->setValue ("editor/show_indent_guides", + ui->editor_ind_guides_checkbox->isChecked ()); + settings->setValue ("editor/indent_width", + ui->editor_ind_width_spinbox->value ()); + settings->setValue ("editor/tab_width", + ui->editor_tab_width_spinbox->value ()); + settings->setValue ("editor/longWindowTitle", + ui->editor_longWindowTitle->isChecked ()); + settings->setValue ("editor/restoreSession", + ui->editor_restoreSession->isChecked ()); + settings->setValue ("editor/create_new_file", + ui->editor_create_new_file->isChecked ()); + settings->setValue ("terminal/fontSize", ui->terminal_fontSize->value ()); + settings->setValue ("terminal/fontName", + ui->terminal_fontName->currentFont ().family ()); + settings->setValue ("filesdockwidget/showFileSize", + ui->showFileSize->isChecked ()); + settings->setValue ("filesdockwidget/showFileType", + ui->showFileType->isChecked ()); + settings->setValue ("filesdockwidget/showLastModified", + ui->showLastModified->isChecked ()); + settings->setValue ("filesdockwidget/showHiddenFiles", + ui->showHiddenFiles->isChecked ()); + settings->setValue ("filesdockwidget/useAlternatingRowColors", + ui->useAlternatingRowColors->isChecked ()); + settings->setValue ("filesdockwidget/sync_octave_directory", + ui->sync_octave_directory->isChecked ()); settings->setValue ("useProxyServer", ui->useProxyServer->isChecked ()); settings->setValue ("proxyType", ui->proxyType->currentText ()); settings->setValue ("proxyHostName", ui->proxyHostName->text ()); settings->setValue ("proxyPort", ui->proxyPort->text ()); settings->setValue ("proxyUserName", ui->proxyUserName->text ()); settings->setValue ("proxyPassword", ui->proxyPassword->text ()); - settings->setValue ("terminal/cursorBlinking", ui->terminal_cursorBlinking->isChecked ()); - settings->setValue ("terminal/cursorUseForegroundColor", ui->terminal_cursorUseForegroundColor->isChecked ()); + settings->setValue ("terminal/cursorBlinking", + ui->terminal_cursorBlinking->isChecked ()); + settings->setValue ("terminal/cursorUseForegroundColor", + ui->terminal_cursorUseForegroundColor->isChecked ()); // the cursor QString cursorType; @@ -506,7 +578,7 @@ write_terminal_colors (settings); - settings->setValue("settings/last_tab",ui->tabWidget->currentIndex ()); + settings->setValue ("settings/last_tab",ui->tabWidget->currentIndex ()); } #ifdef HAVE_QSCINTILLA @@ -514,8 +586,9 @@ settings_dialog::write_lexer_settings (QsciLexer *lexer, QSettings *settings) { QWidget *tab = ui->tabs_editor_lexers-> - findChild <QWidget *>(QString (lexer->language ())+"_styles"); - int styles[MaxLexerStyles]; // array for saving valid styles (enum is not continuous) + findChild <QWidget *>(QString (lexer->language ())+"_styles"); + int styles[MaxLexerStyles]; // array for saving valid styles + // (enum is not continuous) int max_style = get_valid_lexer_styles (lexer, styles); QFontComboBox *select_font; QSpinBox *font_size; @@ -543,9 +616,8 @@ new_font = select_font->currentFont (); if (styles[i] == 0) default_font = new_font; - else - if (select_font->currentText () == lexer->description (0)) - new_font = default_font; + else if (select_font->currentText () == lexer->description (0)) + new_font = default_font; } if (font_size) { @@ -603,7 +675,7 @@ for (int i = 0; i < class_chars.length (); i++) { color = ui->workspace_colors_box->findChild <color_picker *>( - "color_"+class_chars.mid (i,1)); + "color_"+class_chars.mid (i,1)); if (color) settings->setValue ("workspaceview/color_"+class_chars.mid (i,1), color->color ()); @@ -620,7 +692,7 @@ for (int i = 0; i < class_chars.length (); i++) { color = ui->terminal_colors_box->findChild <color_picker *>( - "terminal_color_"+class_chars.mid (i,1)); + "terminal_color_"+class_chars.mid (i,1)); if (color) settings->setValue ("terminal/color_"+class_chars.mid (i,1), color->color ());
--- a/libgui/src/settings-dialog.h +++ b/libgui/src/settings-dialog.h @@ -40,7 +40,8 @@ class settings_dialog:public QDialog { Q_OBJECT public: - explicit settings_dialog (QWidget * parent, const QString& desired_tab = QString ()); + explicit settings_dialog (QWidget * parent, + const QString& desired_tab = QString ()); ~settings_dialog (); void write_changed_settings (); @@ -59,7 +60,7 @@ void read_terminal_colors (QSettings *settings); void write_terminal_colors (QSettings *settings); - + color_picker *_editor_current_line_color; };
--- a/libgui/src/terminal-dock-widget.cc +++ b/libgui/src/terminal-dock-widget.cc @@ -34,7 +34,7 @@ terminal->setFocusPolicy (Qt::StrongFocus); setObjectName ("TerminalDockWidget"); - setWindowIcon (QIcon(":/actions/icons/logo.png")); + setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("Command Window")); setWidget (terminal);
--- a/libgui/src/welcome-wizard.cc +++ b/libgui/src/welcome-wizard.cc @@ -56,13 +56,14 @@ ft.setPointSize (20); title->setFont (ft); - QLabel *msg_1 = new QLabel (tr ("You seem to be using the Octave graphical interface for the first time on this computer. Click 'Finish' to write a configuration file and launch Octave GUI.")); + QLabel *msg_1 = new QLabel ( + tr ("You seem to be using the Octave graphical interface for the first time on this computer. Click 'Finish' to write a configuration file and launch Octave GUI.")); msg_1->setWordWrap (true); QString msg_2_text = QString (tr ("The configuration file is stored in %1. " "If that file exists, you will not see this " "dialog when Octave starts again."). - arg (resource_manager::get_settings_file ())); + arg (resource_manager::get_settings_file ())); QLabel *msg_2 = new QLabel (msg_2_text); msg_2->setWordWrap (true);
--- a/libgui/src/workspace-model.cc +++ b/libgui/src/workspace-model.cc @@ -118,7 +118,7 @@ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) return _columnNames[section]; else - return QVariant(); + return QVariant (); } QVariant @@ -131,7 +131,8 @@ if (role == Qt::BackgroundColorRole) { QString class_chars = resource_manager::storage_class_chars (); - int actual_class = class_chars.indexOf (_scopes[idx.row()].toAscii ()); + int actual_class + = class_chars.indexOf (_scopes[idx.row ()].toAscii ()); if (actual_class >= 0) return QVariant (_storage_class_colors.at (actual_class)); else @@ -146,36 +147,39 @@ { case 0: if (role == Qt::ToolTipRole) - retval = QVariant (tr ("Right click to copy, rename, or display")); + retval + = QVariant (tr ("Right click to copy, rename, or display")); else - retval = QVariant (_symbols[idx.row()]); + retval = QVariant (_symbols[idx.row ()]); break; case 1: - retval = QVariant (_class_names[idx.row()]); + retval = QVariant (_class_names[idx.row ()]); break; case 2: - retval = QVariant (_dimensions[idx.row()]); + retval = QVariant (_dimensions[idx.row ()]); break; case 3: - retval = QVariant (_values[idx.row()]); + retval = QVariant (_values[idx.row ()]); break; case 4: retval = QVariant (); QString class_chars = resource_manager::storage_class_chars (); - int actual_class = class_chars.indexOf (_scopes[idx.row()].toAscii ()); + int actual_class + = class_chars.indexOf (_scopes[idx.row ()].toAscii ()); if (actual_class >= 0) { - QStringList class_names = resource_manager::storage_class_names (); + QStringList class_names + = resource_manager::storage_class_names (); retval = QVariant (class_names.at (actual_class)); } break; - } - } + } + } } return retval; @@ -189,7 +193,7 @@ if (idx.column () == 0 && role == Qt::EditRole) { - QString qold_name = _symbols[idx.row()]; + QString qold_name = _symbols[idx.row ()]; QString qnew_name = value.toString (); @@ -250,7 +254,7 @@ void workspace_model::update_table (void) { - beginResetModel(); + beginResetModel (); // Nothing to do except tell the world to recalc. @@ -262,14 +266,16 @@ void workspace_model::notice_settings (const QSettings *settings) { - QList<QColor> default_colors = resource_manager::storage_class_default_colors (); + QList<QColor> default_colors = + resource_manager::storage_class_default_colors (); QString class_chars = resource_manager::storage_class_chars (); for (int i = 0; i < class_chars.length (); i++) { QVariant default_var = default_colors.at (i); - QColor setting_color = settings->value ("workspaceview/color_"+class_chars.mid (i,1), - default_var).value<QColor> (); + QColor setting_color = settings->value ("workspaceview/color_" + + class_chars.mid (i,1), + default_var).value<QColor> (); _storage_class_colors.replace (i,setting_color); } }
--- a/libgui/src/workspace-model.h +++ b/libgui/src/workspace-model.h @@ -64,7 +64,8 @@ bool is_top_level (void) const { return _top_level; } - QColor storage_class_color (int s_class) { return _storage_class_colors.at (s_class); } + QColor storage_class_color (int s_class) + { return _storage_class_colors.at (s_class); } public slots:
--- a/libgui/src/workspace-view.cc +++ b/libgui/src/workspace-view.cc @@ -67,13 +67,14 @@ QSettings *settings = resource_manager::get_settings (); // Initialize column order and width of the workspace - - view->horizontalHeader ()->restoreState (settings->value ("workspaceview/column_state").toByteArray ()); + + view->horizontalHeader ()->restoreState ( + settings->value ("workspaceview/column_state").toByteArray ()); // Connect signals and slots. connect (view, SIGNAL (customContextMenuRequested (const QPoint&)), - this, SLOT(contextmenu_requested (const QPoint&))); + this, SLOT (contextmenu_requested (const QPoint&))); connect (this, SIGNAL (command_requested (const QString&)), p, SLOT (execute_command_in_terminal (const QString&))); @@ -84,8 +85,8 @@ { QSettings *settings = resource_manager::get_settings (); - settings->setValue("workspaceview/column_state", - view->horizontalHeader ()->saveState ()); + settings->setValue ("workspaceview/column_state", + view->horizontalHeader ()->saveState ()); settings->sync (); } @@ -112,12 +113,12 @@ QAbstractItemModel *m = view->model (); // if it isnt Local, Glocal etc, allow the ctx menu - if (index.isValid() && index.column () == 0) + if (index.isValid () && index.column () == 0) { - index = index.sibling (index.row(), 0); + index = index.sibling (index.row (), 0); QMap<int, QVariant> item_data = m->itemData (index); - + QString var_name = item_data[0].toString (); menu.addAction (tr ("Copy"), this, @@ -136,13 +137,13 @@ menu.addSeparator (); - menu.addAction ("disp(" + var_name + ")", this, + menu.addAction ("disp (" + var_name + ")", this, SLOT (handle_contextmenu_disp ())); - menu.addAction ("plot(" + var_name + ")", this, + menu.addAction ("plot (" + var_name + ")", this, SLOT (handle_contextmenu_plot ())); - menu.addAction ("stem(" + var_name + ")", this, + menu.addAction ("stem (" + var_name + ")", this, SLOT (handle_contextmenu_stem ())); menu.exec (view->mapToGlobal (qpos)); @@ -156,12 +157,12 @@ if (index.isValid ()) { - index = index.sibling(index.row(), 0); + index = index.sibling (index.row (), 0); QAbstractItemModel *m = view->model (); QMap<int, QVariant> item_data = m->itemData (index); - + QString var_name = item_data[0].toString (); QClipboard *clipboard = QApplication::clipboard (); @@ -177,12 +178,12 @@ if (index.isValid ()) { - index = index.sibling(index.row(), 0); + index = index.sibling (index.row (), 0); QAbstractItemModel *m = view->model (); QMap<int, QVariant> item_data = m->itemData (index); - + QString var_name = item_data[0].toString (); QInputDialog* inputDialog = new QInputDialog (); @@ -225,12 +226,12 @@ if (index.isValid ()) { - index = index.sibling(index.row(), 0); + index = index.sibling (index.row (), 0); QAbstractItemModel *m = view->model (); QMap<int, QVariant> item_data = m->itemData (index); - + QString var_name = item_data[0].toString (); emit command_requested (cmdname + " (" + var_name + ");"); @@ -256,13 +257,14 @@ _model->notice_settings (settings); // update colors of model first QString tool_tip; - tool_tip = QString (tr ("View the variables in the active workspace.<br>")); - tool_tip += QString (tr ("Colors for the storage class:")); + tool_tip = QString (tr ("View the variables in the active workspace.<br>")); + tool_tip += QString (tr ("Colors for the storage class:")); for (int i = 0; i < resource_manager::storage_class_chars ().length (); i++) { - tool_tip += QString ("<div style=\"background-color:%1;color:#000000\">%2</div>") - .arg (_model->storage_class_color (i).name ()) - .arg (resource_manager::storage_class_names ().at (i)); + tool_tip += + QString ("<div style=\"background-color:%1;color:#000000\">%2</div>") + .arg (_model->storage_class_color (i).name ()) + .arg (resource_manager::storage_class_names ().at (i)); } setToolTip (tool_tip); }