stationlistmodel.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef STATIONLISTMODEL_H
00022 #define STATIONLISTMODEL_H
00023
00024 #include <QAbstractTableModel>
00025 #include <QPointer>
00026 #include <QList>
00027 #include <phonon/mediaobject.h>
00028 #include <phonon/path.h>
00029 #include <phonon/audiooutput.h>
00030 #include "listensupport.h"
00031 #include "radiostation.h"
00032
00033 class stationlistWidget;
00034
00054 class stationlistModel : public QAbstractTableModel
00055 {
00056
00057 Q_OBJECT
00058
00071 Q_PROPERTY(quint64 bandwidth READ bandwidth)
00072
00073
00083 Q_PROPERTY(int numberOfActiveStreams READ numberOfActiveStreams)
00084
00085 public:
00090 explicit stationlistModel(stationlistWidget *parent,
00091 QWidget *mainWidget = 0);
00092
00094 virtual ~stationlistModel();
00095
00128 enum columnInfoType{
00129 columnHeaderTitle,
00130 columnHeaderToolTip,
00131 columnHeaderWhatsThis,
00132 columnWidth,
00133 setColumnWidth,
00134 columnVisibility,
00135 setColumnVisibility,
00136 columnData
00137 };
00138
00144 QModelIndex addNewStation();
00145
00147 quint64 bandwidth() const;
00148
00153 virtual int columnCount(const QModelIndex & parent = QModelIndex()) const;
00154
00184 QVariant columnInfo(const columnInfoType type,
00185 const int column,
00186 const qint64 row = (-1),
00187 const quint64 value = (-1),
00188 QList<radioStation *> listOfStations = QList<radioStation *>()) const;
00189
00205 virtual QVariant data (const QModelIndex & index, int role = Qt::DisplayRole) const;
00206
00208 virtual bool dropMimeData(const QMimeData *data,
00209 Qt::DropAction action,
00210 int row,
00211 int column,
00212 const QModelIndex & parent);
00213
00216 virtual Qt::ItemFlags flags(const QModelIndex & index) const;
00217
00221 virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
00222
00225 virtual QStringList mimeTypes () const;
00226
00228 int numberOfActiveStreams() const;
00229
00235 virtual bool queryClose();
00236
00241 virtual void readProperties(const KConfigGroup & m_configGroup);
00242
00252 virtual bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
00253
00258 virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
00259
00266 virtual void saveProperties(KConfigGroup & m_configGroup);
00267
00271 virtual void sort (int column, Qt::SortOrder order = Qt::AscendingOrder);
00272
00273 signals:
00275 void bandwidthChanged();
00277 void numberOfActiveStreamsChanged();
00279 void numberOfActiveStreamsIsZero();
00280
00281 public slots:
00285 void enableListeningIn();
00287 void disableListeningIn();
00289 void paste();
00291 void pasteSelection();
00295 void record(const int index);
00298 void showConfigDialog(const int index);
00303 void stopRecording(const int index);
00304
00305 protected:
00308 QPointer<stationlistWidget> view;
00309
00310 private:
00316 void helper_connectSignalsAndSlots(radioStation *m_stream);
00318 QList<QUrl> helper_convertToUrl(const QMimeData *data);
00330 bool helper_firstIsAfterSecond(const PropertyValue & firstValue,
00331 const PropertyValue & secondValue,
00332 Qt::SortOrder order);
00337 bool helper_isNumericValue(const QVariant & value);
00341 qlonglong helper_toLongLong(const PropertyValue & value);
00343 void helper_writeStationListToGeneralSettings();
00345 quint64 internal_bandwidth;
00347 int internal_numberOfActiveStreams;
00349 listenSupport listen;
00361 QStringList *m_listOfStreamsOfWhichTheUserWantsThatTheyRip;
00364 QPointer<QWidget> m_mainWidget;
00367 QList<radioStation *> m_stationlist;
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379 private slots:
00396 void recalculate_numberOfActiveStreams_and_bandwidth();
00398 void reloadBitrate(const qlonglong stationIndex);
00400 void reloadDataSize(const qlonglong stationIndex);
00402 void reloadMetaInterval(const qlonglong stationIndex);
00404 void reloadMetaInterval_milliSeconds(const qlonglong stationIndex);
00406 void reloadRelayPort(const qlonglong stationIndex);
00408 void reloadServerName(const qlonglong stationIndex);
00410 void reloadSong(const qlonglong stationIndex);
00412 void reloadStatus(const qlonglong stationIndex);
00414 void reloadStreamName(const qlonglong stationIndex);
00416 void reloadUri(const qlonglong stationIndex);
00436 void rememberListOfStreamsWhichTheUserWantsToRip_ifNotYetDone();
00437
00438 };
00439
00440 #endif