Connect to Settings::PathAdded/Removed directly in GameListModel

It no longer makes sense to connect these signals in GameList, since
GameListModel is now owned by Settings.
This commit is contained in:
Michael M 2017-08-19 15:47:48 -07:00
parent 7d9ad88bc5
commit 623026f420
3 changed files with 2 additions and 8 deletions

View File

@ -49,8 +49,6 @@ GameList::GameList(QWidget* parent) : QStackedWidget(parent)
connect(m_list, &QTableView::doubleClicked, this, &GameList::GameSelected); connect(m_list, &QTableView::doubleClicked, this, &GameList::GameSelected);
connect(m_grid, &QListView::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::rowsInserted, this, &GameList::ConsiderViewChange);
connect(m_model, &QAbstractItemModel::rowsRemoved, this, &GameList::ConsiderViewChange); connect(m_model, &QAbstractItemModel::rowsRemoved, this, &GameList::ConsiderViewChange);

View File

@ -14,8 +14,8 @@ GameListModel::GameListModel(QObject* parent) : QAbstractTableModel(parent)
{ {
connect(&m_tracker, &GameTracker::GameLoaded, this, &GameListModel::UpdateGame); connect(&m_tracker, &GameTracker::GameLoaded, this, &GameListModel::UpdateGame);
connect(&m_tracker, &GameTracker::GameRemoved, this, &GameListModel::RemoveGame); connect(&m_tracker, &GameTracker::GameRemoved, this, &GameListModel::RemoveGame);
connect(this, &GameListModel::DirectoryAdded, &m_tracker, &GameTracker::AddDirectory); connect(&Settings::Instance(), &Settings::PathAdded, &m_tracker, &GameTracker::AddDirectory);
connect(this, &GameListModel::DirectoryRemoved, &m_tracker, &GameTracker::RemoveDirectory); connect(&Settings::Instance(), &Settings::PathRemoved, &m_tracker, &GameTracker::RemoveDirectory);
for (const QString& dir : Settings::Instance().GetPaths()) for (const QString& dir : Settings::Instance().GetPaths())
m_tracker.AddDirectory(dir); m_tracker.AddDirectory(dir);

View File

@ -48,10 +48,6 @@ public:
void UpdateGame(QSharedPointer<GameFile> game); void UpdateGame(QSharedPointer<GameFile> game);
void RemoveGame(const QString& path); void RemoveGame(const QString& path);
signals:
void DirectoryAdded(const QString& dir);
void DirectoryRemoved(const QString& dir);
private: private:
// Index in m_games, or -1 if it isn't found // Index in m_games, or -1 if it isn't found
int FindGame(const QString& path) const; int FindGame(const QString& path) const;