~ubuntu-branches/ubuntu/lucid/ktorrent/lucid

« back to all changes in this revision

Viewing changes to libktcore/interfaces/guiinterface.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-12-08 19:17:41 UTC
  • mfrom: (1.2.1 upstream) (0.7.12 sid)
  • Revision ID: james.westby@ubuntu.com-20091208191741-lqlq0xvnlv8ki19u
Tags: 3.3.1+dfsg.1-1ubuntu1
* Merge with Debian Testing remaining changes:
  - Build-depend directly on libboost-serialization1.40-dev since
    libboost-serialization-dev from boost-defaults is not in Main
  - Add in rules: include /usr/lib/kubuntu-desktop-i18n/debhelper/kubuntu.mk
  - Don't use dpkg-source 3.0 format
  - Add quilt to build-depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <qlist.h>
24
24
#include <ktcore_export.h>
25
25
 
26
 
class QWidget;
27
26
class QString;
28
27
class QProgressBar;
29
28
class KMainWindow;
40
39
 
41
40
namespace kt
42
41
{
 
42
        class ScanListener;
43
43
        class PrefPageInterface;
44
44
        class Plugin;
45
45
        class GUIInterface;
46
 
 
47
 
        enum Position
48
 
        {
49
 
                LEFT, ///< New widgets will be added to the left of the old
50
 
                RIGHT, ///< New widgets will be added to the right of the old
51
 
                ABOVE, ///< New widgets will be added above the old
52
 
                BELOW  ///< New widgets will be added below the old
53
 
        };
54
 
        
55
 
        /**
56
 
         * Small interface for classes who want to know when
57
 
         * current torrent in the gui changes.
58
 
         */
59
 
        class KTCORE_EXPORT ViewListener
60
 
        {
61
 
        public:
62
 
                ViewListener() {}
63
 
                virtual ~ViewListener() {}
64
 
                
65
 
                virtual void currentTorrentChanged(bt::TorrentInterface* tc) = 0;
66
 
        };
67
 
        
68
 
        /**
69
 
         * Plugins wanting to add closeable tabs, should implement this interface.
70
 
         * That way they can be notified of close requests.
71
 
         * Not providing this interface in addTabPage means the tab cannot be closed.
72
 
        */
73
 
        class KTCORE_EXPORT CloseTabListener
74
 
        {
75
 
        public:
76
 
                CloseTabListener() {}
77
 
                virtual ~CloseTabListener() {}
78
 
 
79
 
                /// By default all tabs can be closed, but this can be overridden
80
 
                virtual bool closeAllowed(QWidget* ) {return true;}
81
 
                
82
 
                /// THe close button was pressed for this tab, please remove it from the GUI
83
 
                virtual void tabCloseRequest(kt::GUIInterface* gui,QWidget* tab) = 0;
84
 
        };
85
 
        
86
 
        /**
87
 
         * Plugins wanting to know when the current tab changes, should implement this interface.
88
 
         */
89
 
        class KTCORE_EXPORT CurrentTabPageListener
90
 
        {
91
 
        public:
92
 
                virtual ~CurrentTabPageListener() {}
93
 
                
94
 
                /// The current tab page has changed
95
 
                virtual void currentTabPageChanged(QWidget* page) = 0;
96
 
        };
 
46
        class Activity;
 
47
        class TorrentActivityInterface;
97
48
 
98
49
        /**
99
50
         * Base class for the status bar
122
73
        */
123
74
        class KTCORE_EXPORT GUIInterface
124
75
        {
125
 
                QList<ViewListener*> listeners;
126
 
                QList<CurrentTabPageListener*> ctp_listeners;
127
76
        public:
128
77
                GUIInterface();
129
78
                virtual ~GUIInterface();
130
79
 
131
80
                /// Get a pointer to the main window
132
81
                virtual KMainWindow* getMainWindow() = 0;
133
 
 
134
 
                /// Add a view listener.
135
 
                void addViewListener(ViewListener* vl);
136
 
 
137
 
                /// Remove a view listener
138
 
                void removeViewListener(ViewListener* vl);
139
 
                
140
 
                /// Add a current tab page listener
141
 
                void addCurrentTabPageListener(CurrentTabPageListener* ctpl);
142
 
                
143
 
                /// Remove a current tab page listener
144
 
                void removeCurrentTabPageListener(CurrentTabPageListener* ctpl);
145
 
                
146
 
                /**
147
 
                 * Add a new tab page to the GUI
148
 
                 * @param page The widget
149
 
                 * @param icon Icon for the tab
150
 
                 * @param caption Text on the tab
151
 
                 * @param tooltip Tooltip for the tab
152
 
                 * @param ctl For closeable tabs this pointer should be set
153
 
                 */
154
 
                virtual void addTabPage(QWidget* page,const QString & icon,const QString & caption,const QString & tooltip,CloseTabListener* ctl = 0) = 0;
155
 
 
156
 
                /**
157
 
                 * Remove a tab page, does nothing if the page
158
 
                 * isn't added. Does not delete the widget.
159
 
                 * @param page The page
160
 
                 */
161
 
                virtual void removeTabPage(QWidget* page) = 0;
162
 
 
 
82
                
 
83
                /// Add an activity
 
84
                virtual void addActivity(Activity* act) = 0;
 
85
                
 
86
                /// Remove an activity
 
87
                virtual void removeActivity(Activity* act) = 0;
 
88
                
 
89
                /// Set the current activity
 
90
                virtual void setCurrentActivity(Activity* act) = 0;
 
91
                
163
92
                /**
164
93
                 * Add a page to the preference dialog.
165
94
                 * @param page The page
184
113
                 * @param p The Plugin
185
114
                 */
186
115
                virtual void removePluginGui(Plugin* p) = 0;
187
 
                
188
 
                enum ToolDock
189
 
                {
190
 
                        DOCK_LEFT,
191
 
                        DOCK_RIGHT,
192
 
                        DOCK_BOTTOM
193
 
                };
194
 
                
195
 
                /**
196
 
                 * Add a tool widget.
197
 
                 * @param w The widget
198
 
                 * @param icon Name of icon to use
199
 
                 * @param caption The caption to use
200
 
                 * @param tooltip Tooltip for the tool widget
201
 
                 * @param dock Where to dock the widget
202
 
                 */
203
 
                virtual void addToolWidget(QWidget* w,const QString & icon,const QString & caption,const QString & tooltip,ToolDock dock) = 0;
204
 
                
205
 
                /**
206
 
                 * Remove a tool widget.
207
 
                 * @param w The widget
208
 
                 */
209
 
                virtual void removeToolWidget(QWidget* w) = 0;
210
 
 
211
 
                /// Get the current torrent.
212
 
                virtual const bt::TorrentInterface* getCurrentTorrent() const = 0;
213
 
                
214
 
                /// Get the current torrent 
215
 
                virtual bt::TorrentInterface* getCurrentTorrent() = 0;
216
116
        
217
 
                /// Show a scan dialog, and start the data scan
218
 
                virtual void dataScan(bt::TorrentInterface* tc,bool auto_import,bool silently,const QString & dlg_caption) = 0;
 
117
                /// A data scan was started, show in the gui
 
118
                virtual void dataScanStarted(ScanListener* listener) = 0;
 
119
                
 
120
                /// A data scan was closed, remove it from the gui
 
121
                virtual void dataScanClosed(ScanListener* listener) = 0;
219
122
 
220
123
                /// Select the files to download, return false if users cancels
221
 
                virtual bool selectFiles(bt::TorrentInterface* tc,bool* user,bool* start_torrent,const QString & group_hint,bool* skip_check) = 0;
 
124
                virtual bool selectFiles(bt::TorrentInterface* tc,bool* start_torrent,const QString & group_hint,const QString & location_hint,bool* skip_check) = 0;
222
125
 
223
126
                /// Show an error message box
224
127
                virtual void errorMsg(const QString & err) = 0;
232
135
                /// Get the status bar
233
136
                virtual StatusBarInterface* getStatusBar() = 0;
234
137
                
235
 
                /**
236
 
                 * Set the icon of a tab
237
 
                 * @param tab 
238
 
                 * @param icon 
239
 
                 */
240
 
                virtual void setTabIcon(QWidget* tab,const QString & icon) = 0;
241
 
                
242
 
                /**
243
 
                 * Set the text of a tab
244
 
                 * @param tab 
245
 
                 * @param icon 
246
 
                 */
247
 
                virtual void setTabText(QWidget* tab,const QString & text) = 0;
248
 
                
249
 
                /**
250
 
                 * Set the current tab page.
251
 
                 * @param tab 
252
 
                 */
253
 
                virtual void setCurrentTab(QWidget* tab) = 0;
254
 
                
255
 
                /**
256
 
                 * Get the current tab page
257
 
                 * @return The current tab page
258
 
                 */
259
 
                virtual QWidget* getCurrentTab() = 0;
260
 
 
261
 
        protected:
262
 
                /**
263
 
                 * Notifies all view listeners of the change in the current downloading TorrentInterface
264
 
                 * @param tc Pointer to current TorrentInterface
265
 
                 */
266
 
                void notifyViewListeners(bt::TorrentInterface* tc);
267
 
                
268
 
                /**
269
 
                 * Notify current tab page listeners that the current tab page has changed
270
 
                 * @param page The page
271
 
                 */
272
 
                void notifyCurrentTabPageListeners(QWidget* page);
 
138
                /// Get the torrent activity
 
139
                virtual TorrentActivityInterface* getTorrentActivity() = 0;
273
140
        };
274
141
 
275
142
}