Changeset 137 for smplayer/vendor/current/src/prefinterface.cpp
- Timestamp:
- Dec 3, 2012, 5:29:00 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/vendor/current/src/prefinterface.cpp
r127 r137 22 22 #include "preferences.h" 23 23 #include "paths.h" 24 #include "config.h"25 24 #include "languages.h" 26 25 #include "recents.h" 26 #include "urlhistory.h" 27 27 28 28 #include <QDir> … … 50 50 iconset_combo->addItem( "Default" ); 51 51 52 #ifdef SKINS 53 n_skins = 0; 54 #endif 55 52 56 // User 53 57 QDir icon_dir = Paths::configPath() + "/themes"; … … 55 59 QStringList iconsets = icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); 56 60 for (int n=0; n < iconsets.count(); n++) { 61 #ifdef SKINS 62 QString css_file = Paths::configPath() + "/themes/" + iconsets[n] + "/main.css"; 63 bool is_skin = QFile::exists(css_file); 64 //qDebug("***** %s %d", css_file.toUtf8().constData(), is_skin); 65 if (is_skin) { 66 skin_combo->addItem( iconsets[n] ); 67 n_skins++; 68 } 69 else 70 #endif 57 71 iconset_combo->addItem( iconsets[n] ); 58 72 } … … 62 76 iconsets = icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); 63 77 for (int n=0; n < iconsets.count(); n++) { 78 #ifdef SKINS 79 QString css_file = Paths::themesPath() + "/" + iconsets[n] + "/main.css"; 80 bool is_skin = QFile::exists(css_file); 81 //qDebug("***** %s %d", css_file.toUtf8().constData(), is_skin); 82 if ((is_skin) && (iconset_combo->findText( iconsets[n] ) == -1)) { 83 skin_combo->addItem( iconsets[n] ); 84 n_skins++; 85 } 86 else 87 #endif 64 88 if (iconset_combo->findText( iconsets[n] ) == -1) { 65 89 iconset_combo->addItem( iconsets[n] ); 66 90 } 67 91 } 92 #ifdef SKINS 93 if (skin_combo->itemText(0) == "Black") { 94 skin_combo->removeItem(0); 95 skin_combo->addItem("Black"); 96 } 97 #endif 68 98 69 99 #ifdef SINGLE_INSTANCE … … 74 104 #endif 75 105 106 #ifdef SKINS 107 connect(gui_combo, SIGNAL(currentIndexChanged(int)), 108 this, SLOT(GUIChanged(int))); 109 #endif 110 76 111 #ifdef Q_OS_WIN 77 112 floating_bypass_wm_check->hide(); 113 #endif 114 115 #ifndef SEEKBAR_RESOLUTION 116 seeking_method_group->hide(); 117 #endif 118 119 #ifndef SKINS 120 skin_combo->hide(); 121 skin_label->hide(); 122 skin_sp->hide(); 78 123 #endif 79 124 … … 163 208 gui_combo->addItem( tr("Mini GUI"), "MiniGUI"); 164 209 gui_combo->addItem( tr("Mpc GUI"), "MpcGUI"); 210 #ifdef SKINS 211 gui_combo->addItem( tr("Skinnable GUI"), "SkinGUI"); 212 if (n_skins == 0) { 213 QModelIndex index = gui_combo->model()->index(gui_combo->count()-1,0); 214 gui_combo->model()->setData(index, QVariant(0), Qt::UserRole -1); 215 } 216 #endif 165 217 gui_combo->setCurrentIndex(gui_index); 166 218 … … 180 232 setUseSingleInstance(pref->use_single_instance); 181 233 #endif 182 setRecentsMaxItems(pref->history_recents->maxItems());183 184 234 setSeeking1(pref->seeking1); 185 235 setSeeking2(pref->seeking2); … … 188 238 189 239 setUpdateWhileDragging(pref->update_while_seeking); 240 #ifdef SEEKBAR_RESOLUTION 190 241 setRelativeSeeking(pref->relative_seeking); 242 #endif 191 243 setPreciseSeeking(pref->precise_seeking); 192 244 … … 208 260 setFloatingBypassWindowManager(pref->bypass_window_manager); 209 261 #endif 262 263 setRecentsMaxItems(pref->history_recents->maxItems()); 264 setURLMaxItems(pref->history_urls->maxItems()); 265 setRememberDirs(pref->save_dirs); 210 266 } 211 267 … … 241 297 #endif 242 298 243 if (pref->history_recents->maxItems() != recentsMaxItems()) {244 pref->history_recents->setMaxItems( recentsMaxItems() );245 recents_changed = true;246 }247 248 299 pref->seeking1 = seeking1(); 249 300 pref->seeking2 = seeking2(); … … 252 303 253 304 pref->update_while_seeking = updateWhileDragging(); 305 #ifdef SEEKBAR_RESOLUTION 254 306 pref->relative_seeking= relativeSeeking(); 307 #endif 255 308 pref->precise_seeking = preciseSeeking(); 256 309 … … 273 326 pref->bypass_window_manager = floatingBypassWindowManager(); 274 327 #endif 328 329 if (pref->history_recents->maxItems() != recentsMaxItems()) { 330 pref->history_recents->setMaxItems( recentsMaxItems() ); 331 recents_changed = true; 332 } 333 334 if (pref->history_urls->maxItems() != urlMaxItems()) { 335 pref->history_urls->setMaxItems( urlMaxItems() ); 336 url_max_changed = true; 337 } 338 339 pref->save_dirs = rememberDirs(); 275 340 } 276 341 … … 296 361 297 362 void PrefInterface::setIconSet(QString set) { 363 /* 298 364 if (set.isEmpty()) 299 365 iconset_combo->setCurrentIndex(0); 300 366 else 301 367 iconset_combo->setCurrentText(set); 368 */ 369 iconset_combo->setCurrentIndex(0); 370 for (int n=0; n < iconset_combo->count(); n++) { 371 if (iconset_combo->itemText(n) == set) { 372 iconset_combo->setCurrentIndex(n); 373 break; 374 } 375 } 376 #ifdef SKINS 377 skin_combo->setCurrentIndex(0); 378 for (int n=0; n < skin_combo->count(); n++) { 379 if (skin_combo->itemText(n) == set) { 380 skin_combo->setCurrentIndex(n); 381 break; 382 } 383 } 384 #endif 302 385 } 303 386 304 387 QString PrefInterface::iconSet() { 388 #ifdef SKINS 389 QString GUI = gui_combo->itemData(gui_combo->currentIndex()).toString(); 390 if (GUI == "SkinGUI") { 391 return skin_combo->currentText(); 392 } 393 else 394 #endif 305 395 if (iconset_combo->currentIndex()==0) 306 396 return ""; … … 341 431 342 432 void PrefInterface::setGUI(QString gui_name) { 433 #ifdef SKINS 434 if ((n_skins == 0) && (gui_name == "SkinGUI")) gui_name = "DefaultGUI"; 435 #endif 343 436 int i = gui_combo->findData(gui_name); 344 437 if (i < 0) i=0; … … 349 442 return gui_combo->itemData(gui_combo->currentIndex()).toString(); 350 443 } 444 445 #ifdef SKINS 446 void PrefInterface::GUIChanged(int index) { 447 if (gui_combo->itemData(index).toString() == "SkinGUI") { 448 iconset_combo->hide(); 449 iconset_label->hide(); 450 iconset_sp->hide(); 451 skin_combo->show(); 452 skin_label->show(); 453 skin_sp->show(); 454 } else { 455 iconset_combo->show(); 456 iconset_label->show(); 457 iconset_sp->show(); 458 skin_combo->hide(); 459 skin_label->hide(); 460 skin_sp->hide(); 461 } 462 } 463 #endif 351 464 352 465 #ifdef SINGLE_INSTANCE … … 360 473 } 361 474 #endif 362 363 void PrefInterface::setRecentsMaxItems(int n) {364 recents_max_items_spin->setValue(n);365 }366 367 int PrefInterface::recentsMaxItems() {368 return recents_max_items_spin->value();369 }370 475 371 476 void PrefInterface::setSeeking1(int n) { … … 412 517 } 413 518 519 #ifdef SEEKBAR_RESOLUTION 414 520 void PrefInterface::setRelativeSeeking(bool b) { 415 521 relative_seeking_button->setChecked(b); … … 420 526 return relative_seeking_button->isChecked(); 421 527 } 528 #endif 422 529 423 530 void PrefInterface::setPreciseSeeking(bool b) { … … 512 619 #endif 513 620 621 void PrefInterface::setRecentsMaxItems(int n) { 622 recents_max_items_spin->setValue(n); 623 } 624 625 int PrefInterface::recentsMaxItems() { 626 return recents_max_items_spin->value(); 627 } 628 629 void PrefInterface::setURLMaxItems(int n) { 630 url_max_items_spin->setValue(n); 631 } 632 633 int PrefInterface::urlMaxItems() { 634 return url_max_items_spin->value(); 635 } 636 637 void PrefInterface::setRememberDirs(bool b) { 638 save_dirs_check->setChecked(b); 639 } 640 641 bool PrefInterface::rememberDirs() { 642 return save_dirs_check->isChecked(); 643 } 644 514 645 void PrefInterface::createHelp() { 515 646 clearHelp(); … … 528 659 tr("If this option is enabled the video window will be hidden when playing audio files.") ); 529 660 530 setWhatsThis(recents_max_items_spin, tr("Recent files"),531 tr("Select the maximum number of items that will be shown in the "532 "<b>Open->Recent files</b> submenu. If you set it to 0 that "533 "menu won't be shown at all.") );534 535 661 setWhatsThis(language_combo, tr("Language"), 536 662 tr("Here you can change the language of the application.") ); 537 538 setWhatsThis(iconset_combo, tr("Icon set"),539 tr("Select the icon set you prefer for the application.") );540 541 setWhatsThis(style_combo, tr("Style"),542 tr("Select the style you prefer for the application.") );543 663 544 664 setWhatsThis(gui_combo, tr("GUI"), … … 548 668 "toolbar and control bar. The <b>Mini GUI</b> provides a " 549 669 "more simple GUI, without toolbar and a control bar with few " 550 "buttons.<br>" 551 "<b>Note:</b> this option will take effect the next " 552 "time you run SMPlayer.") ); 670 "buttons.") ); 671 672 setWhatsThis(iconset_combo, tr("Icon set"), 673 tr("Select the icon set you prefer for the application.") ); 674 675 #ifdef SKINS 676 setWhatsThis(skin_combo, tr("Skin"), 677 tr("Select the skin you prefer for the application. Only available with the skinnable GUI.") ); 678 #endif 679 680 setWhatsThis(style_combo, tr("Style"), 681 tr("Select the style you prefer for the application.") ); 682 553 683 554 684 setWhatsThis(changeFontButton, tr("Default font"), … … 576 706 tr("Select what to do when dragging the time slider.") ); 577 707 708 #ifdef SEEKBAR_RESOLUTION 578 709 setWhatsThis(seeking_method_group, tr("Seeking method"), 579 710 tr("Sets the method to be used when seeking with the slider. " 580 711 "Absolute seeking may be a little bit more accurate, while " 581 712 "relative seeking may work better with files with a wrong length.") ); 713 #endif 582 714 583 715 setWhatsThis(precise_seeking_check, tr("Precise seeking"), … … 621 753 "doesn't work well with your window manager.") ); 622 754 #endif 755 756 addSectionTitle(tr("Privacy")); 757 758 setWhatsThis(recents_max_items_spin, tr("Recent files"), 759 tr("Select the maximum number of items that will be shown in the " 760 "<b>Open->Recent files</b> submenu. If you set it to 0 that " 761 "menu won't be shown at all.") ); 762 763 setWhatsThis(url_max_items_spin, tr("Max. URLs"), 764 tr("Select the maximum number of items that the <b>Open->URL</b> " 765 "dialog will remember. Set it to 0 if you don't want any URL " 766 "to be stored.") ); 767 768 setWhatsThis(save_dirs_check, tr("Remember last directory"), 769 tr("If this option is checked, SMPlayer will remember the last folder you use to open a file.") ); 623 770 } 624 771
Note:
See TracChangeset
for help on using the changeset viewer.