connect(menu->volumeSlider(), SIGNAL(volumeChangedByUser(double)), player, SLOT(setVolume(double)));
connect(player, SIGNAL(mutedChanged(bool)), menu->volumeSlider(), SLOT(setMuted(bool)));
connect(menu->volumeSlider(), SIGNAL(mutedChangedByUser(bool)), player, SLOT(setMuted(bool)));
+ connect(player, SIGNAL(automarkChanged(int)), menu->seekSlider(), SLOT(setAutomark(int)));
connect(player, SIGNAL(message(QString)), menu, SLOT(showMessage(QString)));
void SeekSlider::init()
{
- ticking = false;
m_length = 1000;
m_seekPosition = 20;
markerWidth = 2;
const QColor unwatchedPartColor(0, 255, 0, 100);
const QColor toolTipBackgroundColor(0, 0, 0, 150);
const QColor toolTipForegroundColor(255, 255, 255);
+ const QColor automarkPositionColor(255, 255, 0, 150);
// border
// unwatched part
p.fillRect(markerPos + markerWidth / 2, seekerTop + 1, seekerWidth - markerPos, seekerHeight - 1, unwatchedPartColor);
+ // automark position
+ if (m_automark)
+ {
+ const int automarkPos = (seekerWidth * m_automark) / 100;
+ p.fillRect(automarkPos - markerWidth / 2, seekerTop + 1, markerWidth, seekerHeight - 1, automarkPositionColor);
+ }
+
// previous locations before seeking
int i = 1;
for (auto it = previuousPos.constBegin(); it != previuousPos.constEnd(); ++it)
void SeekSlider::tick(qint64 msec)
{
- ticking = true;
setSeekPosition(msec);
- ticking = false;
}
void SeekSlider::totalTimeChanged(qint64 msec)
{
- ticking = true;
setLength(msec);
previuousPos.clear();
- ticking = false;
+}
+
+void SeekSlider::setAutomark(int percent)
+{
+ m_automark = percent;
}
void SeekSlider::seekableChanged(bool isSeekable)
while (!previuousPos.isEmpty() && previuousPos.count() + 1 > maxPreviousPos) previuousPos.dequeue();
previuousPos.enqueue(m_seekPosition);
- ticking = true;
setSeekPosition(newSeekPos);
emit seekRequested(newSeekPos);
- ticking = false;
seek(newSeekPos);
}
{
return m_seekPosition;
}
+
+int SeekSlider::automark() const
+{
+ return m_automark;
+}
{
Q_OBJECT
Q_PROPERTY(qint64 seekPosition READ seekPosition WRITE setSeekPosition NOTIFY seekPositionChanged USER true)
+ Q_PROPERTY(int automark READ automark WRITE setAutomark)
Q_DISABLE_COPY(SeekSlider)
bool event(QEvent *event);
*/
qint64 seekPosition() const;
-
+ int automark() const;
public slots:
// void setOrientation(Qt::Orientation o);
void tick(qint64 msec);
void totalTimeChanged(qint64 msec);
+ void setAutomark(int percent);
+
signals:
void seekPositionChanged(qint64 arg);
void seekRequested(qint64 position);
qint64 pos2time(int pos) const;
int time2pos(qint64 msec) const;
- bool ticking;
bool markerShadowEnabled;
qint64 m_length;
QQueue<qint64> previuousPos;
int maxPreviousPos;
+ int m_automark;
// Seeker Geometry
int seekerTop;