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 "KPrSaloonDoorWipeEffectFactory.h"
21 
22 #include <klocalizedstring.h>
23 
24 #include "KPrSaloonDoorWipeStrategy.h"
25 
26 #define SaloonDoorWipeEffectId  "SaloonDoorWipeEffect"
27 
KPrSaloonDoorWipeEffectFactory()28 KPrSaloonDoorWipeEffectFactory::KPrSaloonDoorWipeEffectFactory()
29 : KPrPageEffectFactory( SaloonDoorWipeEffectId, i18n( "Saloon Door" ) )
30 {
31     addStrategy( new KPrSaloonDoorWipeStrategy( FromTop, "saloonDoorWipe", "top", false ) );
32     addStrategy( new KPrSaloonDoorWipeStrategy( FromLeft, "saloonDoorWipe", "left", false ) );
33     addStrategy( new KPrSaloonDoorWipeStrategy( FromBottom, "saloonDoorWipe", "bottom", false ) );
34     addStrategy( new KPrSaloonDoorWipeStrategy( FromRight, "saloonDoorWipe", "right", false ) );
35 
36     addStrategy( new KPrSaloonDoorWipeStrategy( ToTop, "saloonDoorWipe", "top", true ) );
37     addStrategy( new KPrSaloonDoorWipeStrategy( ToLeft, "saloonDoorWipe", "left", true ) );
38     addStrategy( new KPrSaloonDoorWipeStrategy( ToBottom, "saloonDoorWipe", "bottom", true ) );
39     addStrategy( new KPrSaloonDoorWipeStrategy( ToRight, "saloonDoorWipe", "right", true ) );
40 }
41 
~KPrSaloonDoorWipeEffectFactory()42 KPrSaloonDoorWipeEffectFactory::~KPrSaloonDoorWipeEffectFactory()
43 {
44 }
45 
46 static const char* const s_subTypes[] = {
47     I18N_NOOP( "From Top" ),
48     I18N_NOOP( "From Left" ),
49     I18N_NOOP( "From Bottom" ),
50     I18N_NOOP( "From Right" ),
51     I18N_NOOP( "To Top" ),
52     I18N_NOOP( "To Left" ),
53     I18N_NOOP( "To Bottom" ),
54     I18N_NOOP( "To Right" )
55 };
56 
subTypeName(int subType) const57 QString KPrSaloonDoorWipeEffectFactory::subTypeName(int subType) const
58 {
59     if (subType >= 0 && (uint)subType < sizeof s_subTypes / sizeof s_subTypes[0]) {
60         return i18n( s_subTypes[subType] );
61     } else {
62         return i18n( "Unknown subtype" );
63     }
64 }
65