From e2fd299fc588962b19b91d3e11f7bf274080de84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 30 Sep 2015 00:11:00 +0200 Subject: GH-253 implement launching instances from command line --- logic/InstanceList.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'logic/InstanceList.cpp') diff --git a/logic/InstanceList.cpp b/logic/InstanceList.cpp index 2ff0c913..22b36748 100644 --- a/logic/InstanceList.cpp +++ b/logic/InstanceList.cpp @@ -362,23 +362,16 @@ int InstanceList::add(InstancePtr t) InstancePtr InstanceList::getInstanceById(QString instId) const { - if (m_instances.isEmpty()) - { + if(instId.isEmpty()) return InstancePtr(); - } - - QListIterator iter(m_instances); - InstancePtr inst; - while (iter.hasNext()) + for(auto & inst: m_instances) { - inst = iter.next(); if (inst->id() == instId) - break; + { + return inst; + } } - if (inst->id() != instId) - return InstancePtr(); - else - return iter.peekPrevious(); + return InstancePtr(); } QModelIndex InstanceList::getInstanceIndexById(const QString &id) const -- cgit v1.2.3