ui: Fixed escaping and interrupting

* Fixed crash when closing window with ESCAPE
* Fixed interrupt status message not showing when interrupting parsing
This commit is contained in:
Eberhard Graether
2016-03-10 11:47:33 +01:00
parent 66e8be4b4d
commit 527418fe2c
4 changed files with 12 additions and 7 deletions
-2
View File
@@ -1,4 +1,3 @@
ConfigManager.cpp WARNING: value path/to/nowhere is not present in config.
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:1:20
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:1:20
@@ -66,7 +65,6 @@ NetworkProtocolHelper.cpp ERROR: Failed to parse message, invalid type token
NetworkProtocolHelper.cpp ERROR: Failed to parse setActiveToken message, invalid token count
Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml
Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml
ConfigManager.cpp WARNING: value NewBool is not present in config.
INFO: file: file.cpp < 0:0 0:0>
TextAccess.cpp ERROR: Could not open file file.cpp
INFO: typedef: type <file.cpp 1:1 1:1>
+11 -4
View File
@@ -25,7 +25,15 @@ void TaskScheduler::pushTask(std::shared_ptr<Task> task)
void TaskScheduler::pushNextTask(std::shared_ptr<Task> task)
{
std::lock_guard<std::mutex> lock(m_tasksMutex);
m_tasks.push_front(task);
if (m_tasks.size() == 0)
{
m_tasks.push_front(task);
}
else
{
m_tasks.insert(m_tasks.begin() + 1, task);
}
}
void TaskScheduler::interruptCurrentTask()
@@ -142,15 +150,14 @@ void TaskScheduler::updateTasks()
while (m_tasks.size())
{
std::shared_ptr<Task> task = m_tasks.front();
m_tasks.pop_front();
m_tasksMutex.unlock();
Task::TaskState state = task->process(interrupt);
m_tasksMutex.lock();
if (state != Task::STATE_FINISHED && state != Task::STATE_CANCELED)
if (state == Task::STATE_FINISHED || state == Task::STATE_CANCELED)
{
m_tasks.push_front(task);
m_tasks.pop_front();
}
interrupt = m_interruptTask;
-1
View File
@@ -483,7 +483,6 @@ void QtMainWindow::toggleView(View* view, bool fromMenu)
void QtMainWindow::handleEscapeShortcut()
{
m_windowStack.popWindow();
MessageInterruptTasks().dispatch();
}
+1
View File
@@ -260,6 +260,7 @@ void QtWindow::keyPressEvent(QKeyEvent *event)
if (m_cancelAble && event->key() == Qt::Key_Escape)
{
emit canceled();
return;
}
QWidget::keyPressEvent(event);