File indexing completed on 2024-10-06 03:40:32
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2007 Kevin Ottens <ervin@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef KJOBTRACKERSTEST_H 0009 #define KJOBTRACKERSTEST_H 0010 0011 #include <KJob> 0012 0013 #include <QTimer> 0014 0015 class KTestJob : public KJob 0016 { 0017 Q_OBJECT 0018 0019 public: 0020 enum State { 0021 StatingDirs, 0022 CreatingDirs, 0023 CopyingFiles, 0024 Stopped, 0025 }; 0026 0027 // 10 files per directory 0028 // 1000 bytes per files 0029 KTestJob(int numberOfDirs = 5); 0030 ~KTestJob() override; 0031 0032 void start() override; 0033 0034 private Q_SLOTS: 0035 void nextStep(); 0036 0037 protected: 0038 void stateNextDir(); 0039 void createNextDir(); 0040 void copyNextFile(); 0041 0042 bool doSuspend() override; 0043 bool doResume() override; 0044 bool doKill() override; 0045 0046 private: 0047 qulonglong m_numberOfDirs; 0048 qulonglong m_currentSpeed; 0049 State m_state; 0050 QTimer m_timer; 0051 }; 0052 0053 #endif