Settings: Implement NetPlay globals

This commit is contained in:
spycrab 2017-08-01 12:55:21 +02:00
parent 2e29509b75
commit 78cc759d56
4 changed files with 44 additions and 10 deletions

View File

@ -416,16 +416,7 @@ QString GameList::GetSelectedGame() const
return QStringLiteral("");
}
<<<<<<< HEAD
GameListModel* GameList::GetModel() const
{
return m_model;
}
void GameList::SetPreferredView(bool table)
=======
void GameList::SetPreferredView(bool list)
>>>>>>> af63a1c36d... tmp.
{
m_prefer_list = list;
Settings::Instance().SetPreferredView(list);

View File

@ -20,7 +20,6 @@ class GameList final : public QStackedWidget
public:
explicit GameList(QWidget* parent = nullptr);
QString GetSelectedGame() const;
GameListModel* GetModel() const;
void SetListView() { SetPreferredView(true); }
void SetGridView() { SetPreferredView(false); }

View File

@ -11,6 +11,7 @@
#include "Common/FileUtil.h"
#include "Common/StringUtil.h"
#include "Core/ConfigManager.h"
#include "DolphinQt2/GameList/GameListModel.h"
#include "DolphinQt2/Settings.h"
#include "InputCommon/InputConfig.h"
@ -171,3 +172,29 @@ void Settings::SetLogConfigVisible(bool visible)
emit LogConfigVisibilityChanged(visible);
}
}
GameListModel* Settings::GetGameListModel() const
{
static GameListModel* model = new GameListModel;
return model;
}
NetPlayClient* Settings::GetNetPlayClient()
{
return m_client.get();
}
void Settings::ResetNetPlayClient(NetPlayClient* client)
{
m_client.reset(client);
}
NetPlayServer* Settings::GetNetPlayServer()
{
return m_server.get();
}
void Settings::ResetNetPlayServer(NetPlayServer* server)
{
m_server.reset(server);
}

View File

@ -4,16 +4,22 @@
#pragma once
#include <memory>
#include <QObject>
#include <QVector>
#include "Common/NonCopyable.h"
#include "Core/NetPlayClient.h"
#include "Core/NetPlayServer.h"
namespace DiscIO
{
enum class Language;
}
class GameListModel;
class InputConfig;
// UI settings to be stored in the config directory.
@ -57,6 +63,15 @@ public:
void IncreaseVolume(int volume);
void DecreaseVolume(int volume);
// NetPlay
NetPlayClient* GetNetPlayClient();
void ResetNetPlayClient(NetPlayClient* client = nullptr);
NetPlayServer* GetNetPlayServer();
void ResetNetPlayServer(NetPlayServer* server = nullptr);
// Other
GameListModel* GetGameListModel() const;
signals:
void ThemeChanged();
void PathAdded(const QString&);
@ -68,5 +83,7 @@ signals:
void LogConfigVisibilityChanged(bool visible);
private:
std::unique_ptr<NetPlayClient> m_client;
std::unique_ptr<NetPlayServer> m_server;
Settings();
};