Changeset 181 for smplayer/trunk/src/widgetactions.cpp
- Timestamp:
- Aug 31, 2016, 5:31:04 PM (9 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 179
- Property svn:mergeinfo changed
-
smplayer/trunk/src/widgetactions.cpp
r176 r181 19 19 #include "widgetactions.h" 20 20 #include "colorutils.h" 21 #include "helper.h" 21 22 #include <QLabel> 22 23 #include <QDebug> … … 47 48 QList<QWidget *> l = createdWidgets(); 48 49 for (int n=0; n < l.count(); n++) { 49 TimeSlider *s = (TimeSlider*) l[n]; 50 s->setEnabled(b);; 50 l[n]->setEnabled(b); 51 51 } 52 52 setEnabled(b); … … 204 204 205 205 206 TimeLabelAction::TimeLabelAction( QWidget * parent )206 TimeLabelAction::TimeLabelAction(TimeLabelType type, QWidget * parent ) 207 207 : MyWidgetAction(parent) 208 208 { 209 label_type = type; 210 current_time = 0; 211 total_time = 0; 212 updateText(); 209 213 } 210 214 … … 212 216 } 213 217 218 void TimeLabelAction::setCurrentTime(double t) { 219 current_time = t; 220 updateText(); 221 } 222 223 void TimeLabelAction::setTotalTime(double t) { 224 total_time = t; 225 updateText(); 226 } 227 228 void TimeLabelAction::updateText() { 229 QString ct = Helper::formatTime(current_time); 230 QString tt = Helper::formatTime(total_time); 231 QString rt; 232 if (total_time < 1) rt = "00:00:00"; else rt = "-" + Helper::formatTime(total_time - current_time); 233 234 switch (label_type) { 235 case CurrentTime: setText(ct); break; 236 case TotalTime: setText(tt); break; 237 case CurrentAndTotalTime: setText(ct + " / " + tt); break; 238 case RemainingTime: setText(rt); break; 239 } 240 } 241 214 242 void TimeLabelAction::setText(QString s) { 215 _text = s;243 current_text = s; 216 244 emit newText(s); 217 245 } … … 220 248 QLabel * time_label = new QLabel(parent); 221 249 time_label->setObjectName("time_label"); 222 time_label->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); 223 time_label->setAutoFillBackground(true); 224 225 ColorUtils::setBackgroundColor( time_label, QColor(0,0,0) ); 226 ColorUtils::setForegroundColor( time_label, QColor(255,255,255) ); 227 time_label->setText( "00:00:00 / 00:00:00" ); 228 time_label->setFrameShape( QFrame::Panel ); 229 time_label->setFrameShadow( QFrame::Sunken ); 250 time_label->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); 251 //time_label->setAutoFillBackground(true); 252 253 //ColorUtils::setBackgroundColor( time_label, QColor(0,0,0) ); 254 //ColorUtils::setForegroundColor( time_label, QColor(255,255,255) ); 255 256 if (current_text.isEmpty()) current_text = "00:00:00 / 00:00:00"; 257 time_label->setText(current_text); 258 259 //time_label->setFrameShape( QFrame::Panel ); 260 //time_label->setFrameShadow( QFrame::Sunken ); 230 261 231 262 connect( this, SIGNAL(newText(QString)),
Note:
See TracChangeset
for help on using the changeset viewer.