Changeset View
Changeset View
Standalone View
Standalone View
src/ViewContainer.h
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 61 | public: | |||
---|---|---|---|---|---|
71 | * Called when the ViewContainer is destroyed. When reimplementing this in | 71 | * Called when the ViewContainer is destroyed. When reimplementing this in | ||
72 | * subclasses, use object->deleteLater() to delete any widgets or other objects | 72 | * subclasses, use object->deleteLater() to delete any widgets or other objects | ||
73 | * instead of 'delete object'. | 73 | * instead of 'delete object'. | ||
74 | */ | 74 | */ | ||
75 | ~TabbedViewContainer() Q_DECL_OVERRIDE; | 75 | ~TabbedViewContainer() Q_DECL_OVERRIDE; | ||
76 | 76 | | |||
77 | /** Adds a new view to the container widget */ | 77 | /** Adds a new view to the container widget */ | ||
78 | void addView(TerminalDisplay *view, int index = -1); | 78 | void addView(TerminalDisplay *view, int index = -1); | ||
79 | void addSplitter(ViewSplitter *splitter, int index = -1); | ||||
80 | | ||||
81 | /** splits the currently focused Splitter */ | ||||
82 | void splitView(TerminalDisplay *view, Qt::Orientation orientation); | ||||
79 | 83 | | |||
80 | /** Removes a view from the container */ | 84 | /** Removes a view from the container */ | ||
81 | void removeView(TerminalDisplay *view); | 85 | void removeView(TerminalDisplay *view); | ||
82 | 86 | | |||
83 | void setTabActivity(int index, bool activity); | 87 | void setTabActivity(int index, bool activity); | ||
84 | 88 | | |||
85 | void updateTitle(ViewProperties *item); | 89 | void updateTitle(ViewProperties *item); | ||
86 | void updateIcon(ViewProperties *item); | 90 | void updateIcon(ViewProperties *item); | ||
87 | void updateActivity(ViewProperties *item); | 91 | void updateActivity(ViewProperties *item); | ||
88 | 92 | | |||
89 | /** Changes the active view to the next view */ | 93 | /** Changes the active view to the next view */ | ||
90 | void activateNextView(); | 94 | void activateNextView(); | ||
91 | 95 | | |||
92 | /** Changes the active view to the previous view */ | 96 | /** Changes the active view to the previous view */ | ||
93 | void activatePreviousView(); | 97 | void activatePreviousView(); | ||
94 | 98 | | |||
95 | /** Changes the active view to the last view */ | 99 | /** Changes the active view to the last view */ | ||
96 | void activateLastView(); | 100 | void activateLastView(); | ||
97 | 101 | | |||
98 | /** Changes the active view to the last used view */ | | |||
99 | void activateLastUsedView(bool reverse); | | |||
100 | | ||||
101 | /** Toggle between last two views */ | | |||
102 | void toggleLastUsedView(); | | |||
103 | | ||||
104 | void setCss(const QString& styleSheet = QString()); | 102 | void setCss(const QString& styleSheet = QString()); | ||
105 | void setCssFromFile(const QUrl& url); | 103 | void setCssFromFile(const QUrl& url); | ||
104 | | ||||
105 | ViewSplitter *activeViewSplitter(); | ||||
106 | /** | 106 | /** | ||
107 | * This enum describes the directions | 107 | * This enum describes the directions | ||
108 | * in which views can be re-arranged within the container | 108 | * in which views can be re-arranged within the container | ||
109 | * using the moveActiveView() method. | 109 | * using the moveActiveView() method. | ||
110 | */ | 110 | */ | ||
111 | enum MoveDirection { | 111 | enum MoveDirection { | ||
112 | /** Moves the view to the left. */ | 112 | /** Moves the view to the left. */ | ||
113 | MoveViewLeft, | 113 | MoveViewLeft, | ||
Show All 15 Lines | |||||
129 | * The default implementation does nothing. */ | 129 | * The default implementation does nothing. */ | ||
130 | // TODO: Reenable this later. | 130 | // TODO: Reenable this later. | ||
131 | // void setNewViewMenu(QMenu *menu); | 131 | // void setNewViewMenu(QMenu *menu); | ||
132 | void renameTab(int index); | 132 | void renameTab(int index); | ||
133 | ViewManager *connectedViewManager(); | 133 | ViewManager *connectedViewManager(); | ||
134 | void currentTabChanged(int index); | 134 | void currentTabChanged(int index); | ||
135 | void closeCurrentTab(); | 135 | void closeCurrentTab(); | ||
136 | void wheelScrolled(int delta); | 136 | void wheelScrolled(int delta); | ||
137 | 137 | void currentSessionControllerChanged(SessionController *controller); | |||
138 | void tabDoubleClicked(int index); | 138 | void tabDoubleClicked(int index); | ||
139 | void openTabContextMenu(const QPoint &point); | 139 | void openTabContextMenu(const QPoint &point); | ||
140 | void setNavigationVisibility(ViewManager::NavigationVisibility navigationVisibility); | 140 | void setNavigationVisibility(ViewManager::NavigationVisibility navigationVisibility); | ||
141 | void moveTabToWindow(int index, QWidget *window); | 141 | void moveTabToWindow(int index, QWidget *window); | ||
142 | 142 | | |||
143 | void maximizeCurrentTerminal(); | ||||
144 | void restoreOtherTerminals(); | ||||
143 | /* return the widget(int index) casted to TerminalDisplay* | 145 | /* return the widget(int index) casted to TerminalDisplay* | ||
144 | * | 146 | * | ||
145 | * The only thing that this class holds are TerminalDisplays, so | 147 | * The only thing that this class holds are TerminalDisplays, so | ||
146 | * this is the only thing that should be used to retrieve widgets. | 148 | * this is the only thing that should be used to retrieve widgets. | ||
147 | */ | 149 | */ | ||
148 | TerminalDisplay *terminalAt(int index); | 150 | ViewSplitter *viewSplitterAt(int index); | ||
151 | | ||||
152 | void connectTerminalDisplay(TerminalDisplay *view); | ||||
153 | void disconnectTerminalDisplay(TerminalDisplay *view); | ||||
154 | | ||||
149 | Q_SIGNALS: | 155 | Q_SIGNALS: | ||
150 | /** Emitted when the container has no more children */ | 156 | /** Emitted when the container has no more children */ | ||
151 | void empty(TabbedViewContainer *container); | 157 | void empty(TabbedViewContainer *container); | ||
152 | 158 | | |||
153 | /** Emitted when the user requests to open a new view */ | 159 | /** Emitted when the user requests to open a new view */ | ||
154 | void newViewRequest(TabbedViewContainer *thisContainer); | 160 | void newViewRequest(); | ||
155 | 161 | | |||
156 | /** Requests creation of a new view, with the selected profile. */ | 162 | /** Requests creation of a new view, with the selected profile. */ | ||
157 | void newViewWithProfileRequest(TabbedViewContainer *thisContainer, const Profile::Ptr&); | 163 | void newViewWithProfileRequest(const Profile::Ptr&); | ||
158 | 164 | | |||
159 | /** | 165 | /** | ||
160 | * Emitted when the user requests to move a view from another container | 166 | * Emitted when the user requests to move a view from another container | ||
161 | * into this container. If 'success' is set to true by a connected slot | 167 | * into this container. If 'success' is set to true by a connected slot | ||
162 | * then the original view will be removed. | 168 | * then the original view will be removed. | ||
163 | * | 169 | * | ||
164 | * @param index Index at which to insert the new view in the container | 170 | * @param index Index at which to insert the new view in the container | ||
165 | * or -1 to append it. This index should be passed to addView() when | 171 | * or -1 to append it. This index should be passed to addView() when | ||
166 | * the new view has been created. | 172 | * the new view has been created. | ||
167 | * @param sessionControllerId The identifier of the view. | 173 | * @param sessionControllerId The identifier of the view. | ||
168 | */ | 174 | */ | ||
169 | void moveViewRequest(int index, int sessionControllerId); | 175 | void moveViewRequest(int index, int sessionControllerId); | ||
170 | 176 | | |||
171 | /** Emitted when the active view changes */ | 177 | /** Emitted when the active view changes */ | ||
172 | void activeViewChanged(TerminalDisplay *view); | 178 | void activeViewChanged(TerminalDisplay *view); | ||
173 | 179 | | |||
174 | /** Emitted when a view is added to the container. */ | 180 | /** Emitted when a view is added to the container. */ | ||
175 | void viewAdded(TerminalDisplay *view); | 181 | void viewAdded(TerminalDisplay *view); | ||
176 | 182 | | |||
177 | /** Emitted when a view is removed from the container. */ | 183 | /** Emitted when a view is removed from the container. */ | ||
178 | void viewRemoved(TerminalDisplay *view); | 184 | void viewRemoved(TerminalDisplay *view); | ||
179 | 185 | | |||
180 | /** detach the specific tab */ | 186 | /** detach the specific tab */ | ||
181 | void detachTab(TabbedViewContainer *self, TerminalDisplay *activeView); | 187 | void detachTab(int tabIdx); | ||
182 | 188 | | |||
183 | protected: | 189 | protected: | ||
184 | /** | | |||
185 | * Rearranges the order of widgets in the container. | | |||
186 | * | | |||
187 | * @param fromIndex Current index of the widget to move | | |||
188 | * @param toIndex New index for the widget | | |||
189 | */ | | |||
190 | void moveViewWidget(int fromIndex, int toIndex); | | |||
191 | | ||||
192 | // close tabs and unregister | 190 | // close tabs and unregister | ||
193 | void closeTerminalTab(int idx); | 191 | void closeTerminalTab(int idx); | ||
194 | 192 | | |||
195 | void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE; | 193 | void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE; | ||
196 | private Q_SLOTS: | 194 | private Q_SLOTS: | ||
197 | void viewDestroyed(QObject *view); | 195 | void viewDestroyed(QObject *view); | ||
198 | void konsoleConfigChanged(); | 196 | void konsoleConfigChanged(); | ||
199 | 197 | | |||
200 | private: | 198 | private: | ||
201 | void forgetView(TerminalDisplay *view); | 199 | void forgetView(ViewSplitter *view); | ||
202 | void updateTabHistory(TerminalDisplay *view, bool remove = false); | | |||
203 | 200 | | |||
204 | QList<TerminalDisplay *> _tabHistory; | | |||
205 | ViewManager *_connectedViewManager; | 201 | ViewManager *_connectedViewManager; | ||
206 | QMenu *_contextPopupMenu; | 202 | QMenu *_contextPopupMenu; | ||
207 | QToolButton *_newTabButton; | 203 | QToolButton *_newTabButton; | ||
208 | QToolButton *_closeTabButton; | 204 | QToolButton *_closeTabButton; | ||
209 | int _contextMenuTabIndex; | 205 | int _contextMenuTabIndex; | ||
210 | ViewManager::NavigationVisibility _navigationVisibility; | 206 | ViewManager::NavigationVisibility _navigationVisibility; | ||
211 | int _tabHistoryIndex; | | |||
212 | }; | 207 | }; | ||
213 | 208 | | |||
214 | 209 | | |||
215 | } | 210 | } | ||
216 | #endif //VIEWCONTAINER_H | 211 | #endif //VIEWCONTAINER_H |