2
* Copyright (C) 2007 Ivan Cukic <ivan.cukic(at)kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2,
6
* or (at your option) any later version, as published by the Free
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details
14
* You should have received a copy of the GNU General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#ifndef LANCELOTWINDOW_H
21
#define LANCELOTWINDOW_H
24
#include <QSignalMapper>
28
#include <KConfigGroup>
31
#include <plasma/svg.h>
32
#include <plasma/plasma.h>
33
#include <plasma/corona.h>
35
#include <lancelot/widgets/PopupList.h>
36
#include <lancelot/widgets/PopupMenu.h>
38
#include "LancelotConfig.h"
39
#include "ui_LancelotWindowBase.h"
42
class ActionListModel;
43
class ResizeBordersPanel;
51
class LancelotWindow: public QGraphicsView, public Ui::LancelotWindowBase
56
virtual ~LancelotWindow();
57
bool eventFilter(QObject * object, QEvent * event);
61
* Shows full window centered on the screen.
63
void lancelotShowCentered();
67
* @param x x coordinate of the mouse
68
* @param y y coordinate of the mouse
70
void lancelotShow(int x, int y);
73
* Shows window with only specified section
74
* @param x x coordinate of the mouse
75
* @param y y coordinate of the mouse
76
* @param name the name of the section to be shown
78
void lancelotShowItem(int x, int y, const QString & name);
82
* @param immediate if not set, the window will start \
83
* the auto-timer for hiding. If true, window will be \
86
void lancelotHide(bool immediate = false);
89
* Opens the search section and searches for
90
* the specified string,
91
* @param string search string
93
void search(const QString & string);
97
* Shows specified section
98
* @param item section to be shown
100
void sectionActivated(const QString & item);
103
void nextSection(int increment);
106
void systemButtonClicked();
108
void lancelotContext();
110
void showAboutDialog();
112
void hideImmediate();
114
void focusChanged(QWidget * old, QWidget * now);
118
* Returns a list of available sections - their IDs
120
QStringList sectionIDs();
123
* Returns a list of available sections - their names
125
QStringList sectionNames();
128
* Returns a list of available sections - their icons
130
QStringList sectionIcons();
134
* Opens the configure shortcuts dialog
136
void configureShortcuts();
139
* Opens the configure menu dialog
141
void configureMenu();
144
* Call this when an external application changes
147
void configurationChanged();
150
* Starts the menu editor
152
void showMenuEditor();
156
* Resizes window and relayouts everything.
162
* @param x x coordinate of position to show at
163
* @param y y coordinate of position to show at
164
* @param centered override x and y and show window centered
166
void showWindow(int x, int y, bool centered = false);
169
* Creates and sets up data models
174
* Loads configuration options
179
* Sets up the actions
183
// void paintEvent(QPaintEvent * event);
184
void drawBackground(QPainter * painter, const QRectF & rect);
187
Lancelot::ResizeBordersPanel * m_root;
188
Plasma::Corona * m_corona;
190
Plasma::LineEdit * editSearch;
192
QHash < Lancelot::ExtenderButton *, QString > systemButtonActions;
195
QString m_searchString;
200
QSignalMapper * m_sectionsSignalMapper;
201
KActionCollection * m_actionCollection;
203
QMap < QString, Lancelot::ActionListModel * > m_models;
204
QMap < QString, Lancelot::ActionListModel * > m_modelGroups;
207
KConfigGroup m_mainConfig;
208
QString m_activeSection;
210
LancelotConfig m_configUi;
211
QWidget * m_configWidget;
213
// Resize related code
215
void mousePressEvent (QMouseEvent * event);
216
void mouseReleaseEvent (QMouseEvent * event);
217
void mouseMoveEvent (QMouseEvent * event);
218
void resizeEvent (QResizeEvent * event);
220
void sendKeyEvent (QKeyEvent * event);
229
Q_DECLARE_FLAGS(ResizeDirection, BaseDirection)
231
ResizeDirection m_resizeDirection;
232
QPoint m_originalMousePosition;
233
QPoint m_originalWindowPosition;
234
QSize m_originalMainSize;
237
QList < QGraphicsWidget * > m_focusList;
241
// Additional widgets
242
Lancelot::PopupList * menuSystemButton;
243
Lancelot::PopupMenu * menuLancelotContext;
246
#endif /*LANCELOTWINDOW_H*/