Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
PreferencesDialog Class Reference

The PreferencesDialog class. More...

#include <preferencesdialog.h>

Inheritance diagram for PreferencesDialog:

Public Member Functions

 PreferencesDialog (QWidget *parent=nullptr)
 PreferencesDialog Constructor. More...
 

Private Slots

virtual void accept () override
 Override of accept to save preferences to Config. More...
 
void reset_default_shortcut ()
 Reset all selected shortcuts in keyboard_tree to their defaults. More...
 
void reset_all_shortcuts ()
 Reset all shortcuts indiscriminately to their defaults. More...
 
bool refine_shortcut_list (const QString &s, QTreeWidgetItem *parent=nullptr)
 Shows/hides shortcut entries according to a shortcut query. More...
 
void load_shortcut_file ()
 Show a file dialog to load an external shortcut preset from file. More...
 
void save_shortcut_file ()
 Show a file dialog to save an external shortcut preset from file. More...
 
void browse_css_file ()
 Show a file dialog to browse for an external CSS file to load for styling the application. More...
 
void delete_all_previews ()
 Delete all previews (waveform and thumbnail cache) More...
 
void edit_default_sequence_settings ()
 Shows a NewSequenceDialog attached to default_sequence. More...
 

Private Member Functions

void setup_ui ()
 Create and arrange all UI widgets. More...
 
void setup_kbd_shortcuts (QMenuBar *menu)
 Populate keyboard shortcut panel with keyboard shortcuts from the menu bar. More...
 
void setup_kbd_shortcut_worker (QMenu *menu, QTreeWidgetItem *parent)
 Internal function called by setup_kbd_shortcuts() to traverse down the menu bar's hierarchy and populate the shortcut panel. More...
 
void delete_previews (char type)
 Delete disk cached preview files (thumbnails, waveforms, etc.) More...
 
void AddBoolPair (QCheckBox *ui, bool *value, bool restart_required=false)
 Add an automated QCheckBox+boolean value pair. More...
 

Private Attributes

QLineEdit * custom_css_fn
 UI widget for editing the CSS filename. More...
 
QLineEdit * imgSeqFormatEdit
 UI widget for editing the list of extensions to detect image sequences from. More...
 
QComboBox * recordingComboBox
 UI widget for editing the recording channels. More...
 
QTreeWidget * keyboard_tree
 UI widget for editing keyboard shortcuts. More...
 
QDoubleSpinBox * upcoming_queue_spinbox
 UI widget for editing the upcoming queue size. More...
 
QComboBox * upcoming_queue_type
 UI widget for editing the upcoming queue type. More...
 
QDoubleSpinBox * previous_queue_spinbox
 UI widget for editing the previous queue size. More...
 
QComboBox * previous_queue_type
 UI widget for editing the previous queue type. More...
 
QSpinBox * effect_textbox_lines_field
 UI widget for editing the size of textboxes in the EffectControls panel. More...
 
QComboBox * audio_output_devices
 UI widget for selecting the output audio device. More...
 
QComboBox * audio_input_devices
 UI widget for selecting the input audio device. More...
 
QComboBox * audio_sample_rate
 UI widget for selecting the audio sampling rates. More...
 
QComboBox * language_combobox
 UI widget for selecting the UI language. More...
 
QSpinBox * thumbnail_res_spinbox
 UI widget for selecting the resolution of the thumbnails to generate. More...
 
QSpinBox * waveform_res_spinbox
 UI widget for selecting the resolution of the waveforms to generate. More...
 
QComboBox * ui_style
 UI widget for selecting the current UI style. More...
 
Sequence default_sequence
 Stored default Sequence object. More...
 
QVector< QAction * > key_shortcut_actions
 List of keyboard shortcut actions that can be triggered (links with key_shortcut_items and key_shortcut_fields) More...
 
QVector< QTreeWidgetItem * > key_shortcut_items
 List of keyboard shortcut items in keyboard_tree corresponding to existing actions (links with key_shortcut_actions and key_shortcut_fields) More...
 
QVector< KeySequenceEditor * > key_shortcut_fields
 List of keyboard shortcut editing fields in keyboard_tree corresponding to existing actions (links with key_shortcut_actions and key_shortcut_fields) More...
 
QVector< QCheckBox * > bool_ui
 Internal array managed by AddBoolPair(). Do not access this directly. More...
 
QVector< bool * > bool_value
 Internal array managed by AddBoolPair(). Do not access this directly. More...
 
QVector< bool > bool_restart_required
 Internal array managed by AddBoolPair(). Do not access this directly. More...
 

Detailed Description

The PreferencesDialog class.

A dialog for the global application settings. Mostly an interface for Config. Can be loaded from any part of the application.

Constructor & Destructor Documentation

PreferencesDialog::PreferencesDialog ( QWidget *  parent = nullptr)
explicit

PreferencesDialog Constructor.

Parameters
parentQWidget parent. Usually MainWindow.

Member Function Documentation

void PreferencesDialog::accept ( )
overrideprivatevirtualslot

Override of accept to save preferences to Config.

void PreferencesDialog::AddBoolPair ( QCheckBox *  ui,
bool *  value,
bool  restart_required = false 
)
private

Add an automated QCheckBox+boolean value pair.

Many preferences are simple true/false (or on/off) options. Rather than adding a QCheckBox for each one and manually setting its checked value to the configuration setting (and vice versa when saving), this convenience function will add it to an automated set of checkboxes, automatically setting the checked state to the current setting, and then saving the new checked state back to the setting when the user accepts the changes (clicks OK).

Parameters
uiA valid QCheckBox item. This function does not take ownership of the QWidget or place it in a layout anywhere.
valueA pointer to the Boolean value this QCheckBox should be shared with. The QCheckBox widget's checked state will be set to the value of this pointer.
restart_requiredDefaults to FALSE, set this to TRUE if changing this setting should prompt the user for a restart of Olive before the setting change takes effect.
void PreferencesDialog::browse_css_file ( )
privateslot

Show a file dialog to browse for an external CSS file to load for styling the application.

void PreferencesDialog::delete_all_previews ( )
privateslot

Delete all previews (waveform and thumbnail cache)

void PreferencesDialog::delete_previews ( char  type)
private

Delete disk cached preview files (thumbnails, waveforms, etc.)

Parameters
typeThe types of previews to
void PreferencesDialog::edit_default_sequence_settings ( )
privateslot

Shows a NewSequenceDialog attached to default_sequence.

void PreferencesDialog::load_shortcut_file ( )
privateslot

Show a file dialog to load an external shortcut preset from file.

bool PreferencesDialog::refine_shortcut_list ( const QString &  s,
QTreeWidgetItem *  parent = nullptr 
)
privateslot

Shows/hides shortcut entries according to a shortcut query.

This function can be directly connected to QLineEdit::textChanged() for simplicity.

Parameters
sThe search query to compare shortcut names to.
parentThis is used as the function calls itself recursively to traverse the menu item hierarchy. This should be left as nullptr when called externally.
Returns

Value used as function calls itself recursively to determine if a menu parent has any children that are not hidden. If so, TRUE is returned so the parent is shown too (even if it doesn't match the search query). If not, FALSE is returned so the parent is hidden.

void PreferencesDialog::reset_all_shortcuts ( )
privateslot

Reset all shortcuts indiscriminately to their defaults.

This is safe to call directly as it'll ask the user if they wish to do so before it resets.

void PreferencesDialog::reset_default_shortcut ( )
privateslot

Reset all selected shortcuts in keyboard_tree to their defaults.

void PreferencesDialog::save_shortcut_file ( )
privateslot

Show a file dialog to save an external shortcut preset from file.

void PreferencesDialog::setup_kbd_shortcut_worker ( QMenu *  menu,
QTreeWidgetItem *  parent 
)
private

Internal function called by setup_kbd_shortcuts() to traverse down the menu bar's hierarchy and populate the shortcut panel.

This function will call itself recursively as it finds submenus belong to the menu provided. It will also create QTreeWidgetItems as children of the parent item provided, either using them as parents themselves for submenus or attaching a KeySequenceEditor to them for shortcut editing.

Parameters
menuThe current menu to traverse down.
parentThe parent item to add QTreeWidgetItems to.
void PreferencesDialog::setup_kbd_shortcuts ( QMenuBar *  menu)
private

Populate keyboard shortcut panel with keyboard shortcuts from the menu bar.

Parameters
menuA reference to the main application's menu bar. Usually MainWindow::menuBar().
void PreferencesDialog::setup_ui ( )
private

Create and arrange all UI widgets.

Member Data Documentation

QComboBox* PreferencesDialog::audio_input_devices
private

UI widget for selecting the input audio device.

QComboBox* PreferencesDialog::audio_output_devices
private

UI widget for selecting the output audio device.

QComboBox* PreferencesDialog::audio_sample_rate
private

UI widget for selecting the audio sampling rates.

QVector<bool> PreferencesDialog::bool_restart_required
private

Internal array managed by AddBoolPair(). Do not access this directly.

QVector<QCheckBox*> PreferencesDialog::bool_ui
private

Internal array managed by AddBoolPair(). Do not access this directly.

QVector<bool*> PreferencesDialog::bool_value
private

Internal array managed by AddBoolPair(). Do not access this directly.

QLineEdit* PreferencesDialog::custom_css_fn
private

UI widget for editing the CSS filename.

Sequence PreferencesDialog::default_sequence
private

Stored default Sequence object.

Default Sequence settings are loaded into an actual Sequence object that can be loaded into NewSequenceDialog for the sake of familiarity with the user.

QSpinBox* PreferencesDialog::effect_textbox_lines_field
private

UI widget for editing the size of textboxes in the EffectControls panel.

QLineEdit* PreferencesDialog::imgSeqFormatEdit
private

UI widget for editing the list of extensions to detect image sequences from.

QVector<QAction*> PreferencesDialog::key_shortcut_actions
private

List of keyboard shortcut actions that can be triggered (links with key_shortcut_items and key_shortcut_fields)

QVector<KeySequenceEditor*> PreferencesDialog::key_shortcut_fields
private

List of keyboard shortcut editing fields in keyboard_tree corresponding to existing actions (links with key_shortcut_actions and key_shortcut_fields)

QVector<QTreeWidgetItem*> PreferencesDialog::key_shortcut_items
private

List of keyboard shortcut items in keyboard_tree corresponding to existing actions (links with key_shortcut_actions and key_shortcut_fields)

QTreeWidget* PreferencesDialog::keyboard_tree
private

UI widget for editing keyboard shortcuts.

QComboBox* PreferencesDialog::language_combobox
private

UI widget for selecting the UI language.

QDoubleSpinBox* PreferencesDialog::previous_queue_spinbox
private

UI widget for editing the previous queue size.

QComboBox* PreferencesDialog::previous_queue_type
private

UI widget for editing the previous queue type.

QComboBox* PreferencesDialog::recordingComboBox
private

UI widget for editing the recording channels.

QSpinBox* PreferencesDialog::thumbnail_res_spinbox
private

UI widget for selecting the resolution of the thumbnails to generate.

QComboBox* PreferencesDialog::ui_style
private

UI widget for selecting the current UI style.

QDoubleSpinBox* PreferencesDialog::upcoming_queue_spinbox
private

UI widget for editing the upcoming queue size.

QComboBox* PreferencesDialog::upcoming_queue_type
private

UI widget for editing the upcoming queue type.

QSpinBox* PreferencesDialog::waveform_res_spinbox
private

UI widget for selecting the resolution of the waveforms to generate.


The documentation for this class was generated from the following files: