2010-03-24 00:11:46 +01:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-03-24 00:11:46 +01:00
|
|
|
|
|
|
|
Clementine 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 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-01-15 18:12:47 +01:00
|
|
|
#ifndef TRACKSLIDER_H
|
|
|
|
#define TRACKSLIDER_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2010-05-10 23:50:31 +02:00
|
|
|
class QLabel;
|
|
|
|
|
2012-05-28 00:44:49 +02:00
|
|
|
class Application;
|
2012-05-25 23:02:10 +02:00
|
|
|
class MoodbarProxyStyle;
|
2010-05-10 23:50:31 +02:00
|
|
|
class Ui_TrackSlider;
|
2010-01-15 18:12:47 +01:00
|
|
|
|
|
|
|
class TrackSlider : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2014-02-10 16:03:54 +01:00
|
|
|
TrackSlider(QWidget* parent = nullptr);
|
2010-05-10 23:50:31 +02:00
|
|
|
~TrackSlider();
|
2010-01-15 18:12:47 +01:00
|
|
|
|
2012-05-28 00:44:49 +02:00
|
|
|
void SetApplication(Application* app);
|
|
|
|
|
2010-01-15 18:12:47 +01:00
|
|
|
// QWidget
|
|
|
|
QSize sizeHint() const;
|
|
|
|
|
2010-03-08 13:13:11 +01:00
|
|
|
// QObject
|
2014-02-07 16:34:20 +01:00
|
|
|
bool event(QEvent*);
|
2010-03-08 13:13:11 +01:00
|
|
|
|
2012-05-25 23:02:10 +02:00
|
|
|
MoodbarProxyStyle* moodbar_style() const { return moodbar_style_; }
|
|
|
|
|
2011-01-25 20:15:51 +01:00
|
|
|
static const char* kSettingsGroup;
|
|
|
|
|
2010-01-15 18:12:47 +01:00
|
|
|
public slots:
|
|
|
|
void SetValue(int elapsed, int total);
|
|
|
|
void SetStopped();
|
|
|
|
void SetCanSeek(bool can_seek);
|
2011-01-27 00:20:56 +01:00
|
|
|
void Seek(int gap);
|
2010-01-15 18:12:47 +01:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
signals:
|
2010-01-15 18:12:47 +01:00
|
|
|
void ValueChanged(int value);
|
2014-05-19 17:51:40 +02:00
|
|
|
void ValueChangedSeconds(int value);
|
2010-01-15 18:12:47 +01:00
|
|
|
|
2015-07-02 14:59:30 +02:00
|
|
|
void SeekForward();
|
|
|
|
void SeekBackward();
|
|
|
|
|
2010-02-24 21:14:40 +01:00
|
|
|
private slots:
|
|
|
|
void ValueMaybeChanged(int value);
|
2011-01-25 20:15:51 +01:00
|
|
|
void ToggleTimeDisplay();
|
2010-02-24 21:14:40 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void UpdateTimes(int elapsed);
|
2010-03-08 13:13:11 +01:00
|
|
|
void UpdateLabelWidth();
|
2010-03-08 13:30:55 +01:00
|
|
|
void UpdateLabelWidth(QLabel* label, const QString& text);
|
2010-02-24 21:14:40 +01:00
|
|
|
|
2010-01-15 18:12:47 +01:00
|
|
|
private:
|
2010-05-10 23:50:31 +02:00
|
|
|
Ui_TrackSlider* ui_;
|
2010-02-24 21:14:40 +01:00
|
|
|
|
2012-05-25 23:02:10 +02:00
|
|
|
MoodbarProxyStyle* moodbar_style_;
|
|
|
|
|
2010-02-24 21:14:40 +01:00
|
|
|
bool setting_value_;
|
2011-01-25 20:15:51 +01:00
|
|
|
bool show_remaining_time_;
|
2014-02-07 16:34:20 +01:00
|
|
|
int slider_maximum_value_; // we cache it to avoid unnecessary updates
|
2010-01-15 18:12:47 +01:00
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
#endif // TRACKSLIDER_H
|