diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 11e2a43..fee4afd 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -7,6 +7,7 @@ #include #include +#include const QString AddressTableModel::Send = "S"; const QString AddressTableModel::Receive = "R"; @@ -145,7 +146,7 @@ AddressTableModel::AddressTableModel(CWallet *wallet, WalletModel *parent) : { columns << tr("Label") << tr("Address"); priv = new AddressTablePriv(wallet, this); - priv->refreshAddressTable(); + QTimer::singleShot(0, this, SLOT(refreshAddressTable())); } AddressTableModel::~AddressTableModel() @@ -326,6 +327,12 @@ void AddressTableModel::updateEntry(const QString &address, const QString &label priv->updateEntry(address, label, isMine, status); } +void AddressTableModel::refreshAddressTable() +{ + priv->refreshAddressTable(); + reset(); +} + QString AddressTableModel::addRow(const QString &type, const QString &label, const QString &address, int addressType) { std::string strLabel = label.toStdString(); diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h index df87ebe..efcdf7d 100644 --- a/src/qt/addresstablemodel.h +++ b/src/qt/addresstablemodel.h @@ -89,6 +89,7 @@ signals: void defaultAddressChanged(const QString &address); public slots: + void refreshAddressTable(); /* Update address list from core. */ void updateEntry(const QString &address, const QString &label, bool isMine, int status); diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index ce5e583..378d538 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -225,8 +225,7 @@ TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *paren cachedNumBlocks(0) { columns << QString() << tr("Date") << tr("Type") << tr("Address") << tr("Amount"); - - priv->refreshWallet(); + QTimer::singleShot(0, this, SLOT(refreshWallet())); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateConfirmations())); @@ -248,8 +247,17 @@ void TransactionTableModel::updateTransaction(const QString &hash, int status) priv->updateWallet(updated, status); } +void TransactionTableModel::refreshWallet() +{ + priv->refreshWallet(); + reset(); +} + void TransactionTableModel::updateConfirmations() { + if(!priv->size()) + return; + if(nBestHeight != cachedNumBlocks) { cachedNumBlocks = nBestHeight; diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index fef2bda..e3576df 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -77,6 +77,7 @@ private: QVariant txAddressDecoration(const TransactionRecord *wtx) const; public slots: + void refreshWallet(); void updateTransaction(const QString &hash, int status); void updateConfirmations(); void updateDisplayUnit(); diff --git a/src/qt/triangles.cpp b/src/qt/triangles.cpp index 4d9b07d..c081caf 100644 --- a/src/qt/triangles.cpp +++ b/src/qt/triangles.cpp @@ -5,7 +5,6 @@ #include "clientmodel.h" #include "walletmodel.h" #include "optionsmodel.h" -#include "messagemodel.h" #include "guiutil.h" #include "guiconstants.h" @@ -224,16 +223,11 @@ int main(int argc, char *argv[]) // Put this in a block, so that the Model objects are cleaned up before // calling Shutdown(). - if (splashref) - splash.finish(&window); - ClientModel clientModel(&optionsModel); WalletModel walletModel(pwalletMain, &optionsModel); - MessageModel messageModel(pwalletMain, &walletModel); window.setClientModel(&clientModel); window.setWalletModel(&walletModel); - window.setMessageModel(&messageModel); // If -min option passed, start window minimized. if(GetBoolArg("-min")) @@ -245,6 +239,9 @@ int main(int argc, char *argv[]) window.show(); } + if (splashref) + splash.finish(&window); + // Place this here as guiref has to be defined if we don't want to lose URIs ipcInit(argc, argv); diff --git a/src/qt/trianglesgui.cpp b/src/qt/trianglesgui.cpp index f3cc517..db36586 100644 --- a/src/qt/trianglesgui.cpp +++ b/src/qt/trianglesgui.cpp @@ -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); diff --git a/src/qt/trianglesgui.h b/src/qt/trianglesgui.h index f816366..478fa4f 100644 --- a/src/qt/trianglesgui.h +++ b/src/qt/trianglesgui.h @@ -180,6 +180,7 @@ public slots: private slots: + void ensureMessageModel(); void menuFileRequested(); void menuOperationsRequested();