~ubuntu-branches/ubuntu/wily/kid3/wily

« back to all changes in this revision

Viewing changes to src/gui/widgets/timeeventeditor.h

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2014-05-05 10:39:24 UTC
  • mfrom: (1.1.17) (2.1.22 sid)
  • Revision ID: package-import@ubuntu.com-20140505103924-9q6a67b7mespmojg
Tags: 3.1-1
* New upstream release.
  - Drop merged patch 01-desktop-keywords.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * \file timeeventeditor.h
 
3
 * Editor for time events (synchronized lyrics and event timing codes).
 
4
 *
 
5
 * \b Project: Kid3
 
6
 * \author Urs Fleisch
 
7
 * \date 15 Mar 2014
 
8
 *
 
9
 * Copyright (C) 2014  Urs Fleisch
 
10
 *
 
11
 * This file is part of Kid3.
 
12
 *
 
13
 * Kid3 is free software; you can redistribute it and/or modify
 
14
 * it under the terms of the GNU General Public License as published by
 
15
 * the Free Software Foundation; either version 2 of the License, or
 
16
 * (at your option) any later version.
 
17
 *
 
18
 * Kid3 is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
 * GNU General Public License for more details.
 
22
 *
 
23
 * You should have received a copy of the GNU General Public License
 
24
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
25
 */
 
26
 
 
27
#ifndef TIMEEVENTEDITOR_H
 
28
#define TIMEEVENTEDITOR_H
 
29
 
 
30
#include <QWidget>
 
31
#include "frame.h"
 
32
 
 
33
class QLabel;
 
34
class QModelIndex;
 
35
class IPlatformTools;
 
36
class Kid3Application;
 
37
class TimeEventModel;
 
38
class EventCodeDelegate;
 
39
class TaggedFile;
 
40
class TimeEventTableView;
 
41
 
 
42
/**
 
43
 * Editor for time events (synchronized lyrics and event timing codes).
 
44
 */
 
45
class TimeEventEditor : public QWidget {
 
46
  Q_OBJECT
 
47
public:
 
48
  /**
 
49
   * Constructor.
 
50
   *
 
51
   * @param platformTools platform tools
 
52
   * @param app application context
 
53
   * @param parent parent widget
 
54
   * @param field  field containing binary data
 
55
   * @param taggedFile tagged file
 
56
   */
 
57
  TimeEventEditor(IPlatformTools* platformTools, Kid3Application* app,
 
58
                  QWidget* parent, const Frame::Field& field,
 
59
                  const TaggedFile* taggedFile);
 
60
 
 
61
  /**
 
62
   * Destructor.
 
63
   */
 
64
  virtual ~TimeEventEditor();
 
65
 
 
66
  /**
 
67
   * Set time event model.
 
68
   * @param model time event model
 
69
   */
 
70
  void setModel(TimeEventModel* model);
 
71
 
 
72
protected:
 
73
  /**
 
74
   * Connect to player when editor is shown.
 
75
   * @param event event
 
76
   */
 
77
  virtual void showEvent(QShowEvent* event);
 
78
 
 
79
  /**
 
80
   * Disconnect from player when editor is hidden.
 
81
   * @param event event
 
82
   */
 
83
  virtual void hideEvent(QHideEvent* event);
 
84
 
 
85
private slots:
 
86
  /**
 
87
   * Make sure that player is visible and in the edited file.
 
88
   */
 
89
  void preparePlayer();
 
90
 
 
91
  /**
 
92
   * Add a time event at the current player position.
 
93
   */
 
94
  void addItem();
 
95
 
 
96
  /**
 
97
   * Load LRC data from clipboard.
 
98
   */
 
99
  void clipData();
 
100
 
 
101
  /**
 
102
   * Import data in LRC format.
 
103
   */
 
104
  void importData();
 
105
 
 
106
  /**
 
107
   * Export data in LRC format.
 
108
   */
 
109
  void exportData();
 
110
 
 
111
  /**
 
112
   * Insert a new row after the current row.
 
113
   */
 
114
  void insertRow();
 
115
 
 
116
  /**
 
117
   * Delete the selected rows.
 
118
   */
 
119
  void deleteRows();
 
120
 
 
121
  /**
 
122
   * Clear the selected cells.
 
123
   */
 
124
  void clearCells();
 
125
 
 
126
  /**
 
127
   * Add offset to time stamps.
 
128
   */
 
129
  void addOffset();
 
130
 
 
131
  /**
 
132
   * Seek to position of current time stamp.
 
133
   */
 
134
  void seekPosition();
 
135
 
 
136
  /**
 
137
   * Display custom context menu.
 
138
   *
 
139
   * @param pos position where context menu is drawn on screen
 
140
   */
 
141
  void customContextMenu(const QPoint& pos);
 
142
 
 
143
  /**
 
144
   * Called when the played track changed.
 
145
   * @param filePath path to file being played
 
146
   */
 
147
  void onTrackChanged(const QString& filePath);
 
148
 
 
149
  /**
 
150
   * Called when the player position changed.
 
151
   * @param position time in ms
 
152
   */
 
153
  void onPositionChanged(qint64 position);
 
154
 
 
155
private:
 
156
  QString getLrcNameFilter() const;
 
157
 
 
158
  IPlatformTools* m_platformTools;
 
159
  Kid3Application* m_app;
 
160
  QLabel* m_label;
 
161
  TimeEventTableView* m_tableView;
 
162
  EventCodeDelegate* m_eventCodeDelegate;
 
163
  TimeEventModel* m_model;
 
164
  const TaggedFile* m_taggedFile;
 
165
  QByteArray m_byteArray;
 
166
  bool m_fileIsPlayed;
 
167
};
 
168
 
 
169
#endif // TIMEEVENTEDITOR_H