Ticket #817: clock.2.diff
File clock.2.diff, 5.3 KB (added by , 18 years ago) |
---|
-
themes/G.A.N.T./ui.xml
1223 1223 </textarea> 1224 1224 </container> 1225 1225 1226 <container name="clock"> 1227 <textarea name="clocktext" drawoder="0"> 1228 <area>630,8,170,35</area> 1229 <font>title</font> 1230 <value>h:mm AP</value> 1231 </textarea> 1232 </container> 1233 1226 1234 <container name="selector"> 1227 1235 <area>0,50,800,310</area> 1228 1236 <listarea name="toptitles" draworder="2"> -
themes/blue/ui.xml
774 774 </textarea> 775 775 </container> 776 776 777 <container name="clock"> 778 <textarea name="clocktext" drawoder="0"> 779 <area>650,4,150,35</area> 780 <font>title</font> 781 <value>h:mm AP</value> 782 </textarea> 783 </container> 784 777 785 <container name="cur_group"> 778 786 <context>0</context> 779 787 <area>20,10,280,35</area> -
programs/mythfrontend/playbackbox.cpp
252 252 generatePreviewPixmap = gContext->GetNumSetting("GeneratePreviewPixmaps"); 253 253 dateformat = gContext->GetSetting("DateFormat", "ddd MMMM d"); 254 254 timeformat = gContext->GetSetting("TimeFormat", "h:mm AP"); 255 showClock = gContext->GetNumSetting("ShowClock", 1); 255 256 256 257 nvp = NULL; 257 258 timer = new QTimer(this); … … 265 266 timer->start(500); 266 267 gContext->addListener(this); 267 268 269 if (showClock) 270 { 271 LayerSet *container = theme->GetSet("clock"); 272 if (container) 273 { 274 UITextType *text = (UITextType*) container->GetType("clocktext"); 275 if (text) 276 { 277 clockRect = text->getScreenArea(); 278 clockformat = text->GetDefaultText(); 279 clockTimer = new QTimer(this); 280 connect(clockTimer, SIGNAL(timeout()), this, SLOT(updateClock())); 281 clockTimer->start(100); 282 } 283 else 284 { 285 showClock = FALSE; 286 } 287 } 288 else 289 { 290 showClock = FALSE; 291 } 292 } 293 268 294 freeSpaceTimer = new QTimer(this); 269 295 connect(freeSpaceTimer, SIGNAL(timeout()), this, 270 296 SLOT(setUpdateFreeSpace())); … … 489 515 setPaletteBackgroundPixmap(myBackground); 490 516 } 491 517 518 void PlaybackBox::updateClock(void) 519 { 520 LayerSet *container = theme->GetSet("clock"); 521 if (container) 522 { 523 UITextType *text = (UITextType*) container->GetType("clocktext"); 524 if (text) 525 { 526 QPainter tmp(this); 527 QPixmap pix(clockRect.size()); 528 pix.fill(this, clockRect.topLeft()); 529 tmp.drawPixmap(clockRect.topLeft(), pix); 530 531 QDateTime now = QDateTime::currentDateTime(); 532 533 if (clockformat.contains('s')) 534 { 535 clockTimer->start(1000); 536 } 537 else 538 { 539 QDateTime nextMin = QDateTime(now.date(), QTime(now.time().hour(), 540 now.time().minute())).addSecs(60); 541 clockTimer->start(1000*(now.secsTo(nextMin)) + 500); 542 } 543 544 QString timeStr = now.toString(clockformat); 545 text->SetText(timeStr); 546 547 if(type != Delete) 548 { 549 text->Draw(&tmp, 0, 0); 550 } 551 else 552 { 553 text->Draw(&tmp, 0, 1); 554 } 555 tmp.end(); 556 } 557 } 558 } 559 492 560 void PlaybackBox::paintEvent(QPaintEvent *e) 493 561 { 494 562 if (e->erased()) … … 522 590 updateVideo(&p); 523 591 } 524 592 593 if (showClock && r.intersects(clockRect)) 594 { 595 clockTimer->start(100); 596 } 597 525 598 skipCnt--; 526 599 if (skipCnt < 0) 527 600 { … … 1903 1976 state = kKilling; // stop preview playback and don't restart it 1904 1977 playingSomething = true; 1905 1978 1979 if (showClock) 1980 clockTimer->stop(); 1981 1906 1982 tv->setLastProgram(lastProgram); 1907 1983 1908 1984 if (tv->Playback(tvrec)) … … 1944 2020 1945 2021 lastProgram = new ProgramInfo(*tvrec); 1946 2022 2023 if (showClock) 2024 clockTimer->start(100); 2025 1947 2026 playingSomething = false; 1948 2027 state = kStarting; // restart playback preview 1949 2028 setEnabled(true); -
programs/mythfrontend/playbackbox.h
43 43 44 44 protected slots: 45 45 void timeout(void); 46 void updateClock(void); 46 47 47 48 void cursorLeft(); 48 49 void cursorRight(); … … 259 260 QString dateformat; 260 261 QString timeformat; 261 262 263 bool showClock; 264 QTimer *clockTimer; 265 QString clockformat; 266 262 267 void grayOut(QPainter *); 263 268 void updateBackground(void); 264 269 void updateVideo(QPainter *); … … 287 292 QRect usageRect; 288 293 QRect videoRect; 289 294 QRect curGroupRect; 295 QRect clockRect; 290 296 291 297 QTimer *fillListTimer; 292 298 int listsize;