File indexing completed on 2025-02-09 05:31:53
0001 /* This file is part of the KDE project 0002 Copyright (C) 2006 Matthias Kretz <kretz@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Lesser General Public 0006 License as published by the Free Software Foundation; either 0007 version 2.1 of the License, or (at your option) version 3, or any 0008 later version accepted by the membership of KDE e.V. (or its 0009 successor approved by the membership of KDE e.V.), Nokia Corporation 0010 (or its successors, if any) and the KDE Free Qt Foundation, which shall 0011 act as a proxy defined in Section 6 of version 3 of the license. 0012 0013 This library is distributed in the hope that it will be useful, 0014 but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0016 Lesser General Public License for more details. 0017 0018 You should have received a copy of the GNU Lesser General Public 0019 License along with this library. If not, see <http://www.gnu.org/licenses/>. 0020 0021 */ 0022 0023 #ifndef SEEKSLIDER_P_H 0024 #define SEEKSLIDER_P_H 0025 0026 #include <QPointer> 0027 #include <QBoxLayout> 0028 #include <QIcon> 0029 #include <QLabel> 0030 #include <QPixmap> 0031 #include <QStyle> 0032 0033 #include "factory_p.h" 0034 #include "phonondefs_p.h" 0035 #include "platform_p.h" 0036 #include "seekslider.h" 0037 #include "swiftslider_p.h" 0038 0039 #ifndef QT_NO_PHONON_SEEKSLIDER 0040 0041 namespace Phonon 0042 { 0043 class MediaObject; 0044 class SeekSliderPrivate 0045 { 0046 P_DECLARE_PUBLIC(SeekSlider) 0047 protected: 0048 SeekSliderPrivate(SeekSlider *parent) 0049 : layout(QBoxLayout::LeftToRight, parent), 0050 slider(Qt::Horizontal, parent), 0051 iconLabel(parent), 0052 ticking(false) 0053 #ifndef QT_NO_PHONON_PLATFORMPLUGIN 0054 ,icon(Platform::icon(QLatin1String("player-time"), parent->style())) 0055 #endif //QT_NO_PHONON_PLATFORMPLUGIN 0056 { 0057 const int e = parent->style()->pixelMetric(QStyle::PM_ButtonIconSize); 0058 iconSize = QSize(e, e); 0059 0060 slider.setPageStep(5000); // 5 sec 0061 slider.setSingleStep(500); // 0.5 sec 0062 0063 layout.setContentsMargins(QMargins()); 0064 layout.setSpacing(2); 0065 layout.addWidget(&iconLabel, 0, Qt::AlignVCenter); 0066 layout.addWidget(&slider, 0, Qt::AlignVCenter); 0067 0068 setEnabled(false); 0069 0070 if (icon.isNull()) { 0071 iconLabel.setVisible(false); 0072 } 0073 } 0074 0075 SeekSlider *q_ptr; 0076 0077 private: 0078 void setEnabled(bool); 0079 void _k_stateChanged(Phonon::State); 0080 void _k_seek(int); 0081 void _k_tick(qint64); 0082 void _k_length(qint64); 0083 void _k_seekableChanged(bool); 0084 void _k_currentSourceChanged(); 0085 0086 QBoxLayout layout; 0087 SwiftSlider slider; 0088 QLabel iconLabel; 0089 QPointer<MediaObject> media; 0090 bool ticking; 0091 QIcon icon; 0092 QSize iconSize; 0093 }; 0094 } // namespace Phonon 0095 0096 #endif //QT_NO_PHONON_SEEKSLIDER 0097 0098 #endif // SEEKSLIDER_P_H 0099 // vim: sw=4 ts=4 tw=80