Abort after timeout must have own signal.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2019-04-02 15:29:33 +03:00
parent faff2b6d5d
commit 4adce13a4d
5 changed files with 13 additions and 1 deletions

View File

@ -74,7 +74,8 @@ DialogLayoutProgress::DialogLayoutProgress(QElapsedTimer timer, qint64 timeout,
if (timeout <= 1000)
{
emit Abort();
emit Timeout();
progressTimer->stop();
}
});
progressTimer->start(1000);

View File

@ -50,6 +50,7 @@ public:
signals:
void Abort();
void Timeout();
public slots:
void Start();

View File

@ -231,6 +231,7 @@ bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator)
progressTimer->start(1000);
#endif
connect(progress.data(), &DialogLayoutProgress::Abort, &lGenerator, &VLayoutGenerator::Abort);
connect(progress.data(), &DialogLayoutProgress::Timeout, &lGenerator, &VLayoutGenerator::Timeout);
}
progress->Start();

View File

@ -324,6 +324,14 @@ void VLayoutGenerator::Abort()
QThreadPool::globalInstance()->clear();
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutGenerator::Timeout()
{
stopGeneration.store(true);
state = LayoutErrors::Timeout;
QThreadPool::globalInstance()->clear();
}
//---------------------------------------------------------------------------------------------------------------------
bool VLayoutGenerator::IsStripOptimization() const
{

View File

@ -130,6 +130,7 @@ public:
public slots:
void Abort();
void Timeout();
private:
Q_DISABLE_COPY(VLayoutGenerator)