| 93 | } |
| 94 | |
| 95 | bool WorldList::update() |
| 96 | { |
| 97 | if (!isValid()) |
| 98 | return false; |
| 99 | |
| 100 | QList<World> newWorlds; |
| 101 | m_dir.refresh(); |
| 102 | auto folderContents = m_dir.entryInfoList(); |
| 103 | // if there are any untracked files... |
| 104 | for (QFileInfo entry : folderContents) |
| 105 | { |
| 106 | if(!entry.isDir()) |
| 107 | continue; |
| 108 | |
| 109 | World w(entry); |
| 110 | if(w.isValid()) |
| 111 | { |
| 112 | newWorlds.append(w); |
| 113 | } |
| 114 | } |
| 115 | beginResetModel(); |
| 116 | worlds.swap(newWorlds); |
| 117 | endResetModel(); |
| 118 | return true; |
| 119 | } |
| 120 | |
| 121 | void WorldList::directoryChanged(QString path) |
| 122 | { |