Ticket #4115: 4115-v2.patch
File 4115-v2.patch, 7.3 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 /* … … 1678 1679 void TV::RunTV(void) 1679 1680 { 1680 1681 paused = false; 1681 QKeyEvent *keypressed;1682 QString netCmd;1683 1682 1684 1683 doing_ff_rew = 0; 1685 1684 ff_rew_index = kInitFFRWSpeed; … … 1768 1767 getRecorderPlaybackInfo = false; 1769 1768 } 1770 1769 1771 if (nvp && (keyList.count() > 0)) 1772 { 1770 bool had_key = false; 1771 if (nvp) 1772 { 1773 QKeyEvent *keypressed = NULL; 1774 1773 1775 keyListLock.lock(); 1774 keypressed = keyList.first(); 1775 keyList.removeFirst(); 1776 if (keyList.count() > 0) 1777 { 1778 keypressed = keyList.first(); 1779 keyList.removeFirst(); 1780 } 1776 1781 keyListLock.unlock(); 1777 1782 1778 ProcessKeypress(keypressed); 1779 delete keypressed; 1783 if (keypressed) 1784 { 1785 had_key = true; 1786 ProcessKeypress(keypressed); 1787 delete keypressed; 1788 } 1780 1789 } 1781 1790 1782 netCmd = ""; 1783 ncLock.lock(); 1784 if (networkControlCommands.size()) 1791 if (nvp && !had_key && !ignoreKeys) 1785 1792 { 1786 netCmd = networkControlCommands.front(); 1787 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); 1788 1804 } 1789 ncLock.unlock();1790 1805 1791 if (netCmd != "")1792 processNetworkControlCommand(netCmd);1793 1794 1806 if ((recorder && recorder->GetErrorStatus()) || 1795 1807 (nvp && nvp->IsErrored()) || IsErrored()) 1796 1808 { … … 3120 3132 } 3121 3133 } 3122 3134 3123 void TV:: processNetworkControlCommand(QStringcommand)3135 void TV::ProcessNetworkControlCommand(const QString &command) 3124 3136 { 3137 #ifdef DEBUG_ACTIONS 3138 VERBOSE(VB_IMPORTANT, LOC + "ProcessNetworkControlCommand(" + 3139 QString("%1)").arg(command)); 3140 #endif 3141 3125 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 } 3126 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 3127 3160 if (tokens[1] != "QUERY") 3128 3161 ClearOSD(); 3129 3162 3130 3163 if (tokens.size() == 3 && tokens[1] == "CHANID") 3131 3164 { 3132 ChangeChannel(tokens[2].toUInt(), ""); 3165 queuedChanID = tokens[2].toUInt(); 3166 queuedChanNum = QString::null; 3167 CommitQueuedInput(); 3133 3168 } 3134 3169 else if (tokens.size() == 3 && tokens[1] == "CHANNEL") 3135 3170 { 3136 if (tokens[2] == "UP") 3137 ChangeChannel(CHANNEL_DIRECTION_UP); 3138 else if (tokens[2] == "DOWN") 3139 ChangeChannel(CHANNEL_DIRECTION_DOWN); 3140 else if (tokens[2].contains(QRegExp("^[-\\.\\d_#]+$"))) 3141 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 } 3142 3181 } 3143 3182 else if (tokens.size() == 3 && tokens[1] == "SPEED") 3144 3183 { … … 3220 3259 } 3221 3260 else if (tokens[2].contains(QRegExp("^\\d+\\/\\d+x$"))) 3222 3261 { 3262 if (activerbuffer->InDVDMenuOrStillFrame()) 3263 return; 3264 3223 3265 if (paused) 3224 3266 DoPause(); 3225 3267 … … 3261 3303 } 3262 3304 else if (tokens.size() >= 3 && tokens[1] == "SEEK" && activenvp) 3263 3305 { 3306 if (activerbuffer->InDVDMenuOrStillFrame()) 3307 return; 3308 3264 3309 if (tokens[2] == "BEGINNING") 3265 3310 DoSeek(-activenvp->GetFramesPlayed(), tr("Jump to Beginning")); 3266 3311 else if (tokens[2] == "FORWARD") … … 5719 5764 if ((tokens[1] != "ANSWER") && (tokens[1] != "RESPONSE")) 5720 5765 { 5721 5766 ncLock.lock(); 5722 networkControlCommands.push_back( message);5767 networkControlCommands.push_back(QDeepCopy<QString>(message)); 5723 5768 ncLock.unlock(); 5724 5769 } 5725 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();