1 /* This file is part of the KDE project
2    Copyright (C) 2008 Marijn Kruisselbrink <mkruisselbrink@kde.org>
3 
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public
6    License as published by the Free Software Foundation; either
7    version 2 of the License, or (at your option) any later version.
8 
9    This library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13 
14    You should have received a copy of the GNU Library General Public License
15    along with this library; see the file COPYING.LIB.  If not, write to
16    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18 */
19 
20 #include "KPrSpiralWipeEffectFactory.h"
21 
22 #include <klocalizedstring.h>
23 
24 #include "KPrSpiralWipeStrategy.h"
25 
26 #define SpiralWipeEffectId "SpiralWipeEffect"
27 
KPrSpiralWipeEffectFactory()28 KPrSpiralWipeEffectFactory::KPrSpiralWipeEffectFactory()
29 : KPrPageEffectFactory( SpiralWipeEffectId, i18n( "Spiral" ) )
30 {
31     addStrategy( new KPrSpiralWipeStrategy(0, true, false) );
32     addStrategy( new KPrSpiralWipeStrategy(1, true, false) );
33     addStrategy( new KPrSpiralWipeStrategy(2, true, false) );
34     addStrategy( new KPrSpiralWipeStrategy(3, true, false) );
35     addStrategy( new KPrSpiralWipeStrategy(0, false, false) );
36     addStrategy( new KPrSpiralWipeStrategy(3, false, false) );
37     addStrategy( new KPrSpiralWipeStrategy(2, false, false) );
38     addStrategy( new KPrSpiralWipeStrategy(1, false, false) );
39     addStrategy( new KPrSpiralWipeStrategy(0, true, true) );
40     addStrategy( new KPrSpiralWipeStrategy(1, true, true) );
41     addStrategy( new KPrSpiralWipeStrategy(2, true, true) );
42     addStrategy( new KPrSpiralWipeStrategy(3, true, true) );
43     addStrategy( new KPrSpiralWipeStrategy(0, false, true) );
44     addStrategy( new KPrSpiralWipeStrategy(3, false, true) );
45     addStrategy( new KPrSpiralWipeStrategy(2, false, true) );
46     addStrategy( new KPrSpiralWipeStrategy(1, false, true) );
47 }
48 
~KPrSpiralWipeEffectFactory()49 KPrSpiralWipeEffectFactory::~KPrSpiralWipeEffectFactory()
50 {
51 }
52 
53 static const char* const s_subTypes[] = {
54     I18N_NOOP( "Clockwise Top Left In" ),
55     I18N_NOOP( "Clockwise Top Left Out" ),
56     I18N_NOOP( "Clockwise Top Right In" ),
57     I18N_NOOP( "Clockwise Top Right Out" ),
58     I18N_NOOP( "Clockwise Bottom Left In" ),
59     I18N_NOOP( "Clockwise Bottom Left Out" ),
60     I18N_NOOP( "Clockwise Bottom Right In" ),
61     I18N_NOOP( "Clockwise Bottom Right Out" ),
62     I18N_NOOP( "Counterclockwise Top Left In" ),
63     I18N_NOOP( "Counterclockwise Top Left Out" ),
64     I18N_NOOP( "Counterclockwise Top Right In" ),
65     I18N_NOOP( "Counterclockwise Top Right Out" ),
66     I18N_NOOP( "Counterclockwise Bottom Left In" ),
67     I18N_NOOP( "Counterclockwise Bottom Left Out" ),
68     I18N_NOOP( "Counterclockwise Bottom Right In" ),
69     I18N_NOOP( "Counterclockwise Bottom Right Out" )
70 };
71 
subTypeName(int subType) const72 QString KPrSpiralWipeEffectFactory::subTypeName(int subType) const
73 {
74     if (subType >= 0 && (uint)subType < sizeof s_subTypes / sizeof s_subTypes[0]) {
75         return i18n( s_subTypes[subType] );
76     } else {
77         return i18n( "Unknown subtype" );
78     }
79 }
80 
81