@ -68,15 +68,15 @@ email : markey@web.de
# include <kaboutdata.h>
# include <kio/job.h>
# include < qevent.h> //genericEventHandler()
# include < qeventloop.h> //applySettings()
# include < qfile.h>
# include < qobjectlist.h> //applyColorScheme()
# include < qpalette.h> //applyColorScheme()
# include < qpixmap.h> //QPixmap::setDefaultOptimization()
# include < qpopupmenu.h> //genericEventHandler
# include < qtimer.h> //showHyperThreadingWarning()
# include < qtooltip.h> //default tooltip for trayicon
# include < t qevent.h> //genericEventHandler()
# include < t qeventloop.h> //applySettings()
# include < t qfile.h>
# include < t qobjectlist.h> //applyColorScheme()
# include < t qpalette.h> //applyColorScheme()
# include < t qpixmap.h> //T QPixmap::setDefaultOptimization()
# include < t qpopupmenu.h> //genericEventHandler
# include < t qtimer.h> //showHyperThreadingWarning()
# include < t qtooltip.h> //default tooltip for trayicon
// For the HyperThreading fix
# ifdef __linux__
@ -86,8 +86,8 @@ email : markey@web.de
# endif //SCHEDAFFINITY_SUPPORT
# endif //__linux__
QMutex Debug : : mutex ;
QMutex Amarok : : globalDirsMutex ;
T QMutex Debug : : mutex ;
T QMutex Amarok : : globalDirsMutex ;
int App : : mainThreadId = 0 ;
@ -153,12 +153,12 @@ App::App()
char bundlePath [ 1024 ] ;
if ( CFURLGetFileSystemRepresentation ( urlRef , true , ( UInt8 * ) bundlePath , sizeof ( bundlePath ) ) )
{
QCString bp ( bundlePath ) ;
T QCString bp ( bundlePath ) ;
size_t len = bp . length ( ) ;
if ( len > 4 & & bp . right ( 4 ) = = " .app " )
{
bp . append ( " /Contents/MacOS " ) ;
QCString path = getenv ( " PATH " ) ;
T QCString path = getenv ( " PATH " ) ;
if ( path . length ( ) > 0 )
{
path . prepend ( " : " ) ;
@ -174,7 +174,7 @@ App::App()
}
# endif
QPixmap: : setDefaultOptimization ( QPixmap: : MemoryOptim ) ;
T QPixmap: : setDefaultOptimization ( T QPixmap: : MemoryOptim ) ;
//needs to be created before the wizard
new Amarok : : DcopPlayerHandler ( ) ; // Must be created first
@ -197,7 +197,7 @@ App::App()
AEInstallEventHandler ( kCoreEventClass , kAEReopenApplication , appleEventProcessorUPP , ( long ) this , true ) ;
# endif
QTimer: : singleShot ( 0 , this , SLOT( continueInit ( ) ) ) ;
T QTimer: : singleShot ( 0 , this , TQT_ SLOT( continueInit ( ) ) ) ;
}
App : : ~ App ( )
@ -214,7 +214,7 @@ App::~App()
AmarokConfig : : setResumeTrack ( EngineController : : instance ( ) - > playingURL ( ) . prettyURL ( ) ) ;
AmarokConfig : : setResumeTime ( engine - > position ( ) ) ;
}
else AmarokConfig : : setResumeTrack ( QString: : null ) ; //otherwise it'll play previous resume next time!
else AmarokConfig : : setResumeTrack ( T QString: : null ) ; //otherwise it'll play previous resume next time!
}
EngineController : : instance ( ) - > endSession ( ) ; //records final statistics
@ -231,7 +231,7 @@ App::~App()
ThreadManager : : deleteInstance ( ) ; //waits for jobs to finish
// this must be deleted before the connection to the Xserver is
// severed, or we risk a crash when the QApplication is exited,
// severed, or we risk a crash when the T QApplication is exited,
// I asked Trolltech! *smug*
delete Amarok : : OSD : : instance ( ) ;
@ -244,24 +244,24 @@ App::~App()
# include <dcopref.h>
# include < qstringlist.h>
# include < t qstringlist.h>
namespace
{
// grabbed from KsCD source, kompatctdisk.cpp
QString urlToDevice ( const QString& device )
T QString urlToDevice ( const T QString& device )
{
KURL deviceUrl ( device ) ;
if ( deviceUrl . protocol ( ) = = " media " | | deviceUrl . protocol ( ) = = " system " )
{
DCOPRef mediamanager ( " kded " , " mediamanager " ) ;
DCOPReply reply = mediamanager . call ( " properties( QString)" , deviceUrl . fileName ( ) ) ;
QStringList properties = reply ;
DCOPReply reply = mediamanager . call ( " properties( T QString)" , deviceUrl . fileName ( ) ) ;
T QStringList properties = reply ;
if ( ! reply . isValid ( ) | | properties . count ( ) < 6 )
{
debug ( ) < < " Invalid reply from mediamanager " < < endl ;
return QString( ) ;
return T QString( ) ;
}
else
{
@ -355,7 +355,7 @@ void App::handleCliArgs() //static
else if ( args - > isSet ( " cdplay " ) )
{
haveArgs = true ;
QString device = args - > getOption ( " cdplay " ) ;
T QString device = args - > getOption ( " cdplay " ) ;
device = DeviceManager : : instance ( ) - > convertMediaUrlToDevice ( device ) ;
KURL : : List urls ;
if ( EngineController : : engine ( ) - > getAudioCDContents ( device , urls ) ) {
@ -434,48 +434,48 @@ void App::initGlobalShortcuts()
EngineController * const ec = EngineController : : instance ( ) ;
m_pGlobalAccel - > insert ( " play " , i18n ( " Play " ) , 0 , KKey ( " WIN+x " ) , 0 ,
ec , SLOT( play ( ) ) , true , true ) ;
ec , TQT_ SLOT( play ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " pause " , i18n ( " Pause " ) , 0 , 0 , 0 ,
ec , SLOT( pause ( ) ) , true , true ) ;
ec , TQT_ SLOT( pause ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " play_pause " , i18n ( " Play/Pause " ) , 0 , KKey ( " WIN+c " ) , 0 ,
ec , SLOT( playPause ( ) ) , true , true ) ;
ec , TQT_ SLOT( playPause ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " stop " , i18n ( " Stop " ) , 0 , KKey ( " WIN+v " ) , 0 ,
ec , SLOT( stop ( ) ) , true , true ) ;
ec , TQT_ SLOT( stop ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " stop_after_global " , i18n ( " Stop Playing After Current Track " ) , 0 , KKey ( " WIN+CTRL+v " ) , 0 ,
Playlist : : instance ( ) - > qscrollview ( ) , SLOT( toggleStopAfterCurrentTrack ( ) ) , true , true ) ;
Playlist : : instance ( ) - > qscrollview ( ) , TQT_ SLOT( toggleStopAfterCurrentTrack ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " next " , i18n ( " Next Track " ) , 0 , KKey ( " WIN+b " ) , 0 ,
ec , SLOT( next ( ) ) , true , true ) ;
ec , TQT_ SLOT( next ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " prev " , i18n ( " Previous Track " ) , 0 , KKey ( " WIN+z " ) , 0 ,
ec , SLOT( previous ( ) ) , true , true ) ;
ec , TQT_ SLOT( previous ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " volup " , i18n ( " Increase Volume " ) , 0 , KKey ( " WIN+KP_Add " ) , 0 ,
ec , SLOT( increaseVolume ( ) ) , true , true ) ;
ec , TQT_ SLOT( increaseVolume ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " voldn " , i18n ( " Decrease Volume " ) , 0 , KKey ( " WIN+KP_Subtract " ) , 0 ,
ec , SLOT( decreaseVolume ( ) ) , true , true ) ;
ec , TQT_ SLOT( decreaseVolume ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " seekforward " , i18n ( " Seek Forward " ) , 0 , KKey ( " WIN+Shift+KP_Add " ) , 0 ,
ec , SLOT( seekForward ( ) ) , true , true ) ;
ec , TQT_ SLOT( seekForward ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " seekbackward " , i18n ( " Seek Backward " ) , 0 , KKey ( " WIN+Shift+KP_Subtract " ) , 0 ,
ec , SLOT( seekBackward ( ) ) , true , true ) ;
ec , TQT_ SLOT( seekBackward ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " playlist_add " , i18n ( " Add Media... " ) , 0 , KKey ( " WIN+a " ) , 0 ,
m_pPlaylistWindow , SLOT( slotAddLocation ( ) ) , true , true ) ;
m_pPlaylistWindow , TQT_ SLOT( slotAddLocation ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " show " , i18n ( " Toggle Playlist Window " ) , 0 , KKey ( " WIN+p " ) , 0 ,
m_pPlaylistWindow , SLOT( showHide ( ) ) , true , true ) ;
m_pPlaylistWindow , TQT_ SLOT( showHide ( ) ) , true , true ) ;
# ifdef Q_WS_X11
m_pGlobalAccel - > insert ( " osd " , i18n ( " Show OSD " ) , 0 , KKey ( " WIN+o " ) , 0 ,
Amarok : : OSD : : instance ( ) , SLOT( forceToggleOSD ( ) ) , true , true ) ;
Amarok : : OSD : : instance ( ) , TQT_ SLOT( forceToggleOSD ( ) ) , true , true ) ;
# endif
m_pGlobalAccel - > insert ( " mute " , i18n ( " Mute Volume " ) , 0 , KKey ( " WIN+m " ) , 0 ,
ec , SLOT( mute ( ) ) , true , true ) ;
ec , TQT_ SLOT( mute ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " rating1 " , i18n ( " Rate Current Track: 1 " ) , 0 , KKey ( " WIN+1 " ) , 0 ,
this , SLOT( setRating1 ( ) ) , true , true ) ;
this , TQT_ SLOT( setRating1 ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " rating2 " , i18n ( " Rate Current Track: 2 " ) , 0 , KKey ( " WIN+2 " ) , 0 ,
this , SLOT( setRating2 ( ) ) , true , true ) ;
this , TQT_ SLOT( setRating2 ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " rating3 " , i18n ( " Rate Current Track: 3 " ) , 0 , KKey ( " WIN+3 " ) , 0 ,
this , SLOT( setRating3 ( ) ) , true , true ) ;
this , TQT_ SLOT( setRating3 ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " rating4 " , i18n ( " Rate Current Track: 4 " ) , 0 , KKey ( " WIN+4 " ) , 0 ,
this , SLOT( setRating4 ( ) ) , true , true ) ;
this , TQT_ SLOT( setRating4 ( ) ) , true , true ) ;
m_pGlobalAccel - > insert ( " rating5 " , i18n ( " Rate Current Track: 5 " ) , 0 , KKey ( " WIN+5 " ) , 0 ,
this , SLOT( setRating5 ( ) ) , true , true ) ;
this , TQT_ SLOT( setRating5 ( ) ) , true , true ) ;
m_pGlobalAccel - > setConfigGroup ( " Shortcuts " ) ;
m_pGlobalAccel - > readSettings ( kapp - > config ( ) ) ;
@ -515,9 +515,9 @@ void App::fixHyperThreading()
DEBUG_BLOCK
# ifdef __linux__
QString line ;
T QString line ;
uint cpuCount = 0 ;
QFile cpuinfo ( " /proc/cpuinfo " ) ;
T QFile cpuinfo ( " /proc/cpuinfo " ) ;
if ( cpuinfo . open ( IO_ReadOnly ) ) {
while ( cpuinfo . readLine ( line , 20000 ) ! = - 1 ) {
if ( line . startsWith ( " flags " ) )
@ -540,12 +540,12 @@ void App::fixHyperThreading()
# endif //SCHEDAFFINITY_3PARAMS
{
warning ( ) < < " sched_setaffinity() call failed with error code: " < < errno < < endl ;
QTimer: : singleShot ( 0 , this , SLOT( showHyperThreadingWarning ( ) ) ) ;
T QTimer: : singleShot ( 0 , this , TQT_ SLOT( showHyperThreadingWarning ( ) ) ) ;
return ;
}
# else //SCHEDAFFINITY_SUPPORT
warning ( ) < < " glibc failed checks for sched_setaffinity " < < endl ;
QTimer: : singleShot ( 0 , this , SLOT( showHyperThreadingWarning ( ) ) ) ;
T QTimer: : singleShot ( 0 , this , TQT_ SLOT( showHyperThreadingWarning ( ) ) ) ;
# endif //SCHEDAFFINITY_SUPPORT
}
else { debug ( ) < < " Workaround not enabled " < < endl ; }
@ -557,7 +557,7 @@ void App::fixHyperThreading()
void App : : showHyperThreadingWarning ( ) // SLOT
{
const QString text =
const T QString text =
i18n ( " <p>You are using a system with multiple CPUs. "
" Please note that Amarok may be unstable with this "
" configuration.</p> "
@ -576,14 +576,14 @@ void App::showHyperThreadingWarning() // SLOT
# include <taglib/id3v1tag.h>
# include <taglib/tbytevector.h>
# include < qtextcodec.h>
# include < t qtextcodec.h>
//this class is only used in this module, so I figured I may as well define it
//here and save creating another header/source file combination
class ID3v1StringHandler : public TagLib : : ID3v1 : : StringHandler
{
QTextCodec * m_codec ;
T QTextCodec * m_codec ;
virtual TagLib : : String parse ( const TagLib : : ByteVector & data ) const
{
@ -592,19 +592,19 @@ class ID3v1StringHandler : public TagLib::ID3v1::StringHandler
virtual TagLib : : ByteVector render ( const TagLib : : String & ts ) const
{
const QCString qcs = m_codec - > fromUnicode ( TStringToQString ( ts ) ) ;
const T QCString qcs = m_codec - > fromUnicode ( TStringToQString ( ts ) ) ;
return TagLib : : ByteVector ( qcs , qcs . length ( ) ) ;
}
public :
ID3v1StringHandler ( int codecIndex )
: m_codec ( QTextCodec: : codecForIndex ( codecIndex ) )
: m_codec ( T QTextCodec: : codecForIndex ( codecIndex ) )
{
debug ( ) < < " codec: " < < m_codec < < endl ;
debug ( ) < < " codec-name: " < < m_codec - > name ( ) < < endl ;
}
ID3v1StringHandler ( QTextCodec * codec )
ID3v1StringHandler ( T QTextCodec * codec )
: m_codec ( codec )
{
debug ( ) < < " codec: " < < m_codec < < endl ;
@ -642,7 +642,7 @@ void App::applySettings( bool firstTime )
if ( ! firstTime ) m_pPlayerWindow - > show ( ) ;
connect ( m_pPlayerWindow , SIGNAL( playlistToggled ( bool ) ) , m_pPlaylistWindow , SLOT( showHide ( ) ) ) ;
connect ( m_pPlayerWindow , TQT_ SIGNAL( playlistToggled ( bool ) ) , m_pPlaylistWindow , TQT_ SLOT( showHide ( ) ) ) ;
# ifdef Q_WS_X11
//TODO get this to work!
@ -699,7 +699,7 @@ void App::applySettings( bool firstTime )
//on startup we need to show the window, but only if it wasn't hidden on exit
//and always if the trayicon isn't showing
QWidget* main_window = mainWindow ( ) ;
T QWidget* main_window = mainWindow ( ) ;
# ifdef Q_WS_X11
if ( ( main_window & & firstTime & & ! Amarok : : config ( ) - > readBoolEntry ( " HiddenOnExit " , false ) ) | | ( main_window & & ! AmarokConfig : : showTrayIcon ( ) ) )
# endif
@ -707,7 +707,7 @@ void App::applySettings( bool firstTime )
main_window - > show ( ) ;
//takes longer but feels shorter. Crazy eh? :)
kapp - > eventLoop ( ) - > processEvents ( QEventLoop: : ExcludeUserInput ) ;
kapp - > eventLoop ( ) - > processEvents ( T QEventLoop: : ExcludeUserInput ) ;
}
@ -739,12 +739,12 @@ void App::applySettings( bool firstTime )
} //</Context>
{ // delete unneeded cover images from cache
const QString size = QString: : number ( AmarokConfig : : coverPreviewSize ( ) ) + ' @ ' ;
const QDir cacheDir = Amarok : : saveLocation ( " albumcovers/cache/ " ) ;
const QStringList obsoleteCovers = cacheDir . entryList ( " * " ) ;
const T QString size = T QString: : number ( AmarokConfig : : coverPreviewSize ( ) ) + ' @ ' ;
const T QDir cacheDir = Amarok : : saveLocation ( " albumcovers/cache/ " ) ;
const T QStringList obsoleteCovers = cacheDir . entryList ( " * " ) ;
foreach ( obsoleteCovers )
if ( ! ( * it ) . startsWith ( size ) & & ! ( * it ) . startsWith ( " 50@ " ) )
QFile( cacheDir . filePath ( * it ) ) . remove ( ) ;
T QFile( cacheDir . filePath ( * it ) ) . remove ( ) ;
}
//if ( !firstTime )
@ -767,7 +767,7 @@ App::continueInit()
MoodServer : : instance ( ) ;
// Remember old folder setup, so we can detect changes after the wizard was used
//const QStringList oldCollectionFolders = MountPointManager::instance()->collectionFolders();
//const T QStringList oldCollectionFolders = MountPointManager::instance()->collectionFolders();
if ( Amarok : : config ( ) - > readBoolEntry ( " First Run " , true ) | | args - > isSet ( " wizard " ) ) {
@ -787,7 +787,7 @@ App::continueInit()
# endif
m_pPlaylistWindow - > init ( ) ; //creates the playlist, browsers, etc.
//init playlist window as soon as the database is guaranteed to be usable
//connect( CollectionDB::instance(), SIGNAL( databaseUpdateDone() ), m_pPlaylistWindow, SLOT( init() ) );
//connect( CollectionDB::instance(), TQT_ SIGNAL( databaseUpdateDone() ), m_pPlaylistWindow, TQT_ SLOT( init() ) );
initGlobalShortcuts ( ) ;
//load previous playlist in separate thread
if ( restoreSession & & AmarokConfig : : savePlaylist ( ) )
@ -798,7 +798,7 @@ App::continueInit()
}
if ( args - > isSet ( " engine " ) ) {
// we correct some common errors (case issues, missing -engine off the end)
QString engine = args - > getOption ( " engine " ) . lower ( ) ;
T QString engine = args - > getOption ( " engine " ) . lower ( ) ;
if ( engine . startsWith ( " gstreamer " ) ) engine = " gst-engine " ;
if ( ! engine . endsWith ( " engine " ) ) engine + = " -engine " ;
@ -815,7 +815,7 @@ App::continueInit()
std : : cout < < " STARTUP \n " < < std : : flush ;
//after this point only analyzer and temporary pixmaps will be created
QPixmap: : setDefaultOptimization ( QPixmap: : BestOptim ) ;
T QPixmap: : setDefaultOptimization ( T QPixmap: : BestOptim ) ;
//do after applySettings(), or the OSD will flicker and other wierdness!
//do before restoreSession()!
@ -838,11 +838,11 @@ App::continueInit()
// (e.g. deleted collection.db)
if ( CollectionDB : : instance ( ) - > isEmpty ( ) )
{
//connect( collDB, SIGNAL( databaseUpdateDone() ), collDB, SLOT( startScan() ) );
//connect( collDB, TQT_ SIGNAL( databaseUpdateDone() ), collDB, TQT_ SLOT( startScan() ) );
collDB - > startScan ( ) ;
}
else if ( AmarokConfig : : monitorChanges ( ) )
//connect( collDB, SIGNAL( databaseUpdateDone() ), collDB, SLOT( scanModifiedDirs() ) );
//connect( collDB, TQT_ SIGNAL( databaseUpdateDone() ), collDB, TQT_ SLOT( scanModifiedDirs() ) );
collDB - > scanModifiedDirs ( ) ;
@ -852,11 +852,11 @@ App::continueInit()
void
App : : applyColorScheme ( )
{
QColorGroup group ;
T QColorGroup group ;
using Amarok : : ColorScheme : : AltBase ;
int h , s , v ;
QWidget* const browserBar = static_cast < QWidget* > ( playlistWindow ( ) - > child ( " BrowserBar " ) ) ;
QWidget* const contextBrowser = static_cast < QWidget* > ( ContextBrowser : : instance ( ) ) ;
T QWidget* const browserBar = static_cast < T QWidget* > ( playlistWindow ( ) - > child ( " BrowserBar " ) ) ;
T QWidget* const contextBrowser = static_cast < T QWidget* > ( ContextBrowser : : instance ( ) ) ;
if ( AmarokConfig : : schemeKDE ( ) )
{
@ -871,31 +871,31 @@ App::applyColorScheme()
else if ( AmarokConfig : : schemeAmarok ( ) )
{
group = QApplication: : palette ( ) . active ( ) ;
const QColor bg ( Amarok : : blue ) ;
group = T QApplication: : palette ( ) . active ( ) ;
const T QColor bg ( Amarok : : blue ) ;
AltBase . setRgb ( 57 , 64 , 98 ) ;
group . setColor ( QColorGroup: : Text , Qt : : white ) ;
group . setColor ( QColorGroup: : Link , 0xCCCCCC ) ;
group . setColor ( QColorGroup: : Base , bg ) ;
group . setColor ( QColorGroup: : Foreground , 0xd7d7ef ) ;
group . setColor ( QColorGroup: : Background , AltBase ) ;
group . setColor ( T QColorGroup: : Text , Qt : : white ) ;
group . setColor ( T QColorGroup: : Link , 0xCCCCCC ) ;
group . setColor ( T QColorGroup: : Base , bg ) ;
group . setColor ( T QColorGroup: : Foreground , 0xd7d7ef ) ;
group . setColor ( T QColorGroup: : Background , AltBase ) ;
group . setColor ( QColorGroup: : Button , AltBase ) ;
group . setColor ( QColorGroup: : ButtonText , 0xd7d7ef ) ;
group . setColor ( T QColorGroup: : Button , AltBase ) ;
group . setColor ( T QColorGroup: : ButtonText , 0xd7d7ef ) ;
// group.setColor( QColorGroup::Light, Qt::cyan /*lighter than Button color*/ );
// group.setColor( QColorGroup::Midlight, Qt::blue /*between Button and Light*/ );
// group.setColor( QColorGroup::Dark, Qt::green /*darker than Button*/ );
// group.setColor( QColorGroup::Mid, Qt::red /*between Button and Dark*/ );
// group.setColor( QColorGroup::Shadow, Qt::yellow /*a very dark color. By default, the shadow color is Qt::black*/ );
// group.setColor( T QColorGroup::Light, Qt::cyan /*lighter than Button color*/ );
// group.setColor( T QColorGroup::Midlight, Qt::blue /*between Button and Light*/ );
// group.setColor( T QColorGroup::Dark, Qt::green /*darker than Button*/ );
// group.setColor( T QColorGroup::Mid, Qt::red /*between Button and Dark*/ );
// group.setColor( T QColorGroup::Shadow, Qt::yellow /*a very dark color. By default, the shadow color is Qt::black*/ );
group . setColor ( QColorGroup: : Highlight , Qt : : white ) ;
group . setColor ( QColorGroup: : HighlightedText , bg ) ;
//group.setColor( QColorGroup::BrightText, QColor( 0xff, 0x40, 0x40 ) ); //GlowColor
group . setColor ( T QColorGroup: : Highlight , Qt : : white ) ;
group . setColor ( T QColorGroup: : HighlightedText , bg ) ;
//group.setColor( T QColorGroup::BrightText, T QColor( 0xff, 0x40, 0x40 ) ); //GlowColor
AltBase . getHsv ( & h , & s , & v ) ;
group . setColor ( QColorGroup: : Midlight , QColor( h , s / 3 , ( int ) ( v * 1.2 ) , QColor: : Hsv ) ) ; //column separator in playlist
group . setColor ( T QColorGroup: : Midlight , T QColor( h , s / 3 , ( int ) ( v * 1.2 ) , T QColor: : Hsv ) ) ; //column separator in playlist
//TODO set all colours, even button colours, that way we can change the dark,
//light, etc. colours and Amarok scheme will look much better
@ -907,18 +907,18 @@ App::applyColorScheme()
Foreground = 0x80A0FF ;
//all children() derive their palette from this
playlistWindow ( ) - > setPalette ( QPalette( group , group , group ) ) ;
playlistWindow ( ) - > setPalette ( T QPalette( group , group , group ) ) ;
browserBar - > unsetPalette ( ) ;
contextBrowser - > setPalette ( QPalette( group , group , group ) ) ;
contextBrowser - > setPalette ( T QPalette( group , group , group ) ) ;
}
else if ( AmarokConfig : : schemeCustom ( ) )
{
// we try to be smart: this code figures out contrasting colors for
// selection and alternate background rows
group = QApplication: : palette ( ) . active ( ) ;
const QColor fg ( AmarokConfig : : playlistWindowFgColor ( ) ) ;
const QColor bg ( AmarokConfig : : playlistWindowBgColor ( ) ) ;
group = T QApplication: : palette ( ) . active ( ) ;
const T QColor fg ( AmarokConfig : : playlistWindowFgColor ( ) ) ;
const T QColor bg ( AmarokConfig : : playlistWindowBgColor ( ) ) ;
//TODO use the ensureContrast function you devised in BlockAnalyzer
@ -930,34 +930,34 @@ App::applyColorScheme()
fg . hsv ( & h , & s , & v ) ;
v + = ( v < 128 ) ? + 150 : - 150 ;
v & = 255 ; //ensures 0 <= v < 256
QColor highlight ( h , s , v , QColor: : Hsv ) ;
T QColor highlight ( h , s , v , T QColor: : Hsv ) ;
group . setColor ( QColorGroup: : Base , bg ) ;
group . setColor ( QColorGroup: : Background , bg . dark ( 115 ) ) ;
group . setColor ( QColorGroup: : Text , fg ) ;
group . setColor ( QColorGroup: : Link , fg . light ( 120 ) ) ;
group . setColor ( QColorGroup: : Highlight , highlight ) ;
group . setColor ( QColorGroup: : HighlightedText , Qt : : white ) ;
group . setColor ( QColorGroup: : Dark , Qt : : darkGray ) ;
group . setColor ( T QColorGroup: : Base , bg ) ;
group . setColor ( T QColorGroup: : Background , bg . dark ( 115 ) ) ;
group . setColor ( T QColorGroup: : Text , fg ) ;
group . setColor ( T QColorGroup: : Link , fg . light ( 120 ) ) ;
group . setColor ( T QColorGroup: : Highlight , highlight ) ;
group . setColor ( T QColorGroup: : HighlightedText , Qt : : white ) ;
group . setColor ( T QColorGroup: : Dark , Qt : : darkGray ) ;
PlayerWidget : : determineAmarokColors ( ) ;
// we only colour the middle section since we only
// allow the user to choose two colours
browserBar - > setPalette ( QPalette( group , group , group ) ) ;
contextBrowser - > setPalette ( QPalette( group , group , group ) ) ;
browserBar - > setPalette ( T QPalette( group , group , group ) ) ;
contextBrowser - > setPalette ( T QPalette( group , group , group ) ) ;
playlistWindow ( ) - > unsetPalette ( ) ;
}
// set the KListView alternate colours
QObjectList* const list = playlistWindow ( ) - > queryList ( " KListView " ) ;
for ( QObject * o = list - > first ( ) ; o ; o = list - > next ( ) )
T QObjectList* const list = playlistWindow ( ) - > queryList ( " KListView " ) ;
for ( T QObject * o = list - > first ( ) ; o ; o = list - > next ( ) )
static_cast < KListView * > ( o ) - > setAlternateBackground ( AltBase ) ;
delete list ; //heap allocated!
}
bool Amarok : : genericEventHandler ( QWidget * recipient , QEvent * e )
bool Amarok : : genericEventHandler ( T QWidget * recipient , T QEvent * e )
{
//this is used as a generic event handler for widgets that want to handle
//typical events in an Amarok fashion
@ -971,15 +971,15 @@ bool Amarok::genericEventHandler( QWidget *recipient, QEvent *e )
switch ( e - > type ( ) )
{
case QEvent: : DragEnter :
# define e static_cast< QDropEvent*>(e)
case T QEvent: : DragEnter :
# define e static_cast< T QDropEvent*>(e)
e - > accept ( KURLDrag : : canDecode ( e ) ) ;
break ;
case QEvent: : Drop :
case T QEvent: : Drop :
if ( KURLDrag : : canDecode ( e ) )
{
QPopupMenu popup ;
T QPopupMenu popup ;
//FIXME this isn't a good way to determine if there is a currentTrack, need playlist() function
const bool b = EngineController : : engine ( ) - > loaded ( ) ;
@ -1007,9 +1007,9 @@ bool Amarok::genericEventHandler( QWidget *recipient, QEvent *e )
//this like every entry in the generic event handler is used by more than one widget
//please don't remove!
case QEvent: : Wheel :
case T QEvent: : Wheel :
{
# define e static_cast< QWheelEvent*>(e)
# define e static_cast< T QWheelEvent*>(e)
//this behaviour happens for the systray and the player window
//to override one, override it in that class
@ -1041,12 +1041,12 @@ bool Amarok::genericEventHandler( QWidget *recipient, QEvent *e )
break ;
}
case QEvent: : Close :
case T QEvent: : Close :
//KDE policy states we should hide to tray and not quit() when the
//close window button is pushed for the main widget
static_cast < QCloseEvent* > ( e ) - > accept ( ) ; //if we don't do this the info box appears on quit()!
static_cast < T QCloseEvent* > ( e ) - > accept ( ) ; //if we don't do this the info box appears on quit()!
if ( AmarokConfig : : showTrayIcon ( ) & & ! e - > spontaneous ( ) & & ! kapp - > sessionSaving ( ) )
{
@ -1128,7 +1128,7 @@ void App::slotConfigEqualizer() //SLOT
}
void App : : slotConfigAmarok ( const QCString& page )
void App : : slotConfigAmarok ( const T QCString& page )
{
DEBUG_THREAD_FUNC_INFO
@ -1139,7 +1139,7 @@ void App::slotConfigAmarok( const QCString& page )
//KConfigDialog didn't find an instance of this dialog, so lets create it :
dialog = new AmarokConfigDialog ( m_pPlaylistWindow , " settings " , AmarokConfig : : self ( ) ) ;
connect ( dialog , SIGNAL( settingsChanged ( ) ) , SLOT( applySettings ( ) ) ) ;
connect ( dialog , TQT_ SIGNAL( settingsChanged ( ) ) , TQT_ SLOT( applySettings ( ) ) ) ;
}
//FIXME it seems that if the dialog is on a different desktop it gets lost
@ -1188,17 +1188,17 @@ void App::firstRunWizard()
setTopWidget ( & wizard ) ;
KConfigDialogManager * config = new KConfigDialogManager ( & wizard , AmarokConfig : : self ( ) , " wizardconfig " ) ;
config - > updateWidgets ( ) ;
// connect(config, SIGNAL(settingsChanged()), SLOT(updateSettings()));
// connect(config, TQT_ SIGNAL(settingsChanged()), TQT_ SLOT(updateSettings()));
wizard . setCaption ( makeStdCaption ( i18n ( " First-Run Wizard " ) ) ) ;
if ( wizard . exec ( ) ! = QDialog: : Rejected )
if ( wizard . exec ( ) ! = T QDialog: : Rejected )
{
//make sure that the DB config is stored in amarokrc before calling CollectionDB's ctor
AmarokConfig : : setDatabaseEngine (
QString: : number ( Amarok : : databaseTypeCode ( wizard . dbSetup7 - > databaseEngine - > currentText ( ) ) ) ) ;
T QString: : number ( Amarok : : databaseTypeCode ( wizard . dbSetup7 - > databaseEngine - > currentText ( ) ) ) ) ;
config - > updateSettings ( ) ;
const QStringList oldCollectionFolders = MountPointManager : : instance ( ) - > collectionFolders ( ) ;
const T QStringList oldCollectionFolders = MountPointManager : : instance ( ) - > collectionFolders ( ) ;
wizard . writeCollectionConfig ( ) ;
// If wizard is invoked at runtime, rescan collection if folder setup has changed
@ -1235,7 +1235,7 @@ KIO::Job *App::trashFiles( const KURL::List &files )
# if KDE_IS_VERSION( 3, 3, 91 )
KIO : : Job * job = KIO : : trash ( files , true /*show progress*/ ) ;
Amarok : : StatusBar : : instance ( ) - > newProgressOperation ( job ) . setDescription ( i18n ( " Moving files to trash " ) ) ;
connect ( job , SIGNAL( result ( KIO : : Job * ) ) , this , SLOT( slotTrashResult ( KIO : : Job * ) ) ) ;
connect ( job , TQT_ SIGNAL( result ( KIO : : Job * ) ) , this , TQT_ SLOT( slotTrashResult ( KIO : : Job * ) ) ) ;
return job ;
# else
KIO : : Job * job = KIO : : move ( files , KGlobalSettings : : trashPath ( ) ) ;
@ -1252,7 +1252,7 @@ void App::setRating( int n )
const Engine : : State s = EngineController : : instance ( ) - > engine ( ) - > state ( ) ;
if ( s = = Engine : : Playing | | s = = Engine : : Paused | | s = = Engine : : Idle )
{
const QString path = EngineController : : instance ( ) - > playingURL ( ) . path ( ) ;
const T QString path = EngineController : : instance ( ) - > playingURL ( ) . path ( ) ;
CollectionDB : : instance ( ) - > setSongRating ( path , n , true ) ;
const int rating = CollectionDB : : instance ( ) - > getSongRating ( path ) ;
EngineController : : instance ( ) - > updateBundleRating ( rating ) ;
@ -1270,10 +1270,10 @@ void App::slotTrashResult( KIO::Job *job )
job - > showErrorDialog ( PlaylistWindow : : self ( ) ) ;
}
QWidget * App : : mainWindow ( ) const
T QWidget * App : : mainWindow ( ) const
{
return AmarokConfig : : showPlayerWindow ( ) ? static_cast < QWidget* > ( m_pPlayerWindow )
: static_cast < QWidget* > ( m_pPlaylistWindow ) ;
return AmarokConfig : : showPlayerWindow ( ) ? static_cast < T QWidget* > ( m_pPlayerWindow )
: static_cast < T QWidget* > ( m_pPlaylistWindow ) ;
}
void App : : quit ( )
@ -1282,7 +1282,7 @@ void App::quit()
if ( MediaBrowser : : instance ( ) - > blockQuit ( ) )
{
// don't quit yet, as some media devices still have to finish transferring data
QTimer: : singleShot ( 100 , this , SLOT( quit ( ) ) ) ;
T QTimer: : singleShot ( 100 , this , TQT_ SLOT( quit ( ) ) ) ;
return ;
}
KApplication : : quit ( ) ;
@ -1292,7 +1292,7 @@ namespace Amarok
{
/// @see amarok.h
QWidget * mainWindow ( )
T QWidget * mainWindow ( )
{
return pApp - > playlistWindow ( ) ;
}
@ -1302,90 +1302,90 @@ namespace Amarok
return pApp - > playlistWindow ( ) - > actionCollection ( ) ;
}
KConfig * config ( const QString & group )
KConfig * config ( const T QString & group )
{
//Slightly more useful config() that allows setting the group simultaneously
kapp - > config ( ) - > setGroup ( group ) ;
return kapp - > config ( ) ;
}
bool invokeBrowser ( const QString& url )
bool invokeBrowser ( const T QString& url )
{
//URL can be in whatever forms KURL::fromPathOrURL understands - ie most.
const QString cmd = " %1 \" %2 \" " ;
const T QString cmd = " %1 \" %2 \" " ;
return KRun : : runCommand ( cmd . arg ( AmarokConfig : : externalBrowser ( ) , KURL : : fromPathOrURL ( url ) . url ( ) ) ) > 0 ;
}
namespace ColorScheme
{
QColor Base ;
QColor Text ;
QColor Background ;
QColor Foreground ;
QColor AltBase ;
T QColor Base ;
T QColor Text ;
T QColor Background ;
T QColor Foreground ;
T QColor AltBase ;
}
OverrideCursor : : OverrideCursor ( Qt : : CursorShape cursor )
{
QApplication: : setOverrideCursor ( cursor = = Qt : : WaitCursor ? KCursor : : waitCursor ( ) : KCursor : : workingCursor ( ) ) ;
T QApplication: : setOverrideCursor ( cursor = = Qt : : WaitCursor ? KCursor : : waitCursor ( ) : KCursor : : workingCursor ( ) ) ;
}
OverrideCursor : : ~ OverrideCursor ( )
{
QApplication: : restoreOverrideCursor ( ) ;
T QApplication: : restoreOverrideCursor ( ) ;
}
QString saveLocation ( const QString & directory )
T QString saveLocation ( const T QString & directory )
{
globalDirsMutex . lock ( ) ;
QString result = KGlobal : : dirs ( ) - > saveLocation ( " data " , QString( " amarok/ " ) + directory , true ) ;
T QString result = KGlobal : : dirs ( ) - > saveLocation ( " data " , T QString( " amarok/ " ) + directory , true ) ;
globalDirsMutex . unlock ( ) ;
return result ;
}
QString cleanPath ( const QString & path )
T QString cleanPath ( const T QString & path )
{
QString result = path ;
T QString result = path ;
// german umlauts
result . replace ( QChar( 0x00e4 ) , " ae " ) . replace ( QChar( 0x00c4 ) , " Ae " ) ;
result . replace ( QChar( 0x00f6 ) , " oe " ) . replace ( QChar( 0x00d6 ) , " Oe " ) ;
result . replace ( QChar( 0x00fc ) , " ue " ) . replace ( QChar( 0x00dc ) , " Ue " ) ;
result . replace ( QChar( 0x00df ) , " ss " ) ;
result . replace ( T QChar( 0x00e4 ) , " ae " ) . replace ( T QChar( 0x00c4 ) , " Ae " ) ;
result . replace ( T QChar( 0x00f6 ) , " oe " ) . replace ( T QChar( 0x00d6 ) , " Oe " ) ;
result . replace ( T QChar( 0x00fc ) , " ue " ) . replace ( T QChar( 0x00dc ) , " Ue " ) ;
result . replace ( T QChar( 0x00df ) , " ss " ) ;
// some strange accents
result . replace ( QChar( 0x00e7 ) , " c " ) . replace ( QChar( 0x00c7 ) , " C " ) ;
result . replace ( QChar( 0x00fd ) , " y " ) . replace ( QChar( 0x00dd ) , " Y " ) ;
result . replace ( QChar( 0x00f1 ) , " n " ) . replace ( QChar( 0x00d1 ) , " N " ) ;
result . replace ( T QChar( 0x00e7 ) , " c " ) . replace ( T QChar( 0x00c7 ) , " C " ) ;
result . replace ( T QChar( 0x00fd ) , " y " ) . replace ( T QChar( 0x00dd ) , " Y " ) ;
result . replace ( T QChar( 0x00f1 ) , " n " ) . replace ( T QChar( 0x00d1 ) , " N " ) ;
// czech letters with carons
result . replace ( QChar( 0x0161 ) , " s " ) . replace ( QChar( 0x0160 ) , " S " ) ;
result . replace ( QChar( 0x010d ) , " c " ) . replace ( QChar( 0x010c ) , " C " ) ;
result . replace ( QChar( 0x0159 ) , " r " ) . replace ( QChar( 0x0158 ) , " R " ) ;
result . replace ( QChar( 0x017e ) , " z " ) . replace ( QChar( 0x017d ) , " Z " ) ;
result . replace ( QChar( 0x0165 ) , " t " ) . replace ( QChar( 0x0164 ) , " T " ) ;
result . replace ( QChar( 0x0148 ) , " n " ) . replace ( QChar( 0x0147 ) , " N " ) ;
result . replace ( QChar( 0x010f ) , " d " ) . replace ( QChar( 0x010e ) , " D " ) ;
result . replace ( T QChar( 0x0161 ) , " s " ) . replace ( T QChar( 0x0160 ) , " S " ) ;
result . replace ( T QChar( 0x010d ) , " c " ) . replace ( T QChar( 0x010c ) , " C " ) ;
result . replace ( T QChar( 0x0159 ) , " r " ) . replace ( T QChar( 0x0158 ) , " R " ) ;
result . replace ( T QChar( 0x017e ) , " z " ) . replace ( T QChar( 0x017d ) , " Z " ) ;
result . replace ( T QChar( 0x0165 ) , " t " ) . replace ( T QChar( 0x0164 ) , " T " ) ;
result . replace ( T QChar( 0x0148 ) , " n " ) . replace ( T QChar( 0x0147 ) , " N " ) ;
result . replace ( T QChar( 0x010f ) , " d " ) . replace ( T QChar( 0x010e ) , " D " ) ;
// accented vowels
QChar a [ ] = { ' a ' , 0xe0 , 0xe1 , 0xe2 , 0xe3 , 0xe5 , 0 } ;
QChar A [ ] = { ' A ' , 0xc0 , 0xc1 , 0xc2 , 0xc3 , 0xc5 , 0 } ;
QChar e [ ] = { ' e ' , 0xe8 , 0xe9 , 0xea , 0xeb , 0x11b , 0 } ;
QChar E [ ] = { ' E ' , 0xc8 , 0xc9 , 0xca , 0xcb , 0x11a , 0 } ;
QChar i [ ] = { ' i ' , 0xec , 0xed , 0xee , 0xef , 0 } ;
QChar I [ ] = { ' I ' , 0xcc , 0xcd , 0xce , 0xcf , 0 } ;
QChar o [ ] = { ' o ' , 0xf2 , 0xf3 , 0xf4 , 0xf5 , 0xf8 , 0 } ;
QChar O [ ] = { ' O ' , 0xd2 , 0xd3 , 0xd4 , 0xd5 , 0xd8 , 0 } ;
QChar u [ ] = { ' u ' , 0xf9 , 0xfa , 0xfb , 0x16f , 0 } ;
QChar U [ ] = { ' U ' , 0xd9 , 0xda , 0xdb , 0x16e , 0 } ;
QChar nul [ ] = { 0 } ;
QChar * replacements [ ] = { a , A , e , E , i , I , o , O , u , U , nul } ;
T QChar a [ ] = { ' a ' , 0xe0 , 0xe1 , 0xe2 , 0xe3 , 0xe5 , 0 } ;
T QChar A [ ] = { ' A ' , 0xc0 , 0xc1 , 0xc2 , 0xc3 , 0xc5 , 0 } ;
T QChar e [ ] = { ' e ' , 0xe8 , 0xe9 , 0xea , 0xeb , 0x11b , 0 } ;
T QChar E [ ] = { ' E ' , 0xc8 , 0xc9 , 0xca , 0xcb , 0x11a , 0 } ;
T QChar i [ ] = { ' i ' , 0xec , 0xed , 0xee , 0xef , 0 } ;
T QChar I [ ] = { ' I ' , 0xcc , 0xcd , 0xce , 0xcf , 0 } ;
T QChar o [ ] = { ' o ' , 0xf2 , 0xf3 , 0xf4 , 0xf5 , 0xf8 , 0 } ;
T QChar O [ ] = { ' O ' , 0xd2 , 0xd3 , 0xd4 , 0xd5 , 0xd8 , 0 } ;
T QChar u [ ] = { ' u ' , 0xf9 , 0xfa , 0xfb , 0x16f , 0 } ;
T QChar U [ ] = { ' U ' , 0xd9 , 0xda , 0xdb , 0x16e , 0 } ;
T QChar nul [ ] = { 0 } ;
T QChar * replacements [ ] = { a , A , e , E , i , I , o , O , u , U , nul } ;
for ( uint i = 0 ; i < result . length ( ) ; i + + )
{
QChar c = result . ref ( i ) ;
for ( uint n = 0 ; replacements [ n ] [ 0 ] ! = QChar( 0 ) ; n + + )
T QChar c = result . ref ( i ) ;
for ( uint n = 0 ; replacements [ n ] [ 0 ] ! = T QChar( 0 ) ; n + + )
{
for ( uint k = 0 ; replacements [ n ] [ k ] ! = QChar( 0 ) ; k + + )
for ( uint k = 0 ; replacements [ n ] [ k ] ! = T QChar( 0 ) ; k + + )
{
if ( replacements [ n ] [ k ] = = c )
{
@ -1398,13 +1398,13 @@ namespace Amarok
return result ;
}
QString asciiPath ( const QString & path )
T QString asciiPath ( const T QString & path )
{
QString result = path ;
T QString result = path ;
for ( uint i = 0 ; i < result . length ( ) ; i + + )
{
QChar c = result . ref ( i ) ;
if ( c > QChar( 0x7f ) | | c = = QChar( 0 ) )
T QChar c = result . ref ( i ) ;
if ( c > T QChar( 0x7f ) | | c = = T QChar( 0 ) )
{
c = ' _ ' ;
}
@ -1413,14 +1413,14 @@ namespace Amarok
return result ;
}
QString vfatPath ( const QString & path )
T QString vfatPath ( const T QString & path )
{
QString s = path ;
T QString s = path ;
for ( uint i = 0 ; i < s . length ( ) ; i + + )
{
QChar c = s . ref ( i ) ;
if ( c < QChar( 0x20 )
T QChar c = s . ref ( i ) ;
if ( c < T QChar( 0x20 )
| | c = = ' * ' | | c = = ' ? ' | | c = = ' < ' | | c = = ' > '
| | c = = ' | ' | | c = = ' " ' | | c = = ' : ' | | c = = ' / '
| | c = = ' \\ ' )
@ -1431,14 +1431,14 @@ namespace Amarok
uint len = s . length ( ) ;
if ( len = = 3 | | ( len > 3 & & s [ 3 ] = = ' . ' ) )
{
QString l = s . left ( 3 ) . lower ( ) ;
T QString l = s . left ( 3 ) . lower ( ) ;
if ( l = = " aux " | | l = = " con " | | l = = " nul " | | l = = " prn " )
s = ' _ ' + s ;
}
else if ( len = = 4 | | ( len > 4 & & s [ 4 ] = = ' . ' ) )
{
QString l = s . left ( 3 ) . lower ( ) ;
QString d = s . mid ( 3 , 1 ) ;
T QString l = s . left ( 3 ) . lower ( ) ;
T QString d = s . mid ( 3 , 1 ) ;
if ( ( l = = " com " | | l = = " lpt " ) & &
( d = = " 0 " | | d = = " 1 " | | d = = " 2 " | | d = = " 3 " | | d = = " 4 " | |
d = = " 5 " | | d = = " 6 " | | d = = " 7 " | | d = = " 8 " | | d = = " 9 " ) )
@ -1459,9 +1459,9 @@ namespace Amarok
return s ;
}
QString decapitateString ( const QString & input , const QString & ref )
T QString decapitateString ( const T QString & input , const T QString & ref )
{
QString t = ref . upper ( ) ;
T QString t = ref . upper ( ) ;
int length = t . length ( ) ;
int commonLength = 0 ;
while ( length > 0 )
@ -1478,7 +1478,7 @@ namespace Amarok
length = length / 2 ;
}
}
QString clean = input ;
T QString clean = input ;
if ( t . endsWith ( " " ) | | ! ref . at ( t . length ( ) ) . isLetterOrNumber ( ) ) // common part ends with a space or complete word
clean = input . right ( input . length ( ) - commonLength ) . stripWhiteSpace ( ) ;
return clean ;