DolphinQt2: Avoid an unnecessary string conversion
This commit is contained in:
parent
68152faf43
commit
f2103c1b51
|
@ -18,8 +18,7 @@ const QSize GAMECUBE_BANNER_SIZE(96, 32);
|
|||
GameListModel::GameListModel(QObject* parent) : QAbstractTableModel(parent)
|
||||
{
|
||||
connect(&m_tracker, &GameTracker::GameLoaded, this, &GameListModel::UpdateGame);
|
||||
connect(&m_tracker, &GameTracker::GameRemoved, this,
|
||||
[this](const QString& path) { RemoveGame(path.toStdString()); });
|
||||
connect(&m_tracker, &GameTracker::GameRemoved, this, &GameListModel::RemoveGame);
|
||||
connect(&Settings::Instance(), &Settings::PathAdded, &m_tracker, &GameTracker::AddDirectory);
|
||||
connect(&Settings::Instance(), &Settings::PathRemoved, &m_tracker, &GameTracker::RemoveDirectory);
|
||||
connect(&Settings::Instance(), &Settings::PathReloadRequested, &m_tracker,
|
||||
|
|
|
@ -90,9 +90,7 @@ void GameTracker::StartInternal()
|
|||
auto emit_game_loaded = [this](const std::shared_ptr<const UICommon::GameFile>& game) {
|
||||
emit GameLoaded(std::move(game));
|
||||
};
|
||||
auto emit_game_removed = [this](const std::string& path) {
|
||||
emit GameRemoved(QString::fromStdString(path));
|
||||
};
|
||||
auto emit_game_removed = [this](const std::string& path) { emit GameRemoved(path); };
|
||||
|
||||
std::lock_guard<std::mutex> lk(m_mutex);
|
||||
|
||||
|
@ -159,7 +157,7 @@ void GameTracker::RemoveDirectoryInternal(const QString& dir)
|
|||
removePath(path);
|
||||
m_tracked_files.remove(path);
|
||||
if (m_started)
|
||||
emit GameRemoved(path);
|
||||
emit GameRemoved(path.toStdString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +193,7 @@ void GameTracker::UpdateDirectoryInternal(const QString& dir)
|
|||
{
|
||||
m_tracked_files.remove(missing);
|
||||
if (m_started)
|
||||
GameRemoved(missing);
|
||||
GameRemoved(missing.toStdString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +203,7 @@ void GameTracker::UpdateFileInternal(const QString& file)
|
|||
if (QFileInfo(file).exists())
|
||||
{
|
||||
if (m_started)
|
||||
GameRemoved(file);
|
||||
GameRemoved(file.toStdString());
|
||||
addPath(file);
|
||||
LoadGame(file);
|
||||
}
|
||||
|
@ -213,7 +211,7 @@ void GameTracker::UpdateFileInternal(const QString& file)
|
|||
{
|
||||
m_tracked_files.remove(file);
|
||||
if (m_started)
|
||||
emit GameRemoved(file);
|
||||
emit GameRemoved(file.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QMap>
|
||||
|
@ -39,7 +40,7 @@ public:
|
|||
|
||||
signals:
|
||||
void GameLoaded(std::shared_ptr<const UICommon::GameFile> game);
|
||||
void GameRemoved(const QString& path);
|
||||
void GameRemoved(const std::string& path);
|
||||
|
||||
private:
|
||||
void LoadCache();
|
||||
|
@ -80,3 +81,4 @@ private:
|
|||
};
|
||||
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<const UICommon::GameFile>)
|
||||
Q_DECLARE_METATYPE(std::string)
|
||||
|
|
Loading…
Reference in New Issue