Changeset View
Changeset View
Standalone View
Standalone View
src/ViewContainer.h
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 64 | public: | |||
---|---|---|---|---|---|
73 | /** | 73 | /** | ||
74 | * Called when the ViewContainer is destroyed. When reimplementing this in | 74 | * Called when the ViewContainer is destroyed. When reimplementing this in | ||
75 | * subclasses, use object->deleteLater() to delete any widgets or other objects | 75 | * subclasses, use object->deleteLater() to delete any widgets or other objects | ||
76 | * instead of 'delete object'. | 76 | * instead of 'delete object'. | ||
77 | */ | 77 | */ | ||
78 | ~TabbedViewContainer() Q_DECL_OVERRIDE; | 78 | ~TabbedViewContainer() Q_DECL_OVERRIDE; | ||
79 | 79 | | |||
80 | /** Adds a new view to the container widget */ | 80 | /** Adds a new view to the container widget */ | ||
81 | void addView(QWidget *view, ViewProperties *item, int index = -1); | 81 | void addView(TerminalDisplay *view, ViewProperties *item, int index = -1); | ||
82 | 82 | | |||
83 | /** Removes a view from the container */ | 83 | /** Removes a view from the container */ | ||
84 | void removeView(QWidget *view); | 84 | void removeView(TerminalDisplay *view); | ||
85 | 85 | | |||
86 | /** Returns the ViewProperties instance associated with a particular view in the container */ | | |||
87 | ViewProperties *viewProperties(QWidget *view) const; | | |||
88 | void setTabActivity(int index, bool activity); | 86 | void setTabActivity(int index, bool activity); | ||
89 | 87 | | |||
90 | void updateTitle(ViewProperties *item); | 88 | void updateTitle(ViewProperties *item); | ||
91 | void updateIcon(ViewProperties *item); | 89 | void updateIcon(ViewProperties *item); | ||
92 | void updateActivity(ViewProperties *item); | 90 | void updateActivity(ViewProperties *item); | ||
93 | 91 | | |||
94 | /** Changes the active view to the next view */ | 92 | /** Changes the active view to the next view */ | ||
95 | void activateNextView(); | 93 | void activateNextView(); | ||
Show All 39 Lines | |||||
135 | void currentTabChanged(int index); | 133 | void currentTabChanged(int index); | ||
136 | void closeCurrentTab(); | 134 | void closeCurrentTab(); | ||
137 | void wheelScrolled(int delta); | 135 | void wheelScrolled(int delta); | ||
138 | 136 | | |||
139 | void tabDoubleClicked(int index); | 137 | void tabDoubleClicked(int index); | ||
140 | void openTabContextMenu(const QPoint &point); | 138 | void openTabContextMenu(const QPoint &point); | ||
141 | void setNavigationVisibility(ViewManager::NavigationVisibility navigationVisibility); | 139 | void setNavigationVisibility(ViewManager::NavigationVisibility navigationVisibility); | ||
142 | void moveTabToWindow(int index, QWidget *window); | 140 | void moveTabToWindow(int index, QWidget *window); | ||
141 | | ||||
142 | /* return the widget(int index) casted to TerminalDisplay* | ||||
143 | * | ||||
144 | * The only thing that this class holds are TerminalDisplays, so | ||||
145 | * this is the only thing that should be used to retrieve widgets. | ||||
146 | */ | ||||
147 | TerminalDisplay *terminalAt(int index); | ||||
143 | Q_SIGNALS: | 148 | Q_SIGNALS: | ||
144 | /** Emitted when the container has no more children */ | 149 | /** Emitted when the container has no more children */ | ||
145 | void empty(TabbedViewContainer *container); | 150 | void empty(TabbedViewContainer *container); | ||
146 | 151 | | |||
147 | /** Emitted when the user requests to open a new view */ | 152 | /** Emitted when the user requests to open a new view */ | ||
148 | void newViewRequest(TabbedViewContainer *thisContainer); | 153 | void newViewRequest(TabbedViewContainer *thisContainer); | ||
149 | 154 | | |||
150 | /** Requests creation of a new view, with the selected profile. */ | 155 | /** Requests creation of a new view, with the selected profile. */ | ||
151 | void newViewWithProfileRequest(TabbedViewContainer *thisContainer, Profile::Ptr); | 156 | void newViewWithProfileRequest(TabbedViewContainer *thisContainer, Profile::Ptr); | ||
152 | 157 | | |||
153 | /** | 158 | /** | ||
154 | * Emitted when the user requests to move a view from another container | 159 | * Emitted when the user requests to move a view from another container | ||
155 | * into this container. If 'success' is set to true by a connected slot | 160 | * into this container. If 'success' is set to true by a connected slot | ||
156 | * then the original view will be removed. | 161 | * then the original view will be removed. | ||
157 | * | 162 | * | ||
158 | * @param index Index at which to insert the new view in the container or -1 | 163 | * @param index Index at which to insert the new view in the container or -1 | ||
159 | * to append it. This index should be passed to addView() when the new view | 164 | * to append it. This index should be passed to addView() when the new view | ||
160 | * has been created. | 165 | * has been created. | ||
161 | * @param id The identifier of the view. | 166 | * @param id The identifier of the view. | ||
162 | */ | 167 | */ | ||
163 | void moveViewRequest(int index, int sessionControllerId); | 168 | void moveViewRequest(int index, int sessionControllerId); | ||
164 | 169 | | |||
165 | /** Emitted when the active view changes */ | 170 | /** Emitted when the active view changes */ | ||
166 | void activeViewChanged(QWidget *view); | 171 | void activeViewChanged(TerminalDisplay *view); | ||
167 | 172 | | |||
168 | /** Emitted when a view is added to the container. */ | 173 | /** Emitted when a view is added to the container. */ | ||
169 | void viewAdded(QWidget *view, ViewProperties *properties); | 174 | void viewAdded(TerminalDisplay *view, ViewProperties *properties); | ||
170 | 175 | | |||
171 | /** Emitted when a view is removed from the container. */ | 176 | /** Emitted when a view is removed from the container. */ | ||
172 | void viewRemoved(QWidget *view); | 177 | void viewRemoved(TerminalDisplay *view); | ||
173 | 178 | | |||
174 | /** detach the specific tab */ | 179 | /** detach the specific tab */ | ||
175 | void detachTab(TabbedViewContainer *self, QWidget *activeView); | 180 | void detachTab(TabbedViewContainer *self, TerminalDisplay *activeView); | ||
176 | 181 | | |||
177 | protected: | 182 | protected: | ||
178 | /** Returns the widgets which are associated with a particular navigation item */ | | |||
179 | QList<QWidget *> widgetsForItem(ViewProperties *item) const; | | |||
180 | | ||||
181 | /** | 183 | /** | ||
182 | * Rearranges the order of widgets in the container. | 184 | * Rearranges the order of widgets in the container. | ||
183 | * | 185 | * | ||
184 | * @param fromIndex Current index of the widget to move | 186 | * @param fromIndex Current index of the widget to move | ||
185 | * @param toIndex New index for the widget | 187 | * @param toIndex New index for the widget | ||
186 | */ | 188 | */ | ||
187 | void moveViewWidget(int fromIndex, int toIndex); | 189 | void moveViewWidget(int fromIndex, int toIndex); | ||
188 | 190 | | |||
189 | // close tabs and unregister | 191 | // close tabs and unregister | ||
190 | void closeTerminalTab(int idx); | 192 | void closeTerminalTab(int idx); | ||
191 | 193 | | |||
192 | void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE; | 194 | void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE; | ||
193 | private Q_SLOTS: | 195 | private Q_SLOTS: | ||
194 | void viewDestroyed(QObject *view); | 196 | void viewDestroyed(QObject *view); | ||
195 | void konsoleConfigChanged(); | 197 | void konsoleConfigChanged(); | ||
196 | 198 | | |||
197 | private: | 199 | private: | ||
198 | void forgetView(QWidget *view); | 200 | void forgetView(TerminalDisplay *view); | ||
199 | void updateTabHistory(QWidget *view, bool remove = false); | 201 | void updateTabHistory(TerminalDisplay *view, bool remove = false); | ||
200 | 202 | | |||
201 | QHash<QWidget *, ViewProperties *> _navigation; | 203 | QList<TerminalDisplay *> _tabHistory; | ||
202 | QList<QWidget *> _tabHistory; | | |||
203 | ViewManager *_connectedViewManager; | 204 | ViewManager *_connectedViewManager; | ||
204 | QMenu *_contextPopupMenu; | 205 | QMenu *_contextPopupMenu; | ||
205 | QToolButton *_newTabButton; | 206 | QToolButton *_newTabButton; | ||
206 | QToolButton *_closeTabButton; | 207 | QToolButton *_closeTabButton; | ||
207 | int _contextMenuTabIndex; | 208 | int _contextMenuTabIndex; | ||
208 | ViewManager::NavigationVisibility _navigationVisibility; | 209 | ViewManager::NavigationVisibility _navigationVisibility; | ||
209 | int _tabHistoryIndex; | 210 | int _tabHistoryIndex; | ||
210 | }; | 211 | }; | ||
211 | 212 | | |||
212 | 213 | | |||
213 | } | 214 | } | ||
214 | #endif //VIEWCONTAINER_H | 215 | #endif //VIEWCONTAINER_H |