~ubuntu-branches/ubuntu/wily/smplayer/wily

« back to all changes in this revision

Viewing changes to src/prefinterface.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Maia Kozheva
  • Date: 2009-03-31 23:05:43 UTC
  • mfrom: (1.2.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20090331230543-0h2hfwpwlu9opbv2
* New upstream release. (Closes: #523791)
  - Reworked subtitle font preferences. (Closes: #503295)
  - No longer installs qt_fr.qm. (Closes: #486314)
* debian/control:
  - Bumped Standards-Version to 3.8.1.
  - Changed maintainer name (still the same person and GPG key).
  - Changed section to video.
  - Build-depend on zlib1g-dev for findsubtitles.
  - Require Qt >= 4.3 per readme.
  - Added ${misc:Depends}.
  - Make smplayer-translations depend on smplayer and smplayer recommend
    smplayer-translations, not the other way round. (Closes: #489375)
* debian/copyright:
  - Significantly expanded per-file with new upstream authors.
* debian/rules:
  - Make make use correct uic in install.
  - Clean svn_revision.
  - Removed get-orig-source - not needed with uscan --repack.
* debian/patches/01_gl_translation.patch:
  - Added patch to fix lrelease error on smplayer_gl.ts.
* Added debian/README.source for simple-patchsys.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  smplayer, GUI front-end for mplayer.
2
 
    Copyright (C) 2006-2008 Ricardo Villalba <rvm@escomposlinux.org>
 
2
    Copyright (C) 2006-2009 Ricardo Villalba <rvm@escomposlinux.org>
3
3
 
4
4
    This program is free software; you can redistribute it and/or modify
5
5
    it under the terms of the GNU General Public License as published by
20
20
#include "prefinterface.h"
21
21
#include "images.h"
22
22
#include "preferences.h"
23
 
#include "helper.h"
 
23
#include "paths.h"
24
24
#include "config.h"
 
25
#include "languages.h"
 
26
#include "recents.h"
25
27
 
26
28
#include <QDir>
27
29
#include <QStyleFactory>
46
48
        iconset_combo->addItem( "Default" );
47
49
 
48
50
        // User
49
 
        QDir icon_dir = Helper::appHomePath() + "/themes";
 
51
        QDir icon_dir = Paths::configPath() + "/themes";
50
52
        qDebug("icon_dir: %s", icon_dir.absolutePath().toUtf8().data());
51
53
        QStringList iconsets = icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
52
54
        for (int n=0; n < iconsets.count(); n++) {
53
55
                iconset_combo->addItem( iconsets[n] );
54
56
        }
55
57
        // Global
56
 
        icon_dir = Helper::themesPath();
 
58
        icon_dir = Paths::themesPath();
57
59
        qDebug("icon_dir: %s", icon_dir.absolutePath().toUtf8().data());
58
60
        iconsets = icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
59
61
        for (int n=0; n < iconsets.count(); n++) {
65
67
        connect(single_instance_check, SIGNAL(toggled(bool)), 
66
68
            this, SLOT(changeInstanceImages()));
67
69
 
 
70
#ifdef Q_OS_WIN
 
71
        floating_bypass_wm_check->hide();
 
72
#endif
 
73
 
68
74
        retranslateStrings();
69
75
}
70
76
 
81
87
}
82
88
 
83
89
void PrefInterface::createLanguageCombo() {
84
 
        QMap <QString,QString> m;
85
 
        m["bg"] = tr("Bulgarian");
86
 
        m["ca"] = tr("Catalan");
87
 
        m["cs"] = tr("Czech");
88
 
        m["de"] = tr("German");
89
 
        m["el_GR"] = tr("Greek");
90
 
        m["en_US"] = tr("English");
91
 
        m["es"] = tr("Spanish");
92
 
        m["eu"] = tr("Basque");
93
 
        m["fi"] = tr("Finnish");
94
 
        m["fr"] = tr("French");
95
 
        m["gl"] = tr("Galician");
96
 
        m["hu"] = tr("Hungarian");
97
 
        m["it"] = tr("Italian");
98
 
        m["ja"] = tr("Japanese");
99
 
        m["ka"] = tr("Georgian");
100
 
        m["ko"] = tr("Korean");
101
 
        m["mk"] = tr("Macedonian");
102
 
        m["nl"] = tr("Dutch");
103
 
        m["pl"] = tr("Polish");
104
 
        m["pt_BR"] = tr("Portuguese - Brazil");
105
 
        m["pt_PT"] = tr("Portuguese - Portugal");
106
 
        m["ro_RO"] = tr("Romanian");
107
 
        m["ru_RU"] = tr("Russian");
108
 
        m["sk"] = tr("Slovak");
109
 
        m["sr"] = tr("Serbian");
110
 
        m["sv"] = tr("Swedish");
111
 
        m["tr"] = tr("Turkish");
112
 
        m["uk_UA"] = tr("Ukrainian");
113
 
        m["zh_CN"] = tr("Simplified-Chinese");
114
 
        m["zh_TW"] = tr("Traditional Chinese");
 
90
        QMap <QString,QString> m = Languages::translations();
115
91
 
116
92
        // Language combo
117
 
        QDir translation_dir = Helper::translationPath();
 
93
        QDir translation_dir = Paths::translationPath();
118
94
        QStringList languages = translation_dir.entryList( QStringList() << "*.qm");
119
95
        QRegExp rx_lang("smplayer_(.*)\\.qm");
120
96
        language_combo->clear();
177
153
        gui_combo->clear();
178
154
        gui_combo->addItem( tr("Default GUI"), "DefaultGUI");
179
155
        gui_combo->addItem( tr("Mini GUI"), "MiniGUI");
 
156
        gui_combo->addItem( tr("Mpc GUI"), "MpcGUI");
180
157
        gui_combo->setCurrentIndex(gui_index);
181
158
 
 
159
        floating_width_label->setNum(floating_width_slider->value());
 
160
        floating_margin_label->setNum(floating_margin_slider->value());
 
161
 
182
162
        createHelp();
183
163
}
184
164
 
190
170
        setSaveSize( pref->save_window_size_on_exit );
191
171
        setUseSingleInstance(pref->use_single_instance);
192
172
        setServerPort(pref->connection_port);
193
 
        setRecentsMaxItems(pref->recents_max_items);
 
173
        setUseAutoPort(pref->use_autoport);
 
174
        setRecentsMaxItems(pref->history_recents->maxItems());
194
175
 
195
176
        setSeeking1(pref->seeking1);
196
177
        setSeeking2(pref->seeking2);
206
187
#endif
207
188
 
208
189
        setGUI(pref->gui);
 
190
 
 
191
        setFloatingAnimated(pref->floating_control_animated);
 
192
        setFloatingWidth(pref->floating_control_width);
 
193
        setFloatingMargin(pref->floating_control_margin);
 
194
        setDisplayFloatingInCompactMode(pref->floating_display_in_compact_mode);
 
195
#ifndef Q_OS_WIN
 
196
        setFloatingBypassWindowManager(pref->bypass_window_manager);
 
197
#endif
209
198
}
210
199
 
211
200
void PrefInterface::getData(Preferences * pref) {
236
225
                port_changed = true;
237
226
        }
238
227
 
239
 
        if (pref->recents_max_items != recentsMaxItems()) {
240
 
                pref->recents_max_items = recentsMaxItems();
 
228
        if (pref->use_autoport != useAutoPort()) {
 
229
                pref->use_autoport = useAutoPort();
 
230
                port_changed = true;
 
231
        }
 
232
 
 
233
        if (pref->history_recents->maxItems() != recentsMaxItems()) {
 
234
                pref->history_recents->setMaxItems( recentsMaxItems() );
241
235
                recents_changed = true;
242
236
        }
243
237
 
258
252
#endif
259
253
 
260
254
        pref->gui = GUI();
 
255
 
 
256
        pref->floating_control_animated = floatingAnimated();
 
257
        pref->floating_control_width = floatingWidth();
 
258
        pref->floating_control_margin = floatingMargin();
 
259
        pref->floating_display_in_compact_mode = displayFloatingInCompactMode();
 
260
#ifndef Q_OS_WIN
 
261
        pref->bypass_window_manager = floatingBypassWindowManager();
 
262
#endif
261
263
}
262
264
 
263
265
void PrefInterface::setLanguage(QString lang) {
352
354
        return server_port_spin->value();
353
355
}
354
356
 
 
357
void PrefInterface::setUseAutoPort(bool b) {
 
358
        automatic_port_button->setChecked(b);
 
359
        manual_port_button->setChecked(!b);
 
360
}
 
361
 
 
362
bool PrefInterface::useAutoPort() {
 
363
        return automatic_port_button->isChecked();
 
364
}
 
365
 
355
366
void PrefInterface::setRecentsMaxItems(int n) {
356
367
        recents_max_items_spin->setValue(n);
357
368
}
433
444
                instances_icon->setPixmap( Images::icon("instance2") );
434
445
}
435
446
 
 
447
// Floating tab
 
448
void PrefInterface::setFloatingAnimated(bool b) {
 
449
        floating_animated_check->setChecked(b);
 
450
}
 
451
 
 
452
bool PrefInterface::floatingAnimated() {
 
453
        return floating_animated_check->isChecked();
 
454
}
 
455
 
 
456
void PrefInterface::setFloatingWidth(int percentage) {
 
457
        floating_width_slider->setValue(percentage);
 
458
}
 
459
 
 
460
int PrefInterface::floatingWidth() {
 
461
        return floating_width_slider->value();
 
462
}
 
463
 
 
464
void PrefInterface::setFloatingMargin(int pixels) {
 
465
        floating_margin_slider->setValue(pixels);
 
466
}
 
467
 
 
468
int PrefInterface::floatingMargin() {
 
469
        return floating_margin_slider->value();
 
470
}
 
471
 
 
472
void PrefInterface::setDisplayFloatingInCompactMode(bool b) {
 
473
        floating_compact_check->setChecked(b);
 
474
}
 
475
 
 
476
bool PrefInterface::displayFloatingInCompactMode() {
 
477
        return floating_compact_check->isChecked();
 
478
}
 
479
 
 
480
#ifndef Q_OS_WIN
 
481
void PrefInterface::setFloatingBypassWindowManager(bool b) {
 
482
        floating_bypass_wm_check->setChecked(b);
 
483
}
 
484
 
 
485
bool PrefInterface::floatingBypassWindowManager() {
 
486
        return floating_bypass_wm_check->isChecked();
 
487
}
 
488
#endif
 
489
 
436
490
void PrefInterface::createHelp() {
437
491
        clearHelp();
438
492
 
501
555
        tr("Check this option if you want to use an already running instance "
502
556
           "of SMPlayer when opening other files.") );
503
557
 
504
 
        setWhatsThis(server_port_spin, tr("Port"),
 
558
        setWhatsThis(automatic_port_button, tr("Automatic port"),
 
559
        tr("SMPlayer needs to listen to a port to receive commands from other "
 
560
           "instances. If you select this option, a port will be "
 
561
           "automatically chosen.") );
 
562
 
 
563
        setWhatsThis(server_port_spin, tr("Manual port"),
505
564
        tr("SMPlayer needs to listen to a port to receive commands from other "
506
565
           "instances. You can change the port in case the default one is "
507
566
           "used by another application.") );
 
567
 
 
568
        manual_port_button->setWhatsThis( server_port_spin->whatsThis() );
 
569
 
 
570
        addSectionTitle(tr("Floating control"));
 
571
 
 
572
        setWhatsThis(floating_animated_check, tr("Animated"),
 
573
                tr("If this option is enabled, the floating control will appear "
 
574
           "with an animation.") );
 
575
 
 
576
        setWhatsThis(floating_width_slider, tr("Width"),
 
577
                tr("Specifies the width of the control (as a percentage).") );
 
578
 
 
579
        setWhatsThis(floating_margin_slider, tr("Margin"),
 
580
                tr("This option sets the number of pixels that the floating control "
 
581
           "will be away from the bottom of the screen. Useful when the "
 
582
           "screen is a TV, as the overscan might prevent the control to be "
 
583
           "visible.") );
 
584
 
 
585
        setWhatsThis(floating_compact_check, tr("Display in compact mode too"),
 
586
                tr("If this option is enabled, the floating control will appear "
 
587
           "in compact mode too. <b>Warning:</b> the floating control has not been "
 
588
           "designed for compact mode and it might not work properly.") );
 
589
 
 
590
#ifndef Q_OS_WIN
 
591
        setWhatsThis(floating_bypass_wm_check, tr("Bypass window manager"),
 
592
                tr("If this option is checked, the control is displayed bypassing the "
 
593
           "window manager. Disable this option if the floating control "
 
594
           "doesn't work well with your window manager.") );
 
595
#endif
508
596
}
509
597
 
510
598
#include "moc_prefinterface.cpp"