1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2006-2007 Ralf Habacker. All rights reserved. |
4 | ** |
5 | ** This file is part of the KDE installer for windows |
6 | ** |
7 | ** This library is free software; you can redistribute it and/or |
8 | ** modify it under the terms of the GNU Library General Public |
9 | ** License version 2 as published by the Free Software Foundation. |
10 | ** |
11 | ** This library is distributed in the hope that it will be useful, |
12 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | ** Library General Public License for more details. |
15 | ** |
16 | ** You should have received a copy of the GNU Library General Public License |
17 | ** along with this library; see the file COPYING.LIB. If not, write to |
18 | ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | ** Boston, MA 02110-1301, USA. |
20 | ** |
21 | ****************************************************************************/ |
22 | |
23 | #ifndef SITE_H |
24 | #define SITE_H |
25 | |
26 | #include "hash.h" |
27 | |
28 | #include <QString> |
29 | #include <QUrl> |
30 | #include <QStringList> |
31 | #include <QHash> |
32 | |
33 | typedef QList<QUrl> QUrlList; |
34 | /** |
35 | holds a site definition |
36 | */ |
37 | class Site |
38 | { |
39 | |
40 | public: |
41 | /// @deprecated we use the autoparser |
42 | enum SiteType {ApacheModIndex, Ftp, SourceForge, SourceForgeMirror }; |
43 | |
44 | Site(); |
45 | |
46 | QString name() const { return m_name; } |
47 | void setName(const QString &name) |
48 | { |
49 | m_name = name; |
50 | } |
51 | |
52 | QUrl url() const { return m_url; } |
53 | void setURL(const QUrl &url) |
54 | { |
55 | m_url = url; |
56 | } |
57 | |
58 | QUrl listURL() const { return m_listUrl; } |
59 | void setListURL(const QUrl &url) |
60 | { |
61 | m_listUrl = url; |
62 | } |
63 | |
64 | const QUrlList &mirrors() const { return m_mirrors; } |
65 | void addMirror(const QUrl &mirror) |
66 | { |
67 | if(!m_mirrors.contains(mirror)) |
68 | m_mirrors += mirror; |
69 | } |
70 | |
71 | QStringList copies() const { return m_copies; } |
72 | void addCopy(const QString ©) |
73 | { |
74 | m_copies += copy; |
75 | } |
76 | |
77 | SiteType Type() const { return m_type; } |
78 | void setType(SiteType type) |
79 | { |
80 | m_type = type; |
81 | } |
82 | |
83 | bool setType(const QString &type); |
84 | |
85 | Hash &hashType() { return m_hashType; } |
86 | |
87 | void addDependencies(const QString &package, const QStringList &deps); |
88 | QStringList getDependencies(const QString &package); |
89 | |
90 | void setCategoryNotes(const QString &category, const QString ¬es); |
91 | QString &categoryNotes(const QString &category); |
92 | |
93 | void setPackageHomeUrl(const QString &package, const QString &url); |
94 | QString packageHomeUrl(const QString &package); |
95 | |
96 | void setPackageNote(const QString &package, const QString ¬es); |
97 | QString packageNote(const QString &package); |
98 | |
99 | void setPackageLongNotes(const QString &package, const QString ¬e); |
100 | QString packageLongNotes(const QString &package); |
101 | |
102 | void setPackageCategories(const QString &package, const QStringList &categories); |
103 | const QStringList &packageCategories(const QString &package); |
104 | |
105 | void addExcludes(const QStringList &excludes); |
106 | bool isExclude(const QString &package); |
107 | |
108 | QString notes() const { return m_notes; } |
109 | void setNotes(const QString ¬es) |
110 | { |
111 | m_notes = notes; |
112 | } |
113 | |
114 | private: |
115 | QString m_name; |
116 | QUrl m_listUrl; |
117 | QUrl m_url; |
118 | QString m_notes; |
119 | SiteType m_type; |
120 | QUrlList m_mirrors; |
121 | QStringList m_excludes; |
122 | QStringList m_copies; |
123 | Hash m_hashType; |
124 | QHash<QString, QStringList> m_dependencies; |
125 | QHash<QString, QStringList> m_packageCategories; |
126 | QHash<QString, QString> m_packageNotes; |
127 | QHash<QString, QString> m_packageLongNotes; |
128 | QHash<QString, QString> m_packageHomeUrl; |
129 | friend QDebug &operator<<(QDebug&, const Site &); |
130 | friend QDebug &operator<<(QDebug&, const SiteType &); |
131 | }; |
132 | |
133 | |
134 | |
135 | |
136 | #endif |
137 | |