1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship 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. *
10 * KWorship 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. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
21 * @file KwCssStyle.cpp
22 * @brief Typed cascading style property.
23 * @author James Hogan <james@albanarts.com>
26 #include "KwCssStyle.h"
28 #include "KwCssUnprocessed.h"
30 KwCssUnprocessed KwCssStringify
<KwCssUnprocessed
>(const KwCssUnprocessed
& value
)
35 KwCssUnprocessed KwCssUnstringify
<KwCssUnprocessed
>(const KwCssUnprocessed
& value
, bool* success
)
41 #include <KwResourceLink.h>
43 KwCssUnprocessed KwCssStringify
<KwResourceLink
>(const KwResourceLink
& value
)
47 case KwResourceLink::Url
:
49 QString url
= value
.url().url();
50 url
.replace('\\', "\\\\")
51 .replace('"', "\\\"");
52 return QString("\"%1\"").arg(url
);
55 case KwResourceLink::FileRelative
:
57 QString url
= value
.path();
58 url
.replace('\\', "\\\\")
59 .replace('"', "\\\"");
60 return QString("frel \"%1\"").arg(url
);
63 case KwResourceLink::ArchiveRoot
:
65 QString url
= value
.path();
66 url
.replace('\\', "\\\\")
67 .replace('"', "\\\"");
68 return QString("aroot \"%1\"").arg(url
);
71 case KwResourceLink::ArchiveRelative
:
73 QString url
= value
.path();
74 url
.replace('\\', "\\\\")
75 .replace('"', "\\\"");
76 return QString("arel \"%1\"").arg(url
);
79 case KwResourceLink::Null
:
88 KwResourceLink KwCssUnstringify
<KwResourceLink
>(const KwCssUnprocessed
& value
, bool* success
)
91 return KwResourceLink();
96 KwCssUnprocessed KwCssStringify
<QBrush
>(const QBrush
& value
)
101 QBrush KwCssUnstringify
<QBrush
>(const KwCssUnprocessed
& value
, bool* success
)
104 return QBrush(Qt::black
);
109 KwCssUnprocessed KwCssStringify
<QPixmap
>(const QPixmap
& value
)
114 QPixmap KwCssUnstringify
<QPixmap
>(const KwCssUnprocessed
& value
, bool* success
)