Scribus
Open source desktop publishing at your fingertips
scimagecachewriteaction.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  copyright : (C) 2010 by Marcus Holland-Moritz
9  email : scribus@mhxnet.de
10 ***************************************************************************/
11 
12 /***************************************************************************
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 ***************************************************************************/
20 
21 #ifndef SCIMAGECACHEWRITEACTION_H
22 #define SCIMAGECACHEWRITEACTION_H
23 
24 #include <QHash>
25 #include <QString>
26 #include <QStringList>
27 
28 #include "scribusapi.h"
29 #include "scimagecachedir.h"
30 
31 class ScLockedFile;
32 
38 {
39 public:
40  ScImageCacheWriteAction(bool haveMasterLock = false);
42 
43  bool start();
44  bool add(const QString & file);
45  bool commit();
46 
47 private:
48  typedef ScImageCacheDir::AccessCounter AccessCounter;
49  typedef QHash<QString, ScLockedFile *> FileMap;
50  QStringList m_files;
51  FileMap m_access;
52  bool m_locked;
53  const bool m_haveMasterLock;
54 
55  void clear();
56  bool unlock();
57  bool update(const QString & dir, ScLockedFile *p, AccessCounter & from, AccessCounter & to);
58 };
59 
60 #endif
Base class for locked file access.
Definition: sclockedfile.h:37
Bracket for write accesses to the image cache.
Definition: scimagecachewriteaction.h:37