rtVTK  0.6.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Slots | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | Static Private Attributes
rtVTK::TimerDialog Class Reference

Connect timers to slot invocations. More...

List of all members.

Public Slots

void slotPauseTimers ()
void slotUnpauseTimers ()

Signals

void sgnlDisableIdle ()
void sgnlRestoreIdle ()
void sgnlPauseTimers ()
void sgnlUnpauseTimers ()

Public Member Functions

 TimerDialog (const vector< Plugin * > &, set< QKeySequence > &, QWidget *=0)
 ~TimerDialog ()
void populate ()

Private Slots

void slotAddTimer ()
void slotRemoveTimer ()
void slotDifferentTimerHasRecievedFocus ()
void slotTimerSettingsHaveBeenModifed ()
void slotTimerSaveSettings ()
void slotHideSuccessfulCreateTimer ()

Private Member Functions

void showEvent (QShowEvent *)
void closeEvent (QCloseEvent *)
void addSlotList (uint, Plugin *)
void removeTabs ()
void humanReadableFcn (string &)
void machineReadableFcn (string &)
void disableEditRemoveUI ()

Private Attributes

Ui::TimerDialog * ui
vector< QListWidget * > listWidgets
map< QListWidget *, uint > pluginIdx
const vector< Plugin * > & plugins
set< QKeySequence > & usedShortcutKeyCombos
vector< Timer * > timers

Static Private Attributes

static const QString EmptyMessage = tr("(None)")

Detailed Description

Connect timers to slot invocations.

TimerDialog presents a dialog box in which the user can create timers whose timeout() signal is connected to a slot in MainWindow or one of the active plugins.
Available slots are those slots whose signature is of the form slot<FunctionName>(). In other words, slots whose names begin with 'slot' and which accept no arguments (i.e. void functions) are made available for timer connections by TimerDialog.
The user creates a new timer by selecting the interval between timeouts, the slot to which the timer will be connected, whether the timer should be activated immediately when the dialog is closed, and optionally a keyboard shortcut for toggling the timer on and off. The user adds a timer each time the Create Timer button is clicked.
In the Edit/Remove Timer tab, the user may edit the settings of a timer or remove it.


Constructor & Destructor Documentation

rtVTK::TimerDialog::TimerDialog ( const vector< Plugin * > &  plugins_,
set< QKeySequence > &  shortcutKeyCombos_,
QWidget *  parent = 0 
) [explicit]

The constructor for TimerDialog populates the modifier combo box and makes connections between button signals and relevant slots.

Parameters:
plugins_:vector<Plugin*>& - a reference to the collection of active plugins for which TimerDialog will populate tabs.
shortcutKeyCombos_:set<QKeySequence>& - a reference to the the collection of already taken unique key shortcuts.
parent: QWidget* = 0 - the parent of TimerDialog.

References listWidgets, pluginIdx, slotAddTimer(), slotDifferentTimerHasRecievedFocus(), slotRemoveTimer(), slotTimerSaveSettings(), slotTimerSettingsHaveBeenModifed(), and ui.

Destroys the heap-allocated objects owned by TimerDialog. This includes all timers that the user has created.

References listWidgets, timers, and ui.


Member Function Documentation

void rtVTK::TimerDialog::addSlotList ( uint  pidx,
Plugin pl 
) [private]

Searches for no-argument functions whose names begin with 'slot' within a given plugin class. A tab is populated with these slots so that they may be connected to timer signals.

Parameters:
pl: Plugin* - A pointer to a plugin object. Note that the plugin class referred to by this pointer must inherit QObject in order for tab population to be possible.
Author:
QuigleyEJ1?

References humanReadableFcn(), listWidgets, rtVTK::Plugin::name, pluginIdx, rtVTK::Plugin::ptr, and ui.

Referenced by populate().

void rtVTK::TimerDialog::closeEvent ( QCloseEvent *  e) [private]

Invokes QDialog::closeEvent(), then activates all timers that have the Enabled option checked. Calls removeTabs().
Emits sgnlRestoreIdle()

Parameters:
e: QCloseEvent* - event to be passed to the base class function implementation.

References removeTabs(), sgnlRestoreIdle(), slotUnpauseTimers(), and ui.

Disables any ui that is associated with editing timers. Prevents users from editing before selecting a timer from the list of current existing timers.

Author:
ClaudyAJ1

References ui.

Referenced by showEvent(), slotRemoveTimer(), and slotTimerSaveSettings().

void rtVTK::TimerDialog::humanReadableFcn ( string &  str) [private]

Given a function name of the form "slotFunctionName()", changes the name to the form "Function Name".

Parameters:
str: string& - reference to the function name. After this function has returned, this string will contain the modified version of the given function name. Passing a non-slot string to this function might cause some interesting and likely ugly results.
Bug:
XXX(cpg) - shouldn't happen, so punt on error handling...

Referenced by addSlotList(), and populate().

void rtVTK::TimerDialog::machineReadableFcn ( string &  str) [private]

Given a function name of the form "Function Name", changes the name to the form "slotFunctionName()".

Parameters:
str: string& - reference to a modified slot name. After this function has returned, this string will contain the actual name of the slot.

Referenced by slotAddTimer().

This function is responsible for performing setup operations. Populates a tab on the ui form that contains names corresponding to MainWindow's slots (specifically, slots whose names begin with 'slot' and which take no arguments).
Additionally, a new tab is added and similarly populated for all active plugins. The Remove tab is populated with identifiers corresponding to timers that already exist.
This functions calls TimerDialog::show() after populating the lists.

References addSlotList(), EmptyMessage, humanReadableFcn(), listWidgets, plugins, timers, and ui.

Referenced by rtVTK::MainWindow::slotShowTimerDialog().

void rtVTK::TimerDialog::removeTabs ( ) [private]

Removes tabs for plugin slots. These tabs are created each time the TimerDialog window is shown, and are destroyed in reverse order each time it is closed. Last in, first out.

References listWidgets, and ui.

Referenced by closeEvent().

Referenced by showEvent().

Referenced by closeEvent().

void rtVTK::TimerDialog::showEvent ( QShowEvent *  e) [private]

Emits sgnlDisableIdle before invoking QDialog::showEvent(). Disables much of the Edit/Remove tab.

Parameters:
e:QShowEvent* - event to be passed to the base class function implementation.

References disableEditRemoveUI(), sgnlDisableIdle(), and slotPauseTimers().

void rtVTK::TimerDialog::slotAddTimer ( ) [private, slot]

This function creates a new Timer object according to the user's specifications. It is called when the user clicks the Create Timer button. Connects a timer to its designated slot and sets a shortcut if the user has specified one.

Author:
QuigleyEJ1
ClaudyAJ1
Bug:
XXX(ejq) - the following access to plugins is dangerous

References EmptyMessage, rtVTK::Timer::enabled, listWidgets, machineReadableFcn(), rtVTK::Plugin::name, pluginIdx, plugins, rtVTK::Plugin::ptr, slotHideSuccessfulCreateTimer(), timers, ui, and usedShortcutKeyCombos.

Referenced by TimerDialog().

Enables the ui so that the user can edit a timer. Only call this slot when the user has clicked on a valid existing timer.

Author:
ClaudyAJ1

References EmptyMessage, timers, and ui.

Referenced by TimerDialog().

A slot for catching the single shot timer which is begun at the creation of a timer. Removes the label announcing success after a short amount of time has elapsed.

References ui.

Referenced by slotAddTimer().

Pause all timers from running.

References timers.

Referenced by showEvent().

void rtVTK::TimerDialog::slotRemoveTimer ( ) [private, slot]

Deletes all timers that are currently selected in lwRemove list widget.

References disableEditRemoveUI(), EmptyMessage, timers, ui, and usedShortcutKeyCombos.

Referenced by TimerDialog().

To save a timer's new settings, the following steps must be completed:

  1. Get the row of the timer being saved.
  2. Save the time interval.
  3. Determine the new shortcut.
  4. Save the shortcut if valid letter combination and if unique.
  5. Remove the shortcut if left blank.
  6. Set the enabled status of the timer equal to the checkbox.
  7. Set the save button to disabled.
  8. Hide the lbl_HeyNowYouGottaSave message.
    Author:
    ClaudyAJ1

References disableEditRemoveUI(), timers, ui, and usedShortcutKeyCombos.

Referenced by TimerDialog().

Allows the user to save changes to the timer if they so choose. This slot should only be called when a timer setting value is changed via the QWidgets on Edit/Remove tab. This slot is not responsible for actually saving the settings. It only enables the ability to save.

Author:
ClaudyAJ1

References ui.

Referenced by TimerDialog().

Start timers which are enabled. Stop timers that are not enabled.

References timers.

Referenced by closeEvent().


Member Data Documentation

const QString rtVTK::TimerDialog::EmptyMessage = tr("(None)") [static, private]

A default message to be displayed in the Remove tab when there are no timers to be removed.

Referenced by populate(), slotAddTimer(), slotDifferentTimerHasRecievedFocus(), and slotRemoveTimer().

vector<QListWidget*> rtVTK::TimerDialog::listWidgets [private]

Each tab on lw_CurrentTimersList is a listWidget. lw_CurrentTimersList can only display one list widget at a time. This vector holds the pointers for all of the lists of slots for each Plugin (and MainWindow at index 0) so that when a different tab index of lw_CurrentTimersList is requested, lw_CurrentTimersList can simply fetch a list from this vector.

Referenced by addSlotList(), populate(), removeTabs(), slotAddTimer(), TimerDialog(), and ~TimerDialog().

map<QListWidget*, uint> rtVTK::TimerDialog::pluginIdx [private]
const vector<Plugin*>& rtVTK::TimerDialog::plugins [private]

This const reference to a vector of Plugin* is bound to MainWindow's plugin pipeline order. The names of slots are extracted from the active plugins and displayed in tabs. Timers may be connected to these slots.

Referenced by populate(), and slotAddTimer().

vector<Timer*> rtVTK::TimerDialog::timers [private]

Aggregates timers created by the user, as well as information relevant to those timers.

Referenced by populate(), slotAddTimer(), slotDifferentTimerHasRecievedFocus(), slotPauseTimers(), slotRemoveTimer(), slotTimerSaveSettings(), slotUnpauseTimers(), and ~TimerDialog().

Ui::TimerDialog* rtVTK::TimerDialog::ui [private]
set<QKeySequence>& rtVTK::TimerDialog::usedShortcutKeyCombos [private]

This is a reference to MainWindow's shortcut key combo list. This list is used for checking that an about-to-be shortcut is unique.

Referenced by slotAddTimer(), slotRemoveTimer(), and slotTimerSaveSettings().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends