if(dock && actionData.toInt() == bufferViewConfigId) {
removeAction(action);
_bufferViews.removeAll(dock);
+ Client::bufferViewOverlay()->removeView(dock->bufferViewId());
dock->deleteLater();
}
}
Q_ASSERT(action);
BufferViewDock *dock = qobject_cast<BufferViewDock *>(action->parent());
Q_ASSERT(dock);
+
+ // Make sure we don't toggle backlog fetch for a view we've already removed
+ if(!_bufferViews.contains(dock))
+ return;
+
if(enabled) {
Client::bufferViewOverlay()->addView(dock->bufferViewId());
BufferViewConfig *config = dock->config();
void MainWin::loadLayout() {
QtUiSettings s;
int accountId = Client::currentCoreAccount().toInt();
- restoreState(s.value(QString("MainWinState-%1").arg(accountId)).toByteArray(), accountId);
+ QByteArray state = s.value(QString("MainWinState-%1").arg(accountId)).toByteArray();
+ if(state.isEmpty()) {
+ // Make sure that the default bufferview is shown
+ if(_bufferViews.count())
+ _bufferViews.at(0)->show();
+ return;
+ }
+
+ restoreState(state, accountId);
_layoutLoaded = true;
}
void MainWin::saveLayout() {
QtUiSettings s;
- int accountId = Client::currentCoreAccount().toInt();
- if(accountId > 0) s.setValue(QString("MainWinState-%1").arg(accountId) , saveState(accountId));
+ int accountId = _bufferViews.count()? Client::currentCoreAccount().toInt() : 0; // only save if we still have a layout!
+ if(accountId > 0)
+ s.setValue(QString("MainWinState-%1").arg(accountId) , saveState(accountId));
}
void MainWin::updateLagIndicator(int lag) {
if(dock && actionData.toInt() != -1) {
removeAction(action);
_bufferViews.removeAll(dock);
+ Client::bufferViewOverlay()->removeView(dock->bufferViewId());
dock->deleteLater();
}
}