[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [Amarok] 288718a: Fix logic fail in color option logic.
From:       Mark Kretschmann <kretschmann () kde ! org>
Date:       2010-10-31 10:43:06
Message-ID: 20101031104306.642E4A60A4 () git ! kde ! org
[Download RAW message or body]

commit 288718a02687be47a36d670e8930ec4c782b9bcd
branch master
Author: Mark Kretschmann <kretschmann@kde.org>
Date:   Sun Oct 31 11:42:28 2010 +0100

    Fix logic fail in color option logic.
    
    Thanks to stuffcorpse for noticing.

diff --git a/src/App.cpp b/src/App.cpp
index 6df5be3..99d45fe 100644
--- a/src/App.cpp
+++ b/src/App.cpp
@@ -361,7 +361,7 @@ App::handleCliArgs() //static
     const bool forceDebug = Amarok::config().readEntry( "Force Debug", false );
 
     Amarok::config().writeEntry( "Debug Enabled", forceDebug ? true : args->isSet( \
                "debug" ) );
-    Amarok::config().writeEntry( "Debug Colorization Enabled", args->isSet( "debug" \
) ); +    Amarok::config().writeEntry( "Debug Colorization Disabled", args->isSet( \
"coloroff" ) );  
     // Debug output will only work from this point on. If Amarok was run without \
                debug output before,
     // then a part of the output (until this point) will be missing. Inform the user \
about this: @@ -471,7 +471,7 @@ App::initCliArgs() //static
     options.add("d");
     options.add("debug", ki18n("Print verbose debugging information"));
     options.add("c");
-    options.add("color", ki18n("Colorize the debug information."));
+    options.add("coloroff", ki18n("Disable colorization for debug output."));
     options.add("m");
     options.add("multipleinstances", ki18n("Allow running multiple Amarok \
                instances"));
     options.add("cwd <directory>", ki18n( "Base for relative filenames/URLs" ));
diff --git a/src/core/support/Debug.cpp b/src/core/support/Debug.cpp
index 278e47c..1151f6b 100644
--- a/src/core/support/Debug.cpp
+++ b/src/core/support/Debug.cpp
@@ -80,7 +80,7 @@ static QString toString( DebugLevel level )
 
 static QString colorize( const QString &text, int color = s_colorIndex )
 {
-    if( debugColorEnabled() )
+    if( !debugColorDisabled() )
         return QString( "\x1b[00;3%1m%2\x1b[00;39m" )
             .arg( QString::number( s_colors[color] ) )
             .arg( text );
@@ -90,7 +90,7 @@ static QString colorize( const QString &text, int color = \
s_colorIndex )  
 static QString reverseColorize( const QString &text, int color )
 {
-    if( debugColorEnabled() )
+    if( !debugColorDisabled() )
         return QString( "\x1b[07;3%1m%2\x1b[00;39m" )
             .arg( QString::number(color), text );
     else
@@ -107,9 +107,9 @@ bool Debug::debugEnabled()
     return KGlobal::config()->group( QLatin1String("General") ).readEntry( \
QLatin1String("Debug Enabled"), false );  }
 
-bool Debug::debugColorEnabled()
+bool Debug::debugColorDisabled()
 {
-    return KGlobal::config()->group( QLatin1String("General") ).readEntry( \
QLatin1String("Debug Colorization Enabled"), true ); +    return \
KGlobal::config()->group( QLatin1String("General") ).readEntry( QLatin1String("Debug \
Colorization Disabled"), false );  }
 
 kdbgstream Debug::dbgstream( DebugLevel level )
diff --git a/src/core/support/Debug.h b/src/core/support/Debug.h
index e3638fe..8e4aaa5 100644
--- a/src/core/support/Debug.h
+++ b/src/core/support/Debug.h
@@ -88,7 +88,7 @@ namespace Debug
 
     AMAROK_CORE_EXPORT kdbgstream dbgstream( DebugLevel level = KDEBUG_INFO );
     AMAROK_CORE_EXPORT bool debugEnabled();
-    AMAROK_CORE_EXPORT bool debugColorEnabled();
+    AMAROK_CORE_EXPORT bool debugColorDisabled();
     AMAROK_CORE_EXPORT const QString &indent();
 
     static inline kdbgstream dbgstreamwrapper( DebugLevel level ) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic