43
43
class PrefPageInterface;
45
45
class GUIInterface;
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
56
* Small interface for classes who want to know when
57
* current torrent in the gui changes.
59
class KTCORE_EXPORT ViewListener
63
virtual ~ViewListener() {}
65
virtual void currentTorrentChanged(bt::TorrentInterface* tc) = 0;
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.
73
class KTCORE_EXPORT CloseTabListener
77
virtual ~CloseTabListener() {}
79
/// By default all tabs can be closed, but this can be overridden
80
virtual bool closeAllowed(QWidget* ) {return true;}
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;
87
* Plugins wanting to know when the current tab changes, should implement this interface.
89
class KTCORE_EXPORT CurrentTabPageListener
92
virtual ~CurrentTabPageListener() {}
94
/// The current tab page has changed
95
virtual void currentTabPageChanged(QWidget* page) = 0;
47
class TorrentActivityInterface;
99
50
* Base class for the status bar
123
74
class KTCORE_EXPORT GUIInterface
125
QList<ViewListener*> listeners;
126
QList<CurrentTabPageListener*> ctp_listeners;
129
78
virtual ~GUIInterface();
131
80
/// Get a pointer to the main window
132
81
virtual KMainWindow* getMainWindow() = 0;
134
/// Add a view listener.
135
void addViewListener(ViewListener* vl);
137
/// Remove a view listener
138
void removeViewListener(ViewListener* vl);
140
/// Add a current tab page listener
141
void addCurrentTabPageListener(CurrentTabPageListener* ctpl);
143
/// Remove a current tab page listener
144
void removeCurrentTabPageListener(CurrentTabPageListener* ctpl);
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
154
virtual void addTabPage(QWidget* page,const QString & icon,const QString & caption,const QString & tooltip,CloseTabListener* ctl = 0) = 0;
157
* Remove a tab page, does nothing if the page
158
* isn't added. Does not delete the widget.
159
* @param page The page
161
virtual void removeTabPage(QWidget* page) = 0;
84
virtual void addActivity(Activity* act) = 0;
86
/// Remove an activity
87
virtual void removeActivity(Activity* act) = 0;
89
/// Set the current activity
90
virtual void setCurrentActivity(Activity* act) = 0;
164
93
* Add a page to the preference dialog.
165
94
* @param page The page
184
113
* @param p The Plugin
186
115
virtual void removePluginGui(Plugin* p) = 0;
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
203
virtual void addToolWidget(QWidget* w,const QString & icon,const QString & caption,const QString & tooltip,ToolDock dock) = 0;
206
* Remove a tool widget.
207
* @param w The widget
209
virtual void removeToolWidget(QWidget* w) = 0;
211
/// Get the current torrent.
212
virtual const bt::TorrentInterface* getCurrentTorrent() const = 0;
214
/// Get the current torrent
215
virtual bt::TorrentInterface* getCurrentTorrent() = 0;
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;
120
/// A data scan was closed, remove it from the gui
121
virtual void dataScanClosed(ScanListener* listener) = 0;
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;
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;
236
* Set the icon of a tab
240
virtual void setTabIcon(QWidget* tab,const QString & icon) = 0;
243
* Set the text of a tab
247
virtual void setTabText(QWidget* tab,const QString & text) = 0;
250
* Set the current tab page.
253
virtual void setCurrentTab(QWidget* tab) = 0;
256
* Get the current tab page
257
* @return The current tab page
259
virtual QWidget* getCurrentTab() = 0;
263
* Notifies all view listeners of the change in the current downloading TorrentInterface
264
* @param tc Pointer to current TorrentInterface
266
void notifyViewListeners(bt::TorrentInterface* tc);
269
* Notify current tab page listeners that the current tab page has changed
270
* @param page The page
272
void notifyCurrentTabPageListeners(QWidget* page);
138
/// Get the torrent activity
139
virtual TorrentActivityInterface* getTorrentActivity() = 0;