Changeset 179 for smplayer/vendor/current/src/prefinterface.cpp
- Timestamp:
- Aug 31, 2016, 5:19:25 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/vendor/current/src/prefinterface.cpp
r175 r179 31 31 #include <QFontDialog> 32 32 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 33 41 #define SINGLE_INSTANCE_TAB 2 42 #define HDPI_TAB 5 34 43 35 44 PrefInterface::PrefInterface(QWidget * parent, Qt::WindowFlags f) … … 41 50 // Style combo 42 51 #if !STYLE_SWITCHING 43 44 52 style_label->hide(); 53 style_combo->hide(); 45 54 #else 46 55 style_combo->addItem( "<default>" ); … … 123 132 #endif 124 133 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 125 144 retranslateStrings(); 126 145 } … … 135 154 136 155 QPixmap PrefInterface::sectionIcon() { 137 return Images::icon("pref_gui" , 22);156 return Images::icon("pref_gui"); 138 157 } 139 158 … … 146 165 QRegExp rx_lang("smplayer_(.*)\\.qm"); 147 166 language_combo->clear(); 148 language_combo->addItem( tr("<Autodetect>"));167 language_combo->addItem("<" + tr("System language") + ">"); 149 168 for (int n=0; n < languages.count(); n++) { 150 169 if (rx_lang.indexIn(languages[n]) > -1) { … … 226 245 floating_margin_label->setNum(floating_margin_slider->value()); 227 246 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 228 257 createHelp(); 229 258 } … … 275 304 setURLMaxItems(pref->history_urls->maxItems()); 276 305 setRememberDirs(pref->save_dirs); 306 307 #ifdef HDPI_SUPPORT 308 loadHDPIData(); 309 #endif 277 310 } 278 311 … … 353 386 354 387 pref->save_dirs = rememberDirs(); 388 389 #ifdef HDPI_SUPPORT 390 saveHDPIData(); 391 #endif 355 392 } 356 393 … … 432 469 433 470 void PrefInterface::setStyle(QString style) { 434 if (style.isEmpty()) 471 if (style.isEmpty()) { 435 472 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 480 QString PrefInterface::style() { 481 if (style_combo->currentIndex() == 0) 482 return ""; 436 483 else 437 style_combo->setCurrentText(style);438 }439 440 QString PrefInterface::style() {441 if (style_combo->currentIndex()==0)442 return "";443 else444 484 return style_combo->currentText(); 445 485 } … … 652 692 } 653 693 694 #ifdef HDPI_SUPPORT 695 void 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 711 void 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 719 void 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 654 734 void PrefInterface::createHelp() { 655 735 clearHelp();
Note:
See TracChangeset
for help on using the changeset viewer.