not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / shells / screensaver / plasmaapp.h
blob21b7e553276b941cdb22b2ac70b81f250d8b642c
1 /*
2 * Copyright 2006, 2007 Aaron Seigo <aseigo@kde.org>
3 * Copyright 2008 Chani Armitage <chanika@gmail.com>
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.
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
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.
21 #ifndef PLASMA_APP_H
22 #define PLASMA_APP_H
24 #include <QList>
26 #include <KUniqueApplication>
28 namespace Plasma
30 class Containment;
31 class Corona;
32 } // namespace Plasma
34 class SaverView;
35 class BackgroundDialog;
37 class PlasmaApp : public KUniqueApplication
39 Q_OBJECT
40 Q_CLASSINFO("D-Bus Interface", "org.kde.plasmaoverlay.App")
41 public:
42 ~PlasmaApp();
44 static PlasmaApp* self();
45 static bool hasComposite();
47 Plasma::Corona* corona();
49 void setActiveOpacity(qreal opacity);
50 void setIdleOpacity(qreal opacity);
51 qreal activeOpacity() const;
52 qreal idleOpacity() const;
54 Q_SIGNALS:
55 // DBUS interface.
56 //if you change stuff, remember to regenerate with:
57 //qdbuscpp2xml -S -M plasmaapp.h > org.kde.plasma-overlay.App.xml
59 //XXX can this be deleted? probably. if lockprocess really cares it can use the unmapnotify
60 void hidden();
62 public Q_SLOTS:
63 // DBUS interface.
64 //if you change stuff, remember to regenerate ^^^
65 /**
66 * tell plasma to go into active mode, ready for interaction
68 void setActive(bool activate);
70 /**
71 * lock widgets
73 void lock();
75 //not really slots, but we want them in dbus:
77 /**
78 * get plasma all set up and ready
79 * this makes sure things like opacity, visibility and locked-ness are set right
80 * normally this is called only by plasmaapp itself when it finishes initialization, but it's
81 * possible that it might need to be run again by lockprocess
83 * @param setupMode whether we're starting in setup mode
85 void setup(bool setupMode);
87 /**
88 * quit the application
89 * this is a duplicate so we can have everything we need in one dbus interface
91 void quit();
93 private Q_SLOTS:
94 void cleanup();
95 void createView(Plasma::Containment *containment);
96 void adjustSize(int screen);
97 void dialogDestroyed(QObject *obj);
98 void hideDialogs();
99 void showDialogs();
100 void configureContainment(Plasma::Containment*);
101 void configDialogRemoved(QObject* dialog);
102 void syncConfig();
104 protected:
105 bool eventFilter(QObject *obj, QEvent *event);
107 private:
108 PlasmaApp(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap);
110 Plasma::Corona *m_corona;
111 SaverView *m_view;
112 QList<QWidget*> m_dialogs;
113 BackgroundDialog *m_configDialog;
115 qreal m_activeOpacity;
116 qreal m_idleOpacity;
119 #endif // multiple inclusion guard