Subversion Repositories Scribus

Rev

Rev 13809 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13809 pierre 1
/***************************************************************************
2
 *   Copyright (C) 2009 by Pierre Marchand                                 *
3
 *   pierre@oep-h.com                                                      *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 *   (at your option) any later version.                                   *
9
 *                                                                         *
10
 *   This program is distributed in the hope that it will be useful,       *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 *   GNU General Public License for more details.                          *
14
 *                                                                         *
15
 *   You should have received a copy of the GNU General Public License     *
16
 *   along with this program; if not, write to the                         *
17
 *   Free Software Foundation, Inc.,                                       *
18122 mrdocs 18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
13809 pierre 19
 ***************************************************************************/
20
 
21
#ifndef OPENPALETTEMANAGER_H
22
#define OPENPALETTEMANAGER_H
23
 
24
#include <QObject>
25
#include <QString>
26
#include <QList>
27
 
28
 
29
class OpenPalette;
30
class PrefsFile;
31
class QWidget;
32
 
33
/**
34
  * This manager maintains records of instanciated open
35
  * palettesand is able to serialize the whole palettes
36
  * collection for further reload.
37
  * It is a singleton (hard one if I can say (no means to grab an instance of it))
38
  */
39
 
40
class OpenPaletteManager : public QObject
41
{
42
        Q_OBJECT
43
 
44
        OpenPaletteManager(){}
45
        OpenPaletteManager(QObject * parent);
46
        static OpenPaletteManager * instance;
47
        static OpenPaletteManager* that();
48
 
49
public:
50
        /**
51
          * Save the configuration of the palettes in an XML file
52
          */
53
        static void savePaletteCollection(const QString& filepath);
54
 
55
        /**
56
          * Load palettes configuration from an XML file
57
          */
58
        static void loadPaletteCollection(const QString& filepath);
59
 
60
        /**
61
          * create a new OpenPalette
62
          */
63
        static void newPalette(QWidget * parent = 0);
64
 
65
        /**
66
          * Return number of palettes
67
          */
68
        static unsigned int count();
69
 
70
        /**
71
          * Return the name of the palette at index idx
72
          */
73
        static QString title(unsigned int idx);
74
 
75
        /**
76
          * Return a property of a palette
77
          */
78
        static QVariant paletteProperty(unsigned int idx, const QString& prop);
79
 
80
 
81
        /**
82
          * Set A property of a palette
83
          */
84
        static bool paletteProperty(unsigned int idx, const QString& prop, const QVariant& val);
85
 
86
        /**
87
          * Return the list of setters attached to the palette at index idx
88
          */
89
        static QStringList items(unsigned int idx);
90
 
91
/**
92
          * Reset the list of setters attached to the palette at index idx
93
          */
94
        static void setItems(unsigned int idx, const QStringList& ilist);
95
 
96
        /**
97
          * subscribe to changes notifications
98
          */
99
        static void subChanges(QObject * subscriber, const char * method);
100
 
101
private:
102
        QList<OpenPalette*> palettes;
103
 
104
private slots:
105
        void unRegisterPalette();
106
        void catchPalette();
107
 
108
signals:
109
        void changed();
110
 
111
};
112
 
113
#endif // OPENPALETTEMANAGER_H