| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2017 Ricardo Villalba <[email protected]>
|
|---|
| 3 | umplayer, Copyright (C) 2010 Ori Rejwan
|
|---|
| 4 |
|
|---|
| 5 | This program is free software; you can redistribute it and/or modify
|
|---|
| 6 | it under the terms of the GNU General Public License as published by
|
|---|
| 7 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 8 | (at your option) any later version.
|
|---|
| 9 |
|
|---|
| 10 | This program is distributed in the hope that it will be useful,
|
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 13 | GNU General Public License for more details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU General Public License
|
|---|
| 16 | along with this program; if not, write to the Free Software
|
|---|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 18 | */
|
|---|
| 19 |
|
|---|
| 20 | #include "mediapanel.h"
|
|---|
| 21 | #include <QPainter>
|
|---|
| 22 | #include <QFont>
|
|---|
| 23 | #include <QFontMetrics>
|
|---|
| 24 | #include <QTimerEvent>
|
|---|
| 25 | #include <QGridLayout>
|
|---|
| 26 | #include <QLabel>
|
|---|
| 27 | #include <QHelpEvent>
|
|---|
| 28 | #include <QToolTip>
|
|---|
| 29 | #include <QDebug>
|
|---|
| 30 | #include "qpropertysetter.h"
|
|---|
| 31 | #include "widgetactions.h"
|
|---|
| 32 | #include "core.h"
|
|---|
| 33 | #include "config.h"
|
|---|
| 34 | #include "actiontools.h"
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | MediaPanel::MediaPanel(QWidget *parent)
|
|---|
| 38 | : QWidget(parent), duration(0)
|
|---|
| 39 | {
|
|---|
| 40 | ui.setupUi(this);
|
|---|
| 41 | setAttribute(Qt::WA_StyledBackground, true);
|
|---|
| 42 | setMinimumWidth(270);
|
|---|
| 43 |
|
|---|
| 44 | if (fontInfo().pixelSize() > 12) {
|
|---|
| 45 | QFont f = font();
|
|---|
| 46 | f.setPixelSize(12);
|
|---|
| 47 | setFont(f);
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
|---|
| 51 | mediaLabel = new ScrollingLabel(this);
|
|---|
| 52 | resolutionLabel = new QLabel(this);
|
|---|
| 53 | resolutionLabel->setObjectName("panel-resolution");
|
|---|
| 54 | resolutionLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
|---|
| 55 | repeatButton = new MyButton(this);
|
|---|
| 56 | shuffleButton = new MyButton(this);
|
|---|
| 57 | seeker = new PanelTimeSeeker;
|
|---|
| 58 | seeker->setObjectName("panel-seeker");
|
|---|
| 59 | seeker->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Ignored);
|
|---|
| 60 | #ifdef SEEKBAR_RESOLUTION
|
|---|
| 61 | seeker->setRange(0, SEEKBAR_RESOLUTION);
|
|---|
|
|---|