stationlistmodel.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2008  Tim Fechtner < urwald at users dot sourceforge dot net >
00003 
00004     This program is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU General Public License as
00006     published by the Free Software Foundation; either version 2 of
00007     the License or (at your option) version 3 or any later version
00008     accepted by the membership of KDE e.V. (or its successor approved
00009     by the membership of KDE e.V.), which shall act as a proxy
00010     defined in Section 14 of version 3 of the license.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #ifndef STATIONLISTMODEL_H
00022 #define STATIONLISTMODEL_H
00023 
00024 #include <QAbstractTableModel>
00025 #include <QPointer>
00026 #include <QList>
00027 #include "radiostation.h"
00028 
00046 class stationlistModel : public QAbstractTableModel
00047 {
00048 
00049      Q_OBJECT
00050 
00063      Q_PROPERTY(quint64 bandwidth READ bandwidth)
00064 
00065      
00075      Q_PROPERTY(int numberOfActiveStreams READ numberOfActiveStreams)
00076 
00077   public:
00081      explicit stationlistModel(const QPointer<QObject> parent = 0,
00082                                 const QPointer<QWidget> mainWidget = 0);
00083 
00085      virtual ~stationlistModel();
00086 
00123      enum columnInfoType {
00124                            columnHeaderTitle,
00125                            columnHeaderToolTip,
00126                            columnHeaderWhatsThis,
00127                            columnWidth,
00128                            setColumnWidth,
00129                            columnVisibility,
00130                            setColumnVisibility,
00131                            columnData,
00132                            columnDataToolTip,
00133                            columnDataWhatsThis
00134                          };
00135 
00137      quint64 bandwidth() const;
00138 
00143      virtual int columnCount(const QModelIndex & parent = QModelIndex()) const;
00144 
00169      QVariant columnInfo(const columnInfoType type,
00170                           const int column,
00171                           const qint64 row = (-1),
00172                           const quint64 value = (-1)) const;
00173 
00189      virtual QVariant data (const QModelIndex & index, int role = Qt::DisplayRole) const;
00190 
00194      virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
00195 
00197      int numberOfActiveStreams() const;
00198 
00200      virtual bool queryClose();
00201 
00203      virtual void readProperties(const KConfigGroup & m_configGroup);
00204 
00209      virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
00210 
00212      virtual void saveProperties(KConfigGroup & m_configGroup);
00213 
00217      virtual void sort (int column, Qt::SortOrder order = Qt::AscendingOrder);
00218 
00219   signals:
00221      void bandwidthChanged();
00223      void numberOfActiveStreamsChanged();
00225      void numberOfActiveStreamsIsZero();
00226 
00227   public slots:
00231      void addNewStation();
00236      void deleteStation(const int index);
00240      void record(const int index);
00243      void showConfigDialog(const int index);
00248      void stopRecording(const int index);
00249 
00250   private:
00256      void helper_connectSignalsAndSlots(QPointer<radioStation> m_stream);
00258      void helper_writeStationListToGeneralSettings();
00260      quint64 internal_bandwidth;
00262      int internal_numberOfActiveStreams;
00273      QStringList * m_listOfStreamsOfWhichTheUserWantsThatTheyRip;
00276      QPointer<QWidget> m_mainWidget;
00279      QList< QPointer<radioStation> > m_stationlist;  /* we need a pointer as list member
00280                                                       instead of radioStation itself
00281                                                       because we need the construct
00282                                                       radioStation with the constructor
00283                                                       (no other way to set the config file),
00284                                                       and when radioStation's
00285                                                       constructor is called, the config file
00286                                                       is opened and so on. I
00287                                                       don't think it's save to copy this
00288                                                       class - what's necessary
00289                                                       when not using a pointer. */
00290 
00291   private slots:
00308      void recalculate_numberOfActiveStreams_and_bandwidth();
00310      void reloadBitrate(const qlonglong stationIndex);
00312      void reloadDataSize(const qlonglong stationIndex);
00314      void reloadMetaInterval(const qlonglong stationIndex);
00316      void reloadRelayPort(const qlonglong stationIndex);
00318      void reloadServerName(const qlonglong stationIndex);
00320      void reloadSong(const qlonglong stationIndex);
00322      void reloadStatus(const qlonglong stationIndex);
00324      void reloadStreamName(const qlonglong stationIndex);
00326      void rememberListOfStreamsWhichTheUserWantsToRip_ifNotYetDone();
00327 
00328 };
00329 
00330 #endif

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