Changeset 846 for trunk/demos/spectrum/app/progressbar.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/demos/spectrum/app/progressbar.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 45 45 ProgressBar::ProgressBar(QWidget *parent) 46 46 : QWidget(parent) 47 , m_buffer Duration(0)47 , m_bufferLength(0) 48 48 , m_recordPosition(0) 49 49 , m_playPosition(0) … … 65 65 void ProgressBar::reset() 66 66 { 67 m_buffer Duration= 0;67 m_bufferLength = 0; 68 68 m_recordPosition = 0; 69 69 m_playPosition = 0; … … 87 87 #endif 88 88 89 if (m_buffer Duration) {89 if (m_bufferLength) { 90 90 QRect bar = rect(); 91 const qreal play = qreal(m_playPosition) / m_buffer Duration;91 const qreal play = qreal(m_playPosition) / m_bufferLength; 92 92 bar.setLeft(rect().left() + play * rect().width()); 93 const qreal record = qreal(m_recordPosition) / m_buffer Duration;93 const qreal record = qreal(m_recordPosition) / m_bufferLength; 94 94 bar.setRight(rect().left() + record * rect().width()); 95 95 painter.fillRect(bar, bufferColor); 96 96 97 97 QRect window = rect(); 98 const qreal windowLeft = qreal(m_windowPosition) / m_buffer Duration;98 const qreal windowLeft = qreal(m_windowPosition) / m_bufferLength; 99 99 window.setLeft(rect().left() + windowLeft * rect().width()); 100 const qreal windowWidth = qreal(m_windowLength) / m_buffer Duration;100 const qreal windowWidth = qreal(m_windowLength) / m_bufferLength; 101 101 window.setWidth(windowWidth * rect().width()); 102 102 painter.fillRect(window, windowColor); … … 104 104 } 105 105 106 void ProgressBar::buffer DurationChanged(qint64 bufferSize)106 void ProgressBar::bufferLengthChanged(qint64 bufferSize) 107 107 { 108 m_buffer Duration= bufferSize;108 m_bufferLength = bufferSize; 109 109 m_recordPosition = 0; 110 110 m_playPosition = 0; … … 117 117 { 118 118 Q_ASSERT(recordPosition >= 0); 119 Q_ASSERT(recordPosition <= m_buffer Duration);119 Q_ASSERT(recordPosition <= m_bufferLength); 120 120 m_recordPosition = recordPosition; 121 121 repaint(); … … 125 125 { 126 126 Q_ASSERT(playPosition >= 0); 127 Q_ASSERT(playPosition <= m_buffer Duration);127 Q_ASSERT(playPosition <= m_bufferLength); 128 128 m_playPosition = playPosition; 129 129 repaint(); … … 133 133 { 134 134 Q_ASSERT(position >= 0); 135 Q_ASSERT(position <= m_buffer Duration);136 Q_ASSERT(position + length <= m_buffer Duration);135 Q_ASSERT(position <= m_bufferLength); 136 Q_ASSERT(position + length <= m_bufferLength); 137 137 m_windowPosition = position; 138 138 m_windowLength = length;
Note:
See TracChangeset
for help on using the changeset viewer.