~ubuntu-branches/debian/sid/smplayer/sid

« back to all changes in this revision

Viewing changes to src/basegui.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Matvey Kozhev
  • Date: 2008-01-31 13:44:53 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080131134453-nc4dwsn5pkiw5s9h
Tags: 0.6.0~rc1-1
* New upstream release.
* debian/control:
  - Build-depend on CDBS.
  - Updated upstream homepage.
* debian/copyright:
  - Updated download address.
* debian/rules:
  - Migrated to CDBS.
  - Tweaked get-orig-source to work with release candidates.
* debian/docs:
  - Removed Translations.txt, upstream removed it from the tarball.
  - Added Release_notes.txt.
* debian/manpages, debian/smplayer.1:
  - Deleted, manpage merged upstream.
* debian/smplayer.install:
  - Install usr/share/man.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  smplayer, GUI front-end for mplayer.
2
 
    Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
 
2
    Copyright (C) 2006-2008 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
35
35
#include <QUrl>
36
36
#include <QDragEnterEvent>
37
37
#include <QDropEvent>
 
38
#include <QDesktopServices>
38
39
 
39
40
#include <cmath>
40
41
 
52
53
#include "eqslider.h"
53
54
#include "videoequalizer.h"
54
55
#include "inputdvddirectory.h"
 
56
#include "inputmplayerversion.h"
55
57
#include "inputurl.h"
56
58
#include "recents.h"
57
 
#include "aboutdialog.h"
 
59
#include "about.h"
 
60
#include "clhelp.h"
58
61
 
59
62
#include "config.h"
60
63
#include "actionseditor.h"
80
83
                near_top(false),
81
84
                near_bottom(false)
82
85
{
 
86
#ifdef Q_OS_WIN
 
87
#if DISABLE_SCREENSAVER_BY_EVENT
 
88
        just_stopped = false;
 
89
#endif
 
90
#endif
 
91
 
83
92
        setWindowTitle( "SMPlayer" );
84
93
 
85
94
        // Not created objects
87
96
        popup = 0;
88
97
        pref_dialog = 0;
89
98
        file_dialog = 0;
 
99
        clhelp_window = 0;
90
100
 
91
101
        // Create objects:
92
102
        recents = new Recents(this);
253
263
 
254
264
#ifdef Q_OS_WIN
255
265
        // VCD's and Audio CD's seem they don't work on windows
256
 
        openVCDAct->setEnabled(pref->enable_vcd_on_windows);
 
266
        //openVCDAct->setEnabled(pref->enable_vcd_on_windows);
257
267
        openAudioCDAct->setEnabled(pref->enable_audiocd_on_windows);
258
268
#endif
259
269
 
382
392
        connect( flipAct, SIGNAL(toggled(bool)),
383
393
             core, SLOT(toggleFlip(bool)) );
384
394
 
 
395
 
385
396
        // Submenu filter
386
397
        postProcessingAct = new MyAction( this, "postprocessing" );
387
398
        postProcessingAct->setCheckable( true );
408
419
        connect( addNoiseAct, SIGNAL(toggled(bool)),
409
420
             core, SLOT(toggleNoise(bool)) );
410
421
 
 
422
#if NEW_ASPECT_CODE
 
423
        addLetterboxAct = new MyAction( this, "add_letterbox" );
 
424
        addLetterboxAct->setCheckable( true );
 
425
        connect( addLetterboxAct, SIGNAL(toggled(bool)),
 
426
             core, SLOT(changeLetterbox(bool)) );
 
427
#endif
 
428
 
 
429
        upscaleAct = new MyAction( this, "upscaling" );
 
430
        upscaleAct->setCheckable( true );
 
431
        connect( upscaleAct, SIGNAL(toggled(bool)),
 
432
             core, SLOT(changeUpscale(bool)) );
 
433
 
411
434
 
412
435
        // Menu Audio
413
436
        muteAct = new MyAction( Qt::Key_M, this, "mute" );
472
495
        connect( loadSubsAct, SIGNAL(triggered()),
473
496
             this, SLOT(loadSub()) );
474
497
 
475
 
#if SUBTITLES_BY_INDEX
476
498
        unloadSubsAct = new MyAction( this, "unload_subs" );
477
499
        connect( unloadSubsAct, SIGNAL(triggered()),
478
500
             core, SLOT(unloadSub()) );
479
 
#endif
480
501
 
481
502
        decSubDelayAct = new MyAction( Qt::Key_Z, this, "dec_sub_delay" );
482
503
        connect( decSubDelayAct, SIGNAL(triggered()),
528
549
        connect( frameCounterAct, SIGNAL(toggled(bool)),
529
550
             this, SLOT(toggleFrameCounter(bool)) );
530
551
 
 
552
        motionVectorsAct = new MyAction( this, "motion_vectors" );
 
553
        motionVectorsAct->setCheckable( true );
 
554
        connect( motionVectorsAct, SIGNAL(toggled(bool)),
 
555
             core, SLOT(visualizeMotionVectors(bool)) );
 
556
 
531
557
        showPreferencesAct = new MyAction( QKeySequence("Ctrl+P"), this, "show_preferences" );
532
558
        connect( showPreferencesAct, SIGNAL(triggered()),
533
559
             this, SLOT(showPreferencesDialog()) );
542
568
             this, SLOT(showLog()) );
543
569
 
544
570
        // Menu Help
 
571
        showFAQAct = new MyAction( this, "faq" );
 
572
        connect( showFAQAct, SIGNAL(triggered()),
 
573
             this, SLOT(helpFAQ()) );
 
574
 
 
575
        showCLOptions = new MyAction( this, "cl_options" );
 
576
        connect( showCLOptions, SIGNAL(triggered()),
 
577
             this, SLOT(helpCLOptions()) );
 
578
 
545
579
        aboutQtAct = new MyAction( this, "about_qt" );
546
580
        connect( aboutQtAct, SIGNAL(triggered()),
547
581
             this, SLOT(helpAboutQt()) );
716
750
        aspect169Act = new MyActionGroupItem(this, aspectGroup, "aspect_16:9", MediaSettings::Aspect169 );
717
751
        aspect1610Act = new MyActionGroupItem(this, aspectGroup, "aspect_16:10", MediaSettings::Aspect1610 );
718
752
        aspect235Act = new MyActionGroupItem(this, aspectGroup, "aspect_2.35:1", MediaSettings::Aspect235 );
 
753
#if !NEW_ASPECT_CODE
719
754
        QAction * aspect_separator = new QAction(aspectGroup);
720
755
        aspect_separator->setSeparator(true);
721
756
        aspect43LetterAct = new MyActionGroupItem(this, aspectGroup, "aspect_4:3_letterbox", MediaSettings::Aspect43Letterbox );
722
757
        aspect169LetterAct = new MyActionGroupItem(this, aspectGroup, "aspect_16:9_letterbox", MediaSettings::Aspect169Letterbox );
723
758
        aspect43PanscanAct = new MyActionGroupItem(this, aspectGroup, "aspect_4:3_panscan", MediaSettings::Aspect43Panscan );
724
759
        aspect43To169Act = new MyActionGroupItem(this, aspectGroup, "aspect_4:3_to_16:9", MediaSettings::Aspect43To169 );
 
760
#endif
725
761
        connect( aspectGroup, SIGNAL(activated(int)),
726
762
             core, SLOT(changeAspectRatio(int)) );
727
763
 
783
819
        deblockAct->setEnabled(b);
784
820
        deringAct->setEnabled(b);
785
821
        addNoiseAct->setEnabled(b);
 
822
#if NEW_ASPECT_CODE
 
823
        addLetterboxAct->setEnabled(b);
 
824
#endif
 
825
        upscaleAct->setEnabled(b);
786
826
 
787
827
        // Menu Audio
788
828
        muteAct->setEnabled(b);
884
924
                deblockAct->setEnabled(false);
885
925
                deringAct->setEnabled(false);
886
926
                addNoiseAct->setEnabled(false);
 
927
#if NEW_ASPECT_CODE
 
928
                addLetterboxAct->setEnabled(false);
 
929
#endif
 
930
                upscaleAct->setEnabled(false);
887
931
 
888
932
                doubleSizeAct->setEnabled(false);
889
933
 
982
1026
        deblockAct->change( tr("&Deblock") );
983
1027
        deringAct->change( tr("De&ring") );
984
1028
        addNoiseAct->change( tr("Add n&oise") );
 
1029
#if NEW_ASPECT_CODE
 
1030
        addLetterboxAct->change( Images::icon("letterbox"), tr("Add &black borders") );
 
1031
#endif
 
1032
        upscaleAct->change( Images::icon("upscaling"), tr("Soft&ware scaling") );
985
1033
 
986
1034
        // Menu Audio
987
1035
        QIcon icset( Images::icon("volume") );
1001
1049
 
1002
1050
        // Menu Subtitles
1003
1051
        loadSubsAct->change( Images::icon("open"), tr("&Load...") );
1004
 
#if SUBTITLES_BY_INDEX
1005
1052
        unloadSubsAct->change( Images::icon("unload"), tr("U&nload") );
1006
 
#endif
1007
1053
        decSubDelayAct->change( Images::icon("delay_down"), tr("Delay &-") );
1008
1054
        incSubDelayAct->change( Images::icon("delay_up"), tr("Delay &+") );
1009
1055
        decSubPosAct->change( Images::icon("sub_up"), tr("&Up") );
1021
1067
        showPropertiesAct->change( Images::icon("info"), tr("View &info and properties...") );
1022
1068
        frameCounterAct->change( Images::icon("frame_counter"),
1023
1069
                             tr("&Show frame counter") );
 
1070
        motionVectorsAct->change( Images::icon("motion_vectors"), 
 
1071
                              tr("Visualize &motion vectors") );
1024
1072
        showPreferencesAct->change( Images::icon("prefs"), tr("P&references") );
1025
1073
 
1026
1074
        // Submenu Logs
1028
1076
        showLogSmplayerAct->change( "SMPlayer" );
1029
1077
 
1030
1078
        // Menu Help
1031
 
        aboutQtAct->change( Images::icon("qt"), tr("About &Qt") );
 
1079
        showFAQAct->change( Images::icon("faq"), tr("&FAQ") );
 
1080
        showCLOptions->change( Images::icon("cl_help"), tr("&Command line options") );
 
1081
        aboutQtAct->change( QPixmap(":/icons-png/qt.png"), tr("About &Qt") );
1032
1082
        aboutThisAct->change( Images::icon("logo_small"), tr("About &SMPlayer") );
1033
1083
 
1034
1084
        // Playlist
1135
1185
        aspect169Act->change( "16:&9" );
1136
1186
        aspect1610Act->change( "1&6:10" );
1137
1187
        aspect235Act->change( "&2.35:1" );
 
1188
#if !NEW_ASPECT_CODE
1138
1189
        aspect43LetterAct->change( tr("4:3 &Letterbox") );
1139
1190
        aspect169LetterAct->change( tr("16:9 L&etterbox") );
1140
1191
        aspect43PanscanAct->change( tr("4:3 &Panscan") );
1141
1192
        aspect43To169Act->change( tr("4:3 &to 16:9") );
 
1193
#endif
1142
1194
 
1143
1195
        deinterlaceNoneAct->change( tr("&None") );
1144
1196
        deinterlaceL5Act->change( tr("&Lowpass5") );
1283
1335
        connect( core, SIGNAL(mediaInfoChanged()),
1284
1336
             this, SLOT(updateMediaInfo()) );
1285
1337
 
 
1338
        connect( core, SIGNAL(failedToParseMplayerVersion(QString)),
 
1339
             this, SLOT(askForMplayerVersion(QString)) );
 
1340
 
1286
1341
        // Hide mplayer window
1287
1342
        connect( core, SIGNAL(noVideo()),
1288
1343
             this, SLOT(hidePanel()) );
1481
1536
        videofilter_menu->addAction(deblockAct);
1482
1537
        videofilter_menu->addAction(deringAct);
1483
1538
        videofilter_menu->addAction(addNoiseAct);
1484
 
 
 
1539
#if NEW_ASPECT_CODE
 
1540
        videofilter_menu->addAction(addLetterboxAct);
 
1541
#endif
 
1542
        videofilter_menu->addAction(upscaleAct);
1485
1543
        videofilter_menu->addSeparator();
1486
1544
        videofilter_menu->addActions(denoiseGroup->actions());
1487
1545
 
1547
1605
        subtitlesMenu->addMenu(subtitlestrack_menu);
1548
1606
 
1549
1607
        subtitlesMenu->addAction(loadSubsAct);
1550
 
#if SUBTITLES_BY_INDEX
1551
1608
        subtitlesMenu->addAction(unloadSubsAct);
1552
 
#endif
1553
1609
        subtitlesMenu->addSeparator();
1554
1610
        subtitlesMenu->addAction(decSubDelayAct);
1555
1611
        subtitlesMenu->addAction(incSubDelayAct);
1585
1641
        optionsMenu->addAction(showPropertiesAct);
1586
1642
        optionsMenu->addAction(showPlaylistAct);
1587
1643
        optionsMenu->addAction(frameCounterAct);
 
1644
        optionsMenu->addAction(motionVectorsAct);
1588
1645
 
1589
1646
        // OSD submenu
1590
1647
        osd_menu = new QMenu(this);
1603
1660
 
1604
1661
 
1605
1662
        // HELP MENU
 
1663
        helpMenu->addAction(showFAQAct);
 
1664
        helpMenu->addAction(showCLOptions);
 
1665
        helpMenu->addSeparator();
1606
1666
        helpMenu->addAction(aboutQtAct);
1607
1667
        helpMenu->addAction(aboutThisAct);
1608
1668
 
1949
2009
        QAction * subNoneAct = subtitleTrackGroup->addAction( tr("&None") );
1950
2010
        subNoneAct->setData(MediaSettings::SubNone);
1951
2011
        subNoneAct->setCheckable(true);
1952
 
#if SUBTITLES_BY_INDEX
1953
2012
        for (n=0; n < core->mdat.subs.numItems(); n++) {
1954
2013
                QAction *a = new QAction(subtitleTrackGroup);
1955
2014
                a->setCheckable(true);
1957
2016
                a->setData(n);
1958
2017
        }
1959
2018
        subtitlestrack_menu->addActions( subtitleTrackGroup->actions() );
1960
 
#else
1961
 
        for (n=0; n < core->mdat.subtitles.numItems(); n++) {
1962
 
                QAction *a = new QAction(subtitleTrackGroup);
1963
 
                a->setCheckable(true);
1964
 
                a->setText(core->mdat.subtitles.itemAt(n).displayName());
1965
 
                a->setData(core->mdat.subtitles.itemAt(n).ID());
1966
 
        }
1967
 
        subtitlestrack_menu->addActions( subtitleTrackGroup->actions() );
1968
 
#endif
1969
2019
 
1970
2020
        // Audio
1971
2021
        audioTrackGroup->clear(true);
2085
2135
        // Subtitles menu
2086
2136
        subtitleTrackGroup->setChecked( core->mset.current_sub_id );
2087
2137
 
2088
 
#if SUBTITLES_BY_INDEX
2089
2138
        // Disable the unload subs action if there's no external subtitles
2090
2139
        unloadSubsAct->setEnabled( !core->mset.external_subtitles.isEmpty() );
2091
 
#else
2092
 
        // If using an external subtitles, disable the rest
2093
 
        bool b = core->mset.external_subtitles.isEmpty();
2094
 
        QList <QAction *> l = subtitleTrackGroup->actions();
2095
 
        for (int n = 1; n < l.count(); n++) {
2096
 
                if (l[n]) l[n]->setEnabled(b);
2097
 
        }
2098
 
#endif
2099
2140
        
2100
2141
        // Audio menu
2101
2142
        audioTrackGroup->setChecked( core->mset.current_audio_id );
2137
2178
        // Add noise
2138
2179
        addNoiseAct->setChecked( core->mset.noise_filter );
2139
2180
 
 
2181
#if NEW_ASPECT_CODE
 
2182
        // Letterbox
 
2183
        addLetterboxAct->setChecked( core->mset.add_letterbox );
 
2184
#endif
 
2185
 
 
2186
        // Upscaling
 
2187
        upscaleAct->setChecked( core->mset.upscaling_filter );
 
2188
 
 
2189
 
2140
2190
        // Postprocessing
2141
2191
        postProcessingAct->setChecked( core->mset.postprocessing_filter );
2142
2192
 
2197
2247
        // Frame counter
2198
2248
        frameCounterAct->setChecked( pref->show_frame_counter );
2199
2249
 
 
2250
        // Motion vectors
 
2251
        motionVectorsAct->setChecked( pref->show_motion_vectors );
 
2252
 
2200
2253
        // Compact mode
2201
2254
        compactAct->setChecked( pref->compact_mode );
2202
2255
 
2206
2259
        // Flip
2207
2260
        flipAct->setChecked( core->mset.flip );
2208
2261
 
 
2262
 
2209
2263
        // Use ass lib
2210
2264
        useAssAct->setChecked( pref->use_ass_subtitles );
2211
2265
 
2257
2311
                qDebug("BaseGui::openRecent: %d", item);
2258
2312
                QString file = recents->item(item);
2259
2313
 
2260
 
                if (playlist->maybeSave()) {
2261
 
                        playlist->clear();
2262
 
                        playlist->addFile(file);
 
2314
                if (pref->auto_add_to_playlist) {
 
2315
                        if (playlist->maybeSave()) {
 
2316
                                playlist->clear();
 
2317
                                playlist->addFile(file);
2263
2318
 
 
2319
                                open( file );
 
2320
                        }
 
2321
                } else {
2264
2322
                        open( file );
2265
2323
                }
 
2324
 
2266
2325
        }
2267
2326
}
2268
2327
 
2274
2333
        if ( (extension=="m3u") || (extension=="m3u8") ) {
2275
2334
                playlist->load_m3u(file);
2276
2335
        } 
 
2336
        else
 
2337
        if (extension=="pls") {
 
2338
                playlist->load_pls(file);
 
2339
        }
2277
2340
        else 
2278
2341
        if (QFileInfo(file).isDir()) {
2279
2342
                openDirectory(file);
2294
2357
        if (files.empty()) return;
2295
2358
 
2296
2359
        if (files.count()==1) {
2297
 
                if (playlist->maybeSave()) {
2298
 
                        playlist->clear();
2299
 
                        playlist->addFile(files[0]);
 
2360
                if (pref->auto_add_to_playlist) {
 
2361
                        if (playlist->maybeSave()) {
 
2362
                                playlist->clear();
 
2363
                                playlist->addFile(files[0]);
2300
2364
 
 
2365
                                open(files[0]);
 
2366
                        }
 
2367
                } else {
2301
2368
                        open(files[0]);
2302
2369
                }
2303
2370
        } else {
2353
2420
        if (!url.isEmpty()) {
2354
2421
                pref->last_url = url;
2355
2422
 
2356
 
                if (playlist->maybeSave()) {
 
2423
                if (pref->auto_add_to_playlist) {
 
2424
                        if (playlist->maybeSave()) {
 
2425
                                core->openStream(url);
 
2426
 
 
2427
                                playlist->clear();
 
2428
                                playlist->addFile(url);
 
2429
                        }
 
2430
                } else {
2357
2431
                        core->openStream(url);
2358
 
 
2359
 
                        playlist->clear();
2360
 
                        playlist->addFile(url);
2361
2432
                }
2362
2433
        }
2363
2434
}
2395
2466
                        playlist->load_m3u(file);
2396
2467
                } 
2397
2468
                else
 
2469
                if (extension=="pls") {
 
2470
                        playlist->load_pls(file);
 
2471
                }
 
2472
                else
2398
2473
                if (extension=="iso") {
2399
2474
                        if (playlist->maybeSave()) {
2400
2475
                                core->open(file);
2402
2477
                }
2403
2478
                else {
2404
2479
                        pref->latest_dir = QFileInfo(file).absolutePath();
2405
 
                        if (playlist->maybeSave()) {
 
2480
                        if (pref->auto_add_to_playlist) {
 
2481
                                if (playlist->maybeSave()) {
 
2482
                                        core->openFile(file);
 
2483
 
 
2484
                                        playlist->clear();
 
2485
                                        playlist->addFile(file);
 
2486
                                }
 
2487
                        } else {
2406
2488
                                core->openFile(file);
2407
 
 
2408
 
                                playlist->clear();
2409
 
                                playlist->addFile(file);
2410
2489
                        }
2411
2490
                }
2412
2491
        }
2547
2626
        if (!s.isEmpty()) core->loadAudioFile(s);
2548
2627
}
2549
2628
 
 
2629
void BaseGui::helpFAQ() {
 
2630
        QDesktopServices::openUrl( Helper::doc("faq.html", pref->language) );
 
2631
}
 
2632
 
 
2633
void BaseGui::helpCLOptions() {
 
2634
        if (clhelp_window == 0) {
 
2635
                clhelp_window = new LogWindow(this);
 
2636
        }
 
2637
        clhelp_window->setWindowTitle( tr("SMPlayer command line options") );
 
2638
        clhelp_window->setHtml(CLHelp::help(true));
 
2639
        clhelp_window->show();
 
2640
}
 
2641
 
2550
2642
void BaseGui::helpAbout() {
2551
 
        AboutDialog d(this);
 
2643
        About d(this);
2552
2644
        d.exec();
2553
2645
}
2554
2646
 
2780
2872
                                openDirectory( files[0] );
2781
2873
                        } else {
2782
2874
                                //openFile( files[0] );
2783
 
                                if (playlist->maybeSave()) {
2784
 
                                        playlist->clear();
2785
 
                                        playlist->addFile(files[0]);
 
2875
                                if (pref->auto_add_to_playlist) {
 
2876
                                        if (playlist->maybeSave()) {
 
2877
                                                playlist->clear();
 
2878
                                                playlist->addFile(files[0]);
2786
2879
 
 
2880
                                                open( files[0] );
 
2881
                                        }
 
2882
                                } else {
2787
2883
                                        open( files[0] );
2788
2884
                                }
2789
2885
                        }
2874
2970
                case Core::Stopped:     statusBar()->showMessage( tr("Stop") , 2000); break;
2875
2971
        }
2876
2972
        if (state == Core::Stopped) setWindowCaption( "SMPlayer" );
 
2973
 
 
2974
#ifdef Q_OS_WIN
 
2975
#if DISABLE_SCREENSAVER_BY_EVENT
 
2976
        just_stopped = false;
 
2977
        
 
2978
        if (state == Core::Stopped) {
 
2979
                just_stopped = true;
 
2980
                int time = 1000 * 60; // 1 minute
 
2981
                QTimer::singleShot( time, this, SLOT(clear_just_stopped()) );
 
2982
        }
 
2983
#endif
 
2984
#endif
2877
2985
}
2878
2986
 
2879
2987
void BaseGui::displayMessage(QString message) {
3075
3183
        }
3076
3184
}
3077
3185
 
 
3186
void BaseGui::goToPosOnDragging(int t) {
 
3187
        if (pref->update_while_seeking) {
 
3188
#if ENABLE_DELAYED_DRAGGING
 
3189
                core->goToPos(t);
 
3190
#else
 
3191
                if ( ( t % 4 ) == 0 ) {
 
3192
                        qDebug("BaseGui::goToPosOnDragging: %d", t);
 
3193
                        core->goToPos(t);
 
3194
                }
 
3195
#endif
 
3196
        }
 
3197
}
 
3198
 
3078
3199
void BaseGui::toggleCompactMode() {
3079
3200
        toggleCompactMode( !pref->compact_mode );
3080
3201
}
3112
3233
        QPoint old_pos = pos();
3113
3234
 
3114
3235
        if (b) {
3115
 
                setWindowFlags(Qt::WindowStaysOnTopHint);
 
3236
                setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
3116
3237
        }
3117
3238
        else {
3118
 
                setWindowFlags(0);
 
3239
                setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
3119
3240
        }
3120
3241
 
3121
3242
        move(old_pos);
3245
3366
        }
3246
3367
}
3247
3368
 
 
3369
void BaseGui::askForMplayerVersion(QString line) {
 
3370
        qDebug("BaseGui::askForMplayerVersion: %s", line.toUtf8().data());
 
3371
 
 
3372
        if (pref->mplayer_user_supplied_version <= 0) {
 
3373
                InputMplayerVersion d(this);
 
3374
                d.setVersion( pref->mplayer_user_supplied_version );
 
3375
                d.setVersionFromOutput(line);
 
3376
                if (d.exec() == QDialog::Accepted) {
 
3377
                        pref->mplayer_user_supplied_version = d.version();
 
3378
                        qDebug("BaseGui::askForMplayerVersion: user supplied version: %d", pref->mplayer_user_supplied_version);
 
3379
                }
 
3380
        } else {
 
3381
                qDebug("BaseGui::askForMplayerVersion: already have a version supplied by user, so no asking");
 
3382
        }
 
3383
}
 
3384
 
3248
3385
 
3249
3386
// Language change stuff
3250
3387
void BaseGui::changeEvent(QEvent *e) {
3255
3392
        }
3256
3393
}
3257
3394
 
 
3395
#ifdef Q_OS_WIN
 
3396
#if DISABLE_SCREENSAVER_BY_EVENT
 
3397
bool BaseGui::winEvent ( MSG * m, long * result ) {
 
3398
        //qDebug("BaseGui::winEvent");
 
3399
        if (m->message==WM_SYSCOMMAND) {
 
3400
                if ((m->wParam & 0xFFF0)==SC_SCREENSAVE || (m->wParam & 0xFFF0)==SC_MONITORPOWER) {
 
3401
                        qDebug("BaseGui::winEvent: received SC_SCREENSAVE or SC_MONITORPOWER");
 
3402
                        if ((pref->disable_screensaver) && (core->state()==Core::Playing)) {
 
3403
                                qDebug("BaseGui::winEvent: not allowing screensaver");
 
3404
                                (*result) = 0;
 
3405
                                return true;
 
3406
                        } else {
 
3407
                                if ((pref->disable_screensaver) && (just_stopped)) {
 
3408
                                        qDebug("BaseGui::winEvent: file just stopped, so not allowing screensaver for a while");
 
3409
                                        (*result) = 0;
 
3410
                                        return true;
 
3411
                                } else {
 
3412
                                        qDebug("BaseGui::winEvent: allowing screensaver");
 
3413
                                        return false;
 
3414
                                }
 
3415
                        }
 
3416
                }
 
3417
        }
 
3418
        return false;
 
3419
}
 
3420
 
 
3421
void BaseGui::clear_just_stopped() {
 
3422
        qDebug("BaseGui::clear_just_stopped");
 
3423
        just_stopped = false;
 
3424
}
 
3425
#endif
 
3426
#endif
 
3427
 
3258
3428
#include "moc_basegui.cpp"