Scribus
Open source desktop publishing at your fingertips
updatemanager.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 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15 
16 #ifndef UPDATEMANAGER_H
17 #define UPDATEMANAGER_H
18 
19 #include "scribusapi.h"
20 
21 #include <QSet>
22 
23 
24 
29 struct SCRIBUS_API UpdateMemento
30 {
31  virtual ~UpdateMemento();
32 };
33 
34 
35 
41 class SCRIBUS_API UpdateManaged
42 {
43 public:
44  virtual void updateNow(UpdateMemento* what) = 0;
45  virtual ~UpdateManaged() {}
46 };
47 
48 
66 class SCRIBUS_API UpdateManager
67 {
68  int m_updatesDisabled;
69  QSet<QPair<UpdateManaged*, UpdateMemento*> > m_pending;
70 
71 public:
72  UpdateManager() : m_updatesDisabled(0), m_pending() {}
73  virtual ~UpdateManager();
74 
75  void setUpdatesEnabled(bool val=true);
76  void setUpdatesDisabled() { setUpdatesEnabled(false); };
77  bool updatesEnabled() { return m_updatesDisabled == 0; };
81  bool requestUpdate(UpdateManaged* observable, UpdateMemento* what);
82 };
83 
84 
85 
86 #endif
Definition: updatemanager.h:29
Definition: updatemanager.h:41
Definition: updatemanager.h:66