~l3on/ubuntu/precise/rkward/rebuild1

« back to all changes in this revision

Viewing changes to rkward/windows/rcontrolwindow.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Friedrichsmeier
  • Date: 2008-04-20 21:30:00 UTC
  • mfrom: (1.2.2 upstream) (3.1.9 hardy)
  • Revision ID: james.westby@ubuntu.com-20080420213000-fs4i8efmfc793bnn
new upstream release
closes: #475175
closes: #463348
closes: #475982

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
                          rcontrolwindow  -  description
3
3
                             -------------------
4
4
    begin                : Wed Oct 12 2005
5
 
    copyright            : (C) 2005 by Thomas Friedrichsmeier
 
5
    copyright            : (C) 2005, 2007 by Thomas Friedrichsmeier
6
6
    email                : tfry@users.sourceforge.net
7
7
 ***************************************************************************/
8
8
 
19
19
#define RCONTROLWINDOW_H
20
20
 
21
21
#include <kparts/part.h>
22
 
#include <kmdichildview.h>
23
22
 
24
23
#include <qmap.h>
25
24
#include <qlabel.h>
26
25
#include <qlistview.h>
27
26
 
 
27
#include "rkmdiwindow.h"
 
28
 
28
29
class QPushButton;
29
30
class RCommand;
30
31
class RCommandChain;
31
32
class RChainOrCommand;
32
33
class RControlWindowListViewItem;
 
34
class RControlWindowPart;
33
35
 
34
36
/**
35
37
        \brief Interface to control R command execution
45
47
 
46
48
@author Thomas Friedrichsmeier
47
49
*/
48
 
class RControlWindow : public KMdiChildView {
 
50
class RControlWindow : public RKMDIWindow {
49
51
        Q_OBJECT
50
 
friend class RControlWindowPart;
51
 
protected:
52
 
/** constructor. Protected. Do not create an instance of this class directly. Rather, create a RControlWindowPart.
 
52
public:
 
53
/** constructor.
53
54
@param parent parent QWidget, usually RKGlobals::rkApp () or similar */
54
 
        RControlWindow (QWidget *parent = 0);
 
55
        RControlWindow (QWidget *parent, bool tool_window, const char *name=0);
55
56
/** destructor */
56
57
        ~RControlWindow ();
57
 
public:
58
58
/** Add new chain to the RControlWindow. Has no effect unless RControlWindow::isShown () */
59
59
        void addChain (RCommandChain *chain);
60
60
/** Add new command to the RControlWindow. The command is added to the given parent chain. Has no effect unless RControlWindow::isShown () */
70
70
 
71
71
/** reimplemented to refresh list of commands when showing. This is needed, as the RControlWindow is only kept up to date as long as it is shown. Hence, if it was hidden, and then gets shown, it will have to update the entire list. */
72
72
        void show ();
 
73
/** Call this once, when the RInterface is ready, and it is ok to try showing commands */
 
74
        void initialize ();
 
75
/** Static reference to the control window */
 
76
        static RControlWindow* getControl () { return control_window; };
73
77
public slots:
74
78
/** command selection was changed. Automatically select sub-items of selected chains. Enable/disable "Cancel" button */
75
79
        void commandSelectionChanged ();
84
88
        QPushButton *cancel_button;
85
89
        QPushButton *pause_button;
86
90
 
 
91
        RControlWindowListViewItem *itemForCommand (RCommand *command);
 
92
        RControlWindowListViewItem *itemForChain (RCommandChain *chain);
 
93
 
87
94
/** internal: recursively add commands/chains */
88
95
        void addCommands (RChainOrCommand *coc, RControlWindowListViewItem *parent);
89
96
/** internal: add single command */
98
105
        QMap <RCommandChain *, RControlWindowListViewItem *> chain_map;
99
106
 
100
107
        bool paused;
 
108
        bool isActive ();
 
109
        bool initialized;
 
110
 
 
111
        void lockMutex ();
 
112
        void unlockMutex ();
 
113
        int mutex_lockcount;
 
114
 
 
115
friend class RKWardMainWindow;
 
116
        static RControlWindow *control_window;
101
117
};
102
118
 
103
119
/**
109
125
*/
110
126
class RControlWindowPart : public KParts::Part {
111
127
        Q_OBJECT
112
 
public:
 
128
friend class RControlWindow;
 
129
protected:
113
130
/** constructor. */
114
 
        RControlWindowPart ();
 
131
        RControlWindowPart (RControlWindow *widget);
115
132
/** destructor */
116
133
        ~RControlWindowPart ();
117
134
};
125
142
class RControlWindowListViewItem : public QListViewItem {
126
143
public:
127
144
/** constructor. */
128
 
        RControlWindowListViewItem (QListViewItem *parent);
 
145
        explicit RControlWindowListViewItem (QListViewItem *parent);
129
146
/** constructor. */
130
 
        RControlWindowListViewItem (QListView *parent);
 
147
        explicit RControlWindowListViewItem (QListView *parent);
131
148
/** destructor */
132
149
        ~RControlWindowListViewItem ();
133
150