void MainWindow::init(NeovimConnector *c) { if (m_shell) { m_shell->deleteLater(); } if (m_nvim) { m_nvim->deleteLater(); } m_nvim = c; m_shell = new Shell(c); setCentralWidget(m_shell); connect(m_shell, SIGNAL(neovimTitleChanged(const QString &)), this, SLOT(neovimSetTitle(const QString &))); connect(m_nvim, &NeovimConnector::processExited, this, &MainWindow::neovimExited); connect(m_nvim, &NeovimConnector::error, this, &MainWindow::neovimError); connect(m_errorWidget, &ErrorWidget::reconnectNeovim, this, &MainWindow::reconnectNeovim); connect(m_shell, &Shell::neovimResized, this, &MainWindow::neovimWidgetResized); m_shell->setFocus(Qt::OtherFocusReason); if (m_nvim->errorCause()) { neovimError(m_nvim->errorCause()); } }
void MainWindow::init(NeovimConnector *c) { if (m_shell) { m_shell->deleteLater(); m_stack.removeWidget(m_shell); } if (m_nvim) { m_nvim->deleteLater(); } m_nvim = c; m_shell = new Shell(c); m_stack.insertWidget(1, m_shell); m_stack.setCurrentIndex(1); connect(m_shell, SIGNAL(neovimAttached(bool)), this, SLOT(neovimAttachmentChanged(bool))); connect(m_shell, SIGNAL(neovimTitleChanged(const QString &)), this, SLOT(neovimSetTitle(const QString &))); connect(m_shell, &Shell::neovimResized, this, &MainWindow::neovimWidgetResized); connect(m_shell, &Shell::neovimMaximized, this, &MainWindow::neovimMaximized); connect(m_shell, &Shell::neovimFullScreen, this, &MainWindow::neovimFullScreen); connect(m_nvim, &NeovimConnector::processExited, this, &MainWindow::neovimExited); connect(m_nvim, &NeovimConnector::error, this, &MainWindow::neovimError); connect(m_errorWidget, &ErrorWidget::reconnectNeovim, this, &MainWindow::reconnectNeovim); m_shell->setFocus(Qt::OtherFocusReason); if (m_nvim->errorCause()) { neovimError(m_nvim->errorCause()); } }