Ticket #4115: 4115-v1.patch
File 4115-v1.patch, 8.4 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/tv_play.h
96 96 97 97 // User input processing commands 98 98 void ProcessKeypress(QKeyEvent *e); 99 void processNetworkControlCommand(QStringcommand);99 void ProcessNetworkControlCommand(const QString &command); 100 100 void customEvent(QCustomEvent *e); 101 101 bool HandleTrackAction(const QString &action); 102 102 -
libs/libmythtv/tv_play.cpp
55 55 const int TV::kInputModeTimeout=5000; 56 56 57 57 #define DEBUG_CHANNEL_PREFIX 0 /**< set to 1 to channel prefixing */ 58 #define DEBUG_ACTIONS 0/**< set to 1 to debug actions */58 #define DEBUG_ACTIONS 1 /**< set to 1 to debug actions */ 59 59 #define LOC QString("TV: ") 60 #define LOC_WARN QString("TV Warning: ") 60 61 #define LOC_ERR QString("TV Error: ") 61 62 62 63 /* … … 135 136 QStringList recTitles; 136 137 QString buttonTitle; 137 138 vector<ProgramInfo *>::iterator it = reclist->begin(); 139 recTitles.append(tr("Exit")); 138 140 while (it != reclist->end()) 139 141 { 140 142 p = *it; … … 149 151 tr("All Tuners are Busy.\n" 150 152 "Select a Current Recording"), 151 153 recTitles, 1); 152 if ( ret == -1)154 if ((0 < ret) && (ret <= reclist->size())) 153 155 { 154 quitAll = true; 156 p = reclist->at(ret-1); 157 curProgram = new ProgramInfo(*p); 155 158 } 156 159 else 157 160 { 158 p = reclist->at(ret); 159 curProgram = new ProgramInfo(*p); 161 quitAll = true; 160 162 } 161 163 } 162 164 } … … 1677 1679 void TV::RunTV(void) 1678 1680 { 1679 1681 paused = false; 1680 QKeyEvent *keypressed;1681 QString netCmd;1682 1682 1683 1683 doing_ff_rew = 0; 1684 1684 ff_rew_index = kInitFFRWSpeed; … … 1767 1767 getRecorderPlaybackInfo = false; 1768 1768 } 1769 1769 1770 if (nvp && (keyList.count() > 0)) 1771 { 1770 bool had_key = false; 1771 if (nvp) 1772 { 1773 QKeyEvent *keypressed = NULL; 1774 1772 1775 keyListLock.lock(); 1773 keypressed = keyList.first(); 1774 keyList.removeFirst(); 1776 if (keyList.count() > 0) 1777 { 1778 keypressed = keyList.first(); 1779 keyList.removeFirst(); 1780 } 1775 1781 keyListLock.unlock(); 1776 1782 1777 ProcessKeypress(keypressed); 1778 delete keypressed; 1783 if (keypressed) 1784 { 1785 had_key = true; 1786 ProcessKeypress(keypressed); 1787 delete keypressed; 1788 } 1779 1789 } 1780 1790 1781 netCmd = ""; 1782 ncLock.lock(); 1783 if (networkControlCommands.size()) 1791 if (nvp && !had_key && !ignoreKeys) 1784 1792 { 1785 netCmd = networkControlCommands.front(); 1786 networkControlCommands.pop_front(); 1793 QString netCmd = QString::null; 1794 ncLock.lock(); 1795 if (networkControlCommands.size()) 1796 { 1797 netCmd = networkControlCommands.front(); 1798 networkControlCommands.pop_front(); 1799 } 1800 ncLock.unlock(); 1801 1802 if (!netCmd.isEmpty()) 1803 ProcessNetworkControlCommand(netCmd); 1787 1804 } 1788 ncLock.unlock();1789 1805 1790 if (netCmd != "")1791 processNetworkControlCommand(netCmd);1792 1793 1806 if ((recorder && recorder->GetErrorStatus()) || 1794 1807 (nvp && nvp->IsErrored()) || IsErrored()) 1795 1808 { … … 3119 3132 } 3120 3133 } 3121 3134 3122 void TV:: processNetworkControlCommand(QStringcommand)3135 void TV::ProcessNetworkControlCommand(const QString &command) 3123 3136 { 3137 #ifdef DEBUG_ACTIONS 3138 VERBOSE(VB_IMPORTANT, LOC + "ProcessNetworkControlCommand(" + 3139 QString("%1)").arg(command)); 3140 #endif 3141 3124 3142 QStringList tokens = QStringList::split(" ", command); 3143 if (tokens.size() < 2) 3144 { 3145 VERBOSE(VB_IMPORTANT, LOC_ERR + "Not enough tokens" 3146 "in network control command" + "\n\t\t\t" + 3147 QString("'%1'").arg(command)); 3148 return; 3149 } 3125 3150 3151 if (!dialogname.isEmpty()) 3152 { 3153 VERBOSE(VB_IMPORTANT, LOC_WARN + "Ignoring network " 3154 "control command\n\t\t\t" + 3155 QString("because dialog '%1'").arg(dialogname) + 3156 "is waiting for a response"); 3157 return; 3158 } 3159 3126 3160 if (tokens[1] != "QUERY") 3127 3161 ClearOSD(); 3128 3162 3129 3163 if (tokens.size() == 3 && tokens[1] == "CHANID") 3130 3164 { 3131 ChangeChannel(tokens[2].toUInt(), ""); 3165 queuedChanID = tokens[2].toUInt(); 3166 queuedChanNum = QString::null; 3167 CommitQueuedInput(); 3132 3168 } 3133 3169 else if (tokens.size() == 3 && tokens[1] == "CHANNEL") 3134 3170 { 3135 if (tokens[2] == "UP") 3136 ChangeChannel(CHANNEL_DIRECTION_UP); 3137 else if (tokens[2] == "DOWN") 3138 ChangeChannel(CHANNEL_DIRECTION_DOWN); 3139 else if (tokens[2].contains(QRegExp("^[-\\.\\d_#]+$"))) 3140 ChangeChannel(0, tokens[2]); 3171 uint aindx = (activenvp == nvp) ? 0 : 1; 3172 if (StateIsLiveTV(GetState()) && !pseudoLiveTVState[aindx]) 3173 { 3174 if (tokens[2] == "UP") 3175 ChangeChannel(CHANNEL_DIRECTION_UP); 3176 else if (tokens[2] == "DOWN") 3177 ChangeChannel(CHANNEL_DIRECTION_DOWN); 3178 else if (tokens[2].contains(QRegExp("^[-\\.\\d_#]+$"))) 3179 ChangeChannel(0, tokens[2]); 3180 } 3141 3181 } 3142 3182 else if (tokens.size() == 3 && tokens[1] == "SPEED") 3143 3183 { … … 3219 3259 } 3220 3260 else if (tokens[2].contains(QRegExp("^\\d+\\/\\d+x$"))) 3221 3261 { 3262 if (activerbuffer->InDVDMenuOrStillFrame()) 3263 return; 3264 3222 3265 if (paused) 3223 3266 DoPause(); 3224 3267 … … 3260 3303 } 3261 3304 else if (tokens.size() >= 3 && tokens[1] == "SEEK" && activenvp) 3262 3305 { 3306 if (activerbuffer->InDVDMenuOrStillFrame()) 3307 return; 3308 3263 3309 if (tokens[2] == "BEGINNING") 3264 3310 DoSeek(-activenvp->GetFramesPlayed(), tr("Jump to Beginning")); 3265 3311 else if (tokens[2] == "FORWARD") … … 5718 5764 if ((tokens[1] != "ANSWER") && (tokens[1] != "RESPONSE")) 5719 5765 { 5720 5766 ncLock.lock(); 5721 networkControlCommands.push_back( message);5767 networkControlCommands.push_back(QDeepCopy<QString>(message)); 5722 5768 ncLock.unlock(); 5723 5769 } 5724 5770 } -
programs/mythfrontend/networkcontrol.cpp
261 261 if (result != "") 262 262 { 263 263 nrLock.lock(); 264 networkControlReplies.push_back( result);264 networkControlReplies.push_back(QDeepCopy<QString>(result)); 265 265 nrLock.unlock(); 266 266 267 267 notifyDataAvailable(); … … 296 296 client = s; 297 297 cs = os; 298 298 299 ncLock.lock(); 299 300 networkControlCommands.clear(); 301 ncLock.unlock(); 302 303 nrLock.lock(); 300 304 networkControlReplies.clear(); 305 nrLock.unlock(); 301 306 302 307 welcomeStr = "MythFrontend Network Control\r\n"; 303 308 if (closedOldConn) … … 332 337 lineIn.replace(QRegExp("[\r\n]"), ""); 333 338 lineIn.replace(QRegExp("^\\s"), ""); 334 339 340 if (lineIn.isEmpty()) 341 continue; 342 335 343 tokens = QStringList::split(" ", lineIn); 336 344 337 345 ncLock.lock(); 338 networkControlCommands.push_back( lineIn);346 networkControlCommands.push_back(QDeepCopy<QString>(lineIn)); 339 347 ncCond.wakeOne(); 340 348 ncLock.unlock(); 341 349 } … … 831 839 for (unsigned int i = 3; i < tokens.size(); i++) 832 840 response += QString(" ") + tokens[i]; 833 841 nrLock.lock(); 834 networkControlReplies.push_back( response);842 networkControlReplies.push_back(QDeepCopy<QString>(response)); 835 843 nrLock.unlock(); 836 844 837 845 notifyDataAvailable();