| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2012 Ricardo Villalba <rvm@users.sourceforge.net>
|
|---|
| 3 |
|
|---|
| 4 | This program is free software; you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 7 | (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | #include "prefinterface.h"
|
|---|
| 21 | #include "images.h"
|
|---|
| 22 | #include "preferences.h"
|
|---|
| 23 | #include "paths.h"
|
|---|
| 24 | #include "config.h"
|
|---|
| 25 | #include "languages.h"
|
|---|
| 26 | #include "recents.h"
|
|---|
| 27 |
|
|---|
| 28 | #include <QDir>
|
|---|
| 29 | #include <QStyleFactory>
|
|---|
| 30 | #include <QFontDialog>
|
|---|
| 31 |
|
|---|
| 32 | #define SINGLE_INSTANCE_TAB 2
|
|---|
| 33 |
|
|---|
| 34 | PrefInterface::PrefInterface(QWidget * parent, Qt::WindowFlags f)
|
|---|
| 35 | : PrefWidget(parent, f )
|
|---|
| 36 | {
|
|---|
| 37 | setupUi(this);
|
|---|
| 38 | /* volume_icon->hide(); */
|
|---|
| 39 |
|
|---|
| 40 | // Style combo
|
|---|
| 41 | #if !STYLE_SWITCHING
|
|---|
| 42 | style_label->hide();
|
|---|
| 43 | style_combo->hide();
|
|---|
| 44 | #else
|
|---|
| 45 | style_combo->addItem( "<default>" );
|
|---|
| 46 | style_combo->addItems( QStyleFactory::keys() );
|
|---|
| 47 | #endif
|
|---|
| 48 |
|
|---|
| 49 | // Icon set combo
|
|---|
| 50 | iconset_combo->addItem( "Default" );
|
|---|
| 51 |
|
|---|
| 52 | // User
|
|---|
| 53 | QDir icon_dir = Paths::configPath() + "/themes";
|
|---|
| 54 | qDebug("icon_dir: %s", icon_dir.absolutePath().toUtf8().data());
|
|---|
| 55 | QStringList iconsets = icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
|---|
| 56 | for (int n=0; n < iconsets.count(); n++) {
|
|---|
| 57 | iconset_combo->addItem( iconsets[n] );
|
|---|
| 58 | }
|
|---|
| 59 | // Global
|
|---|
| 60 | icon_dir = Paths::themesPath();
|
|---|
| 61 | qDebug("icon_dir: %s", icon_dir.absolutePath().toUtf8().data());
|
|---|
| 62 | iconsets = icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
|---|
| 63 | for (int n=0; n < iconsets.count(); n++) {
|
|---|
| 64 | if (iconset_combo->findText( iconsets[n] ) == -1) {
|
|---|
| 65 | iconset_combo->addItem( iconsets[n] );
|
|---|
| 66 | }
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | connect(single_instance_check, SIGNAL(toggled(bool)),
|
|---|
| 70 | this, SLOT(changeInstanceImages()));
|
|---|
| 71 |
|
|---|
| 72 | #ifdef Q_OS_WIN
|
|---|
| 73 | floating_bypass_wm_check->hide();
|
|---|
| 74 | #endif
|
|---|
| 75 |
|
|---|
| 76 | retranslateStrings();
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | PrefInterface::~PrefInterface()
|
|---|
| 80 | {
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | QString PrefInterface::sectionName() {
|
|---|
| 84 | return tr("Interface");
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | QPixmap PrefInterface::sectionIcon() {
|
|---|
| 88 | return Images::icon("pref_gui", 22);
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | void PrefInterface::createLanguageCombo() {
|
|---|
| 92 | QMap <QString,QString> m = Languages::translations();
|
|---|
| 93 |
|
|---|
| 94 | // Language combo
|
|---|
| 95 | QDir translation_dir = Paths::translationPath();
|
|---|
| 96 | QStringList languages = translation_dir.entryList( QStringList() << "*.qm");
|
|---|
| 97 | QRegExp rx_lang("smplayer_(.*)\\.qm");
|
|---|
| 98 | language_combo->clear();
|
|---|
| 99 | language_combo->addItem( tr("<Autodetect>") );
|
|---|
| 100 | for (int n=0; n < languages.count(); n++) {
|
|---|
| 101 | if (rx_lang.indexIn(languages[n]) > -1) {
|
|---|
| 102 | QString l = rx_lang.cap(1);
|
|---|
| 103 | QString text = l;
|
|---|
| 104 | if (m.contains(l)) text = m[l] + " ("+l+")";
|
|---|
| 105 | language_combo->addItem( text, l );
|
|---|
| 106 | }
|
|---|
| 107 | }
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | void PrefInterface::retranslateStrings() {
|
|---|
| 111 | int mainwindow_resize = mainwindow_resize_combo->currentIndex();
|
|---|
| 112 | int timeslider_pos = timeslider_behaviour_combo->currentIndex();
|
|---|
| 113 |
|
|---|
| 114 | retranslateUi(this);
|
|---|
| 115 |
|
|---|
| 116 | mainwindow_resize_combo->setCurrentIndex(mainwindow_resize);
|
|---|
| 117 | timeslider_behaviour_combo->setCurrentIndex(timeslider_pos);
|
|---|
| 118 |
|
|---|
| 119 | // Icons
|
|---|
| 120 | resize_window_icon->setPixmap( Images::icon("resize_window") );
|
|---|
| 121 | /* volume_icon->setPixmap( Images::icon("speaker") ); */
|
|---|
| 122 |
|
|---|
| 123 | changeInstanceImages();
|
|---|
| 124 |
|
|---|
| 125 | // Seek widgets
|
|---|
| 126 | seek1->setLabel( tr("&Short jump") );
|
|---|
| 127 | seek2->setLabel( tr("&Medium jump") );
|
|---|
| 128 | seek3->setLabel( tr("&Long jump") );
|
|---|
| 129 | seek4->setLabel( tr("Mouse &wheel jump") );
|
|---|
| 130 |
|
|---|
| 131 | if (qApp->isLeftToRight()) {
|
|---|
| 132 | seek1->setIcon( Images::icon("forward10s") );
|
|---|
| 133 | seek2->setIcon( Images::icon("forward1m") );
|
|---|
| 134 | seek3->setIcon( Images::icon("forward10m") );
|
|---|
| 135 | } else {
|
|---|
| 136 | seek1->setIcon( Images::flippedIcon("forward10s") );
|
|---|
| 137 | seek2->setIcon( Images::flippedIcon("forward1m") );
|
|---|
| 138 | seek3->setIcon( Images::flippedIcon("forward10m") );
|
|---|
| 139 | }
|
|---|
| 140 | seek4->setIcon( Images::icon("mouse", seek1->icon()->width()) );
|
|---|
| 141 |
|
|---|
| 142 | // Language combo
|
|---|
| 143 | int language_item = language_combo->currentIndex();
|
|---|
| 144 | createLanguageCombo();
|
|---|
| 145 | language_combo->setCurrentIndex( language_item );
|
|---|
| 146 |
|
|---|
| 147 | // Iconset combo
|
|---|
| 148 | iconset_combo->setItemText( 0, tr("Default") );
|
|---|
| 149 |
|
|---|
| 150 | #if STYLE_SWITCHING
|
|---|
| 151 | style_combo->setItemText( 0, tr("Default") );
|
|---|
| 152 | #endif
|
|---|
| 153 |
|
|---|
| 154 | int gui_index = gui_combo->currentIndex();
|
|---|
| 155 | gui_combo->clear();
|
|---|
| 156 | gui_combo->addItem( tr("Default GUI"), "DefaultGUI");
|
|---|
| 157 | gui_combo->addItem( tr("Mini GUI"), "MiniGUI");
|
|---|
| 158 | gui_combo->addItem( tr("Mpc GUI"), "MpcGUI");
|
|---|
| 159 | gui_combo->setCurrentIndex(gui_index);
|
|---|
| 160 |
|
|---|
| 161 | floating_width_label->setNum(floating_width_slider->value());
|
|---|
| 162 | floating_margin_label->setNum(floating_margin_slider->value());
|
|---|
| 163 |
|
|---|
| 164 | createHelp();
|
|---|
| 165 | }
|
|---|
| 166 |
|
|---|
| 167 | void PrefInterface::setData(Preferences * pref) {
|
|---|
| 168 | setLanguage( pref->language );
|
|---|
| 169 | setIconSet( pref->iconset );
|
|---|
| 170 |
|
|---|
| 171 | setResizeMethod( pref->resize_method );
|
|---|
| 172 | setSaveSize( pref->save_window_size_on_exit );
|
|---|
| 173 | setUseSingleInstance(pref->use_single_instance);
|
|---|
| 174 | setServerPort(pref->connection_port);
|
|---|
| 175 | setUseAutoPort(pref->use_autoport);
|
|---|
| 176 | setRecentsMaxItems(pref->history_recents->maxItems());
|
|---|
| 177 |
|
|---|
| 178 | setSeeking1(pref->seeking1);
|
|---|
| 179 | setSeeking2(pref->seeking2);
|
|---|
| 180 | setSeeking3(pref->seeking3);
|
|---|
| 181 | setSeeking4(pref->seeking4);
|
|---|
| 182 |
|
|---|
| 183 | setUpdateWhileDragging(pref->update_while_seeking);
|
|---|
| 184 | setRelativeSeeking(pref->relative_seeking);
|
|---|
| 185 | setPreciseSeeking(pref->precise_seeking);
|
|---|
| 186 |
|
|---|
| 187 | setDefaultFont(pref->default_font);
|
|---|
| 188 |
|
|---|
| 189 | setHideVideoOnAudioFiles(pref->hide_video_window_on_audio_files);
|
|---|
| 190 |
|
|---|
| 191 | #if STYLE_SWITCHING
|
|---|
| 192 | setStyle( pref->style );
|
|---|
| 193 | #endif
|
|---|
| 194 |
|
|---|
| 195 | setGUI(pref->gui);
|
|---|
| 196 |
|
|---|
| 197 | setFloatingAnimated(pref->floating_control_animated);
|
|---|
| 198 | setFloatingWidth(pref->floating_control_width);
|
|---|
| 199 | setFloatingMargin(pref->floating_control_margin);
|
|---|
| 200 | setDisplayFloatingInCompactMode(pref->floating_display_in_compact_mode);
|
|---|
| 201 | #ifndef Q_OS_WIN
|
|---|
| 202 | setFloatingBypassWindowManager(pref->bypass_window_manager);
|
|---|
| 203 | #endif
|
|---|
| 204 | }
|
|---|
| 205 |
|
|---|
| 206 | void PrefInterface::getData(Preferences * pref) {
|
|---|
| 207 | requires_restart = false;
|
|---|
| 208 | language_changed = false;
|
|---|
| 209 | iconset_changed = false;
|
|---|
| 210 | recents_changed = false;
|
|---|
| 211 | port_changed = false;
|
|---|
| 212 | style_changed = false;
|
|---|
| 213 |
|
|---|
| 214 | if (pref->language != language()) {
|
|---|
| 215 | pref->language = language();
|
|---|
| 216 | language_changed = true;
|
|---|
| 217 | qDebug("PrefInterface::getData: chosen language: '%s'", pref->language.toUtf8().data());
|
|---|
| 218 | }
|
|---|
| 219 |
|
|---|
| 220 | if (pref->iconset != iconSet()) {
|
|---|
| 221 | pref->iconset = iconSet();
|
|---|
| 222 | iconset_changed = true;
|
|---|
| 223 | }
|
|---|
| 224 |
|
|---|
| 225 | pref->resize_method = resizeMethod();
|
|---|
| 226 | pref->save_window_size_on_exit = saveSize();
|
|---|
| 227 |
|
|---|
| 228 | pref->use_single_instance = useSingleInstance();
|
|---|
| 229 | if (pref->connection_port != serverPort()) {
|
|---|
| 230 | pref->connection_port = serverPort();
|
|---|
| 231 | port_changed = true;
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 | if (pref->use_autoport != useAutoPort()) {
|
|---|
| 235 | pref->use_autoport = useAutoPort();
|
|---|
| 236 | port_changed = true;
|
|---|
| 237 | }
|
|---|
| 238 |
|
|---|
| 239 | if (pref->history_recents->maxItems() != recentsMaxItems()) {
|
|---|
| 240 | pref->history_recents->setMaxItems( recentsMaxItems() );
|
|---|
| 241 | recents_changed = true;
|
|---|
| 242 | }
|
|---|
| 243 |
|
|---|
| 244 | pref->seeking1 = seeking1();
|
|---|
| 245 | pref->seeking2 = seeking2();
|
|---|
| 246 | pref->seeking3 = seeking3();
|
|---|
| 247 | pref->seeking4 = seeking4();
|
|---|
| 248 |
|
|---|
| 249 | pref->update_while_seeking = updateWhileDragging();
|
|---|
| 250 | pref->relative_seeking= relativeSeeking();
|
|---|
| 251 | pref->precise_seeking = preciseSeeking();
|
|---|
| 252 |
|
|---|
| 253 | pref->default_font = defaultFont();
|
|---|
| 254 |
|
|---|
| 255 | pref->hide_video_window_on_audio_files = hideVideoOnAudioFiles();
|
|---|
| 256 |
|
|---|
| 257 | #if STYLE_SWITCHING
|
|---|
| 258 | if ( pref->style != style() ) {
|
|---|
| 259 | pref->style = style();
|
|---|
| 260 | style_changed = true;
|
|---|
| 261 | }
|
|---|
| 262 | #endif
|
|---|
| 263 |
|
|---|
| 264 | pref->gui = GUI();
|
|---|
| 265 |
|
|---|
| 266 | pref->floating_control_animated = floatingAnimated();
|
|---|
| 267 | pref->floating_control_width = floatingWidth();
|
|---|
| 268 | pref->floating_control_margin = floatingMargin();
|
|---|
| 269 | pref->floating_display_in_compact_mode = displayFloatingInCompactMode();
|
|---|
| 270 | #ifndef Q_OS_WIN
|
|---|
| 271 | pref->bypass_window_manager = floatingBypassWindowManager();
|
|---|
| 272 | #endif
|
|---|
| 273 | }
|
|---|
| 274 |
|
|---|
| 275 | void PrefInterface::setLanguage(QString lang) {
|
|---|
| 276 | if (lang.isEmpty()) {
|
|---|
| 277 | language_combo->setCurrentIndex(0);
|
|---|
| 278 | }
|
|---|
| 279 | else {
|
|---|
| 280 | int pos = language_combo->findData(lang);
|
|---|
| 281 | if (pos != -1)
|
|---|
| 282 | language_combo->setCurrentIndex( pos );
|
|---|
| 283 | else
|
|---|
| 284 | language_combo->setCurrentText(lang);
|
|---|
| 285 | }
|
|---|
| 286 | }
|
|---|
| 287 |
|
|---|
| 288 | QString PrefInterface::language() {
|
|---|
| 289 | if (language_combo->currentIndex()==0)
|
|---|
| 290 | return "";
|
|---|
| 291 | else
|
|---|
| 292 | return language_combo->itemData( language_combo->currentIndex() ).toString();
|
|---|
| 293 | }
|
|---|
| 294 |
|
|---|
| 295 | void PrefInterface::setIconSet(QString set) {
|
|---|
| 296 | if (set.isEmpty())
|
|---|
| 297 | iconset_combo->setCurrentIndex(0);
|
|---|
| 298 | else
|
|---|
| 299 | iconset_combo->setCurrentText(set);
|
|---|
| 300 | }
|
|---|
| 301 |
|
|---|
| 302 | QString PrefInterface::iconSet() {
|
|---|
| 303 | if (iconset_combo->currentIndex()==0)
|
|---|
| 304 | return "";
|
|---|
| 305 | else
|
|---|
| 306 | return iconset_combo->currentText();
|
|---|
| 307 | }
|
|---|
| 308 |
|
|---|
| 309 | void PrefInterface::setResizeMethod(int v) {
|
|---|
| 310 | mainwindow_resize_combo->setCurrentIndex(v);
|
|---|
| 311 | }
|
|---|
| 312 |
|
|---|
| 313 | int PrefInterface::resizeMethod() {
|
|---|
| 314 | return mainwindow_resize_combo->currentIndex();
|
|---|
| 315 | }
|
|---|
| 316 |
|
|---|
| 317 | void PrefInterface::setSaveSize(bool b) {
|
|---|
| 318 | save_size_check->setChecked(b);
|
|---|
| 319 | }
|
|---|
| 320 |
|
|---|
| 321 | bool PrefInterface::saveSize() {
|
|---|
| 322 | return save_size_check->isChecked();
|
|---|
| 323 | }
|
|---|
| 324 |
|
|---|
| 325 |
|
|---|
| 326 | void PrefInterface::setStyle(QString style) {
|
|---|
| 327 | if (style.isEmpty())
|
|---|
| 328 | style_combo->setCurrentIndex(0);
|
|---|
| 329 | else
|
|---|
| 330 | style_combo->setCurrentText(style);
|
|---|
| 331 | }
|
|---|
| 332 |
|
|---|
| 333 | QString PrefInterface::style() {
|
|---|
| 334 | if (style_combo->currentIndex()==0)
|
|---|
| 335 | return "";
|
|---|
| 336 | else
|
|---|
| 337 | return style_combo->currentText();
|
|---|
| 338 | }
|
|---|
| 339 |
|
|---|
| 340 | void PrefInterface::setGUI(QString gui_name) {
|
|---|
| 341 | int i = gui_combo->findData(gui_name);
|
|---|
| 342 | if (i < 0) i=0;
|
|---|
| 343 | gui_combo->setCurrentIndex(i);
|
|---|
| 344 | }
|
|---|
| 345 |
|
|---|
| 346 | QString PrefInterface::GUI() {
|
|---|
| 347 | return gui_combo->itemData(gui_combo->currentIndex()).toString();
|
|---|
| 348 | }
|
|---|
| 349 |
|
|---|
| 350 | void PrefInterface::setUseSingleInstance(bool b) {
|
|---|
| 351 | single_instance_check->setChecked(b);
|
|---|
| 352 | //singleInstanceButtonToggled(b);
|
|---|
| 353 | }
|
|---|
| 354 |
|
|---|
| 355 | bool PrefInterface::useSingleInstance() {
|
|---|
| 356 | return single_instance_check->isChecked();
|
|---|
| 357 | }
|
|---|
| 358 |
|
|---|
| 359 | void PrefInterface::setServerPort(int port) {
|
|---|
| 360 | server_port_spin->setValue(port);
|
|---|
| 361 | }
|
|---|
| 362 |
|
|---|
| 363 | int PrefInterface::serverPort() {
|
|---|
| 364 | return server_port_spin->value();
|
|---|
| 365 | }
|
|---|
| 366 |
|
|---|
| 367 | void PrefInterface::setUseAutoPort(bool b) {
|
|---|
| 368 | automatic_port_button->setChecked(b);
|
|---|
| 369 | manual_port_button->setChecked(!b);
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| 372 | bool PrefInterface::useAutoPort() {
|
|---|
| 373 | return automatic_port_button->isChecked();
|
|---|
| 374 | }
|
|---|
| 375 |
|
|---|
| 376 | void PrefInterface::setSingleInstanceTabEnabled(bool b) {
|
|---|
| 377 | tabWidget->setTabEnabled(SINGLE_INSTANCE_TAB, b);
|
|---|
| 378 | }
|
|---|
| 379 |
|
|---|
| 380 | bool PrefInterface::singleInstanceTabEnabled() {
|
|---|
| 381 | return tabWidget->isTabEnabled(SINGLE_INSTANCE_TAB);
|
|---|
| 382 | }
|
|---|
| 383 |
|
|---|
| 384 | void PrefInterface::setRecentsMaxItems(int n) {
|
|---|
| 385 | recents_max_items_spin->setValue(n);
|
|---|
| 386 | }
|
|---|
| 387 |
|
|---|
| 388 | int PrefInterface::recentsMaxItems() {
|
|---|
| 389 | return recents_max_items_spin->value();
|
|---|
| 390 | }
|
|---|
| 391 |
|
|---|
| 392 | void PrefInterface::setSeeking1(int n) {
|
|---|
| 393 | seek1->setTime(n);
|
|---|
| 394 | }
|
|---|
| 395 |
|
|---|
| 396 | int PrefInterface::seeking1() {
|
|---|
| 397 | return seek1->time();
|
|---|
| 398 | }
|
|---|
| 399 |
|
|---|
| 400 | void PrefInterface::setSeeking2(int n) {
|
|---|
| 401 | seek2->setTime(n);
|
|---|
| 402 | }
|
|---|
| 403 |
|
|---|
| 404 | int PrefInterface::seeking2() {
|
|---|
| 405 | return seek2->time();
|
|---|
| 406 | }
|
|---|
| 407 |
|
|---|
| 408 | void PrefInterface::setSeeking3(int n) {
|
|---|
| 409 | seek3->setTime(n);
|
|---|
| 410 | }
|
|---|
| 411 |
|
|---|
| 412 | int PrefInterface::seeking3() {
|
|---|
| 413 | return seek3->time();
|
|---|
| 414 | }
|
|---|
| 415 |
|
|---|
| 416 | void PrefInterface::setSeeking4(int n) {
|
|---|
| 417 | seek4->setTime(n);
|
|---|
| 418 | }
|
|---|
| 419 |
|
|---|
| 420 | int PrefInterface::seeking4() {
|
|---|
| 421 | return seek4->time();
|
|---|
| 422 | }
|
|---|
| 423 |
|
|---|
| 424 | void PrefInterface::setUpdateWhileDragging(bool b) {
|
|---|
| 425 | if (b)
|
|---|
| 426 | timeslider_behaviour_combo->setCurrentIndex(0);
|
|---|
| 427 | else
|
|---|
| 428 | timeslider_behaviour_combo->setCurrentIndex(1);
|
|---|
| 429 | }
|
|---|
| 430 |
|
|---|
| 431 | bool PrefInterface::updateWhileDragging() {
|
|---|
| 432 | return (timeslider_behaviour_combo->currentIndex() == 0);
|
|---|
| 433 | }
|
|---|
| 434 |
|
|---|
| 435 | void PrefInterface::setRelativeSeeking(bool b) {
|
|---|
| 436 | relative_seeking_button->setChecked(b);
|
|---|
| 437 | absolute_seeking_button->setChecked(!b);
|
|---|
| 438 | }
|
|---|
| 439 |
|
|---|
| 440 | bool PrefInterface::relativeSeeking() {
|
|---|
| 441 | return relative_seeking_button->isChecked();
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | void PrefInterface::setPreciseSeeking(bool b) {
|
|---|
| 445 | precise_seeking_check->setChecked(b);
|
|---|
| 446 | }
|
|---|
| 447 |
|
|---|
| 448 | bool PrefInterface::preciseSeeking() {
|
|---|
| 449 | return precise_seeking_check->isChecked();
|
|---|
| 450 | }
|
|---|
| 451 |
|
|---|
| 452 | void PrefInterface::setDefaultFont(QString font_desc) {
|
|---|
| 453 | default_font_edit->setText(font_desc);
|
|---|
| 454 | }
|
|---|
| 455 |
|
|---|
| 456 | QString PrefInterface::defaultFont() {
|
|---|
| 457 | return default_font_edit->text();
|
|---|
| 458 | }
|
|---|
| 459 |
|
|---|
| 460 | void PrefInterface::on_changeFontButton_clicked() {
|
|---|
| 461 | QFont f = qApp->font();
|
|---|
| 462 |
|
|---|
| 463 | if (!default_font_edit->text().isEmpty()) {
|
|---|
| 464 | f.fromString(default_font_edit->text());
|
|---|
| 465 | }
|
|---|
| 466 |
|
|---|
| 467 | bool ok;
|
|---|
| 468 | f = QFontDialog::getFont( &ok, f, this);
|
|---|
| 469 |
|
|---|
| 470 | if (ok) {
|
|---|
| 471 | default_font_edit->setText( f.toString() );
|
|---|
| 472 | }
|
|---|
| 473 | }
|
|---|
| 474 |
|
|---|
| 475 | void PrefInterface::changeInstanceImages() {
|
|---|
| 476 | if (single_instance_check->isChecked())
|
|---|
| 477 | instances_icon->setPixmap( Images::icon("instance1") );
|
|---|
| 478 | else
|
|---|
| 479 | instances_icon->setPixmap( Images::icon("instance2") );
|
|---|
| 480 | }
|
|---|
| 481 |
|
|---|
| 482 | void PrefInterface::setHideVideoOnAudioFiles(bool b) {
|
|---|
| 483 | hide_video_window_on_audio_check->setChecked(b);
|
|---|
| 484 | }
|
|---|
| 485 |
|
|---|
| 486 | bool PrefInterface::hideVideoOnAudioFiles() {
|
|---|
| 487 | return hide_video_window_on_audio_check->isChecked();
|
|---|
| 488 | }
|
|---|
| 489 |
|
|---|
| 490 | // Floating tab
|
|---|
| 491 | void PrefInterface::setFloatingAnimated(bool b) {
|
|---|
| 492 | floating_animated_check->setChecked(b);
|
|---|
| 493 | }
|
|---|
| 494 |
|
|---|
| 495 | bool PrefInterface::floatingAnimated() {
|
|---|
| 496 | return floating_animated_check->isChecked();
|
|---|
| 497 | }
|
|---|
| 498 |
|
|---|
| 499 | void PrefInterface::setFloatingWidth(int percentage) {
|
|---|
| 500 | floating_width_slider->setValue(percentage);
|
|---|
| 501 | }
|
|---|
| 502 |
|
|---|
| 503 | int PrefInterface::floatingWidth() {
|
|---|
| 504 | return floating_width_slider->value();
|
|---|
| 505 | }
|
|---|
| 506 |
|
|---|
| 507 | void PrefInterface::setFloatingMargin(int pixels) {
|
|---|
| 508 | floating_margin_slider->setValue(pixels);
|
|---|
| 509 | }
|
|---|
| 510 |
|
|---|
| 511 | int PrefInterface::floatingMargin() {
|
|---|
| 512 | return floating_margin_slider->value();
|
|---|
| 513 | }
|
|---|
| 514 |
|
|---|
| 515 | void PrefInterface::setDisplayFloatingInCompactMode(bool b) {
|
|---|
| 516 | floating_compact_check->setChecked(b);
|
|---|
| 517 | }
|
|---|
| 518 |
|
|---|
| 519 | bool PrefInterface::displayFloatingInCompactMode() {
|
|---|
| 520 | return floating_compact_check->isChecked();
|
|---|
| 521 | }
|
|---|
| 522 |
|
|---|
| 523 | #ifndef Q_OS_WIN
|
|---|
| 524 | void PrefInterface::setFloatingBypassWindowManager(bool b) {
|
|---|
| 525 | floating_bypass_wm_check->setChecked(b);
|
|---|
| 526 | }
|
|---|
| 527 |
|
|---|
| 528 | bool PrefInterface::floatingBypassWindowManager() {
|
|---|
| 529 | return floating_bypass_wm_check->isChecked();
|
|---|
| 530 | }
|
|---|
| 531 | #endif
|
|---|
| 532 |
|
|---|
| 533 | void PrefInterface::createHelp() {
|
|---|
| 534 | clearHelp();
|
|---|
| 535 |
|
|---|
| 536 | addSectionTitle(tr("Interface"));
|
|---|
| 537 |
|
|---|
| 538 | setWhatsThis(mainwindow_resize_combo, tr("Autoresize"),
|
|---|
| 539 | tr("The main window can be resized automatically. Select the option "
|
|---|
| 540 | "you prefer.") );
|
|---|
| 541 |
|
|---|
| 542 | setWhatsThis(save_size_check, tr("Remember position and size"),
|
|---|
| 543 | tr("If you check this option, the position and size of the main "
|
|---|
| 544 | "window will be saved and restored when you run SMPlayer again.") );
|
|---|
| 545 |
|
|---|
| 546 | setWhatsThis(hide_video_window_on_audio_check, tr("Hide video window when playing audio files"),
|
|---|
| 547 | tr("If this option is enabled the video window will be hidden when playing audio files.") );
|
|---|
| 548 |
|
|---|
| 549 | setWhatsThis(recents_max_items_spin, tr("Recent files"),
|
|---|
| 550 | tr("Select the maximum number of items that will be shown in the "
|
|---|
| 551 | "<b>Open->Recent files</b> submenu. If you set it to 0 that "
|
|---|
| 552 | "menu won't be shown at all.") );
|
|---|
| 553 |
|
|---|
| 554 | setWhatsThis(language_combo, tr("Language"),
|
|---|
| 555 | tr("Here you can change the language of the application.") );
|
|---|
| 556 |
|
|---|
| 557 | setWhatsThis(iconset_combo, tr("Icon set"),
|
|---|
| 558 | tr("Select the icon set you prefer for the application.") );
|
|---|
| 559 |
|
|---|
| 560 | setWhatsThis(style_combo, tr("Style"),
|
|---|
| 561 | tr("Select the style you prefer for the application.") );
|
|---|
| 562 |
|
|---|
| 563 | setWhatsThis(gui_combo, tr("GUI"),
|
|---|
| 564 | tr("Select the GUI you prefer for the application. Currently "
|
|---|
| 565 | "there are two available: Default GUI and Mini GUI.<br>"
|
|---|
| 566 | "The <b>Default GUI</b> provides the traditional GUI, with the "
|
|---|
| 567 | "toolbar and control bar. The <b>Mini GUI</b> provides a "
|
|---|
| 568 | "more simple GUI, without toolbar and a control bar with few "
|
|---|
| 569 | "buttons.<br>"
|
|---|
| 570 | "<b>Note:</b> this option will take effect the next "
|
|---|
| 571 | "time you run SMPlayer.") );
|
|---|
| 572 |
|
|---|
| 573 | setWhatsThis(changeFontButton, tr("Default font"),
|
|---|
| 574 | tr("You can change here the application's font.") );
|
|---|
| 575 |
|
|---|
| 576 | addSectionTitle(tr("Seeking"));
|
|---|
| 577 |
|
|---|
| 578 | setWhatsThis(seek1, tr("Short jump"),
|
|---|
| 579 | tr("Select the time that should be go forward or backward when you "
|
|---|
| 580 | "choose the %1 action.").arg(tr("short jump")) );
|
|---|
| 581 |
|
|---|
| 582 | setWhatsThis(seek2, tr("Medium jump"),
|
|---|
| 583 | tr("Select the time that should be go forward or backward when you "
|
|---|
| 584 | "choose the %1 action.").arg(tr("medium jump")) );
|
|---|
| 585 |
|
|---|
| 586 | setWhatsThis(seek3, tr("Long jump"),
|
|---|
| 587 | tr("Select the time that should be go forward or backward when you "
|
|---|
| 588 | "choose the %1 action.").arg(tr("long jump")) );
|
|---|
| 589 |
|
|---|
| 590 | setWhatsThis(seek4, tr("Mouse wheel jump"),
|
|---|
| 591 | tr("Select the time that should be go forward or backward when you "
|
|---|
| 592 | "move the mouse wheel.") );
|
|---|
| 593 |
|
|---|
| 594 | setWhatsThis(timeslider_behaviour_combo, tr("Behaviour of time slider"),
|
|---|
| 595 | tr("Select what to do when dragging the time slider.") );
|
|---|
| 596 |
|
|---|
| 597 | setWhatsThis(seeking_method_group, tr("Seeking method"),
|
|---|
| 598 | tr("Sets the method to be used when seeking with the slider. "
|
|---|
| 599 | "Absolute seeking may be a little bit more accurate, while "
|
|---|
| 600 | "relative seeking may work better with files with a wrong length.") );
|
|---|
| 601 |
|
|---|
| 602 | setWhatsThis(precise_seeking_check, tr("Precise seeking"),
|
|---|
| 603 | tr("If this option is enabled, seeks are more accurate but they "
|
|---|
| 604 | "can be a little bit slower. May not work with some video formats.") +"<br>"+
|
|---|
| 605 | tr("Note: this option only works with MPlayer2") );
|
|---|
| 606 |
|
|---|
| 607 | addSectionTitle(tr("Instances"));
|
|---|
| 608 |
|
|---|
| 609 | setWhatsThis(single_instance_check,
|
|---|
| 610 | tr("Use only one running instance of SMPlayer"),
|
|---|
| 611 | tr("Check this option if you want to use an already running instance "
|
|---|
| 612 | "of SMPlayer when opening other files.") );
|
|---|
| 613 |
|
|---|
| 614 | setWhatsThis(automatic_port_button, tr("Automatic port"),
|
|---|
| 615 | tr("SMPlayer needs to listen to a port to receive commands from other "
|
|---|
| 616 | "instances. If you select this option, a port will be "
|
|---|
| 617 | "automatically chosen.") );
|
|---|
| 618 |
|
|---|
| 619 | setWhatsThis(server_port_spin, tr("Manual port"),
|
|---|
| 620 | tr("SMPlayer needs to listen to a port to receive commands from other "
|
|---|
| 621 | "instances. You can change the port in case the default one is "
|
|---|
| 622 | "used by another application.") );
|
|---|
| 623 |
|
|---|
| 624 | manual_port_button->setWhatsThis( server_port_spin->whatsThis() );
|
|---|
| 625 |
|
|---|
| 626 | addSectionTitle(tr("Floating control"));
|
|---|
| 627 |
|
|---|
| 628 | setWhatsThis(floating_animated_check, tr("Animated"),
|
|---|
| 629 | tr("If this option is enabled, the floating control will appear "
|
|---|
| 630 | "with an animation.") );
|
|---|
| 631 |
|
|---|
| 632 | setWhatsThis(floating_width_slider, tr("Width"),
|
|---|
| 633 | tr("Specifies the width of the control (as a percentage).") );
|
|---|
| 634 |
|
|---|
| 635 | setWhatsThis(floating_margin_slider, tr("Margin"),
|
|---|
| 636 | tr("This option sets the number of pixels that the floating control "
|
|---|
| 637 | "will be away from the bottom of the screen. Useful when the "
|
|---|
| 638 | "screen is a TV, as the overscan might prevent the control to be "
|
|---|
| 639 | "visible.") );
|
|---|
| 640 |
|
|---|
| 641 | setWhatsThis(floating_compact_check, tr("Display in compact mode too"),
|
|---|
| 642 | tr("If this option is enabled, the floating control will appear "
|
|---|
| 643 | "in compact mode too. <b>Warning:</b> the floating control has not been "
|
|---|
| 644 | "designed for compact mode and it might not work properly.") );
|
|---|
| 645 |
|
|---|
| 646 | #ifndef Q_OS_WIN
|
|---|
| 647 | setWhatsThis(floating_bypass_wm_check, tr("Bypass window manager"),
|
|---|
| 648 | tr("If this option is checked, the control is displayed bypassing the "
|
|---|
| 649 | "window manager. Disable this option if the floating control "
|
|---|
| 650 | "doesn't work well with your window manager.") );
|
|---|
| 651 | #endif
|
|---|
| 652 | }
|
|---|
| 653 |
|
|---|
| 654 | #include "moc_prefinterface.cpp"
|
|---|