Mercurial > octave-nkf
view libgui/src/settings-dialog.ui @ 15848:424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
* file-editor-tab.cc, file-editor-tab.h (file_editor_tab::~file_editor_tab):
Add. Delete lexer to prevent memory leak. Delete _edit_area to prevent memory
leak. (file_editor_tab::conditional_close): Add. Simple slot that uses QWidget
pointer as unique ID, not for function call.
(file_editor_tab::file_name_query): Add. Simple slot that signals file name to
whomever is connected. (file_editor_tab::find,
file_editor_tab : public QWidget): Removed use of exec() and keep a pointer to
the find_dialog as a member. Toggle hide()/show() via a connected slot to
toggle visibility as desired.
* file-editor.cc, file-editor.h, file-editor-tab.cc file-editor-tab.h
(file_editor : public file_editor_interface, file_editor_tab : public QWidget,
file_editor_tab::file_editor_tab, file_editor_tab::closeEvent,
file_editor_tab::load_file, file_editor_tab::new_file,
file_editor_tab::run_file): Remove _file_editor pointer member from
file_editor_tab and rid file_editor::get_main_window from file_editor. There
should be no need for such information about higher-level hierarchy inside
lower-level objects. (file_editor::request_open_file,
file_editor_tab::open_file): Move QFileDialog to file_editor::request_open_file
and delete file_editor_tab::open_file since most of the remaining functionality
is in file_editor_tab::load_file. (file_editor::active_editor_tab): Deleted.
(file_editor::fetab_change_request, file_editor_tab::change_editor_state):
Added to initiate a request for the editor tab to change focus.
(file_editor_tab::editor_state_changed): Added arguments to pass the copy
status and the directory path so that editor doesn't have to call functions for
such information. (file_editor::handle_editor_state_changed): Add copying
directory of the file_editor_tab to the current editing directory.
(file_editor::check_conflict_save, file_editor_tab::editor_check_conflict_save,
file_editor_tab::save_file_as, file_editor_tab::handle_save_file_as_answer):
Moved a portion of the save-file-as dialog mechanism to the file_editor where
all file names can be obtained to check for conflict with already open files.
The new signal indicates to the editor that a name check be done, and in turn
the editor signals the tab to save the file.
* main-window.cc, file-editor.cc, file-editor.h, file-editor-interface.h
(file_editor::terminal, file_editor : public file_editor_interface,
file_editor_interface : public QDockWidget): Since file_editor_tab no longer
looks up to main_window, remove _main_window and _terminal from file_editor and
file_editor_interface, as well as file_editor::terminal.
* file-editor-tab.cc (file_editor_tab::file_has_changed): Make the dialog
boxes non-modal and use slots to handle user answers.
(file_editor_tab::closeEvent): Remove portion that accesses upper hierarchy
member functions, can find better approaches.
(file_editor_tab::file_editor_tab): Make there no parent for QsciScintilla so
that window modality can be set to individual editor.
* file-editor-tab.cc, file-editor.cc (file_editor_tab::load_file): Use show()
member rather than exec() and set modality to window so that rest of
application may function. Return a QString with message rather than a boolean.
* file-editor-tab.cc, (file_editor_tab::file_has_changed): Remove static
variable alreadyAsking. Multiple file_editor_tabs are using this code so do
not want to block recognition of multiple file having changed on disk
(bug #37406). Instead, simply stop tracking via the file watcher.
(file_editor_tab::save_file, file_editor_tab::save_file_as,
file_editor_tab::handle_save_file_as_answer,
file_editor_tab::handle_save_file_as_answer_close): Added a remove_on_success
variable. Changed the QFileDialog to WindowModal and created slots to handle
file selected signal and finished signal. Signal/slot connects vary based upon
remove_on_success setting. (file_editor_tab::check_file_modified): Changed the
QFileDialog to NonModal and attach some slots. Editor tab can't be parent in
case deleted, so use read-only state of the editor area.
* file-editor-tab.h (file_editor_tab : public QWidget): New signals for
file_editor for tab and file name management. (file_editor_tab::get_file_name):
Delete.
* file-editor.h (file_editor : public file_editor_interface): Make QStringList
sessionFileNames a member of file_editor so that it can retain data between
file_editor_tab signals. Also can be used for checking precense of filenames
and prevent opening multiple copies (bug #36869) Added signals for file editor
tabs--settings_changed, fetab_close_request, and query_file_name. Three new
slots for tab and file name management.
* file-editor-interface.h, file-editor.h
(file_editor_interface::add_file_editor_tab, file_editor::add_file_editor_tab):
Made the text name for the tab an input variable.
* file-editor.cc (file_editor::~file_editor): Replace dynamic_cast with simple
signal querying all file editor tabs for file names which end up in
savedSessionTabs. (file_editor::handle_file_name_changed): Dynamic cast not
necessary since QObject and QWidget are compatible.
(file_editor::handle_tab_close_request): Replace dynamic_cast with signal to
request file_editor_tab with associated tabID tag should close.
(file_editor::handle_tab_remove_request): Rename of handle_tab_close_request.
Instead of dynamic cast, loop through pointers comparing QWidget* to QObject*,
if same tag remove tab via index and also delete which fixes a memory leak.
(file_editor::handle_add_filename_to_list): Simple slot that uses append() of
the list member functions. (file_editor::notice_settings): Rather than dynamic
cast, emit signal for the file_editor_tabs. (file_editor::add_file_editor_tab):
New variety of connections for improved flow. (file_editor::request_open_file):
Given error messages are made WindowModal, the tab shouldn't be delete if file
open is not successful. The file_editor_tab takes care of that.
(file_editor::request_open_file): Added check and message box for the
requested file already open in editor. For the non-interactive overloaded
version, open a message dialog box to tell the user file not found, e.g.,
could not find file in the settings when launched.
(file_editor::request_open_file): Inquire file names and update list before
checking for existence of files. Supply empty title to editor tab then have
file_editor_tab update name.
* file-editor-tab.h, file-editor-tab.cc, file-editor.cc
(file_editor_tab::run_file): New signal process_octave_code.
(file_editor::add_file_editor_tab): Connect signal process_octave_code to
file_editor's parent's slot handle_command_double_clicked.
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Sun, 23 Dec 2012 14:33:48 -0600 |
parents | b081fbe80174 |
children | 22ab4fe661d7 |
line wrap: on
line source
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>settings_dialog</class> <widget class="QDialog" name="settings_dialog"> <property name="windowModality"> <enum>Qt::ApplicationModal</enum> </property> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>600</width> <height>400</height> </rect> </property> <property name="minimumSize"> <size> <width>600</width> <height>400</height> </size> </property> <property name="maximumSize"> <size> <width>600</width> <height>400</height> </size> </property> <property name="windowTitle"> <string>Settings</string> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> <number>0</number> </property> <widget class="QWidget" name="tab_4"> <property name="enabled"> <bool>true</bool> </property> <attribute name="title"> <string>General</string> </attribute> <widget class="QGroupBox" name="groupBox"> <property name="geometry"> <rect> <x>10</x> <y>10</y> <width>551</width> <height>81</height> </rect> </property> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="title"> <string>Icon set for dock widget</string> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> </property> <property name="flat"> <bool>false</bool> </property> <property name="checkable"> <bool>false</bool> </property> <widget class="QRadioButton" name="general_icon_octave"> <property name="geometry"> <rect> <x>0</x> <y>20</y> <width>151</width> <height>21</height> </rect> </property> <property name="text"> <string>Octave logo only</string> </property> <property name="checked"> <bool>true</bool> </property> </widget> <widget class="QRadioButton" name="general_icon_letter"> <property name="geometry"> <rect> <x>0</x> <y>40</y> <width>151</width> <height>21</height> </rect> </property> <property name="text"> <string>Letter icons</string> </property> </widget> <widget class="QRadioButton" name="general_icon_graphic"> <property name="geometry"> <rect> <x>0</x> <y>60</y> <width>151</width> <height>21</height> </rect> </property> <property name="text"> <string>Graphic icons</string> </property> </widget> </widget> </widget> <widget class="QWidget" name="tab"> <attribute name="title"> <string>Editor</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_6"> <item> <layout class="QVBoxLayout" name="verticalLayout_5"> <item> <layout class="QHBoxLayout" name="horizontalLayout_4"> <item> <widget class="QLabel" name="label_8"> <property name="text"> <string>Font</string> </property> </widget> </item> <item> <widget class="QFontComboBox" name="editor_fontName"> <property name="editable"> <bool>false</bool> </property> <property name="fontFilters"> <set>QFontComboBox::MonospacedFonts</set> </property> </widget> </item> <item> <widget class="QLabel" name="label_9"> <property name="text"> <string>Font Size</string> </property> </widget> </item> <item> <widget class="QSpinBox" name="editor_fontSize"> <property name="minimum"> <number>2</number> </property> <property name="maximum"> <number>96</number> </property> <property name="value"> <number>10</number> </property> </widget> </item> <item> <spacer name="horizontalSpacer_4"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>40</width> <height>20</height> </size> </property> </spacer> </item> </layout> </item> <item> <widget class="QCheckBox" name="editor_showLineNumbers"> <property name="enabled"> <bool>true</bool> </property> <property name="text"> <string>Show line numbers</string> </property> </widget> </item> <item> <widget class="QCheckBox" name="editor_highlightCurrentLine"> <property name="enabled"> <bool>true</bool> </property> <property name="text"> <string>Highlight current line</string> </property> </widget> </item> <item> <widget class="QCheckBox" name="editor_codeCompletion"> <property name="enabled"> <bool>true</bool> </property> <property name="text"> <string>Code completion</string> </property> <property name="checked"> <bool>false</bool> </property> </widget> </item> <item> <widget class="QCheckBox" name="editor_longWindowTitle"> <property name="text"> <string>Show complete path in window title</string> </property> </widget> </item> <item> <widget class="QCheckBox" name="editor_restoreSession"> <property name="text"> <string>Restore tabs from previous session on startup</string> </property> </widget> </item> </layout> </item> <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>40</height> </size> </property> </spacer> </item> <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QCheckBox" name="useCustomFileEditor"> <property name="enabled"> <bool>true</bool> </property> <property name="text"> <string>Use custom file editor:</string> </property> </widget> </item> <item> <widget class="QLineEdit" name="customFileEditor"> <property name="enabled"> <bool>false</bool> </property> <property name="text"> <string>emacs</string> </property> </widget> </item> </layout> </item> </layout> </widget> <widget class="QWidget" name="tab_5"> <attribute name="title"> <string>Terminal</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout"> <item> <layout class="QHBoxLayout" name="horizontalLayout_5"> <item> <widget class="QLabel" name="label_11"> <property name="text"> <string>Font</string> </property> </widget> </item> <item> <widget class="QFontComboBox" name="terminal_fontName"> <property name="editable"> <bool>false</bool> </property> <property name="fontFilters"> <set>QFontComboBox::MonospacedFonts</set> </property> </widget> </item> <item> <widget class="QLabel" name="label_12"> <property name="text"> <string>Font Size</string> </property> </widget> </item> <item> <widget class="QSpinBox" name="terminal_fontSize"> <property name="minimum"> <number>2</number> </property> <property name="maximum"> <number>96</number> </property> <property name="value"> <number>10</number> </property> </widget> </item> <item> <spacer name="horizontalSpacer_5"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>40</width> <height>20</height> </size> </property> </spacer> </item> </layout> </item> <item> <layout class="QHBoxLayout" name="horizontalLayout_3"> <item> <widget class="QLabel" name="label"> <property name="text"> <string>Cursor type:</string> </property> </widget> </item> <item> <widget class="QComboBox" name="terminal_cursorType"/> </item> <item> <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>40</width> <height>20</height> </size> </property> </spacer> </item> </layout> </item> <item> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <widget class="QCheckBox" name="terminal_cursorBlinking"> <property name="text"> <string>Cursor blinking</string> </property> </widget> </item> <item> <spacer name="horizontalSpacer_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>40</width> <height>20</height> </size> </property> </spacer> </item> </layout> </item> <item> <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>321</height> </size> </property> </spacer> </item> </layout> </widget> <widget class="QWidget" name="tab_2"> <attribute name="title"> <string>File Browser</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_3"> <item> <widget class="QCheckBox" name="showFilenames"> <property name="text"> <string>Show filenames</string> </property> </widget> </item> <item> <widget class="QCheckBox" name="showFileSize"> <property name="text"> <string>Show file size</string> </property> </widget> </item> <item> <widget class="QCheckBox" name="showFileType"> <property name="text"> <string>Show file type</string> </property> </widget> </item> <item> <widget class="QCheckBox" name="showLastModified"> <property name="text"> <string>Show date of last modification</string> </property> </widget> </item> <item> <widget class="QCheckBox" name="showHiddenFiles"> <property name="text"> <string>Show hidden files</string> </property> </widget> </item> <item> <widget class="QCheckBox" name="useAlternatingRowColors"> <property name="text"> <string>Alternating row colors</string> </property> </widget> </item> <item> <spacer name="verticalSpacer_2"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>360</height> </size> </property> </spacer> </item> </layout> </widget> <widget class="QWidget" name="tab_3"> <attribute name="title"> <string>Network</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_4"> <item> <widget class="QCheckBox" name="useProxyServer"> <property name="text"> <string>Use proxy server</string> </property> </widget> </item> <item> <layout class="QFormLayout" name="formLayout"> <item row="0" column="0"> <widget class="QLabel" name="label_3"> <property name="enabled"> <bool>false</bool> </property> <property name="text"> <string>Proxy Type:</string> </property> </widget> </item> <item row="0" column="1"> <widget class="QComboBox" name="proxyType"> <property name="enabled"> <bool>false</bool> </property> <item> <property name="text"> <string>HttpProxy</string> </property> </item> <item> <property name="text"> <string>Socks5Proxy</string> </property> </item> </widget> </item> <item row="1" column="0"> <widget class="QLabel" name="label_4"> <property name="enabled"> <bool>false</bool> </property> <property name="text"> <string>Hostname:</string> </property> </widget> </item> <item row="1" column="1"> <widget class="QLineEdit" name="proxyHostName"> <property name="enabled"> <bool>false</bool> </property> </widget> </item> <item row="2" column="0"> <widget class="QLabel" name="label_5"> <property name="enabled"> <bool>false</bool> </property> <property name="text"> <string>Port:</string> </property> </widget> </item> <item row="2" column="1"> <widget class="QLineEdit" name="proxyPort"> <property name="enabled"> <bool>false</bool> </property> </widget> </item> <item row="3" column="0"> <widget class="QLabel" name="label_6"> <property name="enabled"> <bool>false</bool> </property> <property name="text"> <string>Username:</string> </property> </widget> </item> <item row="3" column="1"> <widget class="QLineEdit" name="proxyUserName"> <property name="enabled"> <bool>false</bool> </property> </widget> </item> <item row="4" column="0"> <widget class="QLabel" name="label_7"> <property name="enabled"> <bool>false</bool> </property> <property name="text"> <string>Password:</string> </property> </widget> </item> <item row="4" column="1"> <widget class="QLineEdit" name="proxyPassword"> <property name="enabled"> <bool>false</bool> </property> <property name="echoMode"> <enum>QLineEdit::Password</enum> </property> </widget> </item> </layout> </item> </layout> </widget> </widget> </item> <item> <widget class="QDialogButtonBox" name="buttonBox"> <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> </widget> </item> </layout> </widget> <resources/> <connections> <connection> <sender>useProxyServer</sender> <signal>toggled(bool)</signal> <receiver>label_4</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>249</x> <y>59</y> </hint> <hint type="destinationlabel"> <x>69</x> <y>122</y> </hint> </hints> </connection> <connection> <sender>useProxyServer</sender> <signal>toggled(bool)</signal> <receiver>label_3</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>249</x> <y>59</y> </hint> <hint type="destinationlabel"> <x>59</x> <y>91</y> </hint> </hints> </connection> <connection> <sender>useProxyServer</sender> <signal>toggled(bool)</signal> <receiver>label_5</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>249</x> <y>59</y> </hint> <hint type="destinationlabel"> <x>44</x> <y>152</y> </hint> </hints> </connection> <connection> <sender>useProxyServer</sender> <signal>toggled(bool)</signal> <receiver>proxyType</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>249</x> <y>59</y> </hint> <hint type="destinationlabel"> <x>291</x> <y>91</y> </hint> </hints> </connection> <connection> <sender>useProxyServer</sender> <signal>toggled(bool)</signal> <receiver>proxyHostName</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>249</x> <y>59</y> </hint> <hint type="destinationlabel"> <x>291</x> <y>124</y> </hint> </hints> </connection> <connection> <sender>useProxyServer</sender> <signal>toggled(bool)</signal> <receiver>proxyPort</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>249</x> <y>59</y> </hint> <hint type="destinationlabel"> <x>364</x> <y>154</y> </hint> </hints> </connection> <connection> <sender>useCustomFileEditor</sender> <signal>toggled(bool)</signal> <receiver>customFileEditor</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>111</x> <y>62</y> </hint> <hint type="destinationlabel"> <x>343</x> <y>63</y> </hint> </hints> </connection> <connection> <sender>useProxyServer</sender> <signal>toggled(bool)</signal> <receiver>label_7</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>249</x> <y>59</y> </hint> <hint type="destinationlabel"> <x>67</x> <y>212</y> </hint> </hints> </connection> <connection> <sender>useProxyServer</sender> <signal>toggled(bool)</signal> <receiver>proxyUserName</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>249</x> <y>59</y> </hint> <hint type="destinationlabel"> <x>364</x> <y>184</y> </hint> </hints> </connection> <connection> <sender>useProxyServer</sender> <signal>toggled(bool)</signal> <receiver>proxyPassword</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>249</x> <y>59</y> </hint> <hint type="destinationlabel"> <x>364</x> <y>214</y> </hint> </hints> </connection> <connection> <sender>useProxyServer</sender> <signal>toggled(bool)</signal> <receiver>label_6</receiver> <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>249</x> <y>59</y> </hint> <hint type="destinationlabel"> <x>68</x> <y>182</y> </hint> </hints> </connection> <connection> <sender>buttonBox</sender> <signal>accepted()</signal> <receiver>settings_dialog</receiver> <slot>accept()</slot> <hints> <hint type="sourcelabel"> <x>299</x> <y>366</y> </hint> <hint type="destinationlabel"> <x>299</x> <y>199</y> </hint> </hints> </connection> <connection> <sender>buttonBox</sender> <signal>rejected()</signal> <receiver>settings_dialog</receiver> <slot>reject()</slot> <hints> <hint type="sourcelabel"> <x>299</x> <y>366</y> </hint> <hint type="destinationlabel"> <x>299</x> <y>199</y> </hint> </hints> </connection> </connections> </ui>