diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/filelist.cpp | 28 | ||||
| -rw-r--r-- | src/filelist.h | 18 | ||||
| -rw-r--r-- | src/logviewer.cpp | 30 | ||||
| -rw-r--r-- | src/replaygainfilelist.cpp | 51 |
4 files changed, 54 insertions, 73 deletions
diff --git a/src/filelist.cpp b/src/filelist.cpp index eb8b973..a198346 100644 --- a/src/filelist.cpp +++ b/src/filelist.cpp @@ -62,10 +62,6 @@ FileListItem::~FileListItem() void FileListItem::paintCell( TQPainter *p, const TQColorGroup &cg, int column, int width, int alignment ) { // NOTE speed up this function - // NOTE calculate the red color - - TQColorGroup _cg( cg ); - TQColor c; if( column == ((FileList*)listView())->columnByName(i18n("Input")) || column == ((FileList*)listView())->columnByName(i18n("Output")) ) { @@ -88,23 +84,17 @@ void FileListItem::paintCell( TQPainter *p, const TQColorGroup &cg, int column, }*/ } - if( isSelected() && converting ) { - _cg.setColor( TQColorGroup::Highlight, TQColor( 215, 62, 62 ) ); - TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; - } - else if( converting && column != listView()->sortColumn() ) { - _cg.setColor( TQColorGroup::Base, TQColor( 255, 234, 234 ) ); - TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; - } - else if( converting && column == listView()->sortColumn() ) { - _cg.setColor( TQColorGroup::Base, TQColor( 247, 227, 227 ) ); + if( converting ) { + TQColorGroup _cg( cg ); + if ( isSelected() ) { + _cg.setColor( TQColorGroup::Highlight, shiftColorToRed(_cg.highlight(), 40) ); + } else { + _cg.setColor( TQColorGroup::Base, shiftColorToRed(backgroundColor(column), 40)); + } TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; + } else { + TDEListViewItem::paintCell( p, cg, column, width, alignment ); } - - TDEListViewItem::paintCell( p, _cg, column, width, alignment ); } /*void FileListItem::updateOutputCell() diff --git a/src/filelist.h b/src/filelist.h index 5122caa..e3e7071 100644 --- a/src/filelist.h +++ b/src/filelist.h @@ -5,6 +5,8 @@ #include <tdelistview.h> +#include <cstdint> + #include "conversionoptions.h" class CDManager; @@ -233,4 +235,20 @@ signals: void finished( float ); }; +inline TQColor shiftColorToRed(TQColor c, uint8_t strength) { + int r = c.red() + strength * (255 - c.red()) / 255; + int g = c.green() * (255 - strength) / 255; + int b = c.blue() * (255 - strength) / 255; + + return TQColor(r, g, b); +} + +inline TQColor shiftColorToYellow(TQColor c, uint8_t strength) { + int r = c.red() + strength * (255 - c.red()) / 255; + int g = c.green() + strength * (255 - c.green()) / 255; + int b = c.blue() * (255 - strength) / 255; + + return TQColor(r, g, b); +} + #endif // FILELIST_H diff --git a/src/logviewer.cpp b/src/logviewer.cpp index 21f9881..f965592 100644 --- a/src/logviewer.cpp +++ b/src/logviewer.cpp @@ -1,6 +1,7 @@ #include "logviewer.h" #include "logger.h" +#include "filelist.h" //< for color shift functions #include <tqlayout.h> #include <tqstring.h> @@ -33,28 +34,17 @@ LogViewerItem::~LogViewerItem() void LogViewerItem::paintCell( TQPainter *p, const TQColorGroup &cg, int column, int width, int alignment ) { - // NOTE calculate the red color - - TQColorGroup _cg( cg ); - TQColor c; - - if( isSelected() && converting ) { - _cg.setColor( TQColorGroup::Highlight, TQColor( 215, 62, 62 ) ); - TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; - } - else if( converting && column != listView()->sortColumn() ) { - _cg.setColor( TQColorGroup::Base, TQColor( 255, 234, 234 ) ); - TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; - } - else if( converting && column == listView()->sortColumn() ) { - _cg.setColor( TQColorGroup::Base, TQColor( 247, 227, 227 ) ); + if( converting ) { + TQColorGroup _cg( cg ); + if ( isSelected() ) { + _cg.setColor( TQColorGroup::Highlight, shiftColorToRed(_cg.highlight(), 40) ); + } else { + _cg.setColor( TQColorGroup::Base, shiftColorToRed(backgroundColor(column), 40)); + } TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; + } else { + TDEListViewItem::paintCell( p, cg, column, width, alignment ); } - - TDEListViewItem::paintCell( p, _cg, column, width, alignment ); } diff --git a/src/replaygainfilelist.cpp b/src/replaygainfilelist.cpp index 0a7c88b..8b5952b 100644 --- a/src/replaygainfilelist.cpp +++ b/src/replaygainfilelist.cpp @@ -5,6 +5,7 @@ #include "configuration.h" #include "replaygain.h" #include "replaygainpluginloader.h" +#include "filelist.h" //< for color shift functions #include <tqdir.h> #include <tqpainter.h> @@ -66,10 +67,6 @@ ReplayGainFileListItem::~ReplayGainFileListItem() void ReplayGainFileListItem::paintCell( TQPainter *p, const TQColorGroup &cg, int column, int width, int alignment ) { // NOTE speed up this function - // NOTE calculate the red color - - TQColorGroup _cg( cg ); - TQColor c; if( column == ((ReplayGainFileList*)listView())->columnByName(i18n("File")) ) { @@ -83,39 +80,25 @@ void ReplayGainFileListItem::paintCell( TQPainter *p, const TQColorGroup &cg, in } } - if( isSelected() && addingReplayGain ) { - _cg.setColor( TQColorGroup::Highlight, TQColor( 215, 62, 62 ) ); - TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; - } - else if( addingReplayGain && column != listView()->sortColumn() ) { - _cg.setColor( TQColorGroup::Base, TQColor( 255, 234, 234 ) ); - TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; - } - else if( addingReplayGain && column == listView()->sortColumn() ) { - _cg.setColor( TQColorGroup::Base, TQColor( 247, 227, 227 ) ); - TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; - } - - if( isSelected() && queued ) { - _cg.setColor( TQColorGroup::Highlight, TQColor( 230, 232, 100 ) ); - TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; - } - else if( queued && column != listView()->sortColumn() ) { - _cg.setColor( TQColorGroup::Base, TQColor( 255, 255, 190 ) ); + if( addingReplayGain ) { + TQColorGroup _cg( cg ); + if ( isSelected() ) { + _cg.setColor( TQColorGroup::Highlight, shiftColorToRed(_cg.highlight(), 40) ); + } else { + _cg.setColor( TQColorGroup::Base, shiftColorToRed(backgroundColor(column), 40)); + } TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; - } - else if( queued && column == listView()->sortColumn() ) { - _cg.setColor( TQColorGroup::Base, TQColor( 255, 243, 168 ) ); + } else if (queued) { + TQColorGroup _cg( cg ); + if ( isSelected() ) { + _cg.setColor( TQColorGroup::Highlight, shiftColorToYellow(_cg.highlight(), 40) ); + } else { + _cg.setColor( TQColorGroup::Base, shiftColorToYellow(backgroundColor(column), 40)); + } TQListViewItem::paintCell( p, _cg, column, width, alignment ); - return; + } else { + TDEListViewItem::paintCell( p, cg, column, width, alignment ); } - - TDEListViewItem::paintCell( p, _cg, column, width, alignment ); } void ReplayGainFileListItem::setType( Type type ) |
