#include <stationlistwidget.h>
Public Slots | |
void | deleteStation () |
void | saveAllColumnSizes () |
void | scrollToRow (const QModelIndex &index) |
Signals | |
void | multipleSelected (bool value) |
void | noneSelected (bool value) |
void | oneSelected (bool value) |
Public Member Functions | |
stationlistWidget (KActionCollection *actionCollection, QWidget *parent=0, QWidget *mainWindow=0) | |
virtual | ~stationlistWidget () |
virtual bool | queryClose () |
virtual void | readProperties (const KConfigGroup &m_configGroup) |
virtual void | saveProperties (KConfigGroup &m_configGroup) |
QPointer< stationlistModel > | stationlistmodel () |
Protected Member Functions | |
virtual void | contextMenuEvent (QContextMenuEvent *e) |
virtual void | mousePressEvent (QMouseEvent *event) |
Protected Attributes | |
KMenu | contextMenu |
Private Slots | |
void | enableStopListenInAction (bool enabled) |
void | reloadStatusOfListenInAction () |
void | reloadStatusOfPasteAction () |
void | reloadStatusOfStartAndStopActions () |
void | saveColumnSize (const int column) |
void | recalculateActionsStatus () |
Private Member Functions | |
void | setupActions (KActionCollection *actionCollection) |
Private Attributes | |
QPointer< stationlistModel > | m_stationlistModel |
KAction * | deleteAction |
KAction * | newFolderAction |
KAction * | newStreamAction |
KAction * | pasteAction |
KAction * | recordAction |
KAction * | selectAllAction |
KAction * | startListenInAction |
KAction * | stopListenInAction |
KAction * | stopRecordAction |
KAction * | streamSettingsAction |
This class inherits QTreeView. It provides a QTreeView (with nicer default values than the original) and constructs by default a stationlistModel object that is used as model.
It provides context menus.
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.
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 50 of file stationlistwidget.h.
stationlistWidget::stationlistWidget | ( | KActionCollection * | actionCollection, | |
QWidget * | parent = 0 , |
|||
QWidget * | mainWindow = 0 | |||
) | [explicit] |
The constructor.
actionCollection | The KActionCollection to which this object adds its actions. May not be 0! | |
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 38 of file stationlistwidget.cpp.
References stationlistModel::columnVisibility, stationlistModel::columnWidth, m_stationlistModel, saveColumnSize(), and setupActions().
stationlistWidget::~stationlistWidget | ( | ) | [virtual] |
The desctructor.
Definition at line 103 of file stationlistwidget.cpp.
void stationlistWidget::contextMenuEvent | ( | QContextMenuEvent * | e | ) | [protected, virtual] |
Reimplemented from class QAbstractScrollArea.
Just displays the context menu at the appropriate place.
Definition at line 191 of file stationlistwidget.cpp.
References contextMenu, deleteAction, m_stationlistModel, newFolderAction, newStreamAction, pasteAction, recordAction, selectAllAction, startListenInAction, stopListenInAction, stopRecordAction, and streamSettingsAction.
void stationlistWidget::deleteStation | ( | ) | [slot] |
Delete the actually selected stream(s).
Definition at line 177 of file stationlistwidget.cpp.
References m_stationlistModel.
Referenced by setupActions().
void stationlistWidget::enableStopListenInAction | ( | bool | enabled | ) | [private, slot] |
Enables or disabled stopListenInAction.
Definition at line 497 of file stationlistwidget.cpp.
References stopListenInAction.
Referenced by setupActions().
void stationlistWidget::mousePressEvent | ( | QMouseEvent * | event | ) | [protected, virtual] |
Reimplemented from base class.
Handles middle mouse button (insert from "selection" clipboard") and forwards everthing else to the implementation of the base class.
Definition at line 264 of file stationlistwidget.cpp.
References stationlistmodel().
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.
value | is always TRUE. |
Referenced by recalculateActionsStatus().
void stationlistWidget::noneSelected | ( | bool | value | ) | [signal] |
This signal is emitted when the selection changes somehow and now none of the rows is selected.
value | is always TRUE. |
Referenced by recalculateActionsStatus().
void stationlistWidget::oneSelected | ( | bool | value | ) | [signal] |
This signal is emitted when the selection changes somehow and now exactly one of the rows is selected.
value | is always TRUE. |
Referenced by recalculateActionsStatus().
bool stationlistWidget::queryClose | ( | ) | [virtual] |
Saves some settings before the application closes.
Definition at line 247 of file stationlistwidget.cpp.
References saveAllColumnSizes(), and stationlistmodel().
void stationlistWidget::readProperties | ( | const KConfigGroup & | m_configGroup | ) | [virtual] |
Reads properties for restoring the previous session (using session management).
m_configGroup | The location where to read the properties from |
Definition at line 259 of file stationlistwidget.cpp.
References stationlistmodel().
void stationlistWidget::recalculateActionsStatus | ( | ) | [private, slot] |
Recalculates the status of the actions (enabled, disabled, visible, invisible).
Definition at line 132 of file stationlistwidget.cpp.
References deleteAction, stationlistItem::folder, multipleSelected(), newFolderAction, newStreamAction, noneSelected(), oneSelected(), pasteAction, and streamSettingsAction.
Referenced by setupActions().
void stationlistWidget::reloadStatusOfListenInAction | ( | ) | [private, slot] |
Actualizes the status of startListenInAction.
Definition at line 295 of file stationlistwidget.cpp.
References startListenInAction, stationlistItem::stream, and PropertyValue::value.
Referenced by setupActions().
void stationlistWidget::reloadStatusOfPasteAction | ( | ) | [private, slot] |
Actualizes the status of pasteAction.
Definition at line 281 of file stationlistwidget.cpp.
References pasteAction, and stationlistmodel().
Referenced by setupActions().
void stationlistWidget::reloadStatusOfStartAndStopActions | ( | ) | [private, slot] |
Actualizes the status of recordAction and stopRecordAction.
Definition at line 465 of file stationlistwidget.cpp.
References ripping::doesTheUserWantsThatTheStreamIsRipping(), ripping::isRunning, recordAction, stationlistmodel(), and stopRecordAction.
Referenced by setupActions().
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 107 of file stationlistwidget.cpp.
References m_stationlistModel, NOT, saveColumnSize(), and stationlistModel::setColumnVisibility.
Referenced by queryClose(), and saveProperties().
void stationlistWidget::saveColumnSize | ( | const int | column | ) | [private, slot] |
Convenience function, that saves the column size of the given column to the config file.
Definition at line 124 of file stationlistwidget.cpp.
References m_stationlistModel, and stationlistModel::setColumnWidth.
Referenced by saveAllColumnSizes(), and stationlistWidget().
void stationlistWidget::saveProperties | ( | KConfigGroup & | m_configGroup | ) | [virtual] |
Saves properties for restoring this session later (using session management).
m_configGroup | The location where to save the properties |
Definition at line 253 of file stationlistwidget.cpp.
References saveAllColumnSizes(), and stationlistmodel().
void stationlistWidget::scrollToRow | ( | const QModelIndex & | index | ) | [slot] |
Scrolls vertically to the row of index, but doesn't scroll horizontally. This means that index is not necesarry visible, but at least the row in which it is.
index | The index. |
Definition at line 274 of file stationlistwidget.cpp.
void stationlistWidget::setupActions | ( | KActionCollection * | actionCollection | ) | [private] |
Sets up the actions that are supported by this class.
Definition at line 322 of file stationlistwidget.cpp.
References deleteAction, deleteStation(), enableStopListenInAction(), m_stationlistModel, newFolderAction, newStreamAction, pasteAction, recalculateActionsStatus(), recordAction, reloadStatusOfListenInAction(), reloadStatusOfPasteAction(), reloadStatusOfStartAndStopActions(), selectAllAction, startListenInAction, stationlistmodel(), stopListenInAction, stopRecordAction, and streamSettingsAction.
Referenced by stationlistWidget().
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 242 of file stationlistwidget.cpp.
References m_stationlistModel.
Referenced by mousePressEvent(), queryClose(), readProperties(), reloadStatusOfPasteAction(), reloadStatusOfStartAndStopActions(), saveProperties(), and setupActions().
KMenu stationlistWidget::contextMenu [protected] |
The context menu that is displayed when the user makes a click with the right mouse button.
Definition at line 131 of file stationlistwidget.h.
Referenced by contextMenuEvent().
KAction* stationlistWidget::deleteAction [private] |
The list of actions. Action handling.
Definition at line 149 of file stationlistwidget.h.
Referenced by contextMenuEvent(), recalculateActionsStatus(), and setupActions().
QPointer<stationlistModel> stationlistWidget::m_stationlistModel [private] |
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 174 of file stationlistwidget.h.
Referenced by contextMenuEvent(), deleteStation(), saveAllColumnSizes(), saveColumnSize(), setupActions(), stationlistmodel(), and stationlistWidget().
KAction* stationlistWidget::newFolderAction [private] |
Action handling.
Definition at line 151 of file stationlistwidget.h.
Referenced by contextMenuEvent(), recalculateActionsStatus(), and setupActions().
KAction* stationlistWidget::newStreamAction [private] |
Action handling.
Definition at line 153 of file stationlistwidget.h.
Referenced by contextMenuEvent(), recalculateActionsStatus(), and setupActions().
KAction* stationlistWidget::pasteAction [private] |
Action handling.
Definition at line 155 of file stationlistwidget.h.
Referenced by contextMenuEvent(), recalculateActionsStatus(), reloadStatusOfPasteAction(), and setupActions().
KAction* stationlistWidget::recordAction [private] |
Action handling.
Definition at line 157 of file stationlistwidget.h.
Referenced by contextMenuEvent(), reloadStatusOfStartAndStopActions(), and setupActions().
KAction* stationlistWidget::selectAllAction [private] |
Action handling.
Definition at line 159 of file stationlistwidget.h.
Referenced by contextMenuEvent(), and setupActions().
KAction* stationlistWidget::startListenInAction [private] |
Action handling.
Definition at line 161 of file stationlistwidget.h.
Referenced by contextMenuEvent(), reloadStatusOfListenInAction(), and setupActions().
KAction* stationlistWidget::stopListenInAction [private] |
Action handling.
Definition at line 163 of file stationlistwidget.h.
Referenced by contextMenuEvent(), enableStopListenInAction(), and setupActions().
KAction* stationlistWidget::stopRecordAction [private] |
Action handling.
Definition at line 165 of file stationlistwidget.h.
Referenced by contextMenuEvent(), reloadStatusOfStartAndStopActions(), and setupActions().
KAction* stationlistWidget::streamSettingsAction [private] |
Action handling.
Definition at line 167 of file stationlistwidget.h.
Referenced by contextMenuEvent(), recalculateActionsStatus(), and setupActions().