~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/screensaver/shell/plasmaapp.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright 2006, 2007 Aaron Seigo <aseigo@kde.org>
 
3
 *   Copyright 2008 Chani Armitage <chanika@gmail.com>
 
4
 *
 
5
 *   This program is free software; you can redistribute it and/or modify
 
6
 *   it under the terms of the GNU General Public License as
 
7
 *   published by the Free Software Foundation; either version 2,
 
8
 *   or (at your option) any later version.
 
9
 *
 
10
 *   This program is distributed in the hope that it will be useful,
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *   GNU General Public License for more details
 
14
 *
 
15
 *   You should have received a copy of the GNU Library General Public
 
16
 *   License along with this program; if not, write to the
 
17
 *   Free Software Foundation, Inc.,
 
18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef PLASMA_APP_H
 
22
#define PLASMA_APP_H
 
23
 
 
24
#include <QList>
 
25
#include <QPointer>
 
26
#include <QTimer>
 
27
 
 
28
#include <KUniqueApplication>
 
29
 
 
30
#include <plasma/plasma.h>
 
31
 
 
32
namespace Plasma
 
33
{
 
34
    class Containment;
 
35
    class Corona;
 
36
} // namespace Plasma
 
37
 
 
38
class SaverView;
 
39
class BackgroundDialog;
 
40
 
 
41
class PlasmaApp : public KUniqueApplication
 
42
{
 
43
    Q_OBJECT
 
44
    Q_CLASSINFO("D-Bus Interface", "org.kde.plasmaoverlay.App")
 
45
public:
 
46
    ~PlasmaApp();
 
47
 
 
48
    static PlasmaApp* self();
 
49
    static bool hasComposite();
 
50
 
 
51
    Plasma::Corona* corona();
 
52
 
 
53
    void setActiveOpacity(qreal opacity);
 
54
    void setIdleOpacity(qreal opacity);
 
55
    qreal activeOpacity() const;
 
56
    qreal idleOpacity() const;
 
57
 
 
58
Q_SIGNALS:
 
59
    // DBUS interface.
 
60
    //if you change stuff, remember to regenerate with:
 
61
    //qdbuscpp2xml -S -M plasmaapp.h > org.kde.plasma-overlay.App.xml
 
62
 
 
63
    //XXX can this be deleted? probably. if lockprocess really cares it can use the unmapnotify
 
64
    void hidden();
 
65
 
 
66
public Q_SLOTS:
 
67
    // DBUS interface.
 
68
    //if you change stuff, remember to regenerate ^^^
 
69
    /**
 
70
     * tell plasma to go into active mode, ready for interaction
 
71
     */
 
72
    void setActive(bool activate);
 
73
 
 
74
    /**
 
75
     * lock widgets
 
76
     */
 
77
    void lock();
 
78
 
 
79
    //not really slots, but we want them in dbus:
 
80
 
 
81
    /**
 
82
     * get plasma all set up and ready
 
83
     * this makes sure things like opacity, visibility and locked-ness are set right
 
84
     * normally this is called only by plasmaapp itself when it finishes initialization, but it's
 
85
     * possible that it might need to be run again by lockprocess
 
86
     *
 
87
     * @param setupMode whether we're starting in setup mode
 
88
     */
 
89
    void setup(bool setupMode);
 
90
 
 
91
    /**
 
92
     * quit the application
 
93
     * this is a duplicate so we can have everything we need in one dbus interface
 
94
     */
 
95
    void quit();
 
96
 
 
97
private Q_SLOTS:
 
98
    void cleanup();
 
99
    //void adjustSize(int screen);
 
100
    void dialogDestroyed(QObject *obj);
 
101
    void configureContainment(Plasma::Containment*);
 
102
    void syncConfig();
 
103
    void immutabilityChanged(Plasma::ImmutabilityType immutability);
 
104
    void createWaitingViews();
 
105
    void containmentScreenOwnerChanged(int, int, Plasma::Containment*);
 
106
 
 
107
Q_SIGNALS:
 
108
    void showViews();
 
109
    void hideViews();
 
110
    void setViewOpacity(qreal opacity);
 
111
    void showDialogs();
 
112
    void hideDialogs();
 
113
    void hideWidgetExplorer();
 
114
    void enableSetupMode();
 
115
    void disableSetupMode();
 
116
    void openToolBox();
 
117
    void closeToolBox();
 
118
 
 
119
protected:
 
120
    bool eventFilter(QObject *obj, QEvent *event);
 
121
 
 
122
private:
 
123
    PlasmaApp(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap);
 
124
    SaverView *viewForScreen(int screen);
 
125
 
 
126
    Plasma::Corona *m_corona;
 
127
    QList<SaverView*> m_views;
 
128
    QList<QWidget*> m_dialogs;
 
129
    QPointer<BackgroundDialog> m_configDialog;
 
130
    
 
131
    QList<QWeakPointer<Plasma::Containment> > m_viewsWaiting;
 
132
    QTimer m_viewCreationTimer;
 
133
 
 
134
    qreal m_activeOpacity;
 
135
    qreal m_idleOpacity;
 
136
    bool m_active;
 
137
};
 
138
 
 
139
#endif // multiple inclusion guard