Amarok – versatile and easy to use audio player
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
6.9KB

  1. //Released under GPLv2 or later. (C) 2005 Ian Monroe <ian@monroe.nu>
  2. /****************************************************************************
  3. ** ui.h extension file, included from the uic-generated form implementation.
  4. **
  5. ** If you want to add, delete, or rename functions or slots, use
  6. ** TQt Designer to update this file, preserving your code.
  7. **
  8. ** You should not define a constructor or destructor in this file.
  9. ** Instead, write your code in functions called init() and destroy().
  10. ** These will automatically be called by the form's constructor and
  11. ** destructor.
  12. *****************************************************************************/
  13. #include <config.h>
  14. #include "amarokconfig.h"
  15. #include "moodbar.h"
  16. #include "starmanager.h"
  17. #include <kcolordialog.h>
  18. #include <kstandarddirs.h>
  19. void Options1::init()
  20. {
  21. slotUpdateMoodFrame();
  22. //kcfg_CustomRatingsColors->setChecked( AmarokConfig::customRatingsColors() );
  23. //slotUpdateRatingsFrame();
  24. TQStringList browsers;
  25. browsers << "konqueror" << "firefox" << "opera" << "galeon" << "epiphany"
  26. << "safari" << "mozilla";
  27. // Remove browsers which are not actually installed
  28. for( TQStringList::Iterator it = browsers.begin(), end = browsers.end(); it != end; ) {
  29. if( TDEStandardDirs::findExe( *it ).isEmpty() )
  30. it = browsers.erase( it );
  31. else
  32. ++it;
  33. }
  34. #ifdef TQ_WS_MAC
  35. if ( TDEStandardDirs::findExe( "open" ) != TQString() )
  36. browsers.prepend( i18n( "Default Browser" ) );
  37. #else
  38. if ( TDEStandardDirs::findExe( "kfmclient" ) != TQString() )
  39. browsers.prepend( i18n( "Default TDE Browser" ) );
  40. #endif
  41. kComboBox_browser->insertStringList( browsers );
  42. kLineEdit_customBrowser->setText( AmarokConfig::externalBrowser() );
  43. int index = browsers.findIndex( AmarokConfig::externalBrowser() );
  44. if( index >= 0 )
  45. kComboBox_browser->setCurrentItem( index );
  46. else if( AmarokConfig::externalBrowser() ==
  47. #ifdef TQ_WS_MAC
  48. "open"
  49. #else
  50. "kfmclient openURL"
  51. #endif
  52. )
  53. {
  54. kComboBox_browser->setCurrentItem( 0 );
  55. }
  56. else
  57. {
  58. checkBox_customBrowser->setChecked( true );
  59. }
  60. }
  61. void Options1::slotUpdateMoodFrame()
  62. {
  63. if( Moodbar::executableExists() )
  64. {
  65. moodbarHelpLabel->hide();
  66. moodFrame->setEnabled(true);
  67. kcfg_MakeMoodier->setEnabled(kcfg_ShowMoodbar->isChecked());
  68. kcfg_AlterMood->setEnabled(kcfg_ShowMoodbar->isChecked() && kcfg_MakeMoodier->isChecked());
  69. kcfg_MoodsWithMusic->setEnabled(kcfg_ShowMoodbar->isChecked());
  70. }
  71. else
  72. {
  73. moodbarHelpLabel->show();
  74. kcfg_ShowMoodbar->setChecked(false);
  75. moodFrame->setEnabled(false);
  76. }
  77. }
  78. /*
  79. void Options1::slotUpdateRatingsFrame()
  80. {
  81. kcfg_CustomRatingsColors->setEnabled( kcfg_UseRatings->isChecked() );
  82. bool enableStars = kcfg_UseRatings->isChecked() && kcfg_CustomRatingsColors->isChecked();
  83. kcfg_FixedHalfStarColor->setEnabled( enableStars );
  84. AmarokConfig::setCustomRatingsColors( enableStars );
  85. StarManager::instance()->reinitStars();
  86. ratingsFrame->setEnabled( enableStars );
  87. fivestar_1->setPixmap( *StarManager::instance()->getStar( 5 ) );
  88. fivestar_2->setPixmap( *StarManager::instance()->getStar( 5 ) );
  89. fivestar_3->setPixmap( *StarManager::instance()->getStar( 5 ) );
  90. fivestar_4->setPixmap( *StarManager::instance()->getStar( 5 ) );
  91. fivestar_5->setPixmap( *StarManager::instance()->getStar( 5 ) );
  92. fivestar_1->setEnabled( enableStars );
  93. fivestar_2->setEnabled( enableStars );
  94. fivestar_3->setEnabled( enableStars );
  95. fivestar_4->setEnabled( enableStars );
  96. fivestar_5->setEnabled( enableStars );
  97. fourstar_1->setPixmap( *StarManager::instance()->getStar( 4 ) );
  98. fourstar_2->setPixmap( *StarManager::instance()->getStar( 4 ) );
  99. fourstar_3->setPixmap( *StarManager::instance()->getStar( 4 ) );
  100. fourstar_4->setPixmap( *StarManager::instance()->getStar( 4 ) );
  101. fourstar_1->setEnabled( enableStars );
  102. fourstar_2->setEnabled( enableStars );
  103. fourstar_3->setEnabled( enableStars );
  104. fourstar_4->setEnabled( enableStars );
  105. threestar_1->setPixmap( *StarManager::instance()->getStar( 3 ) );
  106. threestar_2->setPixmap( *StarManager::instance()->getStar( 3 ) );
  107. threestar_3->setPixmap( *StarManager::instance()->getStar( 3 ) );
  108. threestar_1->setEnabled( enableStars );
  109. threestar_2->setEnabled( enableStars );
  110. threestar_3->setEnabled( enableStars );
  111. twostar_1->setPixmap( *StarManager::instance()->getStar( 2 ) );
  112. twostar_2->setPixmap( *StarManager::instance()->getStar( 2 ) );
  113. twostar_1->setEnabled( enableStars );
  114. twostar_2->setEnabled( enableStars );
  115. onestar_1->setPixmap( *StarManager::instance()->getStar( 1 ) );
  116. onestar_1->setEnabled( enableStars );
  117. halfstar->setPixmap( *StarManager::instance()->getHalfStar() );
  118. halfstar->setEnabled( enableStars );
  119. }
  120. void Options1::slotFixedHalfStarColor()
  121. {
  122. bool checked = kcfg_FixedHalfStarColor->isChecked();
  123. AmarokConfig::setFixedHalfStarColor( kcfg_FixedHalfStarColor->isChecked() );
  124. slotUpdateRatingsFrame();
  125. }
  126. void Options1::slotPickColorHalf()
  127. {
  128. TQColor halfStar;
  129. int result = KColorDialog::getColor( halfStar );
  130. if( result == KColorDialog::Accepted )
  131. {
  132. AmarokConfig::setStarColorHalf( halfStar );
  133. StarManager::instance()->setHalfColor( halfStar );
  134. slotUpdateRatingsFrame();
  135. }
  136. }
  137. void Options1::slotPickColorOne()
  138. {
  139. TQColor oneStar;
  140. int result = KColorDialog::getColor( oneStar );
  141. if( result == KColorDialog::Accepted )
  142. {
  143. AmarokConfig::setStarColorOne( oneStar );
  144. StarManager::instance()->setColor( 1, oneStar );
  145. slotUpdateRatingsFrame();
  146. }
  147. }
  148. void Options1::slotPickColorTwo()
  149. {
  150. TQColor twoStar;
  151. int result = KColorDialog::getColor( twoStar );
  152. if( result == KColorDialog::Accepted )
  153. {
  154. AmarokConfig::setStarColorTwo( twoStar );
  155. StarManager::instance()->setColor( 2, twoStar );
  156. slotUpdateRatingsFrame();
  157. }
  158. }
  159. void Options1::slotPickColorThree()
  160. {
  161. TQColor threeStar;
  162. int result = KColorDialog::getColor( threeStar );
  163. if( result == KColorDialog::Accepted )
  164. {
  165. AmarokConfig::setStarColorThree( threeStar );
  166. StarManager::instance()->setColor( 3, threeStar );
  167. slotUpdateRatingsFrame();
  168. }
  169. }
  170. void Options1::slotPickColorFour()
  171. {
  172. TQColor fourStar;
  173. int result = KColorDialog::getColor( fourStar );
  174. if( result == KColorDialog::Accepted )
  175. {
  176. AmarokConfig::setStarColorFour( fourStar );
  177. StarManager::instance()->setColor( 4, fourStar );
  178. slotUpdateRatingsFrame();
  179. }
  180. }
  181. void Options1::slotPickColorFive()
  182. {
  183. TQColor fiveStar;
  184. int result = KColorDialog::getColor( fiveStar );
  185. if( result == KColorDialog::Accepted )
  186. {
  187. AmarokConfig::setStarColorFive( fiveStar );
  188. StarManager::instance()->setColor( 5, fiveStar );
  189. slotUpdateRatingsFrame();
  190. }
  191. }
  192. */