From eaafc489fc625d71e4ce797cebb28056746896bc Mon Sep 17 00:00:00 2001 From: Tom Tanner Date: Thu, 9 Jul 2015 18:58:34 +0100 Subject: Reworking the Custom Executables list and the shortcut popup. Certainly fixes the issue where the 'toolbar' entry doesn't lose the cross. One of the 'find' methods ignored case but none of the others did, so I've made it not ignore case either. Also made the code to get the desktop/startmenu paths use a more up-to-date API --- src/executableslist.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/executableslist.cpp') diff --git a/src/executableslist.cpp b/src/executableslist.cpp index badf0813..91bfd39e 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -55,14 +55,6 @@ static QDataStream &operator>>(QDataStream &in, Executable &obj) return in; } - -void registerExecutable() -{ - qRegisterMetaType("Executable"); - qRegisterMetaTypeStreamOperators("Executable"); -} - - ExecutablesList::ExecutablesList() { } @@ -102,23 +94,23 @@ void ExecutablesList::getExecutables(std::vector::const_iterator &be const Executable &ExecutablesList::find(const QString &title) const { - for (std::vector::const_iterator iter = m_Executables.begin(); iter != m_Executables.end(); ++iter) { - if (iter->m_Title == title) { - return *iter; + for (Executable const &exe : m_Executables) { + if (exe.m_Title == title) { + return exe; } } - throw std::runtime_error("invalid name"); + throw std::runtime_error("invalid name " + title.toStdString()); } Executable &ExecutablesList::find(const QString &title) { for (Executable &exe : m_Executables) { - if (QString::compare(exe.m_Title, title, Qt::CaseInsensitive) == 0) { + if (exe.m_Title == title) { return exe; } } - throw std::runtime_error("invalid name"); + throw std::runtime_error("invalid name " + title.toStdString()); } @@ -220,7 +212,7 @@ void ExecutablesList::addExecutable(const QString &title, const QString &executa void ExecutablesList::remove(const QString &title) { for (std::vector::iterator iter = m_Executables.begin(); iter != m_Executables.end(); ++iter) { - if (iter->m_Custom && (iter->m_Title == title)) { + if (iter->m_Custom && iter->m_Title == title) { m_Executables.erase(iter); break; } -- cgit v1.3.1