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 "KPrParallelSnakesWipeEffectFactory.h"
21 
22 #include <klocalizedstring.h>
23 
24 #include "KPrParallelSnakesWipeVerticalStrategy.h"
25 #include "KPrParallelSnakesWipeHorizontalStrategy.h"
26 #include "KPrParallelSnakesWipeDiagonalStrategy.h"
27 
28 #define ParallelSnakesWipeEffectId "ParallelSnakesWipeEffect"
29 
KPrParallelSnakesWipeEffectFactory()30 KPrParallelSnakesWipeEffectFactory::KPrParallelSnakesWipeEffectFactory()
31     : KPrPageEffectFactory( ParallelSnakesWipeEffectId, i18n( "Parallel Snakes" ) )
32 {
33     addStrategy( new KPrParallelSnakesWipeVerticalStrategy(false, false, false) );
34     addStrategy( new KPrParallelSnakesWipeVerticalStrategy(true, true, false) );
35     addStrategy( new KPrParallelSnakesWipeVerticalStrategy(false, true, false) );
36     addStrategy( new KPrParallelSnakesWipeVerticalStrategy(true, false, false) );
37     addStrategy( new KPrParallelSnakesWipeVerticalStrategy(false, false, true) );
38     addStrategy( new KPrParallelSnakesWipeVerticalStrategy(true, true, true) );
39     addStrategy( new KPrParallelSnakesWipeVerticalStrategy(false, true, true) );
40     addStrategy( new KPrParallelSnakesWipeVerticalStrategy(true, false, true) );
41     addStrategy( new KPrParallelSnakesWipeHorizontalStrategy(false, false, false) );
42     addStrategy( new KPrParallelSnakesWipeHorizontalStrategy(true, true, false) );
43     addStrategy( new KPrParallelSnakesWipeHorizontalStrategy(false, true, false) );
44     addStrategy( new KPrParallelSnakesWipeHorizontalStrategy(true, false, false) );
45     addStrategy( new KPrParallelSnakesWipeHorizontalStrategy(false, false, true) );
46     addStrategy( new KPrParallelSnakesWipeHorizontalStrategy(true, true, true) );
47     addStrategy( new KPrParallelSnakesWipeHorizontalStrategy(false, true, true) );
48     addStrategy( new KPrParallelSnakesWipeHorizontalStrategy(true, false, true) );
49     addStrategy( new KPrParallelSnakesWipeDiagonalStrategy(false, true) );
50     addStrategy( new KPrParallelSnakesWipeDiagonalStrategy(true, true) );
51     addStrategy( new KPrParallelSnakesWipeDiagonalStrategy(false, false) );
52     addStrategy( new KPrParallelSnakesWipeDiagonalStrategy(true, false) );
53 }
54 
~KPrParallelSnakesWipeEffectFactory()55 KPrParallelSnakesWipeEffectFactory::~KPrParallelSnakesWipeEffectFactory()
56 {
57 }
58 
59 static const char* const s_subTypes[] = {
60     I18N_NOOP( "Vertical Top Same In" ),
61     I18N_NOOP( "Vertical Top Same Out" ),
62     I18N_NOOP( "Vertical Bottom Same In" ),
63     I18N_NOOP( "Vertical Bottom Same Out" ),
64     I18N_NOOP( "Vertical Top Left Opposite In" ),
65     I18N_NOOP( "Vertical Top Left Opposite Out" ),
66     I18N_NOOP( "Vertical Bottom Left Opposite In" ),
67     I18N_NOOP( "Vertical Bottom Left Opposite Out" ),
68     I18N_NOOP( "Horizontal Left Same In" ),
69     I18N_NOOP( "Horizontal Left Same Out" ),
70     I18N_NOOP( "Horizontal Right Same In" ),
71     I18N_NOOP( "Horizontal Right Same Out" ),
72     I18N_NOOP( "Horizontal Top Left Opposite In" ),
73     I18N_NOOP( "Horizontal Top Left Opposite Out" ),
74     I18N_NOOP( "Horizontal Top Right Opposite In" ),
75     I18N_NOOP( "Horizontal Top Right Opposite Out" ),
76     I18N_NOOP( "Diagonal Bottom Left Opposite In" ),
77     I18N_NOOP( "Diagonal Bottom Left Opposite Out" ),
78     I18N_NOOP( "Diagonal Top Left Opposite In" ),
79     I18N_NOOP( "Diagonal Top Left Opposite Out" )
80 };
81 
subTypeName(int subType) const82 QString KPrParallelSnakesWipeEffectFactory::subTypeName(int subType) const
83 {
84     if (subType >= 0 && (uint)subType < sizeof s_subTypes / sizeof s_subTypes[0]) {
85         return i18n( s_subTypes[subType] );
86     } else {
87         return i18n( "Unknown subtype" );
88     }
89 }
90