Ignore:
Timestamp:
Aug 31, 2016, 5:19:25 PM (9 years ago)
Author:
Silvan Scherrer
Message:

smplayer: update vendor to version 16.8.0

File:
1 edited

Legend:

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

    r175 r179  
    3131#include <QFontDialog>
    3232
     33#ifdef HDPI_SUPPORT
     34#include "hdpisupport.h"
     35
     36#if QT_VERSION >= 0x050600
     37#define HDPI_USE_SCALE_FACTOR
     38#endif
     39#endif
     40
    3341#define SINGLE_INSTANCE_TAB 2
     42#define HDPI_TAB 5
    3443
    3544PrefInterface::PrefInterface(QWidget * parent, Qt::WindowFlags f)
     
    4150        // Style combo
    4251#if !STYLE_SWITCHING
    43     style_label->hide();
    44     style_combo->hide();
     52        style_label->hide();
     53        style_combo->hide();
    4554#else
    4655        style_combo->addItem( "<default>" );
     
    123132#endif
    124133
     134#ifdef HDPI_SUPPORT
     135        scale_group->setEnabled(false);
     136        connect(hdpi_scale_slider, SIGNAL(valueChanged(int)), this, SLOT(updateHDPIScaleNumber(int)));
     137        #ifndef HDPI_STORE_DATA
     138        tabWidget->setTabEnabled(HDPI_TAB, false);
     139        #endif
     140#else
     141        tabWidget->setTabEnabled(HDPI_TAB, false);
     142#endif
     143
    125144        retranslateStrings();
    126145}
     
    135154
    136155QPixmap PrefInterface::sectionIcon() {
    137     return Images::icon("pref_gui", 22);
     156    return Images::icon("pref_gui");
    138157}
    139158
     
    146165        QRegExp rx_lang("smplayer_(.*)\\.qm");
    147166        language_combo->clear();
    148         language_combo->addItem( tr("<Autodetect>") );
     167        language_combo->addItem("<" + tr("System language") + ">");
    149168        for (int n=0; n < languages.count(); n++) {
    150169                if (rx_lang.indexIn(languages[n]) > -1) {
     
    226245        floating_margin_label->setNum(floating_margin_slider->value());
    227246
     247#ifdef HDPI_SUPPORT
     248        #ifdef HDPI_USE_SCALE_FACTOR
     249        hdpi_scale_label->setText(tr("Scale fact&or:"));
     250        hdpi_scale_num_label->setNum((double) hdpi_scale_slider->value() / 10);
     251        #else
     252        hdpi_scale_label->setText(tr("Pixel rati&o:"));
     253        hdpi_scale_num_label->setNum(hdpi_scale_slider->value());
     254        #endif
     255#endif
     256
    228257        createHelp();
    229258}
     
    275304        setURLMaxItems(pref->history_urls->maxItems());
    276305        setRememberDirs(pref->save_dirs);
     306
     307#ifdef HDPI_SUPPORT
     308        loadHDPIData();
     309#endif
    277310}
    278311
     
    353386
    354387        pref->save_dirs = rememberDirs();
     388
     389#ifdef HDPI_SUPPORT
     390        saveHDPIData();
     391#endif
    355392}
    356393
     
    432469
    433470void PrefInterface::setStyle(QString style) {
    434         if (style.isEmpty())
     471        if (style.isEmpty()) {
    435472                style_combo->setCurrentIndex(0);
     473        } else {
     474                int i = style_combo->findText(style, Qt::MatchFixedString);
     475                if (i < 0) i = 0;
     476                style_combo->setCurrentIndex(i);
     477        }
     478}
     479
     480QString PrefInterface::style() {
     481        if (style_combo->currentIndex() == 0)
     482                return "";
    436483        else
    437                 style_combo->setCurrentText(style);
    438 }
    439 
    440 QString PrefInterface::style() {
    441         if (style_combo->currentIndex()==0)
    442                 return "";
    443         else
    444484                return style_combo->currentText();
    445485}
     
    652692}
    653693
     694#ifdef HDPI_SUPPORT
     695void PrefInterface::loadHDPIData() {
     696        HDPISupport * hdpi = HDPISupport::instance();
     697        enable_hdpi_check->setChecked(hdpi->isHDPIEnabled());
     698        auto_scale_check->setChecked(hdpi->autoScale());
     699
     700        #ifdef HDPI_USE_SCALE_FACTOR
     701        hdpi_scale_slider->setMinimum(5);
     702        hdpi_scale_slider->setMaximum(4*10);
     703        hdpi_scale_slider->setValue(hdpi->scaleFactor() * 10);
     704        #else
     705        hdpi_scale_slider->setMinimum(0);
     706        hdpi_scale_slider->setMaximum(4);
     707        hdpi_scale_slider->setValue(hdpi->pixelRatio());
     708        #endif
     709}
     710
     711void PrefInterface::updateHDPIScaleNumber(int v) {
     712        #ifdef HDPI_USE_SCALE_FACTOR
     713        hdpi_scale_num_label->setNum((double) v / 10);
     714        #else
     715        hdpi_scale_num_label->setNum(v);
     716        #endif
     717}
     718
     719void PrefInterface::saveHDPIData() {
     720        HDPISupport * hdpi = HDPISupport::instance();
     721        hdpi->setHDPIEnabled(enable_hdpi_check->isChecked());
     722        hdpi->setAutoScale(auto_scale_check->isChecked());
     723        #ifdef HDPI_USE_SCALE_FACTOR
     724        hdpi->setScaleFactor((double) hdpi_scale_slider->value() / 10);
     725        #else
     726        hdpi->setPixelRatio(hdpi_scale_slider->value());
     727        #endif
     728        #ifdef HDPI_STORE_DATA
     729        hdpi->save();
     730        #endif
     731}
     732#endif
     733
    654734void PrefInterface::createHelp() {
    655735        clearHelp();
Note: See TracChangeset for help on using the changeset viewer.