diff --git a/fulltextsearch.cc b/fulltextsearch.cc index e043bf0d..6755721f 100644 --- a/fulltextsearch.cc +++ b/fulltextsearch.cc @@ -58,14 +58,13 @@ void Indexing::run() { gdWarning( "Exception occured while full-text search: %s", ex.what() ); } - emit sendNowIndexingName( tr( "None" ) ); + emit sendNowIndexingName( QString() ); } FtsIndexing::FtsIndexing( std::vector< sptr< Dictionary::Class > > const & dicts): dictionaries( dicts ), - started( false ), - nowIndexing( tr( "None" ) ) + started( false ) { } @@ -98,6 +97,8 @@ void FtsIndexing::stopIndexing() indexingExited.acquire(); started = false; + + setNowIndexedName( QString() ); } } @@ -263,7 +264,8 @@ void FullTextSearchDialog::saveData() void FullTextSearchDialog::setNewIndexingName( QString name ) { - ui.nowIndexingLabel->setText( tr( "Now indexing: " ) + name ); + ui.nowIndexingLabel->setText( tr( "Now indexing: " ) + + ( name.isEmpty() ? tr( "None" ) : name ) ); showDictNumbers(); } diff --git a/mainstatusbar.cc b/mainstatusbar.cc index 5569a8b0..fe41655b 100644 --- a/mainstatusbar.cc +++ b/mainstatusbar.cc @@ -48,7 +48,8 @@ bool MainStatusBar::hasImage() const void MainStatusBar::clearMessage() { - textWidget->setText( QString() ); + message.clear(); + textWidget->setText( backgroungMessage ); picWidget->setPixmap( QPixmap() ); timer->stop(); refresh(); @@ -56,12 +57,22 @@ void MainStatusBar::clearMessage() QString MainStatusBar::currentMessage() const { - return textWidget->text(); + return message; +} + +void MainStatusBar::setBackgroundMessage(const QString & bkg_message ) +{ + backgroungMessage = bkg_message; + if( message.isEmpty() ) + { + textWidget->setText( backgroungMessage ); + refresh(); + } } void MainStatusBar::showMessage(const QString & str, int timeout, const QPixmap & pixmap) { - textWidget->setText( str ); + textWidget->setText( message = str ); picWidget->setPixmap( pixmap ); // reload stylesheet @@ -77,7 +88,7 @@ void MainStatusBar::showMessage(const QString & str, int timeout, const QPixmap void MainStatusBar::refresh() { - if ( !currentMessage().isEmpty() ) + if ( !textWidget->text().isEmpty() ) { adjustSize(); diff --git a/mainstatusbar.hh b/mainstatusbar.hh index c52fdd6f..68c673c8 100644 --- a/mainstatusbar.hh +++ b/mainstatusbar.hh @@ -23,6 +23,7 @@ signals: public slots: void showMessage(const QString & text, int timeout = 0, const QPixmap & pixmap = QPixmap()); void clearMessage(); + void setBackgroundMessage( QString const & message ); protected: virtual void mousePressEvent(QMouseEvent * event); @@ -35,6 +36,9 @@ private: QLabel * textWidget; QTimer * timer; + QString backgroungMessage; + QString message; + bool eventFilter(QObject *obj, QEvent * event); void refresh(); bool hasImage() const; diff --git a/mainwindow.cc b/mainwindow.cc index 3f6a98b8..e3ace3cc 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -143,7 +143,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ): Gestures::registerRecognizers(); #endif - // use our own, cutsom statusbar + // use our own, custom statusbar setStatusBar(0); mainStatusBar = new MainStatusBar( this ); @@ -674,6 +674,8 @@ MainWindow::MainWindow( Config::Class & cfg_ ): ui.historyList->installEventFilter( this ); + connect( &ftsIndexing, SIGNAL( newIndexingName( QString ) ), this, SLOT( showFTSIndexingName( QString ) ) ); + #ifdef Q_OS_WIN if( cfg.normalMainWindowGeometry.width() <= 0 ) { @@ -1696,7 +1698,10 @@ void MainWindow::pageLoaded( ArticleView * view ) void MainWindow::showStatusBarMessage( QString const & message, int timeout, QPixmap const & icon ) { - mainStatusBar->showMessage( message, timeout, icon ); + if( message.isEmpty() ) + mainStatusBar->clearMessage(); + else + mainStatusBar->showMessage( message, timeout, icon ); } void MainWindow::tabSwitched( int ) @@ -4170,6 +4175,14 @@ void MainWindow::closeGDHelp() } } +void MainWindow::showFTSIndexingName( QString const & name ) +{ + if( name.isEmpty() ) + mainStatusBar->setBackgroundMessage( QString() ); + else + mainStatusBar->setBackgroundMessage( tr( "Now indexing for full-text search: " ) + name ); +} + #ifdef Q_OS_WIN32 bool MainWindow::handleGDMessage( MSG * message, long * result ) diff --git a/mainwindow.hh b/mainwindow.hh index 6012c1ac..829b4718 100644 --- a/mainwindow.hh +++ b/mainwindow.hh @@ -269,6 +269,8 @@ private slots: void editDictionary ( Dictionary::Class * dict ); + void showFTSIndexingName( QString const & name ); + private slots: // Executed in response to a user click on an 'add tab' tool button