summaryrefslogtreecommitdiffstats
path: root/src/projects/k3baudiotrackview.h
blob: f64e4eec9951d5898f0e600f89b7427c7a636da0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* 
 *
 * $Id: k3baudiotrackview.h 619556 2007-01-03 17:38:12Z trueg $
 * Copyright (C) 2004 Sebastian Trueg <trueg@k3b.org>
 *
 * This file is part of the K3b project.
 * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
 *
 * 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.
 * See the file "COPYING" for the exact licensing terms.
 */

#ifndef _K3B_AUDIO_TRACK_VIEW_H_
#define _K3B_AUDIO_TRACK_VIEW_H_

#include <k3blistview.h>

#include <tqmap.h>
#include <tqptrlist.h>
#include <kurl.h>

class K3bAudioTrack;
class K3bAudioTrackViewItem;
class K3bAudioDataSource;
class K3bAudioDoc;
class TDEActionCollection;
class TDEAction;
class TQDropEvent;
class TQKeyEvent;
class TQFocusEvent;
class TQMouseEvent;
class TQDragMoveEvent;
class TQTimer;
class TDEPopupMenu;
class TQPainter;
class K3bListViewItemAnimator;
class K3bAudioTrackPlayer;


class K3bAudioTrackView : public K3bListView
{
  Q_OBJECT
  

 public:
  K3bAudioTrackView( K3bAudioDoc*, TQWidget* parent, const char* name = 0 );
  ~K3bAudioTrackView();

  TDEActionCollection* actionCollection() const { return m_actionCollection; }

  K3bAudioTrackPlayer* player() const { return m_player; }

  void getSelectedItems( TQPtrList<K3bAudioTrack>& tracks, 
			 TQPtrList<K3bAudioDataSource>& sources );

 public slots:
  void showPlayerIndicator( K3bAudioTrack* );
  void togglePauseIndicator( bool b );
  void removePlayerIndicator();

 private:
  void setupColumns();
  void setupActions();
  void showAllSources();
  K3bAudioTrackViewItem* findTrackItem( const TQPoint& pos ) const;
  K3bAudioTrackViewItem* getTrackViewItem( K3bAudioTrack* track, bool* isNew = 0 );

  K3bAudioDoc* m_doc;

  TDEAction* m_actionProperties;
  TDEAction* m_actionRemove;
  TDEAction* m_actionAddSilence;
  TDEAction* m_actionMergeTracks;
  TDEAction* m_actionSplitSource;
  TDEAction* m_actionSplitTrack;
  TDEAction* m_actionEditSource;
  TDEAction* m_actionPlayTrack;
  TDEActionCollection* m_actionCollection;

  bool m_updatingColumnWidths;

  TQMap<K3bAudioTrack*, K3bAudioTrackViewItem*> m_trackItemMap;

  K3bAudioTrackViewItem* m_currentMouseOverItem;
  TQTimer* m_autoOpenTrackTimer;
  TQTimer* m_animationTimer;

  TDEPopupMenu* m_popupMenu;

  K3bAudioTrackPlayer* m_player;

  // used for the audiotrackplayer indicator
  K3bAudioTrack* m_currentlyPlayingTrack;

  // to animate the player icon
  K3bListViewItemAnimator* m_playerItemAnimator;

  // used for the drop-event hack
  KURL::List m_dropUrls;
  K3bAudioTrack* m_dropTrackAfter;
  K3bAudioTrack* m_dropTrackParent;
  K3bAudioDataSource* m_dropSourceAfter;

 private slots:
  void slotAnimation();
  void slotDropped( TQDropEvent* e, TQListViewItem* parent, TQListViewItem* after );
  void slotChanged();
  void slotTrackChanged( K3bAudioTrack* );
  void slotTrackRemoved( K3bAudioTrack* );
  void slotDragTimeout();

  // action slots
  void slotAddSilence();
  void slotRemove();
  void slotMergeTracks();
  void slotSplitSource();
  void slotSplitTrack();
  void showPopupMenu( TDEListView*, TQListViewItem* item, const TQPoint& pos );
  void slotProperties();
  void slotPlayTrack();
  void slotQueryMusicBrainz();
  void slotEditSource();

  // drop-event hack slot
  void slotAddUrls();

 protected:
  void keyPressEvent( TQKeyEvent* e );
  void keyReleaseEvent( TQKeyEvent* e );
  void focusOutEvent( TQFocusEvent* e );
  void contentsMouseMoveEvent( TQMouseEvent* e );
  void contentsDragMoveEvent( TQDragMoveEvent* e );
  void contentsDragLeaveEvent( TQDragLeaveEvent* e );
  void resizeEvent( TQResizeEvent* e );
  void resizeColumns();
  bool acceptDrag(TQDropEvent* e) const;
  TQDragObject* dragObject();
};

#endif