Replace MessageBox with MessageWidget in remaining classes.

Chnage to one method to set MessageWidget text passing type as
parameter.
Only messages with questions requiring user input reamin using
MessageBox dialog.
Use signal/slots to set message in MessageWidget and hide message,
signal/slots only used when required.Maybe need to change all calls to
signals/slots in the future.
This commit is contained in:
Pedro Alves 2015-01-21 16:19:05 +00:00 committed by Janek Bevendorff
parent c2826bb1af
commit 13c85cdfcb
No known key found for this signature in database
GPG key ID: CFEC2F6850BFFA53
20 changed files with 169 additions and 77 deletions

View file

@ -104,6 +104,7 @@ MainWindow::MainWindow()
#endif
setWindowIcon(filePath()->applicationIcon());
m_ui->globalMessageWidget->setHidden(true);
QAction* toggleViewAction = m_ui->toolBar->toggleViewAction();
toggleViewAction->setText(tr("Show toolbar"));
m_ui->menuView->addAction(toggleViewAction);
@ -277,6 +278,11 @@ MainWindow::MainWindow()
connect(m_ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutDialog()));
connect(m_ui->tabWidget, SIGNAL(messageGlobal(QString,MessageWidget::MessageType)), this, SLOT(displayGlobalMessage(QString, MessageWidget::MessageType)));
connect(m_ui->tabWidget, SIGNAL(messageDismissGlobal()), this, SLOT(hideGlobalMessage()));
connect(m_ui->tabWidget, SIGNAL(messageTab(QString,MessageWidget::MessageType)), this, SLOT(displayTabMessage(QString, MessageWidget::MessageType)));
connect(m_ui->tabWidget, SIGNAL(messageDismissTab()), this, SLOT(hideTabMessage()));
updateTrayIcon();
}
@ -787,3 +793,28 @@ bool MainWindow::isTrayIconEnabled() const
&& QSystemTrayIcon::isSystemTrayAvailable();
#endif
}
void MainWindow::displayGlobalMessage(const QString& text, MessageWidget::MessageType type)
{
m_ui->globalMessageWidget->showMessage(text, type);
}
void MainWindow::displayTabMessage(const QString& text, MessageWidget::MessageType type)
{
//if (m_ui->stackedWidget->currentIndex() == 0) {
m_ui->tabWidget->currentDatabaseWidget()->showMessage(text, type);
//}
}
void MainWindow::hideGlobalMessage()
{
m_ui->globalMessageWidget->hideMessage();
}
void MainWindow::hideTabMessage()
{
if (m_ui->stackedWidget->currentIndex() == 0) {
m_ui->tabWidget->currentDatabaseWidget()->hideMessage();
}
}