Show now indexing for full-text search dictionary name in status line (issue #640)

This commit is contained in:
Abs62 2015-11-01 15:22:18 +03:00
parent cf3ec5dfc1
commit cbef0a1a1f
5 changed files with 42 additions and 10 deletions

View file

@ -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();
}

View file

@ -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();

View file

@ -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;

View file

@ -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,6 +1698,9 @@ void MainWindow::pageLoaded( ArticleView * view )
void MainWindow::showStatusBarMessage( QString const & message, int timeout, QPixmap const & icon )
{
if( message.isEmpty() )
mainStatusBar->clearMessage();
else
mainStatusBar->showMessage( message, timeout, icon );
}
@ -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 )

View file

@ -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