Defer heavy UI model loading for faster startup
- Address table and transaction table now load asynchronously via QTimer::singleShot after the event loop starts instead of blocking the constructor - MessageModel (secure messaging) lazy-loaded 1s after wallet init or on-demand when navigating to message page - Splash screen stays visible until window.show() completes - Guard updateConfirmations() against empty transaction table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -95,6 +95,7 @@ TrianglesGUI::TrianglesGUI(bool fIsTestnet, QWidget *parent):
|
||||
ui(new Ui::MainWindow),
|
||||
clientModel(0),
|
||||
walletModel(0),
|
||||
messageModel(0),
|
||||
encryptWalletAction(0),
|
||||
changePassphraseAction(0),
|
||||
unlockWalletAction(0),
|
||||
@@ -594,6 +595,9 @@ void TrianglesGUI::setWalletModel(WalletModel *walletModel)
|
||||
|
||||
// Ask for passphrase if needed
|
||||
connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet()));
|
||||
|
||||
// Load secure messaging after the main window can render.
|
||||
QTimer::singleShot(1000, this, SLOT(ensureMessageModel()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,6 +618,14 @@ void TrianglesGUI::setMessageModel(MessageModel *messageModel)
|
||||
}
|
||||
}
|
||||
|
||||
void TrianglesGUI::ensureMessageModel()
|
||||
{
|
||||
if(messageModel || !walletModel)
|
||||
return;
|
||||
|
||||
setMessageModel(new MessageModel(pwalletMain, walletModel, this));
|
||||
}
|
||||
|
||||
void TrianglesGUI::createTrayIcon()
|
||||
{
|
||||
#ifndef Q_OS_MAC
|
||||
@@ -1025,6 +1037,8 @@ void TrianglesGUI::gotoSendCoinsPage()
|
||||
|
||||
void TrianglesGUI::gotoMessagePage()
|
||||
{
|
||||
ensureMessageModel();
|
||||
|
||||
messageAction->setChecked(true);
|
||||
centralWidget->setCurrentWidget(messagePage);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user