# HG changeset patch # User Jacob Dawid # Date 1338587654 -7200 # Node ID 5cb54cca8a0675f08c8b3dacc829f4d33e864112 # Parent f50591409306fee101af2e1456d5987f6b34cec8 Completion of code reformatting. diff --git a/gui/src/files-dockwidget.cc b/gui/src/files-dockwidget.cc --- a/gui/src/files-dockwidget.cc +++ b/gui/src/files-dockwidget.cc @@ -33,25 +33,25 @@ setWidget (new QWidget (this)); // Create a toolbar - m_navigationToolBar = new QToolBar ("", widget ()); - m_navigationToolBar->setAllowedAreas (Qt::TopToolBarArea); - m_navigationToolBar->setMovable (false); - m_navigationToolBar->setIconSize (QSize (20, 20)); + _navigation_tool_bar = new QToolBar ("", widget ()); + _navigation_tool_bar->setAllowedAreas (Qt::TopToolBarArea); + _navigation_tool_bar->setMovable (false); + _navigation_tool_bar->setIconSize (QSize (20, 20)); // Add a button to the toolbar with the QT standard icon for up-directory // TODO: Maybe change this to be an up-directory icon that is OS specific??? QStyle *style = QApplication::style (); - m_directoryIcon = style->standardIcon (QStyle::SP_FileDialogToParent); - m_directoryUpAction = new QAction (m_directoryIcon, "", m_navigationToolBar); - m_directoryUpAction->setStatusTip (tr ("Move up one directory.")); + _directory_icon = style->standardIcon (QStyle::SP_FileDialogToParent); + _directory_up_action = new QAction (_directory_icon, "", _navigation_tool_bar); + _directory_up_action->setStatusTip (tr ("Move up one directory.")); - m_currentDirectory = new QLineEdit (m_navigationToolBar); - m_currentDirectory->setStatusTip (tr ("Enter the path or filename.")); + _current_directory = new QLineEdit (_navigation_tool_bar); + _current_directory->setStatusTip (tr ("Enter the path or filename.")); - m_navigationToolBar->addAction (m_directoryUpAction); - m_navigationToolBar->addWidget (m_currentDirectory); - connect (m_directoryUpAction, SIGNAL (triggered ()), this, - SLOT (onUpDirectory ())); + _navigation_tool_bar->addAction (_directory_up_action); + _navigation_tool_bar->addWidget (_current_directory); + connect (_directory_up_action, SIGNAL (triggered ()), this, + SLOT (do_up_directory ())); // TODO: Add other buttons for creating directories @@ -60,67 +60,67 @@ homePath = QDir::homePath (); // TODO: This should occur after Octave has been initialized and the startup directory of Octave is established - m_fileSystemModel = new QFileSystemModel (this); - m_fileSystemModel->setFilter (QDir::NoDotAndDotDot | QDir::AllEntries); + _file_system_model = new QFileSystemModel (this); + _file_system_model->setFilter (QDir::NoDotAndDotDot | QDir::AllEntries); QModelIndex - rootPathIndex = m_fileSystemModel->setRootPath (homePath); + rootPathIndex = _file_system_model->setRootPath (homePath); // Attach the model to the QTreeView and set the root index - m_fileTreeView = new QTreeView (widget ()); - m_fileTreeView->setModel (m_fileSystemModel); - m_fileTreeView->setRootIndex (rootPathIndex); - m_fileTreeView->setSortingEnabled (true); - m_fileTreeView->setAlternatingRowColors (true); - m_fileTreeView->setAnimated (true); - m_fileTreeView->setColumnHidden (1, true); - m_fileTreeView->setColumnHidden (2, true); - m_fileTreeView->setColumnHidden (3, true); - m_fileTreeView->setStatusTip (tr ("Doubleclick a file to open it.")); + _file_tree_view = new QTreeView (widget ()); + _file_tree_view->setModel (_file_system_model); + _file_tree_view->setRootIndex (rootPathIndex); + _file_tree_view->setSortingEnabled (true); + _file_tree_view->setAlternatingRowColors (true); + _file_tree_view->setAnimated (true); + _file_tree_view->setColumnHidden (1, true); + _file_tree_view->setColumnHidden (2, true); + _file_tree_view->setColumnHidden (3, true); + _file_tree_view->setStatusTip (tr ("Doubleclick a file to open it.")); - setCurrentDirectory (m_fileSystemModel->fileInfo (rootPathIndex). + set_current_directory (_file_system_model->fileInfo (rootPathIndex). absoluteFilePath ()); - connect (m_fileTreeView, SIGNAL (doubleClicked (const QModelIndex &)), this, - SLOT (itemDoubleClicked (const QModelIndex &))); + connect (_file_tree_view, SIGNAL (doubleClicked (const QModelIndex &)), this, + SLOT (item_double_clicked (const QModelIndex &))); // Layout the widgets vertically with the toolbar on top QVBoxLayout * layout = new QVBoxLayout (); layout->setSpacing (0); - layout->addWidget (m_navigationToolBar); - layout->addWidget (m_fileTreeView); + layout->addWidget (_navigation_tool_bar); + layout->addWidget (_file_tree_view); layout->setMargin (1); widget ()->setLayout (layout); // TODO: Add right-click contextual menus for copying, pasting, deleting files (and others) - connect (m_currentDirectory, SIGNAL (returnPressed ()), this, - SLOT (currentDirectoryEntered ())); + connect (_current_directory, SIGNAL (returnPressed ()), this, + SLOT (current_directory_entered ())); QCompleter * - completer = new QCompleter (m_fileSystemModel, this); - m_currentDirectory->setCompleter (completer); + completer = new QCompleter (_file_system_model, this); + _current_directory->setCompleter (completer); - connect (this, SIGNAL (visibilityChanged(bool)), this, SLOT(handleVisibilityChanged(bool))); + connect (this, SIGNAL (visibilityChanged(bool)), this, SLOT(handle_visibility_changed(bool))); } void -files_dock_widget::itemDoubleClicked (const QModelIndex & index) +files_dock_widget::item_double_clicked (const QModelIndex & index) { // Retrieve the file info associated with the model index. - QFileInfo fileInfo = m_fileSystemModel->fileInfo (index); + QFileInfo fileInfo = _file_system_model->fileInfo (index); // If it is a directory, cd into it. if (fileInfo.isDir ()) { - m_fileSystemModel->setRootPath (fileInfo.absolutePath ()); - m_fileTreeView->setRootIndex (index); - setCurrentDirectory (m_fileSystemModel->fileInfo (index). + _file_system_model->setRootPath (fileInfo.absolutePath ()); + _file_tree_view->setRootIndex (index); + set_current_directory (_file_system_model->fileInfo (index). absoluteFilePath ()); } // Otherwise attempt to open it. else { // Check if the user wants to use a custom file editor. - QSettings *settings = resource_manager::instance ()->settings (); + QSettings *settings = resource_manager::instance ()->get_settings (); if (settings->value ("useCustomFileEditor").toBool ()) { QString editor = settings->value ("customFileEditor").toString (); @@ -130,70 +130,70 @@ } else { - emit openFile (fileInfo.filePath ()); + emit open_file (fileInfo.filePath ()); } } } void -files_dock_widget::setCurrentDirectory (QString currentDirectory) +files_dock_widget::set_current_directory (QString currentDirectory) { - m_currentDirectory->setText (currentDirectory); + _current_directory->setText (currentDirectory); } void -files_dock_widget::onUpDirectory (void) +files_dock_widget::do_up_directory (void) { QDir dir = - QDir (m_fileSystemModel->filePath (m_fileTreeView->rootIndex ())); + QDir (_file_system_model->filePath (_file_tree_view->rootIndex ())); dir.cdUp (); - m_fileSystemModel->setRootPath (dir.absolutePath ()); - m_fileTreeView->setRootIndex (m_fileSystemModel-> + _file_system_model->setRootPath (dir.absolutePath ()); + _file_tree_view->setRootIndex (_file_system_model-> index (dir.absolutePath ())); - setCurrentDirectory (dir.absolutePath ()); + set_current_directory (dir.absolutePath ()); } void -files_dock_widget::currentDirectoryEntered () +files_dock_widget::current_directory_entered () { - QFileInfo fileInfo (m_currentDirectory->text ()); + QFileInfo fileInfo (_current_directory->text ()); if (fileInfo.isDir ()) { - m_fileTreeView->setRootIndex (m_fileSystemModel-> + _file_tree_view->setRootIndex (_file_system_model-> index (fileInfo.absolutePath ())); - m_fileSystemModel->setRootPath (fileInfo.absolutePath ()); - setCurrentDirectory (fileInfo.absoluteFilePath ()); + _file_system_model->setRootPath (fileInfo.absolutePath ()); + set_current_directory (fileInfo.absoluteFilePath ()); } else { if (QFile::exists (fileInfo.absoluteFilePath ())) - emit openFile (fileInfo.absoluteFilePath ()); + emit open_file (fileInfo.absoluteFilePath ()); } } void -files_dock_widget::noticeSettings () +files_dock_widget::notice_settings () { - QSettings *settings = resource_manager::instance ()->settings (); - m_fileTreeView->setColumnHidden (0, !settings->value ("showFilenames").toBool ()); - m_fileTreeView->setColumnHidden (1, !settings->value ("showFileSize").toBool ()); - m_fileTreeView->setColumnHidden (2, !settings->value ("showFileType").toBool ()); - m_fileTreeView->setColumnHidden (3, !settings->value ("showLastModified").toBool ()); - m_fileTreeView->setAlternatingRowColors (settings->value ("useAlternatingRowColors").toBool ()); + QSettings *settings = resource_manager::instance ()->get_settings (); + _file_tree_view->setColumnHidden (0, !settings->value ("showFilenames").toBool ()); + _file_tree_view->setColumnHidden (1, !settings->value ("showFileSize").toBool ()); + _file_tree_view->setColumnHidden (2, !settings->value ("showFileType").toBool ()); + _file_tree_view->setColumnHidden (3, !settings->value ("showLastModified").toBool ()); + _file_tree_view->setAlternatingRowColors (settings->value ("useAlternatingRowColors").toBool ()); //if (settings.value ("showHiddenFiles").toBool ()) // TODO: React on option for hidden files. } void -files_dock_widget::handleVisibilityChanged (bool visible) +files_dock_widget::handle_visibility_changed (bool visible) { if (visible) - emit activeChanged (true); + emit active_changed (true); } void files_dock_widget::closeEvent (QCloseEvent *event) { - emit activeChanged (false); + emit active_changed (false); QDockWidget::closeEvent (event); } diff --git a/gui/src/files-dockwidget.h b/gui/src/files-dockwidget.h --- a/gui/src/files-dockwidget.h +++ b/gui/src/files-dockwidget.h @@ -41,24 +41,22 @@ public slots: /** Slot for handling a change in directory via double click. */ - void itemDoubleClicked (const QModelIndex & index); + void item_double_clicked (const QModelIndex & index); /** Slot for handling the up-directory button in the toolbar. */ - void onUpDirectory (); - - void setCurrentDirectory (QString currentDirectory); - - void currentDirectoryEntered (); + void do_up_directory (); + void set_current_directory (QString currentDirectory); + void current_directory_entered (); /** Tells the widget to notice settings that are probably new. */ - void noticeSettings (); - void handleVisibilityChanged (bool visible); + void notice_settings (); + void handle_visibility_changed (bool visible); signals: - void openFile (QString fileName); + void open_file (QString fileName); /** Custom signal that tells if a user has clicke away that dock widget. */ - void activeChanged (bool active); + void active_changed (bool active); protected: void closeEvent (QCloseEvent *event); @@ -66,20 +64,20 @@ private: // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc - /** Toolbar for file and directory manipulation. */ - QToolBar * m_navigationToolBar; + /** Toolbar for file and directory manipulation. */ + QToolBar * _navigation_tool_bar; - /** Variables for the up-directory action. */ - QIcon m_directoryIcon; - QAction *m_directoryUpAction; - QToolButton *upDirectoryButton; + /** Variables for the up-directory action. */ + QIcon _directory_icon; + QAction * _directory_up_action; + QToolButton * _up_directory_button; - /** The file system model. */ - QFileSystemModel *m_fileSystemModel; + /** The file system model. */ + QFileSystemModel *_file_system_model; - /** The file system view. */ - QTreeView *m_fileTreeView; - QLineEdit *m_currentDirectory; + /** The file system view. */ + QTreeView * _file_tree_view; + QLineEdit * _current_directory; }; #endif // FILESDOCKWIDGET_H diff --git a/gui/src/history-dockwidget.cc b/gui/src/history-dockwidget.cc --- a/gui/src/history-dockwidget.cc +++ b/gui/src/history-dockwidget.cc @@ -27,7 +27,7 @@ void history_dock_widget::construct () { - m_sortFilterProxyModel.setSourceModel(octave_link::instance ()->historyModel()); + m_sortFilterProxyModel.setSourceModel(octave_link::instance ()->get_history_model()); m_historyListView = new QListView (this); m_historyListView->setModel (&m_sortFilterProxyModel); m_historyListView->setAlternatingRowColors (true); @@ -47,26 +47,26 @@ widget ()->setLayout (layout); connect (m_filterLineEdit, SIGNAL (textEdited (QString)), &m_sortFilterProxyModel, SLOT (setFilterWildcard(QString))); - connect (m_historyListView, SIGNAL (doubleClicked (QModelIndex)), this, SLOT (handleDoubleClick (QModelIndex))); - connect (this, SIGNAL (visibilityChanged(bool)), this, SLOT(handleVisibilityChanged(bool))); + connect (m_historyListView, SIGNAL (doubleClicked (QModelIndex)), this, SLOT (handle_double_click (QModelIndex))); + connect (this, SIGNAL (visibilityChanged(bool)), this, SLOT(handle_visibility_changed(bool))); } void -history_dock_widget::handleDoubleClick (QModelIndex modelIndex) +history_dock_widget::handle_double_click (QModelIndex modelIndex) { - emit commandDoubleClicked (modelIndex.data().toString()); + emit command_double_clicked (modelIndex.data().toString()); } void -history_dock_widget::handleVisibilityChanged (bool visible) +history_dock_widget::handle_visibility_changed (bool visible) { if (visible) - emit activeChanged (true); + emit active_changed (true); } void history_dock_widget::closeEvent (QCloseEvent *event) { - emit activeChanged (false); + emit active_changed (false); QDockWidget::closeEvent (event); } diff --git a/gui/src/history-dockwidget.h b/gui/src/history-dockwidget.h --- a/gui/src/history-dockwidget.h +++ b/gui/src/history-dockwidget.h @@ -29,20 +29,20 @@ Q_OBJECT public: history_dock_widget (QWidget *parent = 0); - void updateHistory (QStringList history); + void update_history (QStringList history); public slots: - void handleVisibilityChanged (bool visible); + void handle_visibility_changed (bool visible); signals: void information (QString message); - void commandDoubleClicked (QString command); + void command_double_clicked (QString command); /** Custom signal that tells if a user has clicked away that dock widget. */ - void activeChanged (bool active); + void active_changed (bool active); protected: void closeEvent (QCloseEvent *event); private slots: - void handleDoubleClick (QModelIndex modelIndex); + void handle_double_click (QModelIndex modelIndex); private: void construct (); diff --git a/gui/src/m-editor/file-editor-interface.h b/gui/src/m-editor/file-editor-interface.h --- a/gui/src/m-editor/file-editor-interface.h +++ b/gui/src/m-editor/file-editor-interface.h @@ -32,8 +32,8 @@ : QDockWidget ((QWidget*)mainWindow) // QDockWidget constructor is explicit, hence the cast. { setObjectName ("FileEditor"); - m_terminal = terminal; - m_mainWindow = mainWindow; + _terminal = terminal; + _main_window = mainWindow; connect (this, SIGNAL (visibilityChanged (bool)), this, SLOT (handle_visibility_changed (bool))); } @@ -48,8 +48,8 @@ void active_changed (bool active); protected: - QTerminal* m_terminal; - main_window* m_mainWindow; + QTerminal* _terminal; + main_window* _main_window; void closeEvent (QCloseEvent *event) { diff --git a/gui/src/m-editor/file-editor-tab.cc b/gui/src/m-editor/file-editor-tab.cc --- a/gui/src/m-editor/file-editor-tab.cc +++ b/gui/src/m-editor/file-editor-tab.cc @@ -23,7 +23,7 @@ file_editor_tab::file_editor_tab(file_editor *fileEditor) : QWidget ((QWidget*)fileEditor) { - QSettings *settings = resource_manager::instance ()->settings (); + QSettings *settings = resource_manager::instance ()->get_settings (); _file_editor = fileEditor; _file_name = ""; _edit_area = new QsciScintilla (this); @@ -80,7 +80,7 @@ // connect modified signal connect (_edit_area, SIGNAL (modificationChanged (bool)), this, SLOT (new_title (bool))); - connect (_edit_area, SIGNAL (copyAvailable (bool)), + connect (_edit_area, SIGNAL (copy_available (bool)), this, SLOT (handle_copy_available (bool))); connect (&_file_system_watcher, SIGNAL (fileChanged (QString)), this, SLOT (file_has_changed (QString))); @@ -90,7 +90,7 @@ } bool -file_editor_tab::copyAvailable () +file_editor_tab::copy_available () { return _copy_available; } @@ -98,7 +98,7 @@ void file_editor_tab::closeEvent (QCloseEvent *event) { - if (_file_editor->mainWindow ()->closing ()) + if (_file_editor->mainWindow ()->is_closing ()) { // close whole application: save file or not if modified check_file_modified ("Closing Octave", 0); // no cancel possible diff --git a/gui/src/m-editor/file-editor-tab.h b/gui/src/m-editor/file-editor-tab.h --- a/gui/src/m-editor/file-editor-tab.h +++ b/gui/src/m-editor/file-editor-tab.h @@ -29,7 +29,7 @@ Q_OBJECT public: file_editor_tab (file_editor *fileEditor); - bool copyAvailable (); + bool copy_available (); public slots: void new_title(bool modified); diff --git a/gui/src/m-editor/file-editor.cc b/gui/src/m-editor/file-editor.cc --- a/gui/src/m-editor/file-editor.cc +++ b/gui/src/m-editor/file-editor.cc @@ -30,8 +30,8 @@ { construct (); - m_terminal = terminal; - m_mainWindow = mainWindow; + _terminal = terminal; + _main_window = mainWindow; setVisible (false); } @@ -48,13 +48,13 @@ QTerminal * file_editor::terminal () { - return m_terminal; + return _terminal; } main_window * file_editor::mainWindow () { - return m_mainWindow; + return _main_window; } void @@ -265,7 +265,7 @@ file_editor_tab *fileEditorTab = activeEditorTab (); if (fileEditorTab) { - bool copyAvailable = fileEditorTab->copyAvailable (); + bool copyAvailable = fileEditorTab->copy_available (); m_copyAction->setEnabled (copyAvailable); m_cutAction->setEnabled (copyAvailable); } @@ -275,7 +275,7 @@ file_editor::construct () { QWidget *widget = new QWidget (this); - QSettings *settings = resource_manager::instance ()->settings (); + QSettings *settings = resource_manager::instance ()->get_settings (); QStyle *style = QApplication::style (); m_menuBar = new QMenuBar (widget); diff --git a/gui/src/m-editor/lexer-octave-gui.cc b/gui/src/m-editor/lexer-octave-gui.cc --- a/gui/src/m-editor/lexer-octave-gui.cc +++ b/gui/src/m-editor/lexer-octave-gui.cc @@ -134,7 +134,7 @@ { if (set == 1) { - return resource_manager::instance ()->octaveKeywords (); + return resource_manager::instance ()->octave_keywords (); } return 0; } diff --git a/gui/src/main-window.cc b/gui/src/main-window.cc --- a/gui/src/main-window.cc +++ b/gui/src/main-window.cc @@ -34,7 +34,7 @@ { // We have to set up all our windows, before we finally launch octave. construct (); - octave_link::instance ()->launchOctave(); + octave_link::instance ()->launch_octave(); } main_window::~main_window () @@ -42,153 +42,153 @@ } void -main_window::newFile () +main_window::new_file () { - m_fileEditor->request_new_file (); + _file_editor->request_new_file (); } void -main_window::openFile () +main_window::open_file () { - m_fileEditor->request_open_file (); + _file_editor->request_open_file (); } void -main_window::reportStatusMessage (QString statusMessage) +main_window::report_status_message (QString statusMessage) { - m_statusBar->showMessage (statusMessage, 1000); + _status_bar->showMessage (statusMessage, 1000); } void -main_window::handleSaveWorkspaceRequest () +main_window::handle_save_workspace_request () { QString selectedFile = QFileDialog::getSaveFileName (this, tr ("Save Workspace"), - resource_manager::instance ()->homePath ()); - m_terminal->sendText (QString ("save \'%1\'\n").arg (selectedFile)); - m_terminal->setFocus (); + resource_manager::instance ()->get_home_path ()); + _terminal->sendText (QString ("save \'%1\'\n").arg (selectedFile)); + _terminal->setFocus (); } void -main_window::handleLoadWorkspaceRequest () +main_window::handle_load_workspace_request () { QString selectedFile = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), - resource_manager::instance ()->homePath ()); + resource_manager::instance ()->get_home_path ()); if (!selectedFile.isEmpty ()) { - m_terminal->sendText (QString ("load \'%1\'\n").arg (selectedFile)); - m_terminal->setFocus (); + _terminal->sendText (QString ("load \'%1\'\n").arg (selectedFile)); + _terminal->setFocus (); } } void -main_window::handleClearWorkspaceRequest () +main_window::handle_clear_workspace_request () { - m_terminal->sendText ("clear\n"); - m_terminal->setFocus (); + _terminal->sendText ("clear\n"); + _terminal->setFocus (); } void -main_window::handleCommandDoubleClicked (QString command) +main_window::handle_command_double_clicked (QString command) { - m_terminal->sendText(command); - m_terminal->setFocus (); + _terminal->sendText(command); + _terminal->setFocus (); } void -main_window::openBugTrackerPage () +main_window::open_bug_tracker_page () { QDesktopServices::openUrl (QUrl ("http://savannah.gnu.org/bugs/?group=octave")); } void -main_window::openAgoraPage () +main_window::open_agora_page () { QDesktopServices::openUrl (QUrl ("http://agora.panocha.org.mx/")); } void -main_window::openOctaveForgePage () +main_window::open_octave_forge_page () { QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/")); } void -main_window::processSettingsDialogRequest () +main_window::process_settings_dialog_request () { settings_dialog *settingsDialog = new settings_dialog (this); settingsDialog->exec (); delete settingsDialog; - emit settingsChanged (); - resource_manager::instance ()->updateNetworkSettings (); - noticeSettings(); + emit settings_changed (); + resource_manager::instance ()->update_network_settings (); + notice_settings(); } void -main_window::noticeSettings () +main_window::notice_settings () { // Set terminal font: - QSettings *settings = resource_manager::instance ()->settings (); + QSettings *settings = resource_manager::instance ()->get_settings (); QFont font = QFont(); font.setFamily(settings->value("terminal/fontName").toString()); font.setPointSize(settings->value("terminal/fontSize").toInt ()); - m_terminal->setTerminalFont(font); + _terminal->setTerminalFont(font); } void -main_window::prepareForQuit () +main_window::prepare_for_quit () { - writeSettings (); + write_settings (); } void -main_window::resetWindows () +main_window::reset_windows () { // TODO: Implement. } void -main_window::updateCurrentWorkingDirectory (QString directory) +main_window::update_current_working_directory (QString directory) { - if (m_currentDirectoryComboBox->count () > 31) + if (_current_directory_combo_box->count () > 31) { - m_currentDirectoryComboBox->removeItem (0); + _current_directory_combo_box->removeItem (0); } - m_currentDirectoryComboBox->addItem (directory); - int index = m_currentDirectoryComboBox->findText (directory); - m_currentDirectoryComboBox->setCurrentIndex (index); + _current_directory_combo_box->addItem (directory); + int index = _current_directory_combo_box->findText (directory); + _current_directory_combo_box->setCurrentIndex (index); } void -main_window::changeCurrentWorkingDirectory () +main_window::change_current_working_directory () { QString selectedDirectory = QFileDialog::getExistingDirectory(this, tr ("Set working direcotry")); if (!selectedDirectory.isEmpty ()) { - m_terminal->sendText (QString ("cd \'%1\'\n").arg (selectedDirectory)); - m_terminal->setFocus (); + _terminal->sendText (QString ("cd \'%1\'\n").arg (selectedDirectory)); + _terminal->setFocus (); } } void -main_window::changeCurrentWorkingDirectory (QString directory) +main_window::change_current_working_directory (QString directory) { - m_terminal->sendText (QString ("cd \'%1\'\n").arg (directory)); - m_terminal->setFocus (); + _terminal->sendText (QString ("cd \'%1\'\n").arg (directory)); + _terminal->setFocus (); } void -main_window::currentWorkingDirectoryUp () +main_window::current_working_directory_up () { - m_terminal->sendText ("cd ..\n"); - m_terminal->setFocus (); + _terminal->sendText ("cd ..\n"); + _terminal->setFocus (); } void -main_window::showAboutOctave () +main_window::show_about_octave () { QString message = "GNU Octave\n" @@ -215,26 +215,26 @@ void main_window::closeEvent (QCloseEvent * closeEvent) { - reportStatusMessage (tr ("Saving data and shutting down.")); - m_closing = true; // inform editor window that whole application is closed - octave_link::instance ()->terminateOctave (); + report_status_message (tr ("Saving data and shutting down.")); + _closing = true; // inform editor window that whole application is closed + octave_link::instance ()->terminate_octave (); QMainWindow::closeEvent (closeEvent); } void -main_window::readSettings () +main_window::read_settings () { - QSettings *settings = resource_manager::instance ()->settings (); + QSettings *settings = resource_manager::instance ()->get_settings (); restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ()); restoreState (settings->value ("MainWindow/windowState").toByteArray ()); - emit settingsChanged (); + emit settings_changed (); } void -main_window::writeSettings () +main_window::write_settings () { - QSettings *settings = resource_manager::instance ()->settings (); + QSettings *settings = resource_manager::instance ()->get_settings (); settings->setValue ("MainWindow/geometry", saveGeometry ()); settings->setValue ("MainWindow/windowState", saveState ()); settings->sync (); @@ -245,34 +245,34 @@ { QStyle *style = QApplication::style (); // TODO: Check this. - m_closing = false; // flag for editor files when closed - setWindowIcon (resource_manager::instance ()->icon (resource_manager::Octave)); + _closing = false; // flag for editor files when closed + setWindowIcon (resource_manager::instance ()->get_icon (resource_manager::octave)); // Setup dockable widgets and the status bar. - m_workspaceView = new workspace_view (this); - m_workspaceView->setStatusTip (tr ("View the variables in the active workspace.")); - m_historyDockWidget = new history_dock_widget (this); - m_historyDockWidget->setStatusTip (tr ("Browse and search the command history.")); - m_filesDockWidget = new files_dock_widget (this); - m_filesDockWidget->setStatusTip (tr ("Browse your files.")); - m_statusBar = new QStatusBar (this); + _workspace_view = new workspace_view (this); + _workspace_view->setStatusTip (tr ("View the variables in the active workspace.")); + _history_dock_widget = new history_dock_widget (this); + _history_dock_widget->setStatusTip (tr ("Browse and search the command history.")); + _files_dock_widget = new files_dock_widget (this); + _files_dock_widget->setStatusTip (tr ("Browse your files.")); + _status_bar = new QStatusBar (this); - m_currentDirectoryComboBox = new QComboBox (this); - m_currentDirectoryComboBox->setFixedWidth (300); - m_currentDirectoryComboBox->setEditable (true); - m_currentDirectoryComboBox->setInsertPolicy (QComboBox::InsertAtTop); - m_currentDirectoryComboBox->setMaxVisibleItems (14); + _current_directory_combo_box = new QComboBox (this); + _current_directory_combo_box->setFixedWidth (300); + _current_directory_combo_box->setEditable (true); + _current_directory_combo_box->setInsertPolicy (QComboBox::InsertAtTop); + _current_directory_combo_box->setMaxVisibleItems (14); - m_currentDirectoryToolButton = new QToolButton (this); - m_currentDirectoryToolButton->setIcon (style->standardIcon (QStyle::SP_DirOpenIcon)); + _current_directory_tool_button = new QToolButton (this); + _current_directory_tool_button->setIcon (style->standardIcon (QStyle::SP_DirOpenIcon)); - m_currentDirectoryUpToolButton = new QToolButton (this); - m_currentDirectoryUpToolButton->setIcon (style->standardIcon (QStyle::SP_FileDialogToParent)); + _current_directory_up_tool_button = new QToolButton (this); + _current_directory_up_tool_button->setIcon (style->standardIcon (QStyle::SP_FileDialogToParent)); // Octave Terminal subwindow. - m_terminal = new QTerminal (this); - m_terminal->setObjectName ("OctaveTerminal"); - m_terminalDockWidget = new terminal_dock_widget (m_terminal, this); + _terminal = new QTerminal (this); + _terminal->setObjectName ("OctaveTerminal"); + _terminal_dock_widget = new terminal_dock_widget (_terminal, this); QWidget *dummyWidget = new QWidget (); dummyWidget->setObjectName ("CentralDummyWidget"); @@ -281,152 +281,171 @@ dummyWidget->hide (); setCentralWidget (dummyWidget); - m_fileEditor = new file_editor (m_terminal, this); + _file_editor = new file_editor (_terminal, this); - QMenu *fileMenu = menuBar ()->addMenu (tr ("&File")); - QAction *newFileAction - = fileMenu->addAction (QIcon::fromTheme ("document-new", + QMenu *file_menu = menuBar ()->addMenu (tr ("&File")); + QAction *new_file_action + = file_menu->addAction (QIcon::fromTheme ("document-new", style->standardIcon (QStyle::SP_FileIcon)), tr ("New File")); - QAction *openFileAction - = fileMenu->addAction (QIcon::fromTheme ("document-open", + QAction *open_file_action + = file_menu->addAction (QIcon::fromTheme ("document-open", style->standardIcon (QStyle::SP_FileIcon)), tr ("Open File")); - QAction *settingsAction = fileMenu->addAction (tr ("Settings")); - fileMenu->addSeparator (); - QAction *exitAction = fileMenu->addAction (tr ("Exit")); + QAction *settings_action = file_menu->addAction (tr ("Settings")); + file_menu->addSeparator (); + QAction *exit_action = file_menu->addAction (tr ("Exit")); - QMenu *editMenu = menuBar ()->addMenu (tr ("&Edit")); - QAction *cutAction - = editMenu->addAction (QIcon::fromTheme ("edit-cut", + QMenu *edit_menu = menuBar ()->addMenu (tr ("&Edit")); + QAction *cut_action + = edit_menu->addAction (QIcon::fromTheme ("edit-cut", style->standardIcon (QStyle::SP_FileIcon)), tr ("Cut")); - cutAction->setShortcut (QKeySequence::Cut); + cut_action->setShortcut (QKeySequence::Cut); - QAction *copyAction - = editMenu->addAction (QIcon::fromTheme ("edit-copy", + QAction *copy_action + = edit_menu->addAction (QIcon::fromTheme ("edit-copy", style->standardIcon (QStyle::SP_FileIcon)), tr ("Copy")); - copyAction->setShortcut (QKeySequence::Copy); + copy_action->setShortcut (QKeySequence::Copy); - QAction *pasteAction - = editMenu->addAction (QIcon::fromTheme ("edit-paste", + QAction *paste_action + = edit_menu->addAction (QIcon::fromTheme ("edit-paste", style->standardIcon (QStyle::SP_FileIcon)), tr ("Paste")); - pasteAction->setShortcut (QKeySequence::Paste); + paste_action->setShortcut (QKeySequence::Paste); - QAction *undoAction - = editMenu->addAction (QIcon::fromTheme ("edit-undo", + QAction *undo_action + = edit_menu->addAction (QIcon::fromTheme ("edit-undo", style->standardIcon (QStyle::SP_FileIcon)), tr ("Undo")); - undoAction->setShortcut (QKeySequence::Undo); + undo_action->setShortcut (QKeySequence::Undo); - QAction *redoAction - = editMenu->addAction (QIcon::fromTheme ("edit-redo", + QAction *redo_action + = edit_menu->addAction (QIcon::fromTheme ("edit-redo", style->standardIcon (QStyle::SP_FileIcon)), tr ("Redo")); - redoAction->setShortcut (QKeySequence::Redo); + redo_action->setShortcut (QKeySequence::Redo); //QMenu *debugMenu = menuBar ()->addMenu (tr ("De&bug")); //QMenu *parallelMenu = menuBar ()->addMenu (tr ("&Parallel")); - QMenu *desktopMenu = menuBar ()->addMenu (tr ("&Desktop")); - QAction *loadWorkspaceAction = desktopMenu->addAction (tr ("Load workspace")); - QAction *saveWorkspaceAction = desktopMenu->addAction (tr ("Save workspace")); - QAction *clearWorkspaceAction = desktopMenu->addAction (tr ("Clear workspace")); + QMenu * desktop_menu = menuBar ()->addMenu (tr ("&Desktop")); + QAction * load_workspace_action = desktop_menu->addAction (tr ("Load workspace")); + QAction * save_workspace_action = desktop_menu->addAction (tr ("Save workspace")); + QAction * clear_workspace_action = desktop_menu->addAction (tr ("Clear workspace")); // Window menu - QMenu *windowMenu = menuBar ()->addMenu (tr ("&Window")); - QAction *showCommandWindowAction = windowMenu->addAction (tr ("Command Window")); - showCommandWindowAction->setCheckable (true); - QAction *showWorkspaceAction = windowMenu->addAction (tr ("Workspace")); - showWorkspaceAction->setCheckable (true); - QAction *showHistoryAction = windowMenu->addAction (tr ("Command History")); - showHistoryAction->setCheckable (true); - QAction *showFileBrowserAction = windowMenu->addAction (tr ("Current Directory")); - showFileBrowserAction->setCheckable (true); - QAction *showEditorAction = windowMenu->addAction (tr ("Editor")); - showEditorAction->setCheckable (true); - - windowMenu->addSeparator (); - QAction *resetWindowsAction = windowMenu->addAction (tr ("Reset Windows")); + QMenu * window_menu = menuBar ()->addMenu (tr ("&Window")); + QAction * show_command_window_action = window_menu->addAction (tr ("Command Window")); + show_command_window_action->setCheckable (true); + QAction * show_workspace_action = window_menu->addAction (tr ("Workspace")); + show_workspace_action->setCheckable (true); + QAction * show_history_action = window_menu->addAction (tr ("Command History")); + show_history_action->setCheckable (true); + QAction * show_file_browser_action = window_menu->addAction (tr ("Current Directory")); + show_file_browser_action->setCheckable (true); + QAction * show_editor_action = window_menu->addAction (tr ("Editor")); + show_editor_action->setCheckable (true); + window_menu->addSeparator (); + QAction * reset_windows_action = window_menu->addAction (tr ("Reset Windows")); // Help menu - QMenu *helpMenu = menuBar ()->addMenu (tr ("&Help")); - QAction *reportBugAction = helpMenu->addAction (tr ("Report Bug")); - QAction *agoraAction = helpMenu->addAction (tr ("Visit Agora")); - QAction *octaveForgeAction = helpMenu->addAction (tr ("Visit Octave Forge")); - helpMenu->addSeparator (); - QAction *aboutOctaveAction = helpMenu->addAction (tr ("About Octave")); + QMenu * help_menu = menuBar ()->addMenu (tr ("&Help")); + QAction * report_bug_action = help_menu->addAction (tr ("Report Bug")); + QAction * agora_action = help_menu->addAction (tr ("Visit Agora")); + QAction * octave_forge_action = help_menu->addAction (tr ("Visit Octave Forge")); + help_menu->addSeparator (); + QAction * about_octave_action = help_menu->addAction (tr ("About Octave")); // Toolbars - QToolBar *mainToolBar = addToolBar ("Main"); - mainToolBar->addAction (newFileAction); - mainToolBar->addAction (openFileAction); - mainToolBar->addSeparator (); - mainToolBar->addAction (cutAction); - mainToolBar->addAction (copyAction); - mainToolBar->addAction (pasteAction); - mainToolBar->addAction (undoAction); - mainToolBar->addAction (redoAction); - mainToolBar->addSeparator (); - mainToolBar->addWidget (new QLabel (tr ("Current Directory:"))); - mainToolBar->addWidget (m_currentDirectoryComboBox); - mainToolBar->addWidget (m_currentDirectoryToolButton); - mainToolBar->addWidget (m_currentDirectoryUpToolButton); - - connect (qApp, SIGNAL(aboutToQuit ()), this, SLOT (prepareForQuit ())); - - connect (settingsAction, SIGNAL (triggered ()), this, SLOT (processSettingsDialogRequest ())); - connect (exitAction, SIGNAL (triggered ()), this, SLOT (close ())); - connect (newFileAction, SIGNAL (triggered ()), this, SLOT (newFile ())); - connect (openFileAction, SIGNAL (triggered ()), this, SLOT (openFile ())); - connect (reportBugAction, SIGNAL (triggered ()), this, SLOT (openBugTrackerPage ())); - connect (agoraAction, SIGNAL (triggered ()), this, SLOT (openAgoraPage ())); - connect (octaveForgeAction, SIGNAL (triggered ()), this, SLOT (openOctaveForgePage ())); - connect (aboutOctaveAction, SIGNAL (triggered ()), this, SLOT (showAboutOctave ())); + QToolBar *main_tool_bar = addToolBar ("Main"); + main_tool_bar->addAction (new_file_action); + main_tool_bar->addAction (open_file_action); + main_tool_bar->addSeparator (); + main_tool_bar->addAction (cut_action); + main_tool_bar->addAction (copy_action); + main_tool_bar->addAction (paste_action); + main_tool_bar->addAction (undo_action); + main_tool_bar->addAction (redo_action); + main_tool_bar->addSeparator (); + main_tool_bar->addWidget (new QLabel (tr ("Current Directory:"))); + main_tool_bar->addWidget (_current_directory_combo_box); + main_tool_bar->addWidget (_current_directory_tool_button); + main_tool_bar->addWidget (_current_directory_up_tool_button); - connect (showCommandWindowAction, SIGNAL (toggled (bool)), m_terminalDockWidget, SLOT (setShown (bool))); - connect (m_terminalDockWidget, SIGNAL (activeChanged (bool)), showCommandWindowAction, SLOT (setChecked (bool))); - connect (showWorkspaceAction, SIGNAL (toggled (bool)), m_workspaceView, SLOT (setShown (bool))); - connect (m_workspaceView, SIGNAL (activeChanged (bool)), showWorkspaceAction, SLOT (setChecked (bool))); - connect (showHistoryAction, SIGNAL (toggled (bool)), m_historyDockWidget, SLOT (setShown (bool))); - connect (m_historyDockWidget, SIGNAL (activeChanged (bool)), showHistoryAction, SLOT (setChecked (bool))); - connect (showFileBrowserAction, SIGNAL (toggled (bool)), m_filesDockWidget, SLOT (setShown (bool))); - connect (m_filesDockWidget, SIGNAL (activeChanged (bool)), showFileBrowserAction, SLOT (setChecked (bool))); - connect (showEditorAction, SIGNAL (toggled (bool)), m_fileEditor, SLOT (setShown (bool))); - connect (m_fileEditor, SIGNAL (activeChanged (bool)), showEditorAction, SLOT (setChecked (bool))); - connect (resetWindowsAction, SIGNAL (triggered ()), this, SLOT (resetWindows ())); - //connect (this, SIGNAL (settingsChanged ()), m_workspaceView, SLOT (noticeSettings ())); - //connect (this, SIGNAL (settingsChanged ()), m_historyDockWidget, SLOT (noticeSettings ())); - connect (this, SIGNAL (settingsChanged ()), m_filesDockWidget, SLOT (noticeSettings ())); - connect (this, SIGNAL (settingsChanged ()), this, SLOT (noticeSettings ())); - - connect (m_filesDockWidget, SIGNAL (openFile (QString)), m_fileEditor, SLOT (requestOpenFile (QString))); - connect (m_historyDockWidget, SIGNAL (information (QString)), this, SLOT (reportStatusMessage (QString))); - connect (m_historyDockWidget, SIGNAL (commandDoubleClicked (QString)), this, SLOT (handleCommandDoubleClicked (QString))); - connect (saveWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleSaveWorkspaceRequest ())); - connect (loadWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleLoadWorkspaceRequest ())); - connect (clearWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleClearWorkspaceRequest ())); - - connect (m_currentDirectoryToolButton, SIGNAL (clicked ()), - this, SLOT (changeCurrentWorkingDirectory ())); - connect (m_currentDirectoryUpToolButton, SIGNAL (clicked ()), - this, SLOT(currentWorkingDirectoryUp())); - connect (copyAction, SIGNAL (triggered()), m_terminal, SLOT(copyClipboard ())); - connect (pasteAction, SIGNAL (triggered()), m_terminal, SLOT(pasteClipboard ())); - - connect (octave_link::instance (), SIGNAL (workingDirectoryChanged (QString)), - this, SLOT (updateCurrentWorkingDirectory (QString))); - connect (m_currentDirectoryComboBox, SIGNAL (activated (QString)), - this, SLOT (changeCurrentWorkingDirectory (QString))); + connect (qApp, SIGNAL (aboutToQuit ()), + this, SLOT (prepare_for_quit ())); + connect (settings_action, SIGNAL (triggered ()), + this, SLOT (process_settings_dialog_request ())); + connect (exit_action, SIGNAL (triggered ()), + this, SLOT (close ())); + connect (new_file_action, SIGNAL (triggered ()), + this, SLOT (new_file ())); + connect (open_file_action, SIGNAL (triggered ()), + this, SLOT (open_file ())); + connect (report_bug_action, SIGNAL (triggered ()), + this, SLOT (open_bug_tracker_page ())); + connect (agora_action, SIGNAL (triggered ()), + this, SLOT (open_agora_page ())); + connect (octave_forge_action, SIGNAL (triggered ()), + this, SLOT (open_octave_forge_page ())); + connect (about_octave_action, SIGNAL (triggered ()), + this, SLOT (show_about_octave ())); + connect (show_command_window_action, SIGNAL (toggled (bool)), + _terminal_dock_widget, SLOT (setShown (bool))); + connect (_terminal_dock_widget, SIGNAL (active_changed (bool)), + show_command_window_action, SLOT (setChecked (bool))); + connect (show_workspace_action, SIGNAL (toggled (bool)), + _workspace_view, SLOT (setShown (bool))); + connect (_workspace_view, SIGNAL (active_changed (bool)), + show_workspace_action, SLOT (setChecked (bool))); + connect (show_history_action, SIGNAL (toggled (bool)), + _history_dock_widget, SLOT (setShown (bool))); + connect (_history_dock_widget, SIGNAL (active_changed (bool)), + show_history_action, SLOT (setChecked (bool))); + connect (show_file_browser_action, SIGNAL (toggled (bool)), + _files_dock_widget, SLOT (setShown (bool))); + connect (_files_dock_widget, SIGNAL (active_changed (bool)), + show_file_browser_action, SLOT (setChecked (bool))); + connect (show_editor_action, SIGNAL (toggled (bool)), + _file_editor, SLOT (setShown (bool))); + connect (_file_editor, SIGNAL (active_changed (bool)), + show_editor_action, SLOT (setChecked (bool))); + connect (reset_windows_action, SIGNAL (triggered ()), + this, SLOT (reset_windows ())); + connect (this, SIGNAL (settings_changed ()), + _files_dock_widget, SLOT (notice_settings ())); + connect (this, SIGNAL (settings_changed ()), + this, SLOT (notice_settings ())); + connect (_files_dock_widget, SIGNAL (open_file (QString)), + _file_editor, SLOT (request_open_file (QString))); + connect (_history_dock_widget, SIGNAL (information (QString)), + this, SLOT (report_status_message (QString))); + connect (_history_dock_widget, SIGNAL (command_double_clicked (QString)), + this, SLOT (handle_command_double_clicked (QString))); + connect (save_workspace_action, SIGNAL (triggered ()), + this, SLOT (handle_save_workspace_request ())); + connect (load_workspace_action, SIGNAL (triggered ()), + this, SLOT (handle_load_workspace_request ())); + connect (clear_workspace_action, SIGNAL (triggered ()), + this, SLOT (handle_clear_workspace_request ())); + connect (_current_directory_tool_button, SIGNAL (clicked ()), + this, SLOT (change_current_working_directory ())); + connect (_current_directory_up_tool_button, SIGNAL (clicked ()), + this, SLOT (current_working_directory_up())); + connect (copy_action, SIGNAL (triggered()), + _terminal, SLOT (copyClipboard ())); + connect (paste_action, SIGNAL (triggered()), + _terminal, SLOT (pasteClipboard ())); + connect (octave_link::instance (), SIGNAL (working_directory_changed (QString)), + this, SLOT (update_current_working_directory (QString))); + connect (_current_directory_combo_box, SIGNAL (activated (QString)), + this, SLOT (change_current_working_directory (QString))); setWindowTitle ("Octave"); - setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks); - - addDockWidget (Qt::LeftDockWidgetArea, m_workspaceView); - addDockWidget (Qt::LeftDockWidgetArea, m_historyDockWidget); - addDockWidget (Qt::RightDockWidgetArea, m_filesDockWidget); - addDockWidget (Qt::RightDockWidgetArea, m_fileEditor); - addDockWidget (Qt::BottomDockWidgetArea, m_terminalDockWidget); - setStatusBar (m_statusBar); - - readSettings (); + addDockWidget (Qt::LeftDockWidgetArea, _workspace_view); + addDockWidget (Qt::LeftDockWidgetArea, _history_dock_widget); + addDockWidget (Qt::RightDockWidgetArea, _files_dock_widget); + addDockWidget (Qt::RightDockWidgetArea, _file_editor); + addDockWidget (Qt::BottomDockWidgetArea, _terminal_dock_widget); + setStatusBar (_status_bar); + read_settings (); } diff --git a/gui/src/main-window.h b/gui/src/main-window.h --- a/gui/src/main-window.h +++ b/gui/src/main-window.h @@ -56,75 +56,62 @@ main_window (QWidget * parent = 0); ~main_window (); - QTerminal *terminalView () - { - return m_terminal; - } - - history_dock_widget *historyDockWidget () - { - return m_historyDockWidget; - } - files_dock_widget *filesDockWidget () - { - return m_filesDockWidget; - } - bool closing () - { - return m_closing; - } + QTerminal *get_terminal_view () { return _terminal; } + history_dock_widget *get_history_dock_widget () { return _history_dock_widget; } + files_dock_widget *get_files_dock_widget () { return _files_dock_widget; } + bool is_closing () { return _closing; } signals: - void settingsChanged (); + void settings_changed (); public slots: - void reportStatusMessage (QString statusMessage); - void handleSaveWorkspaceRequest (); - void handleLoadWorkspaceRequest (); - void handleClearWorkspaceRequest (); - void handleCommandDoubleClicked (QString command); - void newFile (); - void openFile (); - void openBugTrackerPage (); - void openAgoraPage (); - void openOctaveForgePage (); - void processSettingsDialogRequest (); - void showAboutOctave (); - void noticeSettings (); - void prepareForQuit (); - void resetWindows (); - void updateCurrentWorkingDirectory (QString directory); - void changeCurrentWorkingDirectory (); - void changeCurrentWorkingDirectory (QString directory); - void currentWorkingDirectoryUp (); + void report_status_message (QString statusMessage); + void handle_save_workspace_request (); + void handle_load_workspace_request (); + void handle_clear_workspace_request (); + void handle_command_double_clicked (QString command); + void new_file (); + void open_file (); + void open_bug_tracker_page (); + void open_agora_page (); + void open_octave_forge_page (); + void process_settings_dialog_request (); + void show_about_octave (); + void notice_settings (); + void prepare_for_quit (); + void reset_windows (); + void update_current_working_directory (QString directory); + void change_current_working_directory (); + void change_current_working_directory (QString directory); + void current_working_directory_up (); protected: void closeEvent (QCloseEvent * closeEvent); - void readSettings (); - void writeSettings (); + void read_settings (); + void write_settings (); private: void construct (); - void establishOctaveLink (); + void establish_octave_link (); - QTerminal *m_terminal; - file_editor_interface *m_fileEditor; + QTerminal * _terminal; + file_editor_interface * _file_editor; // Dock widgets. - workspace_view *m_workspaceView; - history_dock_widget *m_historyDockWidget; - files_dock_widget *m_filesDockWidget; - terminal_dock_widget *m_terminalDockWidget; + workspace_view * _workspace_view; + history_dock_widget * _history_dock_widget; + files_dock_widget * _files_dock_widget; + terminal_dock_widget * _terminal_dock_widget; // Toolbars. - QStatusBar *m_statusBar; + QStatusBar * _status_bar; - QComboBox *m_currentDirectoryComboBox; - QToolButton *m_currentDirectoryToolButton; - QToolButton *m_currentDirectoryUpToolButton; + QComboBox * _current_directory_combo_box; + QToolButton * _current_directory_tool_button; + QToolButton * _current_directory_up_tool_button; // Flag for closing whole application - bool m_closing; + bool _closing; }; #endif // MAINWINDOW_H diff --git a/gui/src/octave-adapter/octave-link.cc b/gui/src/octave-adapter/octave-link.cc --- a/gui/src/octave-adapter/octave-link.cc +++ b/gui/src/octave-adapter/octave-link.cc @@ -23,37 +23,37 @@ int octave_readline_hook () { - octave_link::instance ()->triggerUpdateHistoryModel (); - octave_link::instance ()->buildSymbolInformation (); - octave_link::instance ()->updateCurrentWorkingDirectory (); + octave_link::instance ()->trigger_update_history_model (); + octave_link::instance ()->build_symbol_information (); + octave_link::instance ()->update_current_working_directory (); return 0; } void octave_exit_hook (int status) { Q_UNUSED (status); - octave_link::instance ()->terminateOctave (); + octave_link::instance ()->terminate_octave (); } -octave_link octave_link::m_singleton; +octave_link octave_link::_singleton; octave_link::octave_link ():QObject () { - m_historyModel = new QStringListModel (this); - m_workspaceModel = new workspace_model (this); + _history_model = new QStringListModel (this); + _workspace_model = new workspace_model (this); - m_workspaceModel->insertTopLevelItem(0, new TreeItem ("Local")); - m_workspaceModel->insertTopLevelItem(1, new TreeItem ("Global")); - m_workspaceModel->insertTopLevelItem(2, new TreeItem ("Persistent")); - m_workspaceModel->insertTopLevelItem(3, new TreeItem ("Hidden")); + _workspace_model->insert_top_level_item(0, new tree_item ("Local")); + _workspace_model->insert_top_level_item(1, new tree_item ("Global")); + _workspace_model->insert_top_level_item(2, new tree_item ("Persistent")); + _workspace_model->insert_top_level_item(3, new tree_item ("Hidden")); - _updateWorkspaceModelTimer.setInterval (1000); - _updateWorkspaceModelTimer.setSingleShot (false); - connect(&_updateWorkspaceModelTimer, SIGNAL (timeout ()), - m_workspaceModel, SLOT (updateFromSymbolTable ())); + _update_workspace_model_timer.setInterval (1000); + _update_workspace_model_timer.setSingleShot (false); + connect(&_update_workspace_model_timer, SIGNAL (timeout ()), + _workspace_model, SLOT (update_from_symbol_table ())); - _symbolInformationSemaphore = new QSemaphore (1); - _currentWorkingDirectory = ""; + _symbol_information_semaphore = new QSemaphore (1); + _current_working_directory = ""; } octave_link::~octave_link () @@ -61,29 +61,29 @@ } void -octave_link::launchOctave () +octave_link::launch_octave () { // Create both threads. - m_octaveMainThread = new octave_main_thread (this); + _octave_main_thread = new octave_main_thread (this); command_editor::add_event_hook (octave_readline_hook); octave_exit = octave_exit_hook; // Start the first one. - m_octaveMainThread->start (); - _updateWorkspaceModelTimer.start (); + _octave_main_thread->start (); + _update_workspace_model_timer.start (); } void -octave_link::terminateOctave () +octave_link::terminate_octave () { qApp->quit (); } void -octave_link::triggerUpdateHistoryModel () +octave_link::trigger_update_history_model () { // Determine the client's (our) history length and the one of the server. - int clientHistoryLength = m_historyModel->rowCount (); + int clientHistoryLength = _history_model->rowCount (); int serverHistoryLength = command_history::length (); // If were behind the server, iterate through all new entries and add them to our history. @@ -91,67 +91,67 @@ { for (int i = clientHistoryLength; i < serverHistoryLength; i++) { - m_historyModel->insertRow (0); - m_historyModel->setData (m_historyModel->index (0), QString (command_history::get_entry (i).c_str ())); + _history_model->insertRow (0); + _history_model->setData (_history_model->index (0), QString (command_history::get_entry (i).c_str ())); } } } void -octave_link::updateCurrentWorkingDirectory () +octave_link::update_current_working_directory () { QString _queriedWorkingDirectory = octave_env::get_current_directory ().c_str(); - if (_currentWorkingDirectory != _queriedWorkingDirectory) + if (_current_working_directory != _queriedWorkingDirectory) { - _currentWorkingDirectory = _queriedWorkingDirectory; - QDir::setCurrent (_currentWorkingDirectory); - emit workingDirectoryChanged (_currentWorkingDirectory); + _current_working_directory = _queriedWorkingDirectory; + QDir::setCurrent (_current_working_directory); + emit working_directory_changed (_current_working_directory); } } void -octave_link::acquireSymbolInformation () +octave_link::acquire_symbol_information () { - _symbolInformationSemaphore->acquire (1); + _symbol_information_semaphore->acquire (1); } void -octave_link::releaseSymbolInformation () +octave_link::release_symbol_information () { - _symbolInformationSemaphore->release (1); + _symbol_information_semaphore->release (1); } void -octave_link::buildSymbolInformation () +octave_link::build_symbol_information () { std::list < symbol_table::symbol_record > symbolTable = symbol_table::all_variables (); - acquireSymbolInformation (); - _symbolInformation.clear (); + acquire_symbol_information (); + _symbol_information.clear (); for (std::list < symbol_table::symbol_record > ::iterator iterator = symbolTable.begin (); iterator != symbolTable.end (); iterator++) { - SymbolInformation symbolInformation; - symbolInformation.fromSymbolRecord (*iterator); - _symbolInformation.push_back (symbolInformation); + symbol_information symbolInformation; + symbolInformation.from_symbol_record (*iterator); + _symbol_information.push_back (symbolInformation); } - releaseSymbolInformation (); + release_symbol_information (); } -const QList & -octave_link::symbolInformation () const +const QList & +octave_link::get_symbol_information () const { - return _symbolInformation; + return _symbol_information; } QStringListModel * -octave_link::historyModel () +octave_link::get_history_model () { - return m_historyModel; + return _history_model; } workspace_model * -octave_link::workspaceModel () +octave_link::get_workspace_model () { - return m_workspaceModel; + return _workspace_model; } diff --git a/gui/src/octave-adapter/octave-link.h b/gui/src/octave-adapter/octave-link.h --- a/gui/src/octave-adapter/octave-link.h +++ b/gui/src/octave-adapter/octave-link.h @@ -88,40 +88,40 @@ static octave_link * instance () { - return &m_singleton; + return &_singleton; } - void launchOctave (); - void terminateOctave (); - QStringListModel *historyModel (); - workspace_model *workspaceModel (); + void launch_octave (); + void terminate_octave (); + QStringListModel *get_history_model (); + workspace_model *get_workspace_model (); - void triggerUpdateHistoryModel (); - void updateCurrentWorkingDirectory (); + void trigger_update_history_model (); + void update_current_working_directory (); - void acquireSymbolInformation (); - void releaseSymbolInformation (); - void buildSymbolInformation (); - const QList & symbolInformation () const; + void acquire_symbol_information (); + void release_symbol_information (); + void build_symbol_information (); + const QList & get_symbol_information () const; signals: - void workingDirectoryChanged (QString directory); + void working_directory_changed (QString directory); private: octave_link (); ~octave_link (); - QStringListModel *m_historyModel; - workspace_model *m_workspaceModel; + QStringListModel *_history_model; + workspace_model *_workspace_model; // Threads for running octave and managing the data interaction. - octave_main_thread *m_octaveMainThread; - QTimer _updateWorkspaceModelTimer; + octave_main_thread *_octave_main_thread; + QTimer _update_workspace_model_timer; - QSemaphore *_symbolInformationSemaphore; - QList _symbolInformation; + QSemaphore *_symbol_information_semaphore; + QList _symbol_information; - QString _currentWorkingDirectory; - static octave_link m_singleton; + QString _current_working_directory; + static octave_link _singleton; }; #endif // OCTAVELINK_H diff --git a/gui/src/octave-adapter/symbol-information.h b/gui/src/octave-adapter/symbol-information.h --- a/gui/src/octave-adapter/symbol-information.h +++ b/gui/src/octave-adapter/symbol-information.h @@ -57,14 +57,14 @@ #include "octave/utils.h" #include "octave/variables.h" -typedef struct SymbolInformation +typedef struct symbol_information { enum Scope { - Local = 0, - Global = 1, - Persistent = 2, - Hidden = 3 + local = 0, + global = 1, + persistent = 2, + hidden = 3 }; QString _symbol; @@ -79,7 +79,7 @@ } bool - equals (const SymbolInformation& other) const + equals (const symbol_information& other) const { if (hash () == other.hash ()) { @@ -91,47 +91,47 @@ } bool - fromSymbolRecord (const symbol_table::symbol_record& symbolRecord) + from_symbol_record (const symbol_table::symbol_record& symbol_record) { - if (symbolRecord.is_local () && !symbolRecord.is_global () && !symbolRecord.is_hidden ()) - _scope = Local; - else if (symbolRecord.is_global ()) - _scope = Global; - else if (symbolRecord.is_persistent ()) - _scope = Persistent; - else if (symbolRecord.is_hidden ()) - _scope = Hidden; + if (symbol_record.is_local () && !symbol_record.is_global () && !symbol_record.is_hidden ()) + _scope = local; + else if (symbol_record.is_global ()) + _scope = global; + else if (symbol_record.is_persistent ()) + _scope = persistent; + else if (symbol_record.is_hidden ()) + _scope = hidden; - _symbol = QString (symbolRecord.name ().c_str ()); - _type = QString (symbolRecord.varval ().type_name ().c_str ()); - octave_value octaveValue = symbolRecord.varval (); + _symbol = QString (symbol_record.name ().c_str ()); + _type = QString (symbol_record.varval ().type_name ().c_str ()); + octave_value ov = symbol_record.varval (); // For every type, convert to a human readable string. - if (octaveValue.is_sq_string ()) - _value = QString ("\'%1\'").arg (octaveValue.string_value ().c_str ()); - else if (octaveValue.is_dq_string ()) - _value = QString ("\"%1\"").arg (octaveValue.string_value ().c_str ()); - else if (octaveValue.is_real_scalar ()) - _value = QString ("%1").arg (octaveValue.scalar_value ()); - else if (octaveValue.is_complex_scalar ()) - _value = QString ("%1 + %2i").arg (octaveValue.scalar_value ()) - .arg (octaveValue.complex_value ().imag ()); - else if (octaveValue.is_range ()) - _value = QString ("%1 : %2 : %3").arg (octaveValue.range_value ().base ()) - .arg (octaveValue.range_value ().inc ()) - .arg (octaveValue.range_value ().limit ()); - else if (octaveValue.is_real_matrix ()) - _value = QString ("%1x%2").arg (octaveValue.rows ()) - .arg (octaveValue.columns ()); - else if (octaveValue.is_complex_matrix ()) - _value = QString ("%1x%2").arg (octaveValue.rows ()) - .arg (octaveValue.columns ()); + if (ov.is_sq_string ()) + _value = QString ("\'%1\'").arg (ov.string_value ().c_str ()); + else if (ov.is_dq_string ()) + _value = QString ("\"%1\"").arg (ov.string_value ().c_str ()); + else if (ov.is_real_scalar ()) + _value = QString ("%1").arg (ov.scalar_value ()); + else if (ov.is_complex_scalar ()) + _value = QString ("%1 + %2i").arg (ov.scalar_value ()) + .arg (ov.complex_value ().imag ()); + else if (ov.is_range ()) + _value = QString ("%1 : %2 : %3").arg (ov.range_value ().base ()) + .arg (ov.range_value ().inc ()) + .arg (ov.range_value ().limit ()); + else if (ov.is_real_matrix ()) + _value = QString ("%1x%2").arg (ov.rows ()) + .arg (ov.columns ()); + else if (ov.is_complex_matrix ()) + _value = QString ("%1x%2").arg (ov.rows ()) + .arg (ov.columns ()); else _value = QString (""); return true; } -} SymbolInformation; +} symbol_information; diff --git a/gui/src/octave-gui.cc b/gui/src/octave-gui.cc --- a/gui/src/octave-gui.cc +++ b/gui/src/octave-gui.cc @@ -28,12 +28,12 @@ QApplication application (argc, argv); while (true) { - if (resource_manager::instance ()->isFirstRun ()) + if (resource_manager::instance ()->is_first_run ()) { welcome_wizard welcomeWizard; int returnCode = welcomeWizard.exec (); - QSettings *settings = resource_manager::instance ()->settings (); + QSettings *settings = resource_manager::instance ()->get_settings (); settings->setValue ("connectOnStartup", true); settings->setValue ("showMessageOfTheDay", true); settings->setValue ("showTopic", true); @@ -60,7 +60,7 @@ settings->setValue ("proxyUserName", ""); settings->setValue ("proxyPassword", ""); settings->sync (); - resource_manager::instance ()->reloadSettings (); + resource_manager::instance ()->reload_settings (); application.quit (); // We are in an infinite loop, so everything else than a return @@ -70,16 +70,16 @@ } else { - QSettings *settings = resource_manager::instance ()->settings (); + QSettings *settings = resource_manager::instance ()->get_settings (); QString language = settings->value ("language").toString (); - QString translatorFile = resource_manager::instance ()->findTranslatorFile (language); + QString translatorFile = resource_manager::instance ()->find_translator_file (language); QTranslator translator; translator.load (translatorFile); application.installTranslator (&translator); - resource_manager::instance ()->updateNetworkSettings (); - resource_manager::instance ()->loadIcons (); + resource_manager::instance ()->update_network_settings (); + resource_manager::instance ()->load_icons (); main_window w; w.show (); diff --git a/gui/src/resource-manager.cc b/gui/src/resource-manager.cc --- a/gui/src/resource-manager.cc +++ b/gui/src/resource-manager.cc @@ -19,84 +19,84 @@ #include #include -resource_manager resource_manager::m_singleton; +resource_manager resource_manager::_singleton; resource_manager::resource_manager () { - m_settings = 0; - reloadSettings (); + _settings = 0; + reload_settings (); } resource_manager::~resource_manager () { - delete m_settings; + delete _settings; } QSettings * -resource_manager::settings () +resource_manager::get_settings () { - return m_settings; + return _settings; } QString -resource_manager::homePath () +resource_manager::get_home_path () { - return m_homePath; + return _home_path; } void -resource_manager::reloadSettings () +resource_manager::reload_settings () { QDesktopServices desktopServices; - m_homePath = desktopServices.storageLocation (QDesktopServices::HomeLocation); - setSettings(m_homePath + "/.config/octave-gui/settings"); + _home_path = desktopServices.storageLocation (QDesktopServices::HomeLocation); + set_settings(_home_path + "/.config/octave-gui/settings"); } void -resource_manager::setSettings (QString file) +resource_manager::set_settings (QString file) { - delete m_settings; + delete _settings; - m_firstRun = false; + _first_run = false; if (!QFile::exists (file)) - m_firstRun = true; + _first_run = true; // If the settings file does not exist, QSettings automatically creates it. // Therefore we have to check if it exists before instantiating the settings object. // That way we can detect if the user ran this application before. - m_settings = new QSettings (file, QSettings::IniFormat); + _settings = new QSettings (file, QSettings::IniFormat); } QString -resource_manager::findTranslatorFile (QString language) +resource_manager::find_translator_file (QString language) { // TODO: Quick hack to be able to test language files. return QString("../languages/%1.qm").arg(language); } QIcon -resource_manager::icon (Icon icon) +resource_manager::get_icon (icon i) { - if (m_icons.contains (icon)) + if (_icons.contains (i)) { - return m_icons [icon]; + return _icons [i]; } return QIcon (); } bool -resource_manager::isFirstRun () +resource_manager::is_first_run () { - return m_firstRun; + return _first_run; } void -resource_manager::updateNetworkSettings () +resource_manager::update_network_settings () { QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy; - if (m_settings->value ("useProxyServer").toBool ()) + if (_settings->value ("useProxyServer").toBool ()) { - QString proxyTypeString = m_settings->value ("proxyType").toString (); + QString proxyTypeString = _settings->value ("proxyType").toString (); if (proxyTypeString == "Socks5Proxy") { proxyType = QNetworkProxy::Socks5Proxy; @@ -109,25 +109,25 @@ QNetworkProxy proxy; proxy.setType (proxyType); - proxy.setHostName (m_settings->value ("proxyHostName").toString ()); - proxy.setPort (m_settings->value ("proxyPort").toInt ()); - proxy.setUser (m_settings->value ("proxyUserName").toString ()); - proxy.setPassword (m_settings->value ("proxyPassword").toString ()); + proxy.setHostName (_settings->value ("proxyHostName").toString ()); + proxy.setPort (_settings->value ("proxyPort").toInt ()); + proxy.setUser (_settings->value ("proxyUserName").toString ()); + proxy.setPassword (_settings->value ("proxyPassword").toString ()); QNetworkProxy::setApplicationProxy (proxy); } void -resource_manager::loadIcons () +resource_manager::load_icons () { - m_icons [resource_manager::Octave] = QIcon ("../media/logo.png"); - m_icons [resource_manager::Terminal] = QIcon ("../media/terminal.png"); - m_icons [resource_manager::Documentation] = QIcon ("../media/help_index.png"); - m_icons [resource_manager::Chat] = QIcon ("../media/chat.png"); - m_icons [resource_manager::ChatNewMessage] = QIcon ("../media/jabber_protocol.png"); + _icons [resource_manager::octave] = QIcon ("../media/logo.png"); + _icons [resource_manager::terminal] = QIcon ("../media/terminal.png"); + _icons [resource_manager::documentation] = QIcon ("../media/help_index.png"); + _icons [resource_manager::chat] = QIcon ("../media/chat.png"); + _icons [resource_manager::chat_new_message] = QIcon ("../media/jabber_protocol.png"); } const char* -resource_manager::octaveKeywords () +resource_manager::octave_keywords () { return ".nargin. " diff --git a/gui/src/resource-manager.h b/gui/src/resource-manager.h --- a/gui/src/resource-manager.h +++ b/gui/src/resource-manager.h @@ -26,13 +26,13 @@ class resource_manager { public: - enum Icon + enum icon { - Octave, - Terminal, - Documentation, - Chat, - ChatNewMessage + octave, + terminal, + documentation, + chat, + chat_new_message }; ~resource_manager (); @@ -40,28 +40,28 @@ static resource_manager * instance () { - return &m_singleton; + return &_singleton; } - QSettings *settings (); - QString homePath (); - void reloadSettings (); - void setSettings (QString file); - QString findTranslatorFile (QString language); - void updateNetworkSettings (); - void loadIcons (); - QIcon icon (Icon icon); - bool isFirstRun (); + QSettings *get_settings (); + QString get_home_path (); + void reload_settings (); + void set_settings (QString file); + QString find_translator_file (QString language); + void update_network_settings (); + void load_icons (); + QIcon get_icon (icon i); + bool is_first_run (); + const char *octave_keywords (); - const char *octaveKeywords (); private: resource_manager (); - QSettings *m_settings; - QString m_homePath; - QMap m_icons; - static resource_manager m_singleton; - bool m_firstRun; + QSettings *_settings; + QString _home_path; + QMap _icons; + static resource_manager _singleton; + bool _first_run; }; #endif // RESOURCEMANAGER_H diff --git a/gui/src/settings-dialog.cc b/gui/src/settings-dialog.cc --- a/gui/src/settings-dialog.cc +++ b/gui/src/settings-dialog.cc @@ -21,11 +21,11 @@ #include settings_dialog::settings_dialog (QWidget * parent): -QDialog (parent), ui (new user_interface::settings_dialog) +QDialog (parent), ui (new Ui::settings_dialog) { ui->setupUi (this); - QSettings *settings = resource_manager::instance ()->settings (); + QSettings *settings = resource_manager::instance ()->get_settings (); ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor").toBool ()); ui->customFileEditor->setText (settings->value ("customFileEditor").toString ()); ui->editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers",true).toBool () ); @@ -60,7 +60,7 @@ settings_dialog::~settings_dialog () { - QSettings *settings = resource_manager::instance ()->settings (); + QSettings *settings = resource_manager::instance ()->get_settings (); settings->setValue ("useCustomFileEditor", ui->useCustomFileEditor->isChecked ()); settings->setValue ("customFileEditor", ui->customFileEditor->text ()); settings->setValue ("editor/showLineNumbers", ui->editor_showLineNumbers->isChecked ()); diff --git a/gui/src/settings-dialog.h b/gui/src/settings-dialog.h --- a/gui/src/settings-dialog.h +++ b/gui/src/settings-dialog.h @@ -21,7 +21,7 @@ #include -namespace user_interface +namespace Ui { class settings_dialog; } @@ -33,7 +33,7 @@ ~settings_dialog (); private: - user_interface::settings_dialog * ui; + Ui::settings_dialog * ui; }; #endif // SETTINGSDIALOG_H diff --git a/gui/src/terminal-dockwidget.cc b/gui/src/terminal-dockwidget.cc --- a/gui/src/terminal-dockwidget.cc +++ b/gui/src/terminal-dockwidget.cc @@ -24,5 +24,5 @@ setWindowTitle (tr ("Command Window")); setWidget (terminal); - connect (this, SIGNAL (visibilityChanged (bool)), this, SLOT (handleVisibilityChanged (bool))); + connect (this, SIGNAL (visibilityChanged (bool)), this, SLOT (handle_visibility_changed (bool))); } diff --git a/gui/src/terminal-dockwidget.h b/gui/src/terminal-dockwidget.h --- a/gui/src/terminal-dockwidget.h +++ b/gui/src/terminal-dockwidget.h @@ -28,13 +28,13 @@ terminal_dock_widget (QTerminal *terminal, QWidget *parent = 0); signals: - void activeChanged (bool active); + void active_changed (bool active); public slots: - void handleVisibilityChanged (bool visible) + void handle_visibility_changed (bool visible) { if (visible) - emit activeChanged (true); + emit active_changed (true); } }; diff --git a/gui/src/welcome-wizard.cc b/gui/src/welcome-wizard.cc --- a/gui/src/welcome-wizard.cc +++ b/gui/src/welcome-wizard.cc @@ -20,34 +20,34 @@ welcome_wizard::welcome_wizard (QWidget *parent) : QDialog (parent), - ui (new user_interface::welcome_wizard) + _ui (new Ui::welcome_wizard) { - ui->setupUi (this); - connect (ui->nextButton1, SIGNAL (clicked ()), this, SLOT (next ())); - connect (ui->nextButton2, SIGNAL (clicked ()), this, SLOT (next ())); - connect (ui->nextButton3, SIGNAL (clicked ()), this, SLOT (next ())); - connect (ui->nextButton4, SIGNAL (clicked ()), this, SLOT (next ())); + _ui->setupUi (this); + connect (_ui->nextButton1, SIGNAL (clicked ()), this, SLOT (next ())); + connect (_ui->nextButton2, SIGNAL (clicked ()), this, SLOT (next ())); + connect (_ui->nextButton3, SIGNAL (clicked ()), this, SLOT (next ())); + connect (_ui->nextButton4, SIGNAL (clicked ()), this, SLOT (next ())); - connect (ui->previousButton2, SIGNAL (clicked ()), this, SLOT (previous ())); - connect (ui->previousButton3, SIGNAL (clicked ()), this, SLOT (previous ())); - connect (ui->previousButton4, SIGNAL (clicked ()), this, SLOT (previous ())); - connect (ui->previousButton5, SIGNAL (clicked ()), this, SLOT (previous ())); + connect (_ui->previousButton2, SIGNAL (clicked ()), this, SLOT (previous ())); + connect (_ui->previousButton3, SIGNAL (clicked ()), this, SLOT (previous ())); + connect (_ui->previousButton4, SIGNAL (clicked ()), this, SLOT (previous ())); + connect (_ui->previousButton5, SIGNAL (clicked ()), this, SLOT (previous ())); } welcome_wizard::~welcome_wizard() { - delete ui; + delete _ui; } void welcome_wizard::next () { - ui->stackedWidget->setCurrentIndex (ui->stackedWidget->currentIndex () + 1); + _ui->stackedWidget->setCurrentIndex (_ui->stackedWidget->currentIndex () + 1); } void welcome_wizard::previous () { - ui->stackedWidget->setCurrentIndex (ui->stackedWidget->currentIndex () - 1); + _ui->stackedWidget->setCurrentIndex (_ui->stackedWidget->currentIndex () - 1); } diff --git a/gui/src/welcome-wizard.h b/gui/src/welcome-wizard.h --- a/gui/src/welcome-wizard.h +++ b/gui/src/welcome-wizard.h @@ -20,7 +20,7 @@ #include -namespace user_interface { +namespace Ui { class welcome_wizard; } @@ -37,7 +37,7 @@ void previous (); private: - user_interface::welcome_wizard *ui; + Ui::welcome_wizard *_ui; }; #endif // WELCOMEWIZARD_H diff --git a/gui/src/workspace-model.cc b/gui/src/workspace-model.cc --- a/gui/src/workspace-model.cc +++ b/gui/src/workspace-model.cc @@ -25,7 +25,7 @@ { QList rootData; rootData << tr ("Name") << tr ("Type") << tr ("Value"); - _rootItem = new TreeItem(rootData); + _rootItem = new tree_item(rootData); } workspace_model::~workspace_model() @@ -39,14 +39,14 @@ if (!hasIndex(row, column, parent)) return QModelIndex(); - TreeItem *parentItem; + tree_item *parentItem; if (!parent.isValid()) parentItem = _rootItem; else - parentItem = static_cast(parent.internalPointer()); + parentItem = static_cast(parent.internalPointer()); - TreeItem *childItem = parentItem->child(row); + tree_item *childItem = parentItem->child(row); if (childItem) return createIndex(row, column, childItem); else @@ -59,8 +59,8 @@ if (!index.isValid()) return QModelIndex(); - TreeItem *childItem = static_cast(index.internalPointer()); - TreeItem *parentItem = childItem->parent(); + tree_item *childItem = static_cast(index.internalPointer()); + tree_item *parentItem = childItem->parent(); if (parentItem == _rootItem) return QModelIndex(); @@ -71,35 +71,35 @@ int workspace_model::rowCount(const QModelIndex &parent) const { - TreeItem *parentItem; + tree_item *parentItem; if (parent.column() > 0) return 0; if (!parent.isValid()) parentItem = _rootItem; else - parentItem = static_cast(parent.internalPointer()); + parentItem = static_cast(parent.internalPointer()); - return parentItem->childCount(); + return parentItem->child_count(); } int workspace_model::columnCount(const QModelIndex &parent) const { if (parent.isValid()) - return static_cast(parent.internalPointer())->columnCount(); + return static_cast(parent.internalPointer())->column_count(); else - return _rootItem->columnCount(); + return _rootItem->column_count(); } void -workspace_model::insertTopLevelItem(int at, TreeItem *treeItem) +workspace_model::insert_top_level_item(int at, tree_item *treeItem) { - _rootItem->insertChildItem(at, treeItem); + _rootItem->insert_child_item(at, treeItem); } -TreeItem * -workspace_model::topLevelItem (int at) +tree_item * +workspace_model::top_level_item (int at) { return _rootItem->child(at); } @@ -131,42 +131,42 @@ if (role != Qt::DisplayRole) return QVariant(); - TreeItem *item = static_cast(index.internalPointer()); + tree_item *item = static_cast(index.internalPointer()); return item->data(index.column()); } void -workspace_model::updateFromSymbolTable () +workspace_model::update_from_symbol_table () { - topLevelItem (0)->deleteChildItems (); - topLevelItem (1)->deleteChildItems (); - topLevelItem (2)->deleteChildItems (); - topLevelItem (3)->deleteChildItems (); + top_level_item (0)->delete_child_items (); + top_level_item (1)->delete_child_items (); + top_level_item (2)->delete_child_items (); + top_level_item (3)->delete_child_items (); - octave_link::instance ()-> acquireSymbolInformation(); - const QList & symbolInformation = octave_link::instance() ->symbolInformation (); + octave_link::instance ()-> acquire_symbol_information(); + const QList & symbolInformation = octave_link::instance() ->get_symbol_information (); - foreach (const SymbolInformation& s, symbolInformation) + foreach (const symbol_information& s, symbolInformation) { - TreeItem *child = new TreeItem (); + tree_item *child = new tree_item (); - child->setData (0, s._symbol); - child->setData (1, s._type); - child->setData (2, s._value); + child->set_data (0, s._symbol); + child->set_data (1, s._type); + child->set_data (2, s._value); switch (s._scope) { - case SymbolInformation::Local: topLevelItem (0)->addChild (child); break; - case SymbolInformation::Global: topLevelItem (1)->addChild (child); break; - case SymbolInformation::Persistent: topLevelItem (2)->addChild (child); break; - case SymbolInformation::Hidden: topLevelItem (3)->addChild (child); break; + case symbol_information::local: top_level_item (0)->add_child (child); break; + case symbol_information::global: top_level_item (1)->add_child (child); break; + case symbol_information::persistent: top_level_item (2)->add_child (child); break; + case symbol_information::hidden: top_level_item (3)->add_child (child); break; } } - octave_link::instance ()-> releaseSymbolInformation(); + octave_link::instance ()-> release_symbol_information(); reset(); - emit expandRequest(); + emit expand_request(); } diff --git a/gui/src/workspace-model.h b/gui/src/workspace-model.h --- a/gui/src/workspace-model.h +++ b/gui/src/workspace-model.h @@ -23,83 +23,83 @@ #include #include -class TreeItem +class tree_item { public: - TreeItem(const QList &data, TreeItem *parent = 0) { - _parentItem = parent; - _itemData = data; + tree_item(const QList &data, tree_item *parent = 0) { + _parent_item = parent; + _item_data = data; } - TreeItem(QVariant data = QVariant(), TreeItem *parent = 0) { + tree_item(QVariant data = QVariant(), tree_item *parent = 0) { QList variantList; variantList << data << QVariant() << QVariant(); - _parentItem = parent; - _itemData = variantList; + _parent_item = parent; + _item_data = variantList; } - ~TreeItem() { - qDeleteAll(_childItems); + ~tree_item() { + qDeleteAll(_child_items); } - void insertChildItem(int at, TreeItem *item) { - item->_parentItem = this; - _childItems.insert(at, item); + void insert_child_item(int at, tree_item *item) { + item->_parent_item = this; + _child_items.insert(at, item); } - void addChild(TreeItem *item) { - item->_parentItem = this; - _childItems.append(item); + void add_child(tree_item *item) { + item->_parent_item = this; + _child_items.append(item); } - void deleteChildItems() { - qDeleteAll(_childItems); - _childItems.clear(); + void delete_child_items() { + qDeleteAll(_child_items); + _child_items.clear(); } - void removeChild(TreeItem *item) { - _childItems.removeAll(item); + void remove_child(tree_item *item) { + _child_items.removeAll(item); } QVariant data(int column) const { - return _itemData[column]; + return _item_data[column]; } - void setData(int column, QVariant data) + void set_data(int column, QVariant data) { - _itemData[column] = data; + _item_data[column] = data; } - TreeItem *child(int row) { - return _childItems[row]; + tree_item *child(int row) { + return _child_items[row]; } - int childCount() const { - return _childItems.count(); + int child_count() const { + return _child_items.count(); } - int columnCount() const + int column_count() const { - return _itemData.count(); + return _item_data.count(); } int row() const { - if (_parentItem) - return _parentItem->_childItems.indexOf(const_cast(this)); + if (_parent_item) + return _parent_item->_child_items.indexOf(const_cast(this)); return 0; } - TreeItem *parent() + tree_item *parent() { - return _parentItem; + return _parent_item; } private: - QList _childItems; - QList _itemData; - TreeItem *_parentItem; + QList _child_items; + QList _item_data; + tree_item *_parent_item; }; class workspace_model : public QAbstractItemModel @@ -120,18 +120,18 @@ int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; - void insertTopLevelItem (int at, TreeItem *treeItem); - TreeItem *topLevelItem (int at); + void insert_top_level_item (int at, tree_item *treeItem); + tree_item *top_level_item (int at); public slots: - void updateFromSymbolTable (); + void update_from_symbol_table (); signals: - void expandRequest(); + void expand_request(); private: - TreeItem *_rootItem; + tree_item *_rootItem; }; #endif // WORKSPACEMODEL_H diff --git a/gui/src/workspace-view.cc b/gui/src/workspace-view.cc --- a/gui/src/workspace-view.cc +++ b/gui/src/workspace-view.cc @@ -26,35 +26,35 @@ setObjectName ("WorkspaceView"); setWindowTitle (tr ("Workspace")); - m_workspaceTreeView = new QTreeView (this); - m_workspaceTreeView->setHeaderHidden (false); - m_workspaceTreeView->setAlternatingRowColors (true); - m_workspaceTreeView->setAnimated (true); - m_workspaceTreeView->setModel(octave_link::instance()->workspaceModel()); + _workspace_tree_view = new QTreeView (this); + _workspace_tree_view->setHeaderHidden (false); + _workspace_tree_view->setAlternatingRowColors (true); + _workspace_tree_view->setAnimated (true); + _workspace_tree_view->setModel(octave_link::instance()->get_workspace_model()); setWidget (new QWidget (this)); QVBoxLayout *layout = new QVBoxLayout (); - layout->addWidget (m_workspaceTreeView); + layout->addWidget (_workspace_tree_view); layout->setMargin (2); widget ()->setLayout (layout); connect (this, SIGNAL (visibilityChanged (bool)), - this, SLOT(handleVisibilityChanged (bool))); + this, SLOT(handle_visibility_changed (bool))); - connect (octave_link::instance()->workspaceModel(), SIGNAL(expandRequest()), - m_workspaceTreeView, SLOT(expandAll())); + connect (octave_link::instance()->get_workspace_model(), SIGNAL(expand_request()), + _workspace_tree_view, SLOT(expandAll())); } void -workspace_view::handleVisibilityChanged (bool visible) +workspace_view::handle_visibility_changed (bool visible) { if (visible) - emit activeChanged (true); + emit active_changed (true); } void workspace_view::closeEvent (QCloseEvent *event) { - emit activeChanged (false); + emit active_changed (false); QDockWidget::closeEvent (event); } diff --git a/gui/src/workspace-view.h b/gui/src/workspace-view.h --- a/gui/src/workspace-view.h +++ b/gui/src/workspace-view.h @@ -23,24 +23,24 @@ #include #include "octave-link.h" -class workspace_view:public QDockWidget +class workspace_view : public QDockWidget { Q_OBJECT public: workspace_view (QWidget * parent = 0); public slots: - void handleVisibilityChanged (bool visible); + void handle_visibility_changed (bool visible); signals: /** Custom signal that tells if a user has clicke away that dock widget. */ - void activeChanged (bool active); + void active_changed (bool active); protected: void closeEvent (QCloseEvent *event); private: - QTreeView *m_workspaceTreeView; + QTreeView *_workspace_tree_view; }; #endif // WORKSPACEVIEW_H