Ticket #157: mythtv.diff
| File mythtv.diff, 28.7 KB (added by , 21 years ago) |
|---|
-
libs/libmyth/lcddevice.cpp
10 10 #include "lcddevice.h" 11 11 #include "mythcontext.h" 12 12 #include "mythdialogs.h" 13 #include "mythdbcon.h" 14 #include "../libmythtv/tv.h" 13 15 14 16 #include <unistd.h> 15 17 #include <cmath> … … 30 32 #define LCD_VERSION_4 1 31 33 #define LCD_VERSION_5 2 32 34 35 #define LCD_RECSTATUS_TIME 10000 36 #define LCD_TIME_TIME 5000 37 #define LCD_SCROLLLIST_TIME 2000 38 33 39 LCD::LCD() 34 40 :QObject(NULL, "LCD") 35 41 { … … 68 74 connected = FALSE; 69 75 send_buffer = ""; 70 76 lcdMenuItems = new QPtrList<LCDMenuItem>; 71 77 lcdMenuItems->setAutoDelete(true); 78 72 79 timeTimer = new QTimer(this); 73 80 connect(timeTimer, SIGNAL(timeout()), this, SLOT(outputTime())); 74 81 … … 104 111 105 112 retryTimer = new QTimer(this); 106 113 connect(retryTimer, SIGNAL(timeout()), this, SLOT(restartConnection())); 114 115 recStatusTimer = new QTimer(this); 116 connect(recStatusTimer, SIGNAL(timeout()), this, SLOT(outputRecStatus())); 117 118 scrollListTimer = new QTimer(this); 119 connect(scrollListTimer, SIGNAL(timeout()), this, SLOT(scrollList())); 120 121 gContext->addListener(this); 122 123 isRecording = false; 107 124 } 108 125 109 126 bool LCD::m_server_unavailable = false; … … 138 155 m_server_unavailable = false; 139 156 } 140 157 } 141 142 158 } 143 159 144 160 bool LCD::connectToHost(const QString &lhostname, unsigned int lport) … … 268 284 case LOW: 269 285 aString += QString::number (prioLow); 270 286 break; 287 case OFF: 288 aString += QString::number (prioOff); 289 break; 290 271 291 } 272 292 273 293 sendToServer (aString); … … 363 383 prioHigh = 240; 364 384 prioMedium = 248; 365 385 prioLow = 252; 386 prioOff = 255; 366 387 if (protocolVersion == "0.3") { 367 388 if (serverVersion.startsWith ("CVS-current")) { 368 389 // Latest CVS versions of LCDd has priorities switched … … 371 392 prioHigh = 240; 372 393 prioMedium = 128; 373 394 prioLow = 64; 395 prioOff = 0; 374 396 } 375 397 } 376 398 … … 382 404 383 405 tempString = *it; 384 406 setHeight(tempString.toInt()); 385 386 407 it++; // the string "cellwid" 387 408 it++; // Cell width in pixels; 388 409 … … 449 470 lcd_showgeneric=(gContext->GetSetting("LCDShowGeneric", "1")=="1"); 450 471 lcd_showvolume=(gContext->GetSetting("LCDShowVolume", "1")=="1"); 451 472 lcd_showmenu=(gContext->GetSetting("LCDShowMenu", "1")=="1"); 473 lcd_showrecstatus=(gContext->GetSetting("LCDShowRecStatus", "1")=="1"); 452 474 lcd_backlighton=(gContext->GetSetting("LCDBacklightOn", "1")=="1"); 453 475 lcd_heartbeaton=(gContext->GetSetting("LCDHeartBeatOn", "1")=="1"); 454 476 aString = gContext->GetSetting("LCDPopupTime", "5"); … … 461 483 462 484 sendToServer("client_set name Myth"); 463 485 sendToServer("client_add_key ABCDEF"); 464 486 465 487 // Create all the screens and widgets (when we change activity in the myth 466 488 // program, we just swap the priorities of the screens to show only the 467 489 // "current one") … … 486 508 sendToServer("screen_set Menu backlight on"); 487 509 sendToServer("widget_add Menu topWidget string"); 488 510 for (unsigned int i = 1; i < lcdHeight; i++) { 489 aString = "widget_add Menu menuWidget";490 aString += QString::number (i);491 aString += " string";492 sendToServer(aString);511 aString = "widget_add Menu menuWidget"; 512 aString += QString::number (i); 513 aString += " string"; 514 sendToServer(aString); 493 515 } 494 516 495 517 // The Music Screen … … 522 544 sendToServer("widget_add Channel topWidget string"); 523 545 sendToServer("widget_add Channel botWidget string"); 524 546 sendToServer("widget_add Channel progressBar hbar"); 525 547 526 548 // The Generic Screen 527 549 528 550 sendToServer("screen_add Generic"); … … 544 566 sendToServer("widget_add Volume botWidget string"); 545 567 sendToServer("widget_add Volume progressBar hbar"); 546 568 569 // The Recording Status Screen 570 571 sendToServer("screen_add RecStatus"); 572 setHeartbeat ("RecStatus", lcd_heartbeaton); 573 setPriority("RecStatus", LOW); 574 sendToServer("screen_set RecStatus backlight on"); 575 sendToServer("widget_add RecStatus textWidget1 string"); 576 sendToServer("widget_add RecStatus textWidget2 string"); 577 sendToServer("widget_add RecStatus textWidget3 string"); 578 sendToServer("widget_add RecStatus progressBar hbar"); 579 547 580 lcd_ready = true; 548 581 582 updateRecordingList(); 583 549 584 switchToTime(); // clock is on by default 550 585 551 586 // send buffer if there's anything in there … … 603 638 prioHigh = 240; 604 639 prioMedium = 248; 605 640 prioLow = 252; 641 prioOff = 0; 606 642 } else { 607 643 pVersion = LCD_VERSION_5; 608 644 prioTop = 252; … … 610 646 prioHigh = 240; 611 647 prioMedium = 128; 612 648 prioLow = 64; 649 prioOff = 0; 613 650 } 614 651 } 615 652 … … 627 664 VERBOSE(VB_GENERAL, QString("lcddevice: - showmusicitems : %1").arg(lcd_showmusic_items)); 628 665 VERBOSE(VB_GENERAL, QString("lcddevice: - showtime : %1").arg(lcd_showtime)); 629 666 VERBOSE(VB_GENERAL, QString("lcddevice: - showchannel : %1").arg(lcd_showchannel)); 667 VERBOSE(VB_GENERAL, QString("lcddevice: - showrecstatus : %1").arg(lcd_showrecstatus)); 630 668 VERBOSE(VB_GENERAL, QString("lcddevice: - showgeneric : %1").arg(lcd_showgeneric)); 631 669 VERBOSE(VB_GENERAL, QString("lcddevice: - showvolume : %1").arg(lcd_showvolume)); 632 670 VERBOSE(VB_GENERAL, QString("lcddevice: - showmenu : %1").arg(lcd_showmenu)); … … 658 696 659 697 void LCD::scrollText() 660 698 { 661 if (theMode == 0) 662 outputLeftText("Time", scrollingText.mid(scrollPosition, lcdWidth), 699 if (activeScreen != scrollScreen) 700 return; 701 702 outputLeftText(scrollScreen, scrollingText.mid(scrollPosition, lcdWidth), 663 703 scrollWidget, scrollRow); 664 else if (theMode == 1) 665 outputLeftText("Music", scrollingText.mid(scrollPosition, lcdWidth), 666 scrollWidget, scrollRow); 667 else if (theMode == 2) 668 outputLeftText("Channel", scrollingText.mid(scrollPosition, lcdWidth), 669 scrollWidget, scrollRow); 670 else if (theMode == 3) 671 outputLeftText("Generic", scrollingText.mid(scrollPosition, lcdWidth), 672 scrollWidget, scrollRow); 673 704 674 705 scrollPosition++; 675 706 if (scrollPosition >= scrollingText.length()) 676 707 scrollPosition = 0; 677 708 } 678 709 710 void LCD::scrollList() 711 { 712 if (scrollListItems.count() == 0) 713 return; 714 715 if (activeScreen != scrollListScreen) 716 return; 717 718 outputLeftText(scrollListScreen, scrollListItems[scrollListItem], 719 scrollListWidget, scrollListRow); 720 721 scrollListItem++; 722 if (scrollListItem >= scrollListItems.count()) 723 scrollListItem = 0; 724 } 725 679 726 void LCD::stopAll() 680 727 { 681 728 // The usual reason things would get this far and then lcd_ready being … … 686 733 #endif 687 734 if (lcd_ready) 688 735 { 689 setPriority("Music", LOW); 690 setPriority("Channel", LOW); 691 setPriority("Generic", LOW); 692 setPriority("Volume", LOW); 693 setPriority("Menu", LOW); 736 setPriority("Time", OFF); 737 setPriority("Music", OFF); 738 setPriority("Channel", OFF); 739 setPriority("Generic", OFF); 740 setPriority("Volume", OFF); 741 setPriority("Menu", OFF); 742 setPriority("RecStatus", OFF); 694 743 } 695 744 745 timeTimer->stop(); 696 746 preScrollTimer->stop(); 697 747 scrollTimer->stop(); 698 748 musicTimer->stop(); … … 701 751 popMenuTimer->stop(); 702 752 menuScrollTimer->stop(); 703 753 menuPreScrollTimer->stop(); 754 recStatusTimer->stop(); 755 scrollListTimer->stop(); 756 704 757 unPopMenu(); 705 758 } 706 759 707 760 void LCD::startTime() 708 761 { 709 762 setPriority("Time", MEDIUM); 763 setPriority("RecStatus", LOW); 764 710 765 timeTimer->start(1000, FALSE); 711 766 outputTime(); 712 theMode = 0; 767 activeScreen = "Time"; 768 isTimeVisible = true; 769 770 if (lcd_showrecstatus && isRecording) 771 recStatusTimer->start(LCD_TIME_TIME, FALSE); 713 772 } 714 773 715 774 void LCD::outputText(QPtrList<LCDTextItem> *textItems) … … 732 791 num.setNum(curItem->getRow()); 733 792 734 793 if (curItem->getScroll()) 735 assignScrollingText(curItem->getText(), "textWidget" + num,736 curItem->getRow());794 assignScrollingText(curItem->getText(), curItem->getScreen(), 795 "textWidget" + num, curItem->getRow()); 737 796 else 738 797 { 739 798 switch (curItem->getAlignment()) … … 764 823 QString aString; 765 824 unsigned int x = 0; 766 825 767 x = (int) (rint((lcdWidth - theText.length()) / 2.0) + 1); 768 // Had a problem where I would get something like this: 769 // 2147483633 = (int) (rint((20 - 51) / 2.0) + 1) 770 // so hense this 826 x = (lcdWidth - theText.length()) / 2 + 1; 827 771 828 if (x > lcdWidth) 772 829 x = 1; 773 830 … … 817 874 sendToServer(aString); 818 875 } 819 876 820 void LCD::assignScrollingText(QString theText, QString theWidget, int theRow) 877 void LCD::assignScrollingText(QString theText, QString theScreen, 878 QString theWidget, int theRow) 821 879 { 822 880 // Have to decide what to do with "top line" text given the size 823 881 // of the LCD (as reported by the server) 824 882 883 scrollScreen = theScreen; 825 884 scrollWidget = theWidget; 826 885 scrollRow = theRow; 827 886 828 887 if (theText.length() < lcdWidth) 829 888 { 830 889 // This is trivial, just show the text 831 832 if (theMode == 0) 833 outputCenteredText("Time", theText, theWidget, theRow); 834 else if (theMode == 1) 835 outputCenteredText("Music", theText, theWidget, theRow); 836 else if (theMode == 2) 837 outputCenteredText("Channel", theText, theWidget, theRow); 838 else if (theMode == 3) 839 outputCenteredText("Generic", theText, theWidget, theRow); 890 outputCenteredText(theScreen, theText, theWidget, theRow); 840 891 841 892 scrollTimer->stop(); 842 893 preScrollTimer->stop(); … … 844 895 else 845 896 { 846 897 // Setup for scrolling 847 if (theMode == 0) 848 outputCenteredText("Time", theText.left(lcdWidth), theWidget, 849 theRow); 850 else if (theMode == 1) 851 outputCenteredText("Music", theText.left(lcdWidth), theWidget, 852 theRow); 853 else if (theMode == 2) 854 outputCenteredText("Channel", theText.left(lcdWidth), theWidget, 855 theRow); 856 else if (theMode == 3) 857 outputCenteredText("Generic", theText.left(lcdWidth), theWidget, 858 theRow); 898 outputCenteredText(theScreen, theText.left(lcdWidth), theWidget, theRow); 859 899 860 900 scrollingText = theText; 861 901 scrollPosition = 0; … … 864 904 } 865 905 } 866 906 907 void LCD::assignScrollingList(QStringList theList, QString theScreen, 908 QString theWidget, int theRow) 909 { 910 scrollListScreen = theScreen; 911 scrollListWidget = theWidget; 912 scrollListRow = theRow; 913 scrollListItems = theList; 914 915 scrollListItem = 0; 916 scrollList(); 917 scrollListTimer->start(LCD_SCROLLLIST_TIME, FALSE); 918 } 919 867 920 void LCD::startMusic(QString artist, QString album, QString track) 868 921 { 869 922 QString aString; … … 879 932 aString += " - "; 880 933 } 881 934 aString += track; 882 theMode = 1;883 assignScrollingText(aString );935 activeScreen = "Music"; 936 assignScrollingText(aString, "Music"); 884 937 } 885 938 886 939 void LCD::startChannel(QString channum, QString title, QString subtitle) … … 889 942 if (lcd_showchannel) 890 943 setPriority("Channel", HIGH); 891 944 aString = channum; 892 theMode = 2;893 assignScrollingText(aString, " topWidget", 1);945 activeScreen = "Channel"; 946 assignScrollingText(aString, "Channel", "topWidget", 1); 894 947 aString = title; 895 948 if (subtitle.length() > 0) 896 949 { … … 898 951 aString += subtitle; 899 952 aString += "'"; 900 953 } 901 assignScrollingText(aString, " botWidget", 2);954 assignScrollingText(aString, "Channel", "botWidget", 2); 902 955 if (lcdHeight > 2) 903 956 { 904 957 progress = 0.0; … … 927 980 return; 928 981 929 982 genericTimer->start(500, FALSE); 930 theMode = 3;983 activeScreen = "Generic"; 931 984 generic_progress = 0.0; 932 985 933 986 // Return if there are no more items … … 937 990 // Todo, make scrolling definable in LCDTextItem 938 991 ++it; 939 992 940 theMode = 3; 941 assignScrollingText(curItem->getText(), "textWidget1", curItem->getRow()); 993 assignScrollingText(curItem->getText(), "Generic", "textWidget1", curItem->getRow()); 942 994 943 995 outputGeneric(); 944 996 … … 1365 1417 { 1366 1418 // Stop the scrolling timer 1367 1419 menuScrollTimer->stop(); 1368 setPriority("Menu", LOW);1420 setPriority("Menu", OFF); 1369 1421 } 1370 1422 1371 1423 void LCD::setLevels(int numbLevels, float *values) … … 1462 1514 1463 1515 void LCD::outputTime() 1464 1516 { 1517 if (isRecording) 1518 outputCenteredText("Time", tr("RECORDING"), "topWidget", 1); 1519 else 1520 outputCenteredText("Time", "", "topWidget", 1); 1521 1465 1522 QString aString; 1466 1523 int x, y; 1467 1524 1468 1525 if (lcdHeight < 3) 1469 1526 y = 2; 1470 1527 else 1471 1528 y = (int) rint(lcdHeight / 2) + 1; 1472 1473 x = (int) rint((lcdWidth - 5) / 2) + 1;1474 1529 1530 QString time = QTime::currentTime().toString(timeformat); 1531 x = (lcdWidth - time.length()) / 2 + 1; 1475 1532 aString = "widget_set Time timeWidget "; 1476 1533 aString += QString::number(x); 1477 1534 aString += " "; 1478 1535 aString += QString::number(y); 1479 1536 aString += " \""; 1480 1537 if (lcd_showtime) { 1481 aString += QTime::currentTime().toString(timeformat).left(8)+ "\"";1538 aString += time + "\""; 1482 1539 if (timeFlash) 1483 1540 { 1484 1541 aString = aString.replace(QRegExp(":"), " "); … … 1492 1549 sendToServer(aString); 1493 1550 } 1494 1551 1552 // if one or more recordings are taking place we alternate between 1553 // showing the time and the recording status screen 1554 void LCD::outputRecStatus(void) 1555 { 1556 if (!lcd_ready || !isRecording || !lcd_showrecstatus) 1557 return; 1558 1559 int listTime; 1560 1561 if (isTimeVisible) 1562 { 1563 // switch to the rec status screen 1564 setPriority("RecStatus", MEDIUM); 1565 setPriority("Time", LOW); 1566 1567 timeTimer->stop(); 1568 scrollTimer->stop(); 1569 scrollListTimer->stop(); 1570 listTime = LCD_RECSTATUS_TIME; 1571 isTimeVisible = false; 1572 activeScreen = "RecStatus"; 1573 } 1574 else 1575 { 1576 // switch to the time screen 1577 setPriority("Time", MEDIUM); 1578 setPriority("RecStatus", LOW); 1579 1580 timeTimer->start(1000, FALSE); 1581 scrollTimer->stop(); 1582 scrollListTimer->stop(); 1583 recStatusTimer->start(LCD_TIME_TIME, FALSE); 1584 1585 outputTime(); 1586 activeScreen = "Time"; 1587 isTimeVisible = true; 1588 1589 return; 1590 } 1591 1592 QString aString, status; 1593 QStringList list; 1594 1595 TunerStatus *tuner = tunerList.at(lcdTunerNo); 1596 1597 scrollListItems.clear(); 1598 if (lcdHeight >= 4) 1599 { 1600 outputCenteredText("RecStatus", tr("RECORDING"), "textWidget1", 1); 1601 1602 status = tuner->title; 1603 if (tuner->subTitle != "") 1604 status += " (" + tuner->subTitle + ")"; 1605 1606 list = formatScrollerText(status); 1607 assignScrollingList(list, "RecStatus", "textWidget2", 2); 1608 1609 status = tuner->startTime.toString("hh:mm") + " to " + 1610 tuner->endTime.toString("hh:mm"); 1611 outputCenteredText("RecStatus", status, "textWidget3", 3); 1612 1613 int length = tuner->startTime.secsTo(tuner->endTime); 1614 int delta = tuner->startTime.secsTo(QDateTime::currentDateTime()); 1615 double rec_progress = (double) delta / length; 1616 1617 aString = "widget_set RecStatus progressBar 1 "; 1618 aString += QString::number(lcdHeight); 1619 aString += " "; 1620 aString += QString::number((int)rint(rec_progress * lcdWidth * 1621 cellWidth)); 1622 sendToServer(aString); 1623 1624 listTime = list.count() * LCD_SCROLLLIST_TIME * 2; 1625 } 1626 else 1627 { 1628 status = tr("RECORDING|"); 1629 status += tuner->title; 1630 if (tuner->subTitle != "") 1631 status += "|(" + tuner->subTitle + ")"; 1632 1633 status += "|" + tuner->startTime.toString("hh:mm") + " to " + 1634 tuner->endTime.toString("hh:mm"); 1635 1636 list = formatScrollerText(status); 1637 assignScrollingList(list, "RecStatus", "textWidget1", 1); 1638 1639 int length = tuner->startTime.secsTo(tuner->endTime); 1640 int delta = tuner->startTime.secsTo(QDateTime::currentDateTime()); 1641 double rec_progress = (double) delta / length; 1642 1643 aString = "widget_set RecStatus progressBar 1 "; 1644 aString += QString::number(lcdHeight); 1645 aString += " "; 1646 aString += QString::number((int)rint(rec_progress * lcdWidth * 1647 cellWidth)); 1648 sendToServer(aString); 1649 1650 listTime = list.count() * LCD_SCROLLLIST_TIME * 2; 1651 } 1652 1653 recStatusTimer->start(listTime, FALSE); 1654 1655 if (lcdTunerNo < (int) tunerList.count() - 1) 1656 lcdTunerNo++; 1657 else 1658 lcdTunerNo = 0; 1659 } 1660 1661 void LCD::outputScrollerText(QString theScreen, QString theText, 1662 QString widget, int top, int bottom) 1663 { 1664 QString aString; 1665 aString = "widget_set " + theScreen + " " + widget; 1666 aString += " 1 "; 1667 aString += QString::number(top) + " "; 1668 aString += QString::number(lcdWidth) + " "; 1669 aString += QString::number(bottom); 1670 aString += " v 8 \"" + theText + "\""; 1671 1672 sendToServer(aString); 1673 } 1674 1675 QStringList LCD::formatScrollerText(const QString &text) 1676 { 1677 QString separators = " |-_/:('<~"; 1678 QStringList lines; 1679 1680 int lastSplit = 0; 1681 QString line = ""; 1682 1683 for (uint x = 0; x < text.length(); x++) 1684 { 1685 if (separators.contains(text[x]) > 0) 1686 lastSplit = line.length(); 1687 1688 line += text[x]; 1689 if (line.length() > lcdWidth || text[x] == '|') 1690 { 1691 QString formatedLine; 1692 formatedLine.fill(' ', lcdWidth); 1693 formatedLine = formatedLine.replace((lcdWidth - lastSplit) / 2, 1694 lastSplit, line.left(lastSplit)); 1695 1696 lines.append(formatedLine); 1697 1698 if (line[lastSplit] == ' ' || line[lastSplit] == '|') 1699 line = line.mid(lastSplit + 1); 1700 else 1701 line = line.mid(lastSplit); 1702 1703 lastSplit = lcdWidth; 1704 } 1705 } 1706 1707 // make sure we add the last line 1708 QString formatedLine; 1709 formatedLine.fill(' ', lcdWidth); 1710 formatedLine = formatedLine.replace((lcdWidth - line.length()) / 2, 1711 line.length(), line); 1712 1713 lines.append(formatedLine); 1714 1715 // for (uint x = 0; x < lines.count(); x++) 1716 // cout << "*" << lines[x] << "*" << endl; 1717 1718 return lines; 1719 } 1720 1495 1721 void LCD::outputMusic() 1496 1722 { 1497 1723 QString aString; … … 1633 1859 if (!lcd_ready) 1634 1860 return; 1635 1861 stopAll(); 1862 1636 1863 #if LCD_DEVICE_DEBUG > 1 1637 1864 cout << "lcddevice: switchToNothing " << endl ; 1638 1865 #endif … … 1685 1912 sendToServer("widget_del Time topWidget"); 1686 1913 sendToServer("screen_del Time"); 1687 1914 1915 sendToServer("widget_del RecStatus textWidget1"); 1916 sendToServer("widget_del RecStatus textWidget2"); 1917 sendToServer("widget_del RecStatus textWidget3"); 1918 sendToServer("widget_del RecStatus progressBar"); 1919 1688 1920 socket->close(); 1689 1921 1690 1922 lcd_ready = false; … … 1706 1938 } 1707 1939 if (lcdMenuItems) 1708 1940 delete lcdMenuItems; 1941 1942 gContext->removeListener(this); 1709 1943 } 1710 1944 1945 void LCD::customEvent(QCustomEvent *e) 1946 { 1947 if ((MythEvent::Type)(e->type()) == MythEvent::MythEventMessage) 1948 { 1949 MythEvent *me = (MythEvent *) e; 1950 1951 if (me->Message().left(21) == "RECORDING_LIST_CHANGE") 1952 { 1953 if (lcd_showrecstatus) 1954 { 1955 updateRecordingList(); 1956 1957 if (isRecording) 1958 outputRecStatus(); 1959 else 1960 { 1961 setPriority("Time", MEDIUM); 1962 setPriority("RecStatus", LOW); 1963 1964 timeTimer->start(1000, FALSE); 1965 1966 outputTime(); 1967 activeScreen = "Time"; 1968 isTimeVisible = true; 1969 } 1970 } 1971 } 1972 } 1973 } 1974 1975 void LCD::updateRecordingList(void) 1976 { 1977 if (!gContext->IsConnectedToMaster()) 1978 { 1979 VERBOSE(VB_IMPORTANT, "LCD: Cannot get recording status " 1980 "- not connected to master server?"); 1981 return; 1982 } 1983 1984 tunerList.clear(); 1985 isRecording = false; 1986 1987 QStringList strlist; 1988 1989 // are we currently recording 1990 QString querytext = QString("SELECT cardid FROM capturecard;"); 1991 MSqlQuery query(MSqlQuery::InitCon()); 1992 query.exec(querytext); 1993 QString Status = ""; 1994 1995 if (query.isActive() && query.numRowsAffected()) 1996 { 1997 while(query.next()) 1998 { 1999 QString status = ""; 2000 int cardid = query.value(0).toInt(); 2001 int state = kState_ChangingState; 2002 QString channelName = ""; 2003 QString title = ""; 2004 QString subtitle = ""; 2005 QDateTime dtStart = QDateTime(); 2006 QDateTime dtEnd = QDateTime(); 2007 2008 QString cmd = QString("QUERY_REMOTEENCODER %1").arg(cardid); 2009 2010 while (state == kState_ChangingState) 2011 { 2012 strlist = cmd; 2013 strlist << "GET_STATE"; 2014 gContext->SendReceiveStringList(strlist); 2015 VERBOSE(VB_IMPORTANT, 2016 QString("cardid: %1 state: %2").arg(cardid).arg(strlist[0])); 2017 2018 state = strlist[0].toInt(); 2019 if (state == kState_ChangingState) 2020 usleep(500); 2021 //qApp->processEvents(); 2022 } 2023 2024 if (state == kState_RecordingOnly || state == kState_WatchingRecording) 2025 { 2026 isRecording = true; 2027 2028 strlist = QString("QUERY_RECORDER %1").arg(cardid); 2029 strlist << "GET_RECORDING"; 2030 gContext->SendReceiveStringList(strlist); 2031 title = strlist[0]; 2032 subtitle = strlist[1]; 2033 channelName = strlist[7]; 2034 dtStart.setTime_t((uint)atoi(strlist[11].ascii())); 2035 dtEnd.setTime_t((uint)atoi(strlist[12].ascii())); 2036 } 2037 else 2038 continue; 2039 2040 TunerStatus *tuner = new TunerStatus; 2041 tuner->id = cardid; 2042 tuner->isRecording = (state == kState_RecordingOnly || 2043 state == kState_WatchingRecording); 2044 tuner->channel = channelName; 2045 tuner->title = title; 2046 tuner->subTitle = subtitle; 2047 tuner->startTime = dtStart; 2048 tuner->endTime = dtEnd; 2049 tunerList.append(tuner); 2050 } 2051 } 2052 2053 lcdTunerNo = 0; 2054 } -
libs/libmyth/lcddevice.h
107 107 108 108 static bool m_server_unavailable; 109 109 static class LCD * m_lcd; 110 110 111 void customEvent(QCustomEvent *e); 112 111 113 public: 112 114 ~LCD(); 113 115 … … 197 199 void outputChannel(); // Longer timer (progress bar) 198 200 void outputGeneric(); // Longer timer (progress bar) 199 201 void outputVolume(); 200 202 void outputRecStatus(); 201 203 void scrollMenuText(); // Scroll the menu items if need be 202 204 void beginScrollingMenuText(); // But only after a bit of time has gone by 203 205 void scrollText(); // Scroll the topline text 204 206 void beginScrollingText(); // But only after a bit of time has gone by 205 207 void unPopMenu(); // Remove the Pop Menu display 206 208 void scrollList(); // display a list line by line 209 207 210 private: 208 211 void outputCenteredText(QString theScreen, QString theText, 209 212 QString widget = "topWidget", int row = 1); … … 212 215 QString widget = "topWidget", int row = 1); 213 216 void outputRightText(QString theScreen, QString theText, 214 217 QString widget = "topWidget", int row = 1); 218 219 void outputScrollerText(QString theScreen, QString theText, 220 QString widget = "scroller", int top = 1, int bottom = 1); 221 222 QStringList formatScrollerText(const QString &text); 215 223 224 216 225 void sendToServer(const QString &someText); 217 226 218 enum PRIORITY {TOP, URGENT, HIGH, MEDIUM, LOW };227 enum PRIORITY {TOP, URGENT, HIGH, MEDIUM, LOW, OFF}; 219 228 void setPriority(const QString &screen, PRIORITY priority); 220 229 221 230 void setHeartbeat (const QString &screen, bool onoff); 222 231 223 232 void init(); 224 void assignScrollingText(QString theText, QString theWidget = "topWidget", 225 int theRox = 1); 226 233 void assignScrollingText(QString theText, QString theScreen, 234 QString theWidget = "topWidget", int theRox = 1); 235 void assignScrollingList(QStringList theList, QString theScreen, 236 QString theWidget = "topWidget", int theRow = 1); 237 227 238 void startTime(); 228 239 void startMusic(QString artist, QString album, QString track); 229 240 void startChannel(QString channum, QString title, QString subtitle); … … 234 245 void handleKeyPress(QString key); 235 246 void startVolume(QString app_name); 236 247 237 unsigned int theMode;248 QString activeScreen; 238 249 239 250 QSocket *socket; 240 251 QTimer *LEDTimer; … … 248 259 QTimer *menuPreScrollTimer; 249 260 QTimer *popMenuTimer; 250 261 QTimer *retryTimer; 251 262 QTimer *recStatusTimer; 263 QTimer *scrollListTimer; 264 252 265 void setWidth(unsigned int); 253 266 void setHeight(unsigned int); 254 267 void setCellWidth(unsigned int); … … 261 274 unsigned int prioHigh; 262 275 unsigned int prioMedium; 263 276 unsigned int prioLow; 264 277 unsigned int prioOff; 278 265 279 unsigned int lcdWidth; 266 280 unsigned int lcdHeight; 267 281 unsigned int cellWidth; … … 280 294 QString music_time; 281 295 282 296 QString scrollingText; 283 QString scroll Widget;297 QString scrollScreen, scrollWidget; 284 298 int scrollRow; 285 299 unsigned int scrollPosition; 286 300 QString timeformat; 301 302 QStringList scrollListItems; 303 QString scrollListScreen, scrollListWidget; 304 int scrollListRow; 305 unsigned int scrollListItem; 287 306 288 307 unsigned int menuScrollPosition; 289 308 QPtrList<LCDMenuItem> *lcdMenuItems; … … 304 323 bool lcd_showmusic; 305 324 bool lcd_showchannel; 306 325 bool lcd_showvolume; 326 bool lcd_showrecstatus; 307 327 bool lcd_backlighton; 308 328 bool lcd_heartbeaton; 309 329 int lcd_popuptime; 310 330 QString lcd_showmusic_items; 311 331 312 332 int (*GetLEDMask)(void); 333 334 // recording status stuff 335 typedef struct 336 { 337 int id; 338 bool isRecording; 339 QString channel, title, subTitle; 340 QDateTime startTime, endTime; 341 } TunerStatus; 342 343 void updateRecordingList(void); 344 345 bool isRecording; 346 bool isTimeVisible; 347 int lcdTunerNo; 348 349 QPtrList<TunerStatus> tunerList; 313 350 }; 314 351 315 352 #endif -
programs/mythfrontend/globalsettings.cpp
2469 2469 return gc; 2470 2470 } 2471 2471 2472 static HostCheckBox *LCDShowRecStatus() 2473 { 2474 HostCheckBox *gc = new HostCheckBox("LCDShowRecStatus"); 2475 gc->setLabel(QObject::tr("LCD Displays Recording Status")); 2476 gc->setHelpText(QObject::tr("Display current recordings information.")); 2477 gc->setValue(false); 2478 return gc; 2479 } 2480 2472 2481 static HostCheckBox *LCDShowMenu() 2473 2482 { 2474 2483 HostCheckBox *gc = new HostCheckBox("LCDShowMenu"); … … 2586 2595 setLeft->addChild(LCDShowMusic()); 2587 2596 setLeft->addChild(LCDShowMusicItems()); 2588 2597 setLeft->addChild(LCDShowChannel()); 2598 setRight->addChild(LCDShowRecStatus()); 2589 2599 setRight->addChild(LCDShowVolume()); 2590 2600 setRight->addChild(LCDShowGeneric()); 2591 2601 setRight->addChild(LCDBacklightOn());
