void thread::safeStart()
{
// Invoke the "thread" method only
this->run();
}
void thread::run()
{
// Delete the old object on restart
if ( m_private )
delete m_private;
// Create our private object
m_private = new thread_private;
// And connect its signals to ours
connect( m_private, SIGNAL(databaseOpened(bool)), this, SIGNAL(databaseOpened(bool)) );
connect( m_private, SIGNAL(databaseOpening()) , this, SIGNAL(databaseOpening()) );
connect( m_private, SIGNAL(databaseClosed()) , this, SIGNAL(databaseClosed()) );
connect( m_private, SIGNAL(searchPreparing()) , this, SIGNAL(searchPreparing()) );
connect( m_private, SIGNAL(searchPrepared()) , this, SIGNAL(searchPrepared()) );
connect( m_private, SIGNAL(searchStarted()) , this, SIGNAL(searchStarted()) );
connect( m_private, SIGNAL(searchProgress(double)) , this, SIGNAL(searchProgress(double)) );
connect( m_private, SIGNAL(searchResultsCount(int)), this, SIGNAL(searchResultsCount(int)) );
connect( m_private, SIGNAL(searchResultEntry(const SearchNode&,const QList<SearchAlgo>&,int,double)),
this, SIGNAL(searchResultEntry(const SearchNode&,const QList<SearchAlgo>&,int,double)) );
connect( m_private, SIGNAL(searchFinished()) , this, SIGNAL(searchFinished()) );
connect( m_private, SIGNAL(errorHappened(const QString&)), this, SIGNAL(errorHappened(const QString&)) );
// Start the event loop if we are our own thread
if ( this->isRunning() )
{
// Start the event loop
this->exec();
}
else // Fake the start (in safe mode without threading)
emit started();
}
void thread::safeStart()
{
// Invoke the "thread" method only
this->run();
}
void thread::run()
{
// Delete the old object on restart
if ( m_private )
delete m_private;
// Create our private object
m_private = new thread_private;
// And connect its signals to ours
connect( m_private, SIGNAL(databaseOpened(bool)), this, SIGNAL(databaseOpened(bool)) );
connect( m_private, SIGNAL(databaseOpening()) , this, SIGNAL(databaseOpening()) );
connect( m_private, SIGNAL(databaseClosed()) , this, SIGNAL(databaseClosed()) );
connect( m_private, SIGNAL(searchPreparing()) , this, SIGNAL(searchPreparing()) );
connect( m_private, SIGNAL(searchPrepared()) , this, SIGNAL(searchPrepared()) );
connect( m_private, SIGNAL(searchStarted()) , this, SIGNAL(searchStarted()) );
connect( m_private, SIGNAL(searchProgress(double)) , this, SIGNAL(searchProgress(double)) );
connect( m_private, SIGNAL(searchResultsCount(int)), this, SIGNAL(searchResultsCount(int)) );
connect( m_private, SIGNAL(searchResultEntry(const SearchNode&,const QList<SearchAlgo>&,int,double)),
this, SIGNAL(searchResultEntry(const SearchNode&,const QList<SearchAlgo>&,int,double)) );
connect( m_private, SIGNAL(searchFinished()) , this, SIGNAL(searchFinished()) );
connect( m_private, SIGNAL(errorHappened(const QString&)), this, SIGNAL(errorHappened(const QString&)) );
// Start the event loop if we are our own thread
if ( this->isRunning() )
{
// Start the event loop
this->exec();
}
else // Fake the start (in safe mode without threading)
emit started();
}
To copy to clipboard, switch view to plain text mode
Bookmarks