Browse Source

[Qt] make most Windows appear centered on main GUI

- remove default value for parent variable in dialogs, which should appear
  centered over main GUI and pass appropriate value
- add some addition NULL pointer checks
0.10
Philip Kaufmann 11 years ago
parent
commit
309f796b39
  1. 2
      src/qt/aboutdialog.h
  2. 15
      src/qt/addressbookpage.cpp
  3. 2
      src/qt/addressbookpage.h
  4. 2
      src/qt/askpassphrasedialog.h
  5. 14
      src/qt/bitcoingui.cpp
  6. 2
      src/qt/editaddressdialog.h
  7. 2
      src/qt/openuridialog.h
  8. 2
      src/qt/optionsdialog.h
  9. 2
      src/qt/rpcconsole.h
  10. 2
      src/qt/signverifymessagedialog.h
  11. 12
      src/qt/transactionview.cpp

2
src/qt/aboutdialog.h

@ -19,7 +19,7 @@ class AboutDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit AboutDialog(QWidget *parent = 0); explicit AboutDialog(QWidget *parent);
~AboutDialog(); ~AboutDialog();
void setModel(ClientModel *model); void setModel(ClientModel *model);

15
src/qt/addressbookpage.cpp

@ -158,6 +158,9 @@ void AddressBookPage::onCopyLabelAction()
void AddressBookPage::onEditAction() void AddressBookPage::onEditAction()
{ {
if(!model)
return;
if(!ui->tableView->selectionModel()) if(!ui->tableView->selectionModel())
return; return;
QModelIndexList indexes = ui->tableView->selectionModel()->selectedRows(); QModelIndexList indexes = ui->tableView->selectionModel()->selectedRows();
@ -165,9 +168,9 @@ void AddressBookPage::onEditAction()
return; return;
EditAddressDialog dlg( EditAddressDialog dlg(
tab == SendingTab ? tab == SendingTab ?
EditAddressDialog::EditSendingAddress : EditAddressDialog::EditSendingAddress :
EditAddressDialog::EditReceivingAddress); EditAddressDialog::EditReceivingAddress, this);
dlg.setModel(model); dlg.setModel(model);
QModelIndex origIndex = proxyModel->mapToSource(indexes.at(0)); QModelIndex origIndex = proxyModel->mapToSource(indexes.at(0));
dlg.loadRow(origIndex.row()); dlg.loadRow(origIndex.row());
@ -180,9 +183,9 @@ void AddressBookPage::on_newAddress_clicked()
return; return;
EditAddressDialog dlg( EditAddressDialog dlg(
tab == SendingTab ? tab == SendingTab ?
EditAddressDialog::NewSendingAddress : EditAddressDialog::NewSendingAddress :
EditAddressDialog::NewReceivingAddress, this); EditAddressDialog::NewReceivingAddress, this);
dlg.setModel(model); dlg.setModel(model);
if(dlg.exec()) if(dlg.exec())
{ {

2
src/qt/addressbookpage.h

@ -39,7 +39,7 @@ public:
ForEditing /**< Open address book for editing */ ForEditing /**< Open address book for editing */
}; };
explicit AddressBookPage(Mode mode, Tabs tab, QWidget *parent = 0); explicit AddressBookPage(Mode mode, Tabs tab, QWidget *parent);
~AddressBookPage(); ~AddressBookPage();
void setModel(AddressTableModel *model); void setModel(AddressTableModel *model);

2
src/qt/askpassphrasedialog.h

@ -27,7 +27,7 @@ public:
Decrypt /**< Ask passphrase and decrypt wallet */ Decrypt /**< Ask passphrase and decrypt wallet */
}; };
explicit AskPassphraseDialog(Mode mode, QWidget *parent = 0); explicit AskPassphraseDialog(Mode mode, QWidget *parent);
~AskPassphraseDialog(); ~AskPassphraseDialog();
void accept(); void accept();

14
src/qt/bitcoingui.cpp

@ -10,12 +10,12 @@
#include "guiconstants.h" #include "guiconstants.h"
#include "guiutil.h" #include "guiutil.h"
#include "notificator.h" #include "notificator.h"
#include "openuridialog.h"
#include "optionsdialog.h" #include "optionsdialog.h"
#include "optionsmodel.h" #include "optionsmodel.h"
#include "rpcconsole.h" #include "rpcconsole.h"
#include "walletframe.h" #include "walletframe.h"
#include "walletmodel.h" #include "walletmodel.h"
#include "openuridialog.h"
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#include "macdockiconhandler.h" #include "macdockiconhandler.h"
@ -345,7 +345,7 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers()); setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers());
connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int))); connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
// Receive and report messages from network/worker thread // Receive and report messages from client model
connect(clientModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int))); connect(clientModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int)));
rpcConsole->setClientModel(clientModel); rpcConsole->setClientModel(clientModel);
@ -460,21 +460,25 @@ void BitcoinGUI::optionsClicked()
{ {
if(!clientModel || !clientModel->getOptionsModel()) if(!clientModel || !clientModel->getOptionsModel())
return; return;
OptionsDialog dlg;
OptionsDialog dlg(this);
dlg.setModel(clientModel->getOptionsModel()); dlg.setModel(clientModel->getOptionsModel());
dlg.exec(); dlg.exec();
} }
void BitcoinGUI::aboutClicked() void BitcoinGUI::aboutClicked()
{ {
AboutDialog dlg; if(!clientModel)
return;
AboutDialog dlg(this);
dlg.setModel(clientModel); dlg.setModel(clientModel);
dlg.exec(); dlg.exec();
} }
void BitcoinGUI::openClicked() void BitcoinGUI::openClicked()
{ {
OpenURIDialog dlg; OpenURIDialog dlg(this);
if(dlg.exec()) if(dlg.exec())
{ {
emit receivedURI(dlg.getURI()); emit receivedURI(dlg.getURI());

2
src/qt/editaddressdialog.h

@ -31,7 +31,7 @@ public:
EditSendingAddress EditSendingAddress
}; };
explicit EditAddressDialog(Mode mode, QWidget *parent = 0); explicit EditAddressDialog(Mode mode, QWidget *parent);
~EditAddressDialog(); ~EditAddressDialog();
void setModel(AddressTableModel *model); void setModel(AddressTableModel *model);

2
src/qt/openuridialog.h

@ -16,7 +16,7 @@ class OpenURIDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit OpenURIDialog(QWidget *parent = 0); explicit OpenURIDialog(QWidget *parent);
~OpenURIDialog(); ~OpenURIDialog();
QString getURI(); QString getURI();

2
src/qt/optionsdialog.h

@ -21,7 +21,7 @@ class OptionsDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit OptionsDialog(QWidget *parent = 0); explicit OptionsDialog(QWidget *parent);
~OptionsDialog(); ~OptionsDialog();
void setModel(OptionsModel *model); void setModel(OptionsModel *model);

2
src/qt/rpcconsole.h

@ -19,7 +19,7 @@ class RPCConsole: public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit RPCConsole(QWidget *parent = 0); explicit RPCConsole(QWidget *parent);
~RPCConsole(); ~RPCConsole();
void setClientModel(ClientModel *model); void setClientModel(ClientModel *model);

2
src/qt/signverifymessagedialog.h

@ -18,7 +18,7 @@ class SignVerifyMessageDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit SignVerifyMessageDialog(QWidget *parent = 0); explicit SignVerifyMessageDialog(QWidget *parent);
~SignVerifyMessageDialog(); ~SignVerifyMessageDialog();
void setModel(WalletModel *model); void setModel(WalletModel *model);

12
src/qt/transactionview.cpp

@ -83,14 +83,12 @@ TransactionView::TransactionView(QWidget *parent) :
addressWidget = new QLineEdit(this); addressWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700 #if QT_VERSION >= 0x040700
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
addressWidget->setPlaceholderText(tr("Enter address or label to search")); addressWidget->setPlaceholderText(tr("Enter address or label to search"));
#endif #endif
hlayout->addWidget(addressWidget); hlayout->addWidget(addressWidget);
amountWidget = new QLineEdit(this); amountWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700 #if QT_VERSION >= 0x040700
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
amountWidget->setPlaceholderText(tr("Min amount")); amountWidget->setPlaceholderText(tr("Min amount"));
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@ -355,10 +353,10 @@ void TransactionView::editLabel()
// Determine type of address, launch appropriate editor dialog type // Determine type of address, launch appropriate editor dialog type
QString type = modelIdx.data(AddressTableModel::TypeRole).toString(); QString type = modelIdx.data(AddressTableModel::TypeRole).toString();
EditAddressDialog dlg(type==AddressTableModel::Receive EditAddressDialog dlg(
? EditAddressDialog::EditReceivingAddress type == AddressTableModel::Receive
: EditAddressDialog::EditSendingAddress, ? EditAddressDialog::EditReceivingAddress
this); : EditAddressDialog::EditSendingAddress, this);
dlg.setModel(addressBook); dlg.setModel(addressBook);
dlg.loadRow(idx); dlg.loadRow(idx);
dlg.exec(); dlg.exec();
@ -367,7 +365,7 @@ void TransactionView::editLabel()
{ {
// Add sending address // Add sending address
EditAddressDialog dlg(EditAddressDialog::NewSendingAddress, EditAddressDialog dlg(EditAddressDialog::NewSendingAddress,
this); this);
dlg.setModel(addressBook); dlg.setModel(addressBook);
dlg.setAddress(address); dlg.setAddress(address);
dlg.exec(); dlg.exec();

Loading…
Cancel
Save