/***************************************************************************
 *   Copyright (C) 2009 by Georg Martius and Dominic Schneider   *
 *   georg.martius@web.de   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef __PLOTCHANNELSTABLEMODEL_H
#define __PLOTCHANNELSTABLEMODEL_H


#include <QAbstractTableModel>
#include <QVector>

#include "plotinfo.h"

class PlotChannelsTableModel : public QAbstractTableModel 
{    
  Q_OBJECT;
public:
  
  
  PlotChannelsTableModel(QVector<PlotInfo*>* plotInfos, QObject *parent = 0)
    : QAbstractTableModel(parent) {
    this->plotInfos = plotInfos;
    rowoffset = 2;
  }
  
  int rowCount(const QModelIndex &parent = QModelIndex()) const;
  int columnCount(const QModelIndex &parent = QModelIndex()) const;
  QVariant data(const QModelIndex &index, int role) const;
  QVariant headerData(int section, Qt::Orientation orientation,
                      int role = Qt::DisplayRole) const;
  
  Qt::ItemFlags flags(const QModelIndex &index) const;
  bool setData(const QModelIndex &index, const QVariant &value,
               int role = Qt::EditRole);
                
signals:
  void updateWindow(int index);
                       
public slots:
  void update();
  
private:
  QVector<PlotInfo*>* plotInfos;

  int rowoffset; // number of additional rows due to enable/disable and reference selection
};

#endif
