Ignore:
Timestamp:
Dec 3, 2012, 5:29:00 PM (13 years ago)
Author:
Silvan Scherrer
Message:

SMPlayer: updated vendor to 0.8.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • smplayer/vendor/current/src/prefinterface.cpp

    r127 r137  
    2222#include "preferences.h"
    2323#include "paths.h"
    24 #include "config.h"
    2524#include "languages.h"
    2625#include "recents.h"
     26#include "urlhistory.h"
    2727
    2828#include <QDir>
     
    5050        iconset_combo->addItem( "Default" );
    5151
     52#ifdef SKINS
     53        n_skins = 0;
     54#endif
     55
    5256        // User
    5357        QDir icon_dir = Paths::configPath() + "/themes";
     
    5559        QStringList iconsets = icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
    5660        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
    5771                iconset_combo->addItem( iconsets[n] );
    5872        }
     
    6276        iconsets = icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
    6377        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
    6488                if (iconset_combo->findText( iconsets[n] ) == -1) {
    6589                        iconset_combo->addItem( iconsets[n] );
    6690                }
    6791        }
     92        #ifdef SKINS
     93        if (skin_combo->itemText(0) == "Black") {
     94                skin_combo->removeItem(0);
     95                skin_combo->addItem("Black");
     96        }
     97        #endif
    6898
    6999#ifdef SINGLE_INSTANCE
     
    74104#endif
    75105
     106#ifdef SKINS
     107        connect(gui_combo, SIGNAL(currentIndexChanged(int)),
     108            this, SLOT(GUIChanged(int)));
     109#endif
     110
    76111#ifdef Q_OS_WIN
    77112        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();
    78123#endif
    79124
     
    163208        gui_combo->addItem( tr("Mini GUI"), "MiniGUI");
    164209        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
    165217        gui_combo->setCurrentIndex(gui_index);
    166218
     
    180232        setUseSingleInstance(pref->use_single_instance);
    181233#endif
    182         setRecentsMaxItems(pref->history_recents->maxItems());
    183 
    184234        setSeeking1(pref->seeking1);
    185235        setSeeking2(pref->seeking2);
     
    188238
    189239        setUpdateWhileDragging(pref->update_while_seeking);
     240#ifdef SEEKBAR_RESOLUTION
    190241        setRelativeSeeking(pref->relative_seeking);
     242#endif
    191243        setPreciseSeeking(pref->precise_seeking);
    192244
     
    208260        setFloatingBypassWindowManager(pref->bypass_window_manager);
    209261#endif
     262
     263        setRecentsMaxItems(pref->history_recents->maxItems());
     264        setURLMaxItems(pref->history_urls->maxItems());
     265        setRememberDirs(pref->save_dirs);
    210266}
    211267
     
    241297#endif
    242298
    243         if (pref->history_recents->maxItems() != recentsMaxItems()) {
    244                 pref->history_recents->setMaxItems( recentsMaxItems() );
    245                 recents_changed = true;
    246         }
    247 
    248299        pref->seeking1 = seeking1();
    249300        pref->seeking2 = seeking2();
     
    252303
    253304        pref->update_while_seeking = updateWhileDragging();
     305#ifdef SEEKBAR_RESOLUTION
    254306        pref->relative_seeking= relativeSeeking();
     307#endif
    255308        pref->precise_seeking = preciseSeeking();
    256309
     
    273326        pref->bypass_window_manager = floatingBypassWindowManager();
    274327#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();
    275340}
    276341
     
    296361
    297362void PrefInterface::setIconSet(QString set) {
     363        /*
    298364        if (set.isEmpty())
    299365                iconset_combo->setCurrentIndex(0);
    300366        else
    301367                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
    302385}
    303386
    304387QString 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
    305395        if (iconset_combo->currentIndex()==0)
    306396                return "";
     
    341431
    342432void PrefInterface::setGUI(QString gui_name) {
     433#ifdef SKINS
     434        if ((n_skins == 0) && (gui_name == "SkinGUI")) gui_name = "DefaultGUI";
     435#endif
    343436        int i = gui_combo->findData(gui_name);
    344437        if (i < 0) i=0;
     
    349442        return gui_combo->itemData(gui_combo->currentIndex()).toString();
    350443}
     444
     445#ifdef SKINS
     446void 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
    351464
    352465#ifdef SINGLE_INSTANCE
     
    360473}
    361474#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 }
    370475
    371476void PrefInterface::setSeeking1(int n) {
     
    412517}
    413518
     519#ifdef SEEKBAR_RESOLUTION
    414520void PrefInterface::setRelativeSeeking(bool b) {
    415521        relative_seeking_button->setChecked(b);
     
    420526        return relative_seeking_button->isChecked();
    421527}
     528#endif
    422529
    423530void PrefInterface::setPreciseSeeking(bool b) {
     
    512619#endif
    513620
     621void PrefInterface::setRecentsMaxItems(int n) {
     622        recents_max_items_spin->setValue(n);
     623}
     624
     625int PrefInterface::recentsMaxItems() {
     626        return recents_max_items_spin->value();
     627}
     628
     629void PrefInterface::setURLMaxItems(int n) {
     630        url_max_items_spin->setValue(n);
     631}
     632
     633int PrefInterface::urlMaxItems() {
     634        return url_max_items_spin->value();
     635}
     636
     637void PrefInterface::setRememberDirs(bool b) {
     638        save_dirs_check->setChecked(b);
     639}
     640
     641bool PrefInterface::rememberDirs() {
     642        return save_dirs_check->isChecked();
     643}
     644
    514645void PrefInterface::createHelp() {
    515646        clearHelp();
     
    528659        tr("If this option is enabled the video window will be hidden when playing audio files.") );
    529660
    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 
    535661        setWhatsThis(language_combo, tr("Language"),
    536662                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.") );
    543663
    544664        setWhatsThis(gui_combo, tr("GUI"),
     
    548668           "toolbar and control bar. The <b>Mini GUI</b> provides a "
    549669           "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
    553683
    554684        setWhatsThis(changeFontButton, tr("Default font"),
     
    576706        tr("Select what to do when dragging the time slider.") );
    577707
     708#ifdef SEEKBAR_RESOLUTION
    578709        setWhatsThis(seeking_method_group, tr("Seeking method"),
    579710                tr("Sets the method to be used when seeking with the slider. "
    580711           "Absolute seeking may be a little bit more accurate, while "
    581712           "relative seeking may work better with files with a wrong length.") );
     713#endif
    582714
    583715        setWhatsThis(precise_seeking_check, tr("Precise seeking"),
     
    621753           "doesn't work well with your window manager.") );
    622754#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.") );
    623770}
    624771
Note: See TracChangeset for help on using the changeset viewer.