Changeset View
Changeset View
Standalone View
Standalone View
src/ViewContainer.cpp
Show First 20 Lines • Show All 140 Lines • ▼ Show 20 Line(s) | 121 | #endif | |||
---|---|---|---|---|---|
141 | _newTabButton->setMenu(profileMenu); | 141 | _newTabButton->setMenu(profileMenu); | ||
142 | 142 | | |||
143 | konsoleConfigChanged(); | 143 | konsoleConfigChanged(); | ||
144 | connect(KonsoleSettings::self(), &KonsoleSettings::configChanged, this, &TabbedViewContainer::konsoleConfigChanged); | 144 | connect(KonsoleSettings::self(), &KonsoleSettings::configChanged, this, &TabbedViewContainer::konsoleConfigChanged); | ||
145 | } | 145 | } | ||
146 | 146 | | |||
147 | TabbedViewContainer::~TabbedViewContainer() | 147 | TabbedViewContainer::~TabbedViewContainer() | ||
148 | { | 148 | { | ||
149 | qDebug() << "Started to destroy the tabs"; | ||||
149 | for(int i = 0, end = count(); i < end; i++) { | 150 | for(int i = 0, end = count(); i < end; i++) { | ||
150 | auto view = widget(i); | 151 | auto view = widget(i); | ||
151 | disconnect(view, &QWidget::destroyed, this, &Konsole::TabbedViewContainer::viewDestroyed); | 152 | disconnect(view, &QWidget::destroyed, this, &Konsole::TabbedViewContainer::viewDestroyed); | ||
152 | } | 153 | } | ||
154 | qDebug() << "Finished destroyng tabs."; | ||||
153 | } | 155 | } | ||
154 | 156 | | |||
155 | ViewSplitter *TabbedViewContainer::activeViewSplitter() | 157 | ViewSplitter *TabbedViewContainer::activeViewSplitter() | ||
156 | { | 158 | { | ||
157 | return viewSplitterAt(currentIndex()); | 159 | return viewSplitterAt(currentIndex()); | ||
158 | } | 160 | } | ||
159 | 161 | | |||
160 | ViewSplitter *TabbedViewContainer::viewSplitterAt(int index) | 162 | ViewSplitter *TabbedViewContainer::viewSplitterAt(int index) | ||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Line(s) | |||||
272 | 274 | | |||
273 | void TabbedViewContainer::addSplitter(ViewSplitter *viewSplitter, int index) { | 275 | void TabbedViewContainer::addSplitter(ViewSplitter *viewSplitter, int index) { | ||
274 | if (index == -1) { | 276 | if (index == -1) { | ||
275 | index = addTab(viewSplitter, QString()); | 277 | index = addTab(viewSplitter, QString()); | ||
276 | } else { | 278 | } else { | ||
277 | insertTab(index, viewSplitter, QString()); | 279 | insertTab(index, viewSplitter, QString()); | ||
278 | } | 280 | } | ||
279 | connect(viewSplitter, &ViewSplitter::destroyed, this, &TabbedViewContainer::viewDestroyed); | 281 | connect(viewSplitter, &ViewSplitter::destroyed, this, &TabbedViewContainer::viewDestroyed); | ||
280 | foreach(TerminalDisplay* terminal, viewSplitter->findChildren<TerminalDisplay*>()) { | 282 | auto terminalDisplays = viewSplitter->findChildren<TerminalDisplay*>(); | ||
283 | foreach(TerminalDisplay* terminal, terminalDisplays) { | ||||
281 | connectTerminalDisplay(terminal); | 284 | connectTerminalDisplay(terminal); | ||
282 | } | 285 | } | ||
286 | if (terminalDisplays.count() > 0) { | ||||
287 | updateTitle(qobject_cast<ViewProperties*>(terminalDisplays.at(0)->sessionController())); | ||||
288 | } | ||||
283 | setCurrentIndex(index); | 289 | setCurrentIndex(index); | ||
284 | } | 290 | } | ||
285 | 291 | | |||
286 | void TabbedViewContainer::addView(TerminalDisplay *view, int index) | 292 | void TabbedViewContainer::addView(TerminalDisplay *view, int index) | ||
287 | { | 293 | { | ||
288 | auto viewSplitter = new ViewSplitter(); | 294 | auto viewSplitter = new ViewSplitter(); | ||
289 | viewSplitter->addTerminalDisplay(view, Qt::Horizontal); | 295 | viewSplitter->addTerminalDisplay(view, Qt::Horizontal); | ||
290 | auto item = view->sessionController(); | 296 | auto item = view->sessionController(); | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
351 | void TabbedViewContainer::forgetView(ViewSplitter *view) | 357 | void TabbedViewContainer::forgetView(ViewSplitter *view) | ||
352 | { | 358 | { | ||
353 | Q_UNUSED(view); | 359 | Q_UNUSED(view); | ||
354 | if (count() == 0) { | 360 | if (count() == 0) { | ||
355 | emit empty(this); | 361 | emit empty(this); | ||
356 | } | 362 | } | ||
357 | } | 363 | } | ||
358 | 364 | | |||
359 | void TabbedViewContainer::removeView(TerminalDisplay *view) | | |||
360 | { | | |||
361 | /* TODO: This is absolutely the wrong place. | | |||
362 | * We are removing a terminal display from a ViewSplitter, | | |||
363 | * this should be inside of the view splitter or something. | | |||
364 | */ | | |||
365 | view->setParent(nullptr); | | |||
366 | } | | |||
367 | | ||||
368 | void TabbedViewContainer::activateNextView() | 365 | void TabbedViewContainer::activateNextView() | ||
369 | { | 366 | { | ||
370 | QWidget *active = currentWidget(); | 367 | QWidget *active = currentWidget(); | ||
371 | int index = indexOf(active); | 368 | int index = indexOf(active); | ||
372 | setCurrentIndex(index == count() - 1 ? 0 : index + 1); | 369 | setCurrentIndex(index == count() - 1 ? 0 : index + 1); | ||
373 | } | 370 | } | ||
374 | 371 | | |||
375 | void TabbedViewContainer::activateLastView() | 372 | void TabbedViewContainer::activateLastView() | ||
▲ Show 20 Lines • Show All 201 Lines • Show Last 20 Lines |