• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • ui
  • metalinkcreator
filehandler.h
Go to the documentation of this file.
1 /***************************************************************************
2 * Copyright (C) 2009 Matthias Fuchs <mat69@gmx.net> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
18 ***************************************************************************/
19 
20 #ifndef FILEHANDLER
21 #define FILEHANDLER
22 
23 #include <QtCore/QMutex>
24 #include <QtCore/QThread>
25 
26 #include "metalinker.h"
27 
28 struct FileData
29 {
30  KUrl url;
31  KGetMetalink::File file;
32 };
33 
38 class FileHandlerThread : public QThread
39 {
40  Q_OBJECT
41 
42  public:
43  FileHandlerThread(QObject *parent = 0);
44  ~FileHandlerThread();
45 
46  void setData(const QList<FileData> &files, const QStringList &types, bool createPartial, const KGetMetalink::Resources &tempResources, const KGetMetalink::CommonData &tempCommonData);
47 
48  signals:
49  void fileResult(const KGetMetalink::File file);
50 
51  protected:
52  void run();
53 
54  private:
55  QMutex mutex;
56  bool abort;
57  QList<QList<FileData> > m_files;
58  QList<QStringList> m_types;
59  QList<bool> m_createPartial;
60  QList<KGetMetalink::Resources> m_tempResources;
61  QList<KGetMetalink::CommonData> m_tempCommonDatas;
62 };
63 
68 class DirectoryHandler : public QObject
69 {
70  Q_OBJECT
71 
72  public:
73  DirectoryHandler(QObject *parent);
74  ~DirectoryHandler();
75 
79  QList<FileData> takeFiles();
80 
81  public slots:
86  void slotFiles(const QList<KUrl> &files);
87 
88  signals:
89  void finished();
90 
91  private slots:
92  void slotDirEntries(KIO::Job *job, const KIO::UDSEntryList &entries);
93 
97  void slotFinished(KJob *job);
98 
99  private:
103  void evaluateFileProcess();
104 
105  private:
106  bool m_allJobsStarted;
107  QHash<KJob*, KUrl> m_jobs;
108  QList<FileData> m_files;
109 };
110 
111 #endif
FileData
Definition: filehandler.h:28
DirectoryHandler::slotFiles
void slotFiles(const QList< KUrl > &files)
The files the FileHandler should handle, the urls can also be urls to directories then the files of t...
Definition: filehandler.cpp:145
FileData::url
KUrl url
Definition: filehandler.h:30
DirectoryHandler
Gets the name and the size of the files of a list of urls, also enters directories recursively if nee...
Definition: filehandler.h:68
FileHandlerThread::FileHandlerThread
FileHandlerThread(QObject *parent=0)
Definition: filehandler.cpp:25
DirectoryHandler::finished
void finished()
DirectoryHandler::~DirectoryHandler
~DirectoryHandler()
Definition: filehandler.cpp:133
FileData::file
KGetMetalink::File file
Definition: filehandler.h:31
DirectoryHandler::takeFiles
QList< FileData > takeFiles()
Returns the handled files and clears the member, call this after finished is emitted.
Definition: filehandler.cpp:137
QObject
KGetMetalink::File
Definition: metalinker.h:239
FileHandlerThread::fileResult
void fileResult(const KGetMetalink::File file)
metalinker.h
KGetMetalink::CommonData
Files, File and Metadata contain this Metadata not as member and only for compatibility.
Definition: metalinker.h:93
FileHandlerThread::~FileHandlerThread
~FileHandlerThread()
Definition: filehandler.cpp:31
KGetMetalink::Resources
Definition: metalinker.h:190
FileHandlerThread::run
void run()
Definition: filehandler.cpp:54
DirectoryHandler::DirectoryHandler
DirectoryHandler(QObject *parent)
Definition: filehandler.cpp:127
QThread
KJob
FileHandlerThread
Calculates the checksum and partial checksums for files and adds KGetMetalink::Resources and KGetMeta...
Definition: filehandler.h:38
FileHandlerThread::setData
void setData(const QList< FileData > &files, const QStringList &types, bool createPartial, const KGetMetalink::Resources &tempResources, const KGetMetalink::CommonData &tempCommonData)
Definition: filehandler.cpp:40
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal