forked from qt-creator/qt-creator
Terminal: Defer shell model init
Speculative fix for sometimes slow load times of the Terminal plugin on Windows Task-number: QTCREATORBUG-29840 Change-Id: I6782db075bfaa25fbabe2bac2a8f0f3b4af4f833 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -273,11 +273,15 @@ void TerminalPane::initActions()
|
|||||||
cmd->setAttribute(Command::CA_UpdateIcon);
|
cmd->setAttribute(Command::CA_UpdateIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Internal::ShellModel *shellModel()
|
||||||
|
{
|
||||||
|
static Internal::ShellModel model;
|
||||||
|
return &model;
|
||||||
|
}
|
||||||
|
|
||||||
void TerminalPane::createShellMenu()
|
void TerminalPane::createShellMenu()
|
||||||
{
|
{
|
||||||
const Internal::ShellModel *shellModel = new Internal::ShellModel(&m_shellMenu);
|
connect(&m_shellMenu, &QMenu::aboutToShow, &m_shellMenu, [this] {
|
||||||
|
|
||||||
connect(&m_shellMenu, &QMenu::aboutToShow, &m_shellMenu, [shellModel, this] {
|
|
||||||
m_shellMenu.clear();
|
m_shellMenu.clear();
|
||||||
|
|
||||||
const auto addItems = [this](const QList<Internal::ShellModelItem> &items) {
|
const auto addItems = [this](const QList<Internal::ShellModelItem> &items) {
|
||||||
@@ -292,9 +296,9 @@ void TerminalPane::createShellMenu()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
addItems(shellModel->local());
|
addItems(shellModel()->local());
|
||||||
m_shellMenu.addSection(Tr::tr("Devices"));
|
m_shellMenu.addSection(Tr::tr("Devices"));
|
||||||
addItems(shellModel->remote());
|
addItems(shellModel()->remote());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user