| 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 | #ifdef SINGLE_INSTANCE
|
|---|
| 70 | connect(single_instance_check, SIGNAL(toggled(bool)),
|
|---|
| 71 | this, SLOT(changeInstanceImages()));
|
|---|
| 72 | #else
|
|---|
| 73 | tabWidget->setTabEnabled(SINGLE_INSTANCE_TAB, false);
|
|---|
| 74 | #endif
|
|---|
| 75 |
|
|---|
| 76 | #ifdef Q_OS_WIN
|
|---|
| 77 | floating_bypass_wm_check->hide();
|
|---|
| 78 | #endif
|
|---|
| 79 |
|
|---|
| 80 | retranslateStrings();
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | PrefInterface::~PrefInterface()
|
|---|
| 84 | {
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | QString PrefInterface::sectionName() {
|
|---|
| 88 | return tr("Interface");
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | QPixmap PrefInterface::sectionIcon() {
|
|---|
| 92 | return Images::icon("pref_gui", 22);
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | void PrefInterface::createLanguageCombo() {
|
|---|
| 96 | QMap <QString,QString> m = Languages::translations();
|
|---|
| 97 |
|
|---|
| 98 | // Language combo
|
|---|
| 99 | QDir translation_dir = Paths::translationPath();
|
|---|
| 100 | QStringList languages = translation_dir.entryList( QStringList() << "*.qm");
|
|---|
| 101 | QRegExp rx_lang("smplayer_(.*)\\.qm");
|
|---|
| 102 | language_combo->clear();
|
|---|
| 103 | language_combo->addItem( tr("<Autodetect>") );
|
|---|
| 104 | for (int n=0; n < languages.count(); n++) {
|
|---|
| 105 | if (rx_lang.indexIn(languages[n]) > -1) {
|
|---|
| 106 | QString l = rx_lang.cap(1);
|
|---|
| 107 | QString text = l;
|
|---|
| 108 | if (m.contains(l)) text = m[l] + " ("+l+")";
|
|---|
| 109 | language_combo->addItem( text, l );
|
|---|
| 110 | }
|
|---|
| 111 | }
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | void PrefInterface::retranslateStrings() {
|
|---|
| 115 | int mainwindow_resize = mainwindow_resize_combo->currentIndex();
|
|---|
| 116 | int timeslider_pos = timeslider_behaviour_combo->currentIndex();
|
|---|
| 117 |
|
|---|
| 118 | retranslateUi(this);
|
|---|
| 119 |
|
|---|
| 120 | mainwindow_resize_combo->setCurrentIndex(mainwindow_resize);
|
|---|
| 121 | timeslider_behaviour_combo->setCurrentIndex(timeslider_pos);
|
|---|
| 122 |
|
|---|
| 123 | // Icons
|
|---|
| 124 | resize_window_icon->setPixmap( Images::icon("resize_window") );
|
|---|
| 125 | /* volume_icon->setPixmap( Images::icon("speaker") ); */
|
|---|
| 126 |
|
|---|
| 127 | #ifdef SINGLE_INSTANCE
|
|---|
| 128 | changeInstanceImages();
|
|---|
| 129 | #endif
|
|---|
| 130 |
|
|---|
| 131 | // Seek widgets
|
|---|
| 132 | seek1->setLabel( tr("&Short jump") );
|
|---|
| 133 | seek2->setLabel( tr("&Medium jump") );
|
|---|
| 134 | seek3->setLabel( tr("&Long jump") );
|
|---|
| 135 | seek4->setLabel( tr("Mouse &wheel jump") );
|
|---|
| 136 |
|
|---|
| 137 | if (qApp->isLeftToRight()) {
|
|---|
| 138 | seek1->setIcon( Images::icon("forward10s") );
|
|---|
| 139 | seek2->setIcon( Images::icon("forward1m") );
|
|---|
| 140 | seek3->setIcon( Images::icon("forward10m") );
|
|---|
| 141 | } else {
|
|---|
| 142 | seek1->setIcon( Images::flippedIcon("forward10s") );
|
|---|
| 143 | seek2->setIcon( Images::flippedIcon("forward1m") );
|
|---|
| 144 | seek3->setIcon( Images::flippedIcon("forward10m") );
|
|---|
| 145 | }
|
|---|
| 146 | seek4->setIcon( Images::icon("mouse", seek1->icon()->width()) );
|
|---|
| 147 |
|
|---|
| 148 | // Language combo
|
|---|
| 149 | int language_item = language_combo->currentIndex();
|
|---|
| 150 | createLanguageCombo();
|
|---|
| 151 | language_combo->setCurrentIndex( language_item );
|
|---|
| 152 |
|
|---|
| 153 | // Iconset combo
|
|---|
| 154 | iconset_combo->setItemText( 0, tr("Default") );
|
|---|
| 155 |
|
|---|
| 156 | #if STYLE_SWITCHING
|
|---|
| 157 | style_combo->setItemText( 0, tr("Default") );
|
|---|
| 158 | #endif
|
|---|
| 159 |
|
|---|
| 160 | int gui_index = gui_combo->currentIndex();
|
|---|
| 161 | gui_combo->clear();
|
|---|
| 162 | gui_combo->addItem( tr("Default GUI"), "DefaultGUI");
|
|---|
| 163 | gui_combo->addItem( tr("Mini GUI"), "MiniGUI");
|
|---|
| 164 | gui_combo->addItem( tr("Mpc GUI"), "MpcGUI");
|
|---|
| 165 | gui_combo->setCurrentIndex(gui_index);
|
|---|
| 166 |
|
|---|
| 167 | floating_width_label->setNum(floating_width_slider->value());
|
|---|
| 168 | floating_margin_label->setNum(floating_margin_slider->value());
|
|---|
| 169 |
|
|---|
| 170 | createHelp();
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | void PrefInterface::setData(Preferences * pref) {
|
|---|
| 174 | setLanguage( pref->language );
|
|---|
| 175 | setIconSet( pref->iconset );
|
|---|
| 176 |
|
|---|
| 177 | setResizeMethod( pref->resize_method );
|
|---|
| 178 | setSaveSize( pref->save_window_size_on_exit );
|
|---|
| 179 | #ifdef SINGLE_INSTANCE
|
|---|
| 180 | setUseSingleInstance(pref->use_single_instance);
|
|---|
| 181 | #endif
|
|---|
| 182 | setRecentsMaxItems(pref->history_recents->maxItems());
|
|---|
| 183 |
|
|---|
| 184 | setSeeking1(pref->seeking1);
|
|---|
| 185 | setSeeking2(pref->seeking2);
|
|---|
| 186 | setSeeking3(pref->seeking3);
|
|---|
| 187 | setSeeking4(pref->seeking4);
|
|---|
| 188 |
|
|---|
| 189 | setUpdateWhileDragging(pref->update_while_seeking);
|
|---|
| 190 | setRelativeSeeking(pref->relative_seeking);
|
|---|
| 191 | setPreciseSeeking(pref->precise_seeking);
|
|---|
| 192 |
|
|---|
| 193 | setDefaultFont(pref->default_font);
|
|---|
| 194 |
|
|---|
| 195 | setHideVideoOnAudioFiles(pref->hide_video_window_on_audio_files);
|
|---|
| 196 |
|
|---|
| 197 | #if STYLE_SWITCHING
|
|---|
| 198 | setStyle( pref->style );
|
|---|
| 199 | #endif
|
|---|
| 200 |
|
|---|
| 201 | setGUI(pref->gui);
|
|---|
| 202 |
|
|---|
| 203 | setFloatingAnimated(pref->floating_control_animated);
|
|---|
| 204 | setFloatingWidth(pref->floating_control_width);
|
|---|
| 205 | setFloatingMargin(pref->floating_control_margin);
|
|---|
| 206 | setDisplayFloatingInCompactMode(pref->floating_display_in_compact_mode);
|
|---|
| 207 | #ifndef Q_OS_WIN
|
|---|
| 208 | setFloatingBypassWindowManager(pref->bypass_window_manager);
|
|---|
| 209 | #endif
|
|---|
| 210 | }
|
|---|
| 211 |
|
|---|
| 212 | void PrefInterface::getData(Preferences * pref) {
|
|---|
| 213 | requires_restart = false;
|
|---|
| 214 | language_changed = false;
|
|---|
| 215 | iconset_changed = false;
|
|---|
| 216 | gui_changed = false;
|
|---|
| 217 | style_changed = false;
|
|---|
| 218 | recents_changed = false;
|
|---|
| 219 |
|
|---|
| 220 | if (pref->language != language()) {
|
|---|
| 221 | pref->language = language();
|
|---|
| 222 | language_changed = true;
|
|---|
| 223 | qDebug("PrefInterface::getData: chosen language: '%s'", pref->language.toUtf8().data());
|
|---|
| 224 | }
|
|---|
| 225 |
|
|---|
| 226 | if (pref->iconset != iconSet()) {
|
|---|
| 227 | pref->iconset = iconSet();
|
|---|
| 228 | iconset_changed = true;
|
|---|
| 229 | }
|
|---|
| 230 |
|
|---|
| 231 | if (pref->gui != GUI()) {
|
|---|
| 232 | pref->gui = GUI();
|
|---|
| 233 | gui_changed = true;
|
|---|
| 234 | }
|
|---|
| 235 |
|
|---|
| 236 | pref->resize_method = resizeMethod();
|
|---|
| 237 | pref->save_window_size_on_exit = saveSize();
|
|---|
| 238 |
|
|---|
| 239 | #ifdef SINGLE_INSTANCE
|
|---|
| 240 | pref->use_single_instance = useSingleInstance();
|
|---|
| 241 | #endif
|
|---|
| 242 |
|
|---|
| 243 | if (pref->history_recents->maxItems() != recentsMaxItems()) {
|
|---|
| 244 | pref->history_recents->setMaxItems( recentsMaxItems() );
|
|---|
| 245 | recents_changed = true;
|
|---|
| 246 | }
|
|---|
| 247 |
|
|---|
| 248 | pref->seeking1 = seeking1();
|
|---|
| 249 | pref->seeking2 = seeking2();
|
|---|
| 250 | pref->seeking3 = seeking3();
|
|---|
| 251 | pref->seeking4 = seeking4();
|
|---|
| 252 |
|
|---|
| 253 | pref->update_while_seeking = updateWhileDragging();
|
|---|
| 254 | pref->relative_seeking= relativeSeeking();
|
|---|
| 255 | pref->precise_seeking = preciseSeeking();
|
|---|
| 256 |
|
|---|
| 257 | pref->default_font = defaultFont();
|
|---|
| 258 |
|
|---|
| 259 | pref->hide_video_window_on_audio_files = hideVideoOnAudioFiles();
|
|---|
| 260 |
|
|---|
| 261 | #if STYLE_SWITCHING
|
|---|
| 262 | if ( pref->style != style() ) {
|
|---|
| 263 | pref->style = style();
|
|---|
| 264 | style_changed = true;
|
|---|
| 265 | }
|
|---|
| 266 | #endif
|
|---|
| 267 |
|
|---|
| 268 | pref->floating_control_animated = floatingAnimated();
|
|---|
| 269 | pref->floating_control_width = floatingWidth();
|
|---|
| 270 | pref->floating_control_margin = floatingMargin();
|
|---|
| 271 | pref->floating_display_in_compact_mode = displayFloatingInCompactMode();
|
|---|
| 272 | #ifndef Q_OS_WIN
|
|---|
| 273 | pref->bypass_window_manager = floatingBypassWindowManager();
|
|---|
| 274 | #endif
|
|---|
| 275 | }
|
|---|
| 276 |
|
|---|
| 277 | void PrefInterface::setLanguage(QString lang) {
|
|---|
| 278 | if (lang.isEmpty()) {
|
|---|
| 279 | language_combo->setCurrentIndex(0);
|
|---|
| 280 | }
|
|---|
| 281 | else {
|
|---|
| 282 | int pos = language_combo->findData(lang);
|
|---|
| 283 | if (pos != -1)
|
|---|
| 284 | language_combo->setCurrentIndex( pos );
|
|---|
| 285 | else
|
|---|
| 286 | language_combo->setCurrentText(lang);
|
|---|
| 287 | }
|
|---|
| 288 | }
|
|---|
| 289 |
|
|---|
| 290 | QString PrefInterface::language() {
|
|---|
| 291 | if (language_combo->currentIndex()==0)
|
|---|
| 292 | return "";
|
|---|
| 293 | else
|
|---|
| 294 | return language_combo->itemData( language_combo->currentIndex() ).toString();
|
|---|
| 295 | }
|
|---|
| 296 |
|
|---|
| 297 | void PrefInterface::setIconSet(QString set) {
|
|---|
| 298 | if (set.isEmpty())
|
|---|
| 299 | iconset_combo->setCurrentIndex(0);
|
|---|
| 300 | else
|
|---|
| 301 | iconset_combo->setCurrentText(set);
|
|---|
| 302 | }
|
|---|
| 303 |
|
|---|
| 304 | QString PrefInterface::iconSet() {
|
|---|
| 305 | if (iconset_combo->currentIndex()==0)
|
|---|
| 306 | return "";
|
|---|
| 307 | else
|
|---|
| 308 | return iconset_combo->currentText();
|
|---|
| 309 | }
|
|---|
| 310 |
|
|---|
| 311 | void PrefInterface::setResizeMethod(int v) {
|
|---|
| 312 | mainwindow_resize_combo->setCurrentIndex(v);
|
|---|
| 313 | }
|
|---|
| 314 |
|
|---|
| 315 | int PrefInterface::resizeMethod() {
|
|---|
| 316 | return mainwindow_resize_combo->currentIndex();
|
|---|
| 317 | }
|
|---|
| 318 |
|
|---|
| 319 | void PrefInterface::setSaveSize(bool b) {
|
|---|
| 320 | save_size_check->setChecked(b);
|
|---|
| 321 | }
|
|---|
| 322 |
|
|---|
| 323 | bool PrefInterface::saveSize() {
|
|---|
| 324 | return save_size_check->isChecked();
|
|---|
| 325 | }
|
|---|
| 326 |
|
|---|
| 327 |
|
|---|
| 328 | void PrefInterface::setStyle(QString style) {
|
|---|
| 329 | if (style.isEmpty())
|
|---|
| 330 | style_combo->setCurrentIndex(0);
|
|---|
| 331 | else
|
|---|
| 332 | style_combo->setCurrentText(style);
|
|---|
| 333 | }
|
|---|
| 334 |
|
|---|
| 335 | QString PrefInterface::style() {
|
|---|
| 336 | if (style_combo->currentIndex()==0)
|
|---|
| 337 | return "";
|
|---|
| 338 | else
|
|---|
| 339 | return style_combo->currentText();
|
|---|
| 340 | }
|
|---|
| 341 |
|
|---|
| 342 | void PrefInterface::setGUI(QString gui_name) {
|
|---|
| 343 | int i = gui_combo->findData(gui_name);
|
|---|
| 344 | if (i < 0) i=0;
|
|---|
| 345 | gui_combo->setCurrentIndex(i);
|
|---|
| 346 | }
|
|---|
| 347 |
|
|---|
| 348 | QString PrefInterface::GUI() {
|
|---|
| 349 | return gui_combo->itemData(gui_combo->currentIndex()).toString();
|
|---|
| 350 | }
|
|---|
| 351 |
|
|---|
| 352 | #ifdef SINGLE_INSTANCE
|
|---|
| 353 | void PrefInterface::setUseSingleInstance(bool b) {
|
|---|
| 354 | single_instance_check->setChecked(b);
|
|---|
| 355 | //singleInstanceButtonToggled(b);
|
|---|
| 356 | }
|
|---|
| 357 |
|
|---|
| 358 | bool PrefInterface::useSingleInstance() {
|
|---|
| 359 | return single_instance_check->isChecked();
|
|---|
| 360 | }
|
|---|
| 361 | #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 |
|
|---|
| 371 | void PrefInterface::setSeeking1(int n) {
|
|---|
| 372 | seek1->setTime(n);
|
|---|
| 373 | }
|
|---|
| 374 |
|
|---|
| 375 | int PrefInterface::seeking1() {
|
|---|
| 376 | return seek1->time();
|
|---|
| 377 | }
|
|---|
| 378 |
|
|---|
| 379 | void PrefInterface::setSeeking2(int n) {
|
|---|
| 380 | seek2->setTime(n);
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 | int PrefInterface::seeking2() {
|
|---|
| 384 | return seek2->time();
|
|---|
| 385 | }
|
|---|
| 386 |
|
|---|
| 387 | void PrefInterface::setSeeking3(int n) {
|
|---|
| 388 | seek3->setTime(n);
|
|---|
| 389 | }
|
|---|
| 390 |
|
|---|
| 391 | int PrefInterface::seeking3() {
|
|---|
| 392 | return seek3->time();
|
|---|
| 393 | }
|
|---|
| 394 |
|
|---|
| 395 | void PrefInterface::setSeeking4(int n) {
|
|---|
| 396 | seek4->setTime(n);
|
|---|
| 397 | }
|
|---|
| 398 |
|
|---|
| 399 | int PrefInterface::seeking4() {
|
|---|
| 400 | return seek4->time();
|
|---|
| 401 | }
|
|---|
| 402 |
|
|---|
| 403 | void PrefInterface::setUpdateWhileDragging(bool b) {
|
|---|
| 404 | if (b)
|
|---|
| 405 | timeslider_behaviour_combo->setCurrentIndex(0);
|
|---|
| 406 | else
|
|---|
| 407 | timeslider_behaviour_combo->setCurrentIndex(1);
|
|---|
| 408 | }
|
|---|
| 409 |
|
|---|
| 410 | bool PrefInterface::updateWhileDragging() {
|
|---|
| 411 | return (timeslider_behaviour_combo->currentIndex() == 0);
|
|---|
| 412 | }
|
|---|
| 413 |
|
|---|
| 414 | void PrefInterface::setRelativeSeeking(bool b) {
|
|---|
| 415 | relative_seeking_button->setChecked(b);
|
|---|
| 416 | absolute_seeking_button->setChecked(!b);
|
|---|
| 417 | }
|
|---|
| 418 |
|
|---|
| 419 | bool PrefInterface::relativeSeeking() {
|
|---|
| 420 | return relative_seeking_button->isChecked();
|
|---|
| 421 | }
|
|---|
| 422 |
|
|---|
| 423 | void PrefInterface::setPreciseSeeking(bool b) {
|
|---|
| 424 | precise_seeking_check->setChecked(b);
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| 427 | bool PrefInterface::preciseSeeking() {
|
|---|
| 428 | return precise_seeking_check->isChecked();
|
|---|
| 429 | }
|
|---|
| 430 |
|
|---|
| 431 | void PrefInterface::setDefaultFont(QString font_desc) {
|
|---|
| 432 | default_font_edit->setText(font_desc);
|
|---|
| 433 | }
|
|---|
| 434 |
|
|---|
| 435 | QString PrefInterface::defaultFont() {
|
|---|
| 436 | return default_font_edit->text();
|
|---|
| 437 | }
|
|---|
| 438 |
|
|---|
| 439 | void PrefInterface::on_changeFontButton_clicked() {
|
|---|
| 440 | QFont f = qApp->font();
|
|---|
| 441 |
|
|---|
| 442 | if (!default_font_edit->text().isEmpty()) {
|
|---|
| 443 | f.fromString(default_font_edit->text());
|
|---|
| 444 | }
|
|---|
| 445 |
|
|---|
| 446 | bool ok;
|
|---|
| 447 | f = QFontDialog::getFont( &ok, f, this);
|
|---|
| 448 |
|
|---|
| 449 | if (ok) {
|
|---|
| 450 | default_font_edit->setText( f.toString() );
|
|---|
| 451 | }
|
|---|
| 452 | }
|
|---|
| 453 |
|
|---|
| 454 | #ifdef SINGLE_INSTANCE
|
|---|
| 455 | void PrefInterface::changeInstanceImages() {
|
|---|
| 456 | if (single_instance_check->isChecked())
|
|---|
| 457 | instances_icon->setPixmap( Images::icon("instance1") );
|
|---|
| 458 | else
|
|---|
| 459 | instances_icon->setPixmap( Images::icon("instance2") );
|
|---|
| 460 | }
|
|---|
| 461 | #endif
|
|---|
| 462 |
|
|---|
| 463 | void PrefInterface::setHideVideoOnAudioFiles(bool b) {
|
|---|
| 464 | hide_video_window_on_audio_check->setChecked(b);
|
|---|
| 465 | }
|
|---|
| 466 |
|
|---|
| 467 | bool PrefInterface::hideVideoOnAudioFiles() {
|
|---|
| 468 | return hide_video_window_on_audio_check->isChecked();
|
|---|
| 469 | }
|
|---|
| 470 |
|
|---|
| 471 | // Floating tab
|
|---|
| 472 | void PrefInterface::setFloatingAnimated(bool b) {
|
|---|
| 473 | floating_animated_check->setChecked(b);
|
|---|
| 474 | }
|
|---|
| 475 |
|
|---|
| 476 | bool PrefInterface::floatingAnimated() {
|
|---|
| 477 | return floating_animated_check->isChecked();
|
|---|
| 478 | }
|
|---|
| 479 |
|
|---|
| 480 | void PrefInterface::setFloatingWidth(int percentage) {
|
|---|
| 481 | floating_width_slider->setValue(percentage);
|
|---|
| 482 | }
|
|---|
| 483 |
|
|---|
| 484 | int PrefInterface::floatingWidth() {
|
|---|
| 485 | return floating_width_slider->value();
|
|---|
| 486 | }
|
|---|
| 487 |
|
|---|
| 488 | void PrefInterface::setFloatingMargin(int pixels) {
|
|---|
| 489 | floating_margin_slider->setValue(pixels);
|
|---|
| 490 | }
|
|---|
| 491 |
|
|---|
| 492 | int PrefInterface::floatingMargin() {
|
|---|
| 493 | return floating_margin_slider->value();
|
|---|
| 494 | }
|
|---|
| 495 |
|
|---|
| 496 | void PrefInterface::setDisplayFloatingInCompactMode(bool b) {
|
|---|
| 497 | floating_compact_check->setChecked(b);
|
|---|
| 498 | }
|
|---|
| 499 |
|
|---|
| 500 | bool PrefInterface::displayFloatingInCompactMode() {
|
|---|
| 501 | return floating_compact_check->isChecked();
|
|---|
| 502 | }
|
|---|
| 503 |
|
|---|
| 504 | #ifndef Q_OS_WIN
|
|---|
| 505 | void PrefInterface::setFloatingBypassWindowManager(bool b) {
|
|---|
| 506 | floating_bypass_wm_check->setChecked(b);
|
|---|
| 507 | }
|
|---|
| 508 |
|
|---|
| 509 | bool PrefInterface::floatingBypassWindowManager() {
|
|---|
| 510 | return floating_bypass_wm_check->isChecked();
|
|---|
| 511 | }
|
|---|
| 512 | #endif
|
|---|
| 513 |
|
|---|
| 514 | void PrefInterface::createHelp() {
|
|---|
| 515 | clearHelp();
|
|---|
| 516 |
|
|---|
| 517 | addSectionTitle(tr("Interface"));
|
|---|
| 518 |
|
|---|
| 519 | setWhatsThis(mainwindow_resize_combo, tr("Autoresize"),
|
|---|
| 520 | tr("The main window can be resized automatically. Select the option "
|
|---|
| 521 | "you prefer.") );
|
|---|
| 522 |
|
|---|
| 523 | setWhatsThis(save_size_check, tr("Remember position and size"),
|
|---|
| 524 | tr("If you check this option, the position and size of the main "
|
|---|
| 525 | "window will be saved and restored when you run SMPlayer again.") );
|
|---|
| 526 |
|
|---|
| 527 | setWhatsThis(hide_video_window_on_audio_check, tr("Hide video window when playing audio files"),
|
|---|
| 528 | tr("If this option is enabled the video window will be hidden when playing audio files.") );
|
|---|
| 529 |
|
|---|
| 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 | setWhatsThis(language_combo, tr("Language"),
|
|---|
| 536 | 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 |
|
|---|
| 544 | setWhatsThis(gui_combo, tr("GUI"),
|
|---|
| 545 | tr("Select the GUI you prefer for the application. Currently "
|
|---|
| 546 | "there are two available: Default GUI and Mini GUI.<br>"
|
|---|
| 547 | "The <b>Default GUI</b> provides the traditional GUI, with the "
|
|---|
| 548 | "toolbar and control bar. The <b>Mini GUI</b> provides a "
|
|---|
| 549 | "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.") );
|
|---|
| 553 |
|
|---|
| 554 | setWhatsThis(changeFontButton, tr("Default font"),
|
|---|
| 555 | tr("You can change here the application's font.") );
|
|---|
| 556 |
|
|---|
| 557 | addSectionTitle(tr("Seeking"));
|
|---|
| 558 |
|
|---|
| 559 | setWhatsThis(seek1, tr("Short jump"),
|
|---|
| 560 | tr("Select the time that should be go forward or backward when you "
|
|---|
| 561 | "choose the %1 action.").arg(tr("short jump")) );
|
|---|
| 562 |
|
|---|
| 563 | setWhatsThis(seek2, tr("Medium jump"),
|
|---|
| 564 | tr("Select the time that should be go forward or backward when you "
|
|---|
| 565 | "choose the %1 action.").arg(tr("medium jump")) );
|
|---|
| 566 |
|
|---|
| 567 | setWhatsThis(seek3, tr("Long jump"),
|
|---|
| 568 | tr("Select the time that should be go forward or backward when you "
|
|---|
| 569 | "choose the %1 action.").arg(tr("long jump")) );
|
|---|
| 570 |
|
|---|
| 571 | setWhatsThis(seek4, tr("Mouse wheel jump"),
|
|---|
| 572 | tr("Select the time that should be go forward or backward when you "
|
|---|
| 573 | "move the mouse wheel.") );
|
|---|
| 574 |
|
|---|
| 575 | setWhatsThis(timeslider_behaviour_combo, tr("Behaviour of time slider"),
|
|---|
| 576 | tr("Select what to do when dragging the time slider.") );
|
|---|
| 577 |
|
|---|
| 578 | setWhatsThis(seeking_method_group, tr("Seeking method"),
|
|---|
| 579 | tr("Sets the method to be used when seeking with the slider. "
|
|---|
| 580 | "Absolute seeking may be a little bit more accurate, while "
|
|---|
| 581 | "relative seeking may work better with files with a wrong length.") );
|
|---|
| 582 |
|
|---|
| 583 | setWhatsThis(precise_seeking_check, tr("Precise seeking"),
|
|---|
| 584 | tr("If this option is enabled, seeks are more accurate but they "
|
|---|
| 585 | "can be a little bit slower. May not work with some video formats.") +"<br>"+
|
|---|
| 586 | tr("Note: this option only works with MPlayer2") );
|
|---|
| 587 |
|
|---|
| 588 | #ifdef SINGLE_INSTANCE
|
|---|
| 589 | addSectionTitle(tr("Instances"));
|
|---|
| 590 |
|
|---|
| 591 | setWhatsThis(single_instance_check,
|
|---|
| 592 | tr("Use only one running instance of SMPlayer"),
|
|---|
| 593 | tr("Check this option if you want to use an already running instance "
|
|---|
| 594 | "of SMPlayer when opening other files.") );
|
|---|
| 595 | #endif
|
|---|
| 596 |
|
|---|
| 597 | addSectionTitle(tr("Floating control"));
|
|---|
| 598 |
|
|---|
| 599 | setWhatsThis(floating_animated_check, tr("Animated"),
|
|---|
| 600 | tr("If this option is enabled, the floating control will appear "
|
|---|
| 601 | "with an animation.") );
|
|---|
| 602 |
|
|---|
| 603 | setWhatsThis(floating_width_slider, tr("Width"),
|
|---|
| 604 | tr("Specifies the width of the control (as a percentage).") );
|
|---|
| 605 |
|
|---|
| 606 | setWhatsThis(floating_margin_slider, tr("Margin"),
|
|---|
| 607 | tr("This option sets the number of pixels that the floating control "
|
|---|
| 608 | "will be away from the bottom of the screen. Useful when the "
|
|---|
| 609 | "screen is a TV, as the overscan might prevent the control to be "
|
|---|
| 610 | "visible.") );
|
|---|
| 611 |
|
|---|
| 612 | setWhatsThis(floating_compact_check, tr("Display in compact mode too"),
|
|---|
| 613 | tr("If this option is enabled, the floating control will appear "
|
|---|
| 614 | "in compact mode too. <b>Warning:</b> the floating control has not been "
|
|---|
| 615 | "designed for compact mode and it might not work properly.") );
|
|---|
| 616 |
|
|---|
| 617 | #ifndef Q_OS_WIN
|
|---|
| 618 | setWhatsThis(floating_bypass_wm_check, tr("Bypass window manager"),
|
|---|
| 619 | tr("If this option is checked, the control is displayed bypassing the "
|
|---|
| 620 | "window manager. Disable this option if the floating control "
|
|---|
| 621 | "doesn't work well with your window manager.") );
|
|---|
| 622 | #endif
|
|---|
| 623 | }
|
|---|
| 624 |
|
|---|
| 625 | #include "moc_prefinterface.cpp"
|
|---|