stationlistWidget Class Reference

A widget which provides a full-featured table view showing the streams. More...

#include <stationlistwidget.h>

List of all members.

Public Slots

void addNewStation ()
void deleteStation ()
void displayStreamSettings ()
void record ()
void saveAllColumnSizes ()
void stopRecord ()

Signals

void multipleSelected (bool value)
void noneSelected (bool value)
void oneSelected (bool value)

Public Member Functions

 stationlistWidget (QWidget *parent=0, QPointer< QWidget > mainWindow=0)
virtual ~stationlistWidget ()
virtual bool queryClose ()
virtual void readProperties (const KConfigGroup &m_configGroup)
virtual void saveProperties (KConfigGroup &m_configGroup)
QPointer< stationlistModelstationlistmodel ()

Public Attributes

KMenu contextMenu

Protected Slots

virtual void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected)

Protected Member Functions

virtual void contextMenuEvent (QContextMenuEvent *e)

Private Slots

void saveColumnSize (int column)

Private Attributes

QPointer< stationlistModelm_stationlistModel


Detailed Description

A widget which provides a full-featured table view showing the streams.

This class inherits QTableView. It provides a QTableView (with nicer default values than the original) and constructs by default a stationlistModel object that is used as model.

It provides a context menu. This context menu must be set up manually. See contextMenu.

Furthermore this class provides a number of slots, which can also be used to control the streams. You can, for example, connect KActions to this slots.

So this class handels mainly everthing that has to do with selection of rows (=streams). For all the rest, it relies on stationlistModel.

Warning:
You have to call saveAllColumnSizes() when the application is about to close. See the documentation of the function for details.

Never change the model of this view!

Make sure that you have only one object of this class at the same time.

Definition at line 49 of file stationlistwidget.h.


Constructor & Destructor Documentation

stationlistWidget::stationlistWidget ( QWidget *  parent = 0,
QPointer< QWidget >  mainWindow = 0 
) [explicit]

The constructor.

Parameters:
parent The parent widget for this widget. (We can't use QPointer<QWidget> instead of QWidget * because this way we couldn't pass the argument to QTableView::QTableView().)
mainWindow Pass the mainwindow of the application here. To this window, all settings dialogs will be centered.

Definition at line 31 of file stationlistwidget.cpp.

References stationlistModel::columnVisibility, stationlistModel::columnWidth, m_stationlistModel, and saveColumnSize().

stationlistWidget::~stationlistWidget (  )  [virtual]

The desctructor.

Definition at line 74 of file stationlistwidget.cpp.


Member Function Documentation

bool stationlistWidget::queryClose (  )  [virtual]

TODO

Definition at line 191 of file stationlistwidget.cpp.

References saveAllColumnSizes(), and stationlistmodel().

Here is the call graph for this function:

void stationlistWidget::readProperties ( const KConfigGroup &  m_configGroup  )  [virtual]

TODO

Definition at line 203 of file stationlistwidget.cpp.

References stationlistmodel().

Here is the call graph for this function:

void stationlistWidget::saveProperties ( KConfigGroup &  m_configGroup  )  [virtual]

TODO

Definition at line 197 of file stationlistwidget.cpp.

References saveAllColumnSizes(), and stationlistmodel().

Here is the call graph for this function:

QPointer< stationlistModel > stationlistWidget::stationlistmodel (  ) 

Returns a pointer to the model of this view widget. Unlike model(), this function returns a pointer of type QPointer<stationlistModel>.

Definition at line 186 of file stationlistwidget.cpp.

References m_stationlistModel.

Referenced by queryClose(), readProperties(), and saveProperties().

Here is the caller graph for this function:

void stationlistWidget::multipleSelected ( bool  value  )  [signal]

This signal is emitted when the selection changes somehow and now more than one of the rows are selected.

Parameters:
value is always TRUE.
See also:
selectionChanged()

Referenced by selectionChanged().

void stationlistWidget::noneSelected ( bool  value  )  [signal]

This signal is emitted when the selection changes somehow and now none of the rows is selected.

Parameters:
value is always TRUE.
See also:
selectionChanged()

Referenced by selectionChanged().

void stationlistWidget::oneSelected ( bool  value  )  [signal]

This signal is emitted when the selection changes somehow and now exactly one of the rows is selected.

Parameters:
value is always TRUE.
See also:
selectionChanged()

Referenced by selectionChanged().

void stationlistWidget::addNewStation (  )  [slot]

Adds a new radio station.

Definition at line 175 of file stationlistwidget.cpp.

References m_stationlistModel.

void stationlistWidget::deleteStation (  )  [slot]

Delete the actually selected stream(s).

Definition at line 161 of file stationlistwidget.cpp.

References m_stationlistModel.

void stationlistWidget::displayStreamSettings (  )  [slot]

Displays the settings dialog for the actually selected stream.

Has only an effect if exactly one stream is selected.

Definition at line 149 of file stationlistwidget.cpp.

References m_stationlistModel.

void stationlistWidget::record (  )  [slot]

Start recording for the actually selected streams.

Definition at line 103 of file stationlistwidget.cpp.

References m_stationlistModel.

void stationlistWidget::saveAllColumnSizes (  )  [slot]

This slot saves the column sizes of the widget to the config file. This is necessary to start the next time with the column sizes with which we have left the application.

You have to call this function when the application is about to be closed. Call it in KMainWindow::queryClose()!

We don't do this task in the destructor, because the session manager sometimes only requests for saving files (and this way calls KMainWindow::queryClose()), and then kills the applications after a certain time. So it's better to perform this task not in the destructor, but earlier.

Definition at line 78 of file stationlistwidget.cpp.

References m_stationlistModel, NOT, saveColumnSize(), and stationlistModel::setColumnVisibility.

Referenced by queryClose(), and saveProperties().

void stationlistWidget::stopRecord (  )  [slot]

Stop the selected streams.

Definition at line 116 of file stationlistwidget.cpp.

References m_stationlistModel.

void stationlistWidget::contextMenuEvent ( QContextMenuEvent *  e  )  [protected, virtual]

Reimplemented from class QAbstractScrollArea.

Just displays contextMenu at the appropriate place.

Definition at line 181 of file stationlistwidget.cpp.

References contextMenu.

void stationlistWidget::selectionChanged ( const QItemSelection &  selected,
const QItemSelection &  deselected 
) [protected, virtual, slot]

This reimplemented virtual function

  • calls the implementation of the base class
  • emits always one of the signals multipleSelected(), oneSelected(), noneSelected()
  • calls stationlistModel::setPlaying()...
    • if exactly one row is selected: ...with the index of the selected row
    • else: ...with the value -1

Definition at line 129 of file stationlistwidget.cpp.

References multipleSelected(), noneSelected(), and oneSelected().

void stationlistWidget::saveColumnSize ( int  column  )  [private, slot]

Convenience function, that saves the column size of the given column to the config file.

Definition at line 95 of file stationlistwidget.cpp.

References m_stationlistModel, and stationlistModel::setColumnWidth.

Referenced by saveAllColumnSizes(), and stationlistWidget().


Member Data Documentation

The context menu that is displayed when the user makes a click with the right mouse button. It is empty by default. You have to add actions to give him a function.

Definition at line 70 of file stationlistwidget.h.

Referenced by contextMenuEvent().

A pointer to the used stationlistModel.

We could alternitivly use QTableView::model() and than typecast to stationlistModel, but with this pointer, we have the advantage that we don't need to typecast.

Definition at line 155 of file stationlistwidget.h.

Referenced by addNewStation(), deleteStation(), displayStreamSettings(), record(), saveAllColumnSizes(), saveColumnSize(), stationlistmodel(), stationlistWidget(), and stopRecord().


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

Generated on Sat May 2 10:44:03 2009 for kradioripper by  doxygen 1.5.6