add more spacing
[personal-kdebase.git] / workspace / ksmserver / shutdowndlg.h
blob88f9c48a3ae704f61bd5741bc82c12227f7c5913
1 /*****************************************************************
2 ksmserver - the KDE session management server
4 Copyright 2000 Matthias Ettrich <ettrich@kde.org>
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 ******************************************************************/
25 #ifndef SHUTDOWNDLG_H
26 #define SHUTDOWNDLG_H
28 #include <QDialog>
29 #include <QPushButton>
30 #include <kworkspace.h>
32 class QMenu;
33 class QTimer;
34 class QTimeLine;
35 class QLabel;
36 class LogoutEffect;
38 namespace Plasma
40 class Svg;
41 class FrameSvg;
44 // The (singleton) widget that makes the desktop gray.
45 class KSMShutdownFeedback : public QWidget
47 Q_OBJECT
49 public:
50 static void start();
51 static void stop();
53 protected:
54 ~KSMShutdownFeedback() {}
56 virtual void paintEvent( QPaintEvent* );
58 private Q_SLOTS:
59 void slotPaintEffect();
60 void slotPaintEffectInitialized();
62 private:
63 static KSMShutdownFeedback * s_pSelf;
64 KSMShutdownFeedback();
65 int m_currentY;
66 QPixmap m_pixmap;
67 LogoutEffect *effect;
68 bool initialized;
71 class KSMPushButton : public QPushButton
73 Q_OBJECT
75 public:
76 explicit KSMPushButton( const QString &text, QWidget *parent = 0, bool smallButton = false );
78 void setPixmap( const QPixmap & );
79 void setPopupMenu( QMenu * );
80 protected:
81 void paintEvent(QPaintEvent *e);
82 void resizeEvent(QResizeEvent *e);
83 bool event(QEvent *e);
85 void init();
86 protected:
87 QPixmap m_pixmap;
88 bool m_highlight;
89 QString m_text;
90 private Q_SLOTS:
91 void slotPressed();
92 void slotReleased();
93 void slotTimeout();
94 void animateGlow( qreal );
95 private:
96 QMenu* m_popupMenu;
97 QTimer* m_popupTimer;
98 Plasma::Svg* m_glowSvg;
99 qreal m_glowOpacity;
100 QTimeLine *m_glowTimeLine;
101 bool m_smallButton;
104 // The confirmation dialog
105 class KSMShutdownDlg : public QDialog
107 Q_OBJECT
109 public:
110 static bool confirmShutdown( bool maysd, KWorkSpace::ShutdownType& sdtype, QString& bopt );
112 public Q_SLOTS:
113 void slotLogout();
114 void slotHalt();
115 void slotReboot();
116 void slotReboot(QAction*);
117 void slotSuspend(QAction*);
119 protected:
120 ~KSMShutdownDlg() {}
121 void paintEvent(QPaintEvent *e);
122 void resizeEvent(QResizeEvent *e);
124 private:
125 KSMShutdownDlg( QWidget* parent, bool maysd, KWorkSpace::ShutdownType sdtype );
126 KWorkSpace::ShutdownType m_shutdownType;
127 QString m_bootOption;
128 QStringList rebootOptions;
129 QPixmap m_renderedSvg;
130 Plasma::FrameSvg* m_svg;
131 QLabel *m_automaticallyDoLabel;
132 KSMPushButton *m_btnLogout;
133 KSMPushButton *m_btnHalt;
134 KSMPushButton *m_btnReboot;
135 KSMPushButton *btnBack;
136 int m_automaticallyDoSeconds;
137 int m_pictureWidth;
139 private Q_SLOTS:
140 void automaticallyDoTimeout();
143 #endif