File indexing completed on 2025-01-19 06:54:47
0001 // 0002 // C++ Interface: cCmdQueues 0003 // 0004 // Description: list of all command queues 0005 // 0006 /* 0007 Copyright 2005-2011 Tomas Mecir <kmuddy@kmuddy.com> 0008 0009 This program is free software; you can redistribute it and/or 0010 modify it under the terms of the GNU General Public License as 0011 published by the Free Software Foundation; either version 2 of 0012 the License, or (at your option) any later version. 0013 0014 This program is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU General Public License for more details. 0018 0019 You should have received a copy of the GNU General Public License 0020 along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 0023 #ifndef CCMDQUEUES_H 0024 #define CCMDQUEUES_H 0025 0026 #include <cactionbase.h> 0027 0028 #include <qobject.h> 0029 0030 #include <list> 0031 0032 #include <kmuddy_export.h> 0033 0034 /** 0035 This class stores and manages all the command queues. 0036 0037 @author Tomas Mecir 0038 */ 0039 0040 class cCmdQueue; 0041 class QTimer; 0042 0043 class KMUDDY_EXPORT cCmdQueues : public QObject, public cActionBase 0044 { 0045 Q_OBJECT 0046 public: 0047 /** constructor */ 0048 cCmdQueues (int sess); 0049 /** destructor */ 0050 ~cCmdQueues () override; 0051 0052 /** add a command queue to the list */ 0053 void addQueue (cCmdQueue *queue); 0054 /** remove all command queues */ 0055 void removeAll (); 0056 protected slots: 0057 void timeout (); 0058 protected: 0059 void eventChunkHandler (QString event, int session, cTextChunk *chunk) override; 0060 void eventStringHandler (QString event, int session, QString &par1, const QString &par2) override; 0061 0062 /** react on a line */ 0063 void gotLine (const QString &line); 0064 /** process all queues */ 0065 void processQueues (); 0066 /** process the queue, send all commands that can be sent before waiting */ 0067 void processQueue (cCmdQueue *queue); 0068 0069 std::list<cCmdQueue *> queues; 0070 0071 /** timer for the wait-like commands and slow-walk */ 0072 QTimer *waitTimer; 0073 }; 0074 0075 #endif