ModelView.h 1.32 KB
#ifndef MODELVIEW_H
#define MODELVIEW_H

#include <QWidget>
#include <QTreeView>
#include <QItemSelectionModel>
#include <QKeyEvent>

#include "ProjectModel.h"
#include "Segment.h"
#include "Episode.h"

class ModelView: public QWidget
{
  Q_OBJECT

    public:
  ModelView(ProjectModel *project, int nVignettes = 5, QWidget *parent = 0);
  void adjust();
  void initPlayer();
  QString getCurrentEpisodeFName() const;
  void setDepth(int depth);

  public slots:
  void updatePlayer(const QModelIndex &current, const QModelIndex &previous);
  void positionChanged(qint64 position);
  void playerPaused(bool pause);
  void initShotAnnot(bool checked);

  signals:
  void setPlayer(const QString &fName, const QSize &resolution);
  void setPlayerPosition(qint64);
  void initShotLevel(Segment *segment);
  void insertShot(Segment *segment);
  void removeShot(Segment *segment);
  void editSimShots(Segment *segment);
  void currentShot(QList<qint64>);
  void displaySubtitle(const QString &subtitle);

 protected:
  void keyPressEvent(QKeyEvent *event);
  
 private:
  void updateCurrentEpisode(Segment *segment);
  QList<qint64> genPositionList(Segment *segment);

  Episode *m_currEpisode;
  ProjectModel *m_project;
  QTreeView *m_treeView;
  QItemSelectionModel *m_selection;
  int m_depth;
  int m_nVignettes;
  bool m_playerPaused;
};

#endif