1 /* This file is part of the KDE project
2 Copyright (C) 2008 Sven Langkamp <sven.langkamp@gmail.com>
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 "KPrFanWipeEffectFactory.h"
21
22 #include <klocalizedstring.h>
23
24 #include "KPrCenterFanWipeStrategy.h"
25 #include "KPrSideFanWipeStrategy.h"
26
27 #define FanWipeEffectId "FanWipeEffect"
28
KPrFanWipeEffectFactory()29 KPrFanWipeEffectFactory::KPrFanWipeEffectFactory()
30 : KPrPageEffectFactory( FanWipeEffectId, i18n( "Fan" ) )
31 {
32 addStrategy( new KPrCenterFanWipeStrategy( 0, 1, CenterRight, "fanWipe", "centerRight", false ) );
33 addStrategy( new KPrCenterFanWipeStrategy( 90, 1, CenterTop, "fanWipe", "centerTop", false ) );
34 addStrategy( new KPrCenterFanWipeStrategy( 180, 1, CenterLeft, "fanWipe", "centerRight", true ) );
35 addStrategy( new KPrCenterFanWipeStrategy( 270, 1, CenterBottom, "fanWipe", "centerTop", true ) );
36
37 addStrategy( new KPrSideFanWipeStrategy( 90, 1, FanOutTop, "fanWipe", "top", false ) );
38 addStrategy( new KPrSideFanWipeStrategy( 0, 1, FanOutRight, "fanWipe", "right", false ) );
39 addStrategy( new KPrSideFanWipeStrategy( 270, 1, FanOutBottom, "fanWipe", "bottom", false ) );
40 addStrategy( new KPrSideFanWipeStrategy( 180, 1, FanOutLeft, "fanWipe", "left", false ) );
41 addStrategy( new KPrSideFanWipeStrategy( 90, 1, FanInTop, "fanWipe", "top", true ) );
42 addStrategy( new KPrSideFanWipeStrategy( 0, 1, FanInRight, "fanWipe", "right", true ) );
43 addStrategy( new KPrSideFanWipeStrategy( 270, 1, FanInBottom, "fanWipe", "bottom", true ) );
44 addStrategy( new KPrSideFanWipeStrategy( 180, 1, FanInLeft, "fanWipe", "left", true ) );
45 }
46
~KPrFanWipeEffectFactory()47 KPrFanWipeEffectFactory::~KPrFanWipeEffectFactory()
48 {
49 }
50
51 static const char* const s_subTypes[] = {
52 I18N_NOOP( "Center Right" ),
53 I18N_NOOP( "Center Top" ),
54 I18N_NOOP( "Center Left" ),
55 I18N_NOOP( "Center Bottom" ),
56 I18N_NOOP( "Fan Out Top" ),
57 I18N_NOOP( "Fan Out Right" ),
58 I18N_NOOP( "Fan Out Bottom" ),
59 I18N_NOOP( "Fan Out Left" ),
60 I18N_NOOP( "Fan In Top" ),
61 I18N_NOOP( "Fan In Right" ),
62 I18N_NOOP( "Fan In Bottom" ),
63 I18N_NOOP( "Fan In Left" )
64 };
65
subTypeName(int subType) const66 QString KPrFanWipeEffectFactory::subTypeName(int subType) const
67 {
68 if (subType >= 0 && (uint)subType < sizeof s_subTypes / sizeof s_subTypes[0]) {
69 return i18n( s_subTypes[subType] );
70 } else {
71 return i18n( "Unknown subtype" );
72 }
73 }
74