author | alwin <alwin> | 2005-04-12 16:35:06 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-04-12 16:35:06 (UTC) |
commit | 4fd936e4096ba9c732bde17a48489bfbb94b19ba (patch) (unidiff) | |
tree | fa96015a24e24298c227bfa19314603debb1586d /noncore/multimedia/opieplayer3/audiowidget.cpp | |
parent | 6df2eb36803e072ea9db62153b762250742610f0 (diff) | |
download | opie-4fd936e4096ba9c732bde17a48489bfbb94b19ba.zip opie-4fd936e4096ba9c732bde17a48489bfbb94b19ba.tar.gz opie-4fd936e4096ba9c732bde17a48489bfbb94b19ba.tar.bz2 |
some gui stuff
may switch if videos will scaled up even if display size is larger than
video size
Diffstat (limited to 'noncore/multimedia/opieplayer3/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer3/audiowidget.cpp | 110 |
1 files changed, 30 insertions, 80 deletions
diff --git a/noncore/multimedia/opieplayer3/audiowidget.cpp b/noncore/multimedia/opieplayer3/audiowidget.cpp index b435c1b..aeebf45 100644 --- a/noncore/multimedia/opieplayer3/audiowidget.cpp +++ b/noncore/multimedia/opieplayer3/audiowidget.cpp | |||
@@ -17,54 +17,12 @@ AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f) | |||
17 | m_MainLayout = new QVBoxLayout(this); | 17 | m_MainLayout = new QVBoxLayout(this); |
18 | m_MainLayout->setAutoAdd(true); | 18 | m_MainLayout->setAutoAdd(true); |
19 | m_InfoBox = new QTextView(this); | 19 | m_InfoBox = new QTextView(this); |
20 | #if 0 | ||
21 | m_PosSlider = new QSlider(QSlider::Horizontal,this); | ||
22 | m_PosSlider->setTickInterval(60); | ||
23 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); | ||
24 | connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); | ||
25 | connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); | ||
26 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); | ||
27 | m_pressed = false; | ||
28 | m_uppos=0; | ||
29 | #endif | ||
30 | } | 20 | } |
31 | 21 | ||
32 | AudioWidget::~AudioWidget() | 22 | AudioWidget::~AudioWidget() |
33 | { | 23 | { |
34 | } | 24 | } |
35 | 25 | ||
36 | void AudioWidget::slotNewPos(int /* pos*/) | ||
37 | { | ||
38 | if (!m_xineLib) return; | ||
39 | #if 0 | ||
40 | if (m_uppos==pos) return; | ||
41 | m_xineLib->seekTo(pos); | ||
42 | #endif | ||
43 | } | ||
44 | |||
45 | void AudioWidget::sliderPressed() | ||
46 | { | ||
47 | #if 0 | ||
48 | m_pressed = true; | ||
49 | #endif | ||
50 | } | ||
51 | |||
52 | void AudioWidget::sliderReleased() | ||
53 | { | ||
54 | #if 0 | ||
55 | m_pressed = false; | ||
56 | #endif | ||
57 | } | ||
58 | |||
59 | void AudioWidget::closeEvent(QCloseEvent*e) | ||
60 | { | ||
61 | odebug << "AudioWidget::closeEvent(QCloseEvent*e)" << oendl; | ||
62 | if (m_xineLib) { | ||
63 | m_xineLib->stop(); | ||
64 | } | ||
65 | QWidget::closeEvent(e); | ||
66 | } | ||
67 | |||
68 | int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | 26 | int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) |
69 | { | 27 | { |
70 | m_current = aLnk; | 28 | m_current = aLnk; |
@@ -75,15 +33,14 @@ int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | |||
75 | if (!m_xineLib) { | 33 | if (!m_xineLib) { |
76 | return -1; | 34 | return -1; |
77 | } | 35 | } |
78 | #if 0 | 36 | int res = m_xineLib->play(m_current.file(),0,0); |
79 | m_uppos=0; | ||
80 | m_PosSlider->setValue(0); | ||
81 | #endif | ||
82 | m_xineLib->setShowVideo(false); | ||
83 | int res = m_xineLib->play(m_current.file()); | ||
84 | if (res != 1) { | 37 | if (res != 1) { |
85 | return -2; | 38 | return -2; |
86 | } | 39 | } |
40 | if (!m_xineLib->hasVideo()) { | ||
41 | m_xineLib->setShowVideo( false ); | ||
42 | } | ||
43 | |||
87 | // title | 44 | // title |
88 | QString title = m_xineLib->metaInfo(0); | 45 | QString title = m_xineLib->metaInfo(0); |
89 | // artist | 46 | // artist |
@@ -92,41 +49,39 @@ int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | |||
92 | QString album = m_xineLib->metaInfo(4); | 49 | QString album = m_xineLib->metaInfo(4); |
93 | 50 | ||
94 | int l = m_xineLib->length(); | 51 | int l = m_xineLib->length(); |
95 | int tmp = l; | 52 | QString laenge = secToString(l); |
96 | #if 0 | 53 | QString text = "<qt><center><table border=\"0\">"; |
97 | m_PosSlider->setRange(0,l); | ||
98 | #endif | ||
99 | QString laenge=""; | ||
100 | int h = l/3600; | ||
101 | l-=h*3600; | ||
102 | int m = l/60; | ||
103 | l-=m*60; | ||
104 | if (h>0) { | ||
105 | laenge+=QString("%1 h").arg(h); | ||
106 | } | ||
107 | if (m>0) { | ||
108 | if (!laenge.isEmpty()) laenge+=" "; | ||
109 | laenge+=QString("%1 m").arg(m); | ||
110 | } | ||
111 | if (l>0) { | ||
112 | if (!laenge.isEmpty()) laenge+=" "; | ||
113 | laenge+=QString("%1 s").arg(l); | ||
114 | } | ||
115 | QString text = "<qt>"; | ||
116 | if (artist.length()) { | 54 | if (artist.length()) { |
117 | text+="<H2><center>"+artist+"</center></h2>"; | 55 | text+="<tr><td>"+tr("Artist: ")+"</td><td><b>"+artist+"</b></td></tr>"; |
118 | } | 56 | } |
119 | if (title.length()) { | 57 | if (title.length()) { |
120 | text+="<H2><center>"+title+"</center></h2>"; | 58 | text+="<tr><td>"+tr("Title: ")+"</td><td><font size=\"+2\">"+title+"</font></td></tr>"; |
121 | } else { | 59 | } else { |
122 | text+="<H2><center>"+m_current.name()+"</center></h2>"; | 60 | text+="<tr><td>"+tr("Filename: ")+"</td><td><b>"+m_current.name()+"</b></td></tr>"; |
123 | } | 61 | } |
124 | if (album.length()) { | 62 | if (album.length()) { |
125 | text+="<H2><center>"+album+"</center></h2>"; | 63 | text+="<tr><td>"+tr("Album: ")+"</td><td><b>"+album+"</b></td></tr>"; |
126 | } | 64 | } |
127 | text+="<h3><center>"+laenge+"</center></h3>"; | 65 | text+="<tr><td>"+tr("Length: ")+"</td><td><b>"+laenge+"</b></td></tr>"; |
66 | text+="</table></center></qt>"; | ||
128 | m_InfoBox->setText(text); | 67 | m_InfoBox->setText(text); |
129 | return tmp; | 68 | return l; |
69 | } | ||
70 | |||
71 | QString AudioWidget::secToString(int sec) | ||
72 | { | ||
73 | int l = sec; | ||
74 | int h = l/3600; | ||
75 | l-=h*3600; | ||
76 | int m = l/60; | ||
77 | l-=m*60; | ||
78 | QString s = ""; | ||
79 | if (h>0) { | ||
80 | s.sprintf("%2i:%2i:%2i",h,m,l); | ||
81 | } else { | ||
82 | s.sprintf("%02i:%02i",m,l); | ||
83 | } | ||
84 | return s; | ||
130 | } | 85 | } |
131 | 86 | ||
132 | void AudioWidget::stopPlaying() | 87 | void AudioWidget::stopPlaying() |
@@ -138,9 +93,4 @@ void AudioWidget::stopPlaying() | |||
138 | 93 | ||
139 | void AudioWidget::updatePos(int /* val */) | 94 | void AudioWidget::updatePos(int /* val */) |
140 | { | 95 | { |
141 | #if 0 | ||
142 | if (m_pressed) return; | ||
143 | m_uppos = val; | ||
144 | m_PosSlider->setValue(val); | ||
145 | #endif | ||
146 | } | 96 | } |