File indexing completed on 2025-02-02 14:12:54
0001 /* 0002 Large image displaying library. 0003 0004 Copyright (C) 2004 Maks Orlovich (maksim@kde.org) 0005 0006 Permission is hereby granted, free of charge, to any person obtaining a copy 0007 of this software and associated documentation files (the "Software"), to deal 0008 in the Software without restriction, including without limitation the rights 0009 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 0010 copies of the Software, and to permit persons to whom the Software is 0011 furnished to do so, subject to the following conditions: 0012 0013 The above copyright notice and this permission notice shall be included in 0014 all copies or substantial portions of the Software. 0015 0016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 0019 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 0020 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 0021 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0022 0023 */ 0024 0025 #ifndef UPDATER_H 0026 #define UPDATER_H 0027 0028 #include <QObject> 0029 #include <QVector> 0030 0031 class QTimer; 0032 0033 namespace khtmlImLoad 0034 { 0035 0036 class Image; 0037 0038 /** 0039 The updater class helps manage timers, to permit update messages to be coalesced (so we don't 0040 bug KHTML, or whatever use every 5 pico-seconds. 0041 */ 0042 class Updater: public QObject 0043 { 0044 Q_OBJECT 0045 public: 0046 Updater(); 0047 0048 /** 0049 The frames should call this function as they start having data to emit. 0050 The updater will call back their notifyPerformUpdate() function when a sufficient 0051 amount of time has passed. 0052 */ 0053 void haveUpdates(Image *frame); 0054 0055 /** 0056 Called by image when it's destroyed, and hence should be purged 0057 from the updates list 0058 */ 0059 void destroyed(Image *frame); 0060 0061 private Q_SLOTS: 0062 void pushUpdates(); 0063 private: 0064 QTimer *updatePusher; 0065 bool updatesPending(); 0066 QVector<Image *> frames[10]; 0067 int timePortion; 0068 }; 0069 0070 } 0071 0072 #endif