~ubuntu-branches/ubuntu/vivid/smplayer/vivid

« back to all changes in this revision

Viewing changes to src/screensaver.cpp

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2012-02-16 11:51:44 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20120216115144-hkpz36a4h5f3x9w3
Tags: 0.7.0-1
* Team upload.
* New upstream release (Closes: #655125):
  - Changes since 0.6.10:
    + New favorite menu, where you can add your favorite videos, music,
       streams, youtube videos... It's also possible to add submenus.
    + Support for youtube. Now you can open urls like
      http://www.youtube.com/watch?v=..... using the Open -> URL dialog or
      dragging a link from a browser to the smplayer window.
    + Support for mplayer2 (http://www.mplayer2.org). It's a fork of mplayer
      with interesting features like precise seeking, ordered chapters in
      mkv videos and better pause handling (e.g. seek works while the video
      is paused).
    + New translation: croatian.
  - Changes since 0.6.9:
    + New vdpau configuration dialog, which allow to select the vdpau codecs
      to use. (Closes: #610204)
    + Port for eCS, OS/2 (by Silvan Scherrer).
    + New menu to select the closed caption channel (requires mplayer >=
      r32607).
    + Possibility to select the seeking method (absolute or relative).
    + Possibility to sort the items of the playlist.
* Remove debian/patches/enable_ffodivxvdpau.diff, the application now
  provides a configuration dialog for vdpau.
* Refresh handle_local_urls.diff.
* Update copyright notice.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  smplayer, GUI front-end for mplayer.
2
 
    Copyright (C) 2006-2010 Ricardo Villalba <rvm@escomposlinux.org>
 
2
    Copyright (C) 2006-2012 Ricardo Villalba <rvm@users.sourceforge.net>
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
16
16
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
*/
18
18
 
19
 
#include "screensaver.h"
20
19
#include <Qt>
21
20
#include <QSysInfo>
 
21
#ifndef Q_OS_OS2
22
22
#include <windows.h>
 
23
#endif
 
24
#include "screensaver.h"
23
25
 
24
26
WinScreenSaver::WinScreenSaver() {
 
27
#ifndef Q_OS_OS2
25
28
        lowpower = poweroff = screensaver = 0;
 
29
#else
 
30
        SSaver = new QLibrary("SSCORE");
 
31
        SSaver->load();
 
32
        SSCore_TempDisable = SSCore_TempEnable = NULL;
 
33
        if (SSaver->isLoaded()) {
 
34
                SSCore_TempDisable = (FuncPtr) SSaver->resolve("SSCore_TempDisable");
 
35
                SSCore_TempEnable = (FuncPtr) SSaver->resolve("SSCore_TempEnable");
 
36
        }
 
37
#endif
26
38
        state_saved = false;
27
39
        modified = false;
28
40
        
31
43
 
32
44
WinScreenSaver::~WinScreenSaver() {
33
45
        restoreState();
 
46
#ifdef Q_OS_OS2
 
47
        unload();
 
48
#endif
34
49
}
35
50
 
36
51
void WinScreenSaver::retrieveState() {
37
52
        qDebug("WinScreenSaver::retrieveState");
38
53
        
39
54
        if (!state_saved) {
 
55
#ifndef Q_OS_OS2
40
56
                if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) {
41
57
                        // Not supported on Windows Vista
42
58
                        SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT, 0, &lowpower, 0);
46
62
                state_saved = true;
47
63
                
48
64
                qDebug("WinScreenSaver::retrieveState: lowpower: %d, poweroff: %d, screensaver: %d", lowpower, poweroff, screensaver);
 
65
#else
 
66
                state_saved = true;
 
67
                qDebug("WinScreensaver::retrieveState: init done %s", SSCore_TempDisable ?"succesfully":"failed");
 
68
#endif
49
69
        } else {
50
70
                qDebug("WinScreenSaver::retrieveState: state already saved previously, doing nothing");
51
71
        }
58
78
        }
59
79
        
60
80
        if (state_saved) {
 
81
#ifndef Q_OS_OS2
61
82
                if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) {
62
83
                        // Not supported on Windows Vista
63
84
                        SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, lowpower, NULL, 0);
66
87
                SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, screensaver, NULL, 0);
67
88
                
68
89
                qDebug("WinScreenSaver::restoreState: lowpower: %d, poweroff: %d, screensaver: %d", lowpower, poweroff, screensaver);
 
90
#else
 
91
                if (SSCore_TempEnable) {
 
92
                        SSCore_TempEnable();
 
93
                }
 
94
                qDebug("WinScreenSaver::restoreState done");
 
95
#endif
69
96
        } else {
70
97
                qWarning("WinScreenSaver::restoreState: no data, doing nothing");
71
98
        }
72
99
}
 
100
 
 
101
#ifdef Q_OS_OS2
 
102
void WinScreenSaver::unload() {
 
103
        if (SSaver->isLoaded()) {
 
104
                SSaver->unload();
 
105
                delete SSaver;
 
106
        }
 
107
}
 
108
#endif
73
109
        
74
110
void WinScreenSaver::disable() {
75
111
        qDebug("WinScreenSaver::disable");
76
112
 
 
113
#ifndef Q_OS_OS2
77
114
        if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) {
78
115
                // Not supported on Windows Vista
79
116
                SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, 0, NULL, 0);
80
117
                SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 0, NULL, 0);
81
118
        }
82
119
        SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0);
 
120
#else
 
121
        if (SSCore_TempDisable) {
 
122
                SSCore_TempDisable();
 
123
        }
 
124
#endif
83
125
 
84
126
        modified = true;
85
127
}