source: smplayer/trunk/src/skingui/mediabarpanel.cpp@ 139

Last change on this file since 139 was 139, checked in by Silvan Scherrer, 13 years ago

SMPlayer: update trunk to 0.8.2

File size: 4.2 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2012 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 "mediabarpanel.h"
21#include "ui_mediabarpanel.h"
22#include "playcontrol.h"
23#include "mediapanel.h"
24#include <QHBoxLayout>
25#include <QLabel>
26#include <QDebug>
27#include "qpropertysetter.h"
28#include "colorutils.h"
29#include "qpropertysetter.h"
30#include "volumecontrolpanel.h"
31
32
33
34MediaBarPanel::MediaBarPanel(QWidget *parent) :
35 QWidget(parent),ui(new Ui::MediaBarPanel),core(0)
36{
37 ui->setupUi(this);
38 setAttribute(Qt::WA_StyledBackground, true);
39 setFixedHeight(53);
40 QHBoxLayout* layout = new QHBoxLayout;
41 playControlPanel = new PlayControl(this);
42 IconSetter::instance()->playControl = playControlPanel;
43 volumeControlPanel = new VolumeControlPanel(this);
44 volumeControlPanel->setObjectName("volume-control-panel");
45 mediaPanel = new MediaPanel(this);
46 mediaPanel->setObjectName("media-panel");
47 IconSetter::instance()->mediaPanel = mediaPanel;
48 layout->setSpacing(0);
49 layout->setContentsMargins(0, 0, 0, 0);
50 layout->addWidget(playControlPanel);
51 layout->addWidget(mediaPanel);
52 layout->addWidget(volumeControlPanel);
53 setLayout(layout);
54
55 connect(volumeControlPanel, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int)));
56 connect(mediaPanel, SIGNAL(seekerChanged(int)), this, SIGNAL(seekerChanged(int)));
57}
58
59MediaBarPanel::~MediaBarPanel()
60{
61 delete ui;
62}
63
64void MediaBarPanel::changeEvent(QEvent *e)
65{
66 QWidget::changeEvent(e);
67 switch (e->type()) {
68 case QEvent::LanguageChange:
69 ui->retranslateUi(this);
70 break;
71 default:
72 break;
73 }
74}
75
76void MediaBarPanel::setToolbarActionCollection(QList<QAction *>actions) {
77 IconSetter::instance()->setToolbarActions(actions);
78}
79
80void MediaBarPanel::setPlayControlActionCollection(QList<QAction *>actions)
81{
82 playControlPanel->setActionCollection(actions);
83}
84
85void MediaBarPanel::setMediaPanelActionCollection(QList<QAction *>actions)
86{
87 mediaPanel->setActionCollection(actions);
88}
89
90void MediaBarPanel::setMplayerState(Core::State state)
91{
92 mediaPanel->setMplayerState((int)state);
93}
94
95void MediaBarPanel::setCore(Core *c)
96{
97 core = c;
98 connect(core, SIGNAL(mediaStartPlay()), this, SLOT(setDuration()) );
99 connect( core, SIGNAL(showTime(double)), this, SLOT(gotCurrentTime(double)) );
100 connect( core, SIGNAL(mediaInfoChanged()), this, SLOT(updateMediaInfo()) );
101 /* connect( core, SIGNAL(buffering()), this, SLOT(setBuffering()) ); */
102}
103
104void MediaBarPanel::setDuration()
105{
106 mediaPanel->setDuration(core->mdat.duration);
107}
108
109void MediaBarPanel::setVolumeControlActionCollection(QList<QAction *>actions)
110{
111 volumeControlPanel->setActionCollection(actions);
112}
113
114void MediaBarPanel::gotCurrentTime(double time)
115{
116 mediaPanel->setElapsedText(Helper::formatTime((int)time));
117}
118
119void MediaBarPanel::updateMediaInfo()
120{
121 mediaPanel->setMediaLabelText(core->mdat.displayName());
122}
123
124void MediaBarPanel::displayMessage(QString status)
125{
126 mediaPanel->setStatusText(status);
127}
128
129void MediaBarPanel::displayPermanentMessage(QString status)
130{
131 mediaPanel->setStatusText(status, 0);
132}
133
134void MediaBarPanel::setRecordAvailable(bool av)
135{
136 playControlPanel->setRecordEnabled(av);
137}
138
139void MediaBarPanel::setBuffering()
140{
141 mediaPanel->setBuffering(true);
142}
143
144void MediaBarPanel::setVolume(int v) {
145 volumeControlPanel->setVolume(v);
146}
147
148void MediaBarPanel::setSeeker(int v) {
149 mediaPanel->setSeeker(v);
150}
151
152#include "moc_mediabarpanel.cpp"
153
Note: See TracBrowser for help on using the repository browser.