summaryrefslogtreecommitdiff
path: root/src/executableslist.cpp
diff options
context:
space:
mode:
authorTom Tanner <thosrtanner2@users.sourceforge.net>2015-07-09 18:58:34 +0100
committerTom Tanner <thosrtanner2@users.sourceforge.net>2015-07-09 18:58:34 +0100
commiteaafc489fc625d71e4ce797cebb28056746896bc (patch)
tree6077e6bd54efdeb29cece017159a6b35bea22cd2 /src/executableslist.cpp
parentca591dbd230bf49abad63bb13a30d04cc4725ff8 (diff)
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
Diffstat (limited to 'src/executableslist.cpp')
-rw-r--r--src/executableslist.cpp22
1 files changed, 7 insertions, 15 deletions
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>("Executable");
- qRegisterMetaTypeStreamOperators<Executable>("Executable");
-}
-
-
ExecutablesList::ExecutablesList()
{
}
@@ -102,23 +94,23 @@ void ExecutablesList::getExecutables(std::vector<Executable>::const_iterator &be
const Executable &ExecutablesList::find(const QString &title) const
{
- for (std::vector<Executable>::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<Executable>::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;
}