diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2015-03-02 14:50:07 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2015-03-02 14:50:07 -0600 |
commit | fedadd8610bf43fae208afa1b031b12d824aee1d (patch) | |
tree | a14cc10ca49b6957a8382974869cc7b712e56af4 /tdescreensaver | |
parent | 13c6f00d72f86504d3aa34e33d8e90b7dd49e46b (diff) | |
download | tdeartwork-fedadd8610bf43fae208afa1b031b12d824aee1d.tar.gz tdeartwork-fedadd8610bf43fae208afa1b031b12d824aee1d.zip |
Fix firesaver build warnings and clean up read settings coding style
Diffstat (limited to 'tdescreensaver')
-rw-r--r-- | tdescreensaver/kdesavers/firesaver.cpp | 181 |
1 files changed, 103 insertions, 78 deletions
diff --git a/tdescreensaver/kdesavers/firesaver.cpp b/tdescreensaver/kdesavers/firesaver.cpp index 586fa5ff..ca53482d 100644 --- a/tdescreensaver/kdesavers/firesaver.cpp +++ b/tdescreensaver/kdesavers/firesaver.cpp @@ -1,20 +1,21 @@ // This file is part of KFireSaver3D. - +// +// (c) 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net> +// // KFireSaver3D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. - +// // KFireSaver3D is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. - +// // You should have received a copy of the GNU General Public License // along with KFireSaver3D; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - +// // Author: Enrico Ros, based on the great work of David Sansome (kfiresaver) // Email: asy@libero.it @@ -1001,51 +1002,55 @@ void KFireSaver :: freeTexture( unsigned int & textureID ) void KFireSaver :: readConfig () { - TDEConfig config("kfiresaverrc",true,false); + TDEConfig config("kfiresaverrc", true, false); // show - config.setGroup( "Show" ); - showp.ShowType = (enum enumShowType)config.readNumEntry( "ShowType", 1 ); - parameters.fireworksFrequency = 11 - config.readNumEntry( "FireworksFrequency", 7 ); - if ( parameters.fireworksFrequency < 1 ) + config.setGroup("Show"); + showp.ShowType = (enum enumShowType)config.readNumEntry("ShowType", 1); + parameters.fireworksFrequency = 11 - config.readNumEntry("FireworksFrequency", 7); + if ( parameters.fireworksFrequency < 1 ) { parameters.fireworksFrequency = 1; - if ( parameters.fireworksFrequency > 11 ) + } + if ( parameters.fireworksFrequency > 11 ) { parameters.fireworksFrequency = 11; + } parameters.fireworksFrequency *= (parameters.fireworksFrequency + 1); //*karl gauss's sum* - parameters.particleSize = config.readNumEntry( "ParticlesSize", 0 ); - if ( parameters.particleSize < -5 ) + parameters.particleSize = config.readNumEntry("ParticlesSize", 0); + if ( parameters.particleSize < -5 ) { parameters.particleSize = -5; - if ( parameters.particleSize > 5 ) + } + if ( parameters.particleSize > 5 ) { parameters.particleSize = 5; - if ( parameters.enableBottomFire = config.readBoolEntry( "enable-BottomFire", true ) ) - { + } + parameters.enableBottomFire = config.readBoolEntry("enable-BottomFire", true); + if (parameters.enableBottomFire) { TQColor blue = TQt::darkBlue; - parameters.bottomFireColor = config.readColorEntry( "BottomFireColor", &blue ); + parameters.bottomFireColor = config.readColorEntry("BottomFireColor", &blue); } - parameters.enableSound = config.readBoolEntry( "enable-Sounds", false ); - parameters.enableNoOverhead = config.readBoolEntry( "enable-NoOverhead", true ); - parameters.enableRealtime = config.readBoolEntry( "enable-FrameSkip", true ); + parameters.enableSound = config.readBoolEntry("enable-Sounds", false); + parameters.enableNoOverhead = config.readBoolEntry("enable-NoOverhead", true); + parameters.enableRealtime = config.readBoolEntry("enable-FrameSkip", true); // fireworks config.setGroup( "Fireworks" ); parameters.typesCount = 0; - if ( config.readBoolEntry( "use-Classic", true ) ) + if (config.readBoolEntry("use-Classic", true )) parameters.typesT[parameters.typesCount++] = Sphere; - if ( config.readBoolEntry( "use-Explosion", false ) ) + if (config.readBoolEntry("use-Explosion", false)) parameters.typesT[parameters.typesCount++] = NoFW; - if ( config.readBoolEntry( "use-FlameRing", false ) ) + if (config.readBoolEntry("use-FlameRing", false)) parameters.typesT[parameters.typesCount++] = Circle; - if ( config.readBoolEntry( "use-FlameWorld", false ) ) + if (config.readBoolEntry("use-FlameWorld", false)) parameters.typesT[parameters.typesCount++] = BiCircle; - if ( config.readBoolEntry( "use-Fall", false ) ) + if (config.readBoolEntry("use-Fall", false)) parameters.typesT[parameters.typesCount++] = AngelHairs; - if ( config.readBoolEntry( "use-Splitter", false ) ) + if (config.readBoolEntry("use-Splitter", false)) parameters.typesT[parameters.typesCount++] = Splitter; - if ( config.readBoolEntry( "use-Spirals", false ) ) + if (config.readBoolEntry("use-Spirals", false)) parameters.typesT[parameters.typesCount++] = Spirals; - if ( config.readBoolEntry( "use-SuperNova", false ) ) + if (config.readBoolEntry("use-SuperNova", false)) parameters.typesT[parameters.typesCount++] = SuperNova; - if ( !parameters.typesCount ) { + if (!parameters.typesCount ) { kdWarning() << "KFireSaver3D: Warning, no fireworks enabled in config file" << endl; kdWarning() << " enabling 'Classic Spherical'" << endl; parameters.typesCount = 1; @@ -1054,22 +1059,28 @@ void KFireSaver :: readConfig () parameters.typesT[ parameters.typesCount ] = parameters.typesT[ parameters.typesCount-1 ]; parameters.colorsCount = 0; - if ( config.readBoolEntry( "use-Red", false ) ) + if (config.readBoolEntry( "use-Red", false)) { parameters.colorsT[parameters.colorsCount++] = 0; - if ( config.readBoolEntry( "use-Orange", true ) ) + } + if (config.readBoolEntry( "use-Orange", true)) { parameters.colorsT[parameters.colorsCount++] = 1; - if ( config.readBoolEntry( "use-Green", false ) ) + } + if (config.readBoolEntry( "use-Green", false)) { parameters.colorsT[parameters.colorsCount++] = 2; - if ( config.readBoolEntry( "use-Blue", false ) ) + } + if (config.readBoolEntry( "use-Blue", false)) { parameters.colorsT[parameters.colorsCount++] = 3; - if ( config.readBoolEntry( "use-White", true ) ) + } + if (config.readBoolEntry( "use-White", true)) { parameters.colorsT[parameters.colorsCount++] = 4; - if ( config.readBoolEntry( "use-Purple", false ) ) + } + if (config.readBoolEntry( "use-Purple", false)) { parameters.colorsT[parameters.colorsCount++] = 5; - if ( config.readBoolEntry( "use-DeepGreen", true ) ) + } + if (config.readBoolEntry( "use-DeepGreen", true)) { parameters.colorsT[parameters.colorsCount++] = 6; - if ( !parameters.colorsCount ) - { + } + if (!parameters.colorsCount) { kdWarning() << "KFireSaver3D: Warning enable at least one color" << endl; kdWarning() << " enabling 'Blinding White'" << endl; parameters.colorsCount = 1; @@ -1077,75 +1088,89 @@ void KFireSaver :: readConfig () } parameters.colorsT[ parameters.colorsCount ] = parameters.colorsT[ parameters.colorsCount-1 ]; - parameters.enableCombos = config.readBoolEntry( "use-Multicolor", true ); + parameters.enableCombos = config.readBoolEntry("use-Multicolor", true); // specials config.setGroup( "Specials" ); - if ( parameters.enableLogos = config.readBoolEntry( "enable-Logos", true ) ) - { + if (parameters.enableLogos = config.readBoolEntry( "enable-Logos", true)) { TQImage tempImage; tempImage.setAlphaBuffer( true ); - if ( config.readBoolEntry( "LogosTux", true ) ) - if ( tempImage.load(locate("data","kfiresaver/kfs_tux.png")) ) + if (config.readBoolEntry( "LogosTux", true)) { + if (tempImage.load(locate("data","kfiresaver/kfs_tux.png"))) { imageList.append( new TQImage(tempImage) ); - if ( config.readBoolEntry( "LogosKonqui", true ) ) - if ( tempImage.load(locate("data","kfiresaver/kfs_kde.png")) ) + } + } + if (config.readBoolEntry( "LogosKonqui", true)) { + if (tempImage.load(locate("data","kfiresaver/kfs_kde.png"))) { imageList.append( new TQImage(tempImage) ); - if ( config.readBoolEntry( "LogosTDEIcons", true ) ) { + } + } + if (config.readBoolEntry( "LogosTDEIcons", true)) { const TQString icons[] = { "media-floppy-3_5", "media-optical-cdrom", "drive-harddisk-mounted", "kmix", "network", "my-computer", "folder_home", "konqueror", "kmail", "penguin", "preferences-desktop-personal" }; - for ( int i = 0; i < 11; i++ ) - imageList.append( new TQImage(DesktopIcon(icons[i],64).convertToImage()) ); + for (int i = 0; i < 11; i++) { + imageList.append(new TQImage(DesktopIcon(icons[i],64).convertToImage())); + } } - parameters.enableReduceLogo = config.readBoolEntry( "LogosReduceDetail", true ); - parameters.logoFrequency = 11 - config.readNumEntry( "LogosFrequency", 4 ); - if ( parameters.logoFrequency < 1 ) + parameters.enableReduceLogo = config.readBoolEntry("LogosReduceDetail", true); + parameters.logoFrequency = 11 - config.readNumEntry("LogosFrequency", 4); + if (parameters.logoFrequency < 1) { parameters.logoFrequency = 1; - if ( parameters.logoFrequency > 11 ) + } + if (parameters.logoFrequency > 11) { parameters.logoFrequency = 11; + } } - if ( parameters.enableStars = config.readBoolEntry( "enable-Stars", true ) ) - { - parameters.enableStarFlickering = config.readBoolEntry( "StarsFlicker", false ); - parameters.enableStarGradient = config.readBoolEntry( "StarsGradient", true ); - parameters.starsNumber = config.readNumEntry( "StarsNumber", 4 ); - if ( parameters.starsNumber < 0 ) + parameters.enableStars = config.readBoolEntry("enable-Stars", true); + if (parameters.enableStars) { + parameters.enableStarFlickering = config.readBoolEntry("StarsFlicker", false); + parameters.enableStarGradient = config.readBoolEntry("StarsGradient", true); + parameters.starsNumber = config.readNumEntry("StarsNumber", 4); + if (parameters.starsNumber < 0) { parameters.starsNumber = 0; - if ( parameters.starsNumber > 10 ) + } + if (parameters.starsNumber > 10) { parameters.starsNumber = 10; + } } - parameters.enableWritings = config.readBoolEntry( "enable-Writings", true ); + parameters.enableWritings = config.readBoolEntry("enable-Writings", true); // effects - config.setGroup( "Effects" ); - parameters.enableSphereLight = config.readBoolEntry( "enable-SphericalLight", true ); - if ( parameters.enableFlash = config.readBoolEntry( "enable-Flash", false ) ) - { - parameters.flashOpacity = config.readNumEntry( "FlashOpacity", 5 ); - if ( parameters.flashOpacity < 0 ) + config.setGroup("Effects"); + parameters.enableSphereLight = config.readBoolEntry("enable-SphericalLight", true); + parameters.enableFlash = config.readBoolEntry("enable-Flash", false); + if (parameters.enableFlash) { + parameters.flashOpacity = config.readNumEntry("FlashOpacity", 5); + if ( parameters.flashOpacity < 0 ) { parameters.flashOpacity = 0; - if ( parameters.flashOpacity > 10 ) + } + if ( parameters.flashOpacity > 10 ) { parameters.flashOpacity = 10; + } } - if ( parameters.enableFade = config.readBoolEntry( "enable-Fade", false ) ) - { - parameters.fadeAmount = config.readNumEntry( "FadeIntensity", 3 ); - if ( parameters.fadeAmount < 0 ) + parameters.enableFade = config.readBoolEntry("enable-Fade", false); + if (parameters.enableFade) { + parameters.fadeAmount = config.readNumEntry("FadeIntensity", 3); + if ( parameters.fadeAmount < 0 ) { parameters.fadeAmount = 0; - if ( parameters.fadeAmount > 9 ) + } + if ( parameters.fadeAmount > 9 ) { parameters.fadeAmount = 9; + } } - if ( parameters.enableMegaFlares = config.readBoolEntry( "enable-Flares", true ) ) - { - parameters.megaFlares = config.readNumEntry( "FlaresDimension", 5 ); - if ( parameters.megaFlares < 0 ) + parameters.enableMegaFlares = config.readBoolEntry("enable-Flares", true); + if (parameters.enableMegaFlares) { + parameters.megaFlares = config.readNumEntry("FlaresDimension", 5); + if ( parameters.megaFlares < 0 ) { parameters.megaFlares = 0; - if ( parameters.megaFlares > 10 ) + } + if ( parameters.megaFlares > 10 ) { parameters.megaFlares = 10; + } parameters.megaFlares += 4; parameters.megaFlares *= 2; } - parameters.enableTrails = config.readBoolEntry( "enable-Trail", false ); + parameters.enableTrails = config.readBoolEntry("enable-Trail", false); } |