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

« back to all changes in this revision

Viewing changes to kwin/clients/oxygen/config/oxygendetectwidget.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
#ifndef oxygendetectwidget_h
 
2
#define oxygendetectwidget_h
 
3
 
 
4
//////////////////////////////////////////////////////////////////////////////
 
5
// oxygendetectwidget.h
 
6
// Note: this class is a stripped down version of
 
7
// /kdebase/workspace/kwin/kcmkwin/kwinrules/detectwidget.h
 
8
// Copyright (c) 2004 Lubos Lunak <l.lunak@kde.org>
 
9
 
 
10
// -------------------
 
11
//
 
12
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
 
13
//
 
14
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
15
// of this software and associated documentation files (the "Software"), to
 
16
// deal in the Software without restriction, including without limitation the
 
17
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 
18
// sell copies of the Software, and to permit persons to whom the Software is
 
19
// furnished to do so, subject to the following conditions:
 
20
//
 
21
// The above copyright notice and this permission notice shall be included in
 
22
// all copies or substantial portions of the Software.
 
23
//
 
24
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
25
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
26
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
27
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
28
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
29
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 
30
// IN THE SOFTWARE.
 
31
//////////////////////////////////////////////////////////////////////////////
 
32
 
 
33
#include <map>
 
34
#include <KDialog>
 
35
#include <QtCore/QEvent>
 
36
#include <QtCore/QByteArray>
 
37
#include <QtGui/QCheckBox>
 
38
#include <QtGui/QLabel>
 
39
 
 
40
#include <kwindowsystem.h>
 
41
 
 
42
#include "../oxygenexception.h"
 
43
#include "ui_oxygendetectwidget.h"
 
44
 
 
45
namespace Oxygen
 
46
{
 
47
 
 
48
    class DetectDialog : public KDialog
 
49
    {
 
50
 
 
51
        Q_OBJECT
 
52
 
 
53
        public:
 
54
 
 
55
        //! constructor
 
56
        DetectDialog( QWidget* );
 
57
 
 
58
        //! read window properties or select one from mouse grab
 
59
        void detect( WId window );
 
60
 
 
61
        //! selected class
 
62
        QByteArray selectedClass() const;
 
63
 
 
64
        //! window information
 
65
        const KWindowInfo& windowInfo() const
 
66
        { return _info; }
 
67
 
 
68
        //! exception type
 
69
        Exception::Type exceptionType() const
 
70
        {
 
71
            if( ui.windowClassCheckBox->isChecked() ) return Exception::WindowClassName;
 
72
            else if( ui.windowTitleCheckBox->isChecked() ) return Exception::WindowTitle;
 
73
            else return Exception::WindowClassName;
 
74
        }
 
75
 
 
76
        signals:
 
77
 
 
78
        void detectionDone( bool );
 
79
 
 
80
        protected:
 
81
 
 
82
        virtual bool eventFilter( QObject* o, QEvent* e );
 
83
 
 
84
        private:
 
85
 
 
86
        //! select window from grab
 
87
        void selectWindow();
 
88
 
 
89
        //! read window properties
 
90
        void readWindow( WId window );
 
91
 
 
92
        //! find window under cursor
 
93
        WId findWindow();
 
94
 
 
95
        //! execute
 
96
        void executeDialog( void );
 
97
 
 
98
        //! window machine
 
99
        QString machine;
 
100
 
 
101
        //! main widget
 
102
        Ui_DetectWidget ui;
 
103
 
 
104
        //! invisible dialog used to grab mouse
 
105
        KDialog* _grabber;
 
106
 
 
107
        //! current window information
 
108
        KWindowInfo _info;
 
109
 
 
110
    };
 
111
 
 
112
} // namespace
 
113
 
 
114
#endif