Skip to content

Commit

Permalink
Merge pull request #5945 from ligfx/gamelistmodelcleanup
Browse files Browse the repository at this point in the history
Add initial paths to GameTracker after construction
  • Loading branch information
leoetlino committed Aug 20, 2017
2 parents 8d7f28e + 623026f commit cfee348
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 0 additions & 2 deletions Source/Core/DolphinQt2/GameList/GameList.cpp
Expand Up @@ -49,8 +49,6 @@ GameList::GameList(QWidget* parent) : QStackedWidget(parent)

connect(m_list, &QTableView::doubleClicked, this, &GameList::GameSelected);
connect(m_grid, &QListView::doubleClicked, this, &GameList::GameSelected);
connect(&Settings::Instance(), &Settings::PathAdded, m_model, &GameListModel::DirectoryAdded);
connect(&Settings::Instance(), &Settings::PathRemoved, m_model, &GameListModel::DirectoryRemoved);
connect(m_model, &QAbstractItemModel::rowsInserted, this, &GameList::ConsiderViewChange);
connect(m_model, &QAbstractItemModel::rowsRemoved, this, &GameList::ConsiderViewChange);

Expand Down
7 changes: 5 additions & 2 deletions Source/Core/DolphinQt2/GameList/GameListModel.cpp
Expand Up @@ -14,8 +14,11 @@ GameListModel::GameListModel(QObject* parent) : QAbstractTableModel(parent)
{
connect(&m_tracker, &GameTracker::GameLoaded, this, &GameListModel::UpdateGame);
connect(&m_tracker, &GameTracker::GameRemoved, this, &GameListModel::RemoveGame);
connect(this, &GameListModel::DirectoryAdded, &m_tracker, &GameTracker::AddDirectory);
connect(this, &GameListModel::DirectoryRemoved, &m_tracker, &GameTracker::RemoveDirectory);
connect(&Settings::Instance(), &Settings::PathAdded, &m_tracker, &GameTracker::AddDirectory);
connect(&Settings::Instance(), &Settings::PathRemoved, &m_tracker, &GameTracker::RemoveDirectory);

for (const QString& dir : Settings::Instance().GetPaths())
m_tracker.AddDirectory(dir);

connect(&Settings::Instance(), &Settings::ThemeChanged, [this] {
// Tell the view to repaint. The signal 'dataChanged' also seems like it would work here, but
Expand Down
4 changes: 0 additions & 4 deletions Source/Core/DolphinQt2/GameList/GameListModel.h
Expand Up @@ -48,10 +48,6 @@ class GameListModel final : public QAbstractTableModel
void UpdateGame(QSharedPointer<GameFile> game);
void RemoveGame(const QString& path);

signals:
void DirectoryAdded(const QString& dir);
void DirectoryRemoved(const QString& dir);

private:
// Index in m_games, or -1 if it isn't found
int FindGame(const QString& path) const;
Expand Down
3 changes: 0 additions & 3 deletions Source/Core/DolphinQt2/GameList/GameTracker.cpp
Expand Up @@ -28,9 +28,6 @@ GameTracker::GameTracker(QObject* parent) : QFileSystemWatcher(parent)
connect(m_loader, &GameLoader::GameLoaded, this, &GameTracker::GameLoaded);

m_loader_thread.start();

for (QString dir : Settings::Instance().GetPaths())
AddDirectory(dir);
}

GameTracker::~GameTracker()
Expand Down

0 comments on commit cfee348

Please sign in to comment.