settings the clientData after loading the project
This commit is contained in:
@@ -110,28 +110,10 @@ namespace Noggit::Application
|
||||
//All of the below should be Project Initalisation
|
||||
srand(::time(nullptr));
|
||||
|
||||
QSettings settings;
|
||||
QDir path(settings.value("project/game_path").toString());
|
||||
|
||||
wowpath = path.absolutePath().toStdString();
|
||||
|
||||
Log << "Game path: " << wowpath << std::endl;
|
||||
|
||||
project_path = settings.value("project/path", path.absolutePath()).toString().toStdString();
|
||||
settings.setValue("project/path", QString::fromStdString(project_path));
|
||||
|
||||
Log << "Project path: " << project_path << std::endl;
|
||||
|
||||
settings.setValue("project/game_path", path.absolutePath());
|
||||
settings.setValue("project/path", QString::fromStdString(project_path));
|
||||
}
|
||||
|
||||
void NoggitApplication::Start()
|
||||
{
|
||||
_client_data = std::make_unique<BlizzardArchive::ClientData>(wowpath.string(), BlizzardArchive::ClientVersion::WOTLK, BlizzardArchive::Locale::AUTO, project_path);
|
||||
|
||||
OpenDBs();
|
||||
|
||||
projectSelectionPage = std::make_unique<Noggit::Ui::Windows::noggitRedProjectPage>(this);
|
||||
projectSelectionPage->show();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Noggit::Application {
|
||||
}
|
||||
|
||||
BlizzardArchive::ClientData* clientData() { return _client_data.get(); };
|
||||
void clientData(std::shared_ptr<BlizzardArchive::ClientData> data) { _client_data = data; };
|
||||
|
||||
void Start();
|
||||
void Initalize(int argc, char* argv[]);
|
||||
@@ -56,10 +57,8 @@ namespace Noggit::Application {
|
||||
|
||||
std::shared_ptr<Noggit::Application::NoggitApplicationConfiguration> _applicationConfiguration;
|
||||
std::unique_ptr<Noggit::Ui::Windows::noggitRedProjectPage> projectSelectionPage;
|
||||
std::unique_ptr<BlizzardArchive::ClientData> _client_data;
|
||||
std::shared_ptr<BlizzardArchive::ClientData> _client_data;
|
||||
|
||||
std::filesystem::path wowpath;
|
||||
std::string project_path;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -47,8 +47,10 @@ namespace Noggit::Project
|
||||
{
|
||||
public:
|
||||
std::string ProjectName;
|
||||
std::string ClientPath;
|
||||
ProjectVersion ProjectVersion;
|
||||
std::shared_ptr<BlizzardDatabaseLib::BlizzardDatabase> ClientDatabase;
|
||||
std::shared_ptr<BlizzardArchive::ClientData> ClientData;
|
||||
};
|
||||
|
||||
class ApplicationProject
|
||||
@@ -198,22 +200,34 @@ namespace Noggit::Project
|
||||
if (projectConfiguration.contains("Client") && projectConfiguration["Client"].isObject())
|
||||
{
|
||||
auto projectClientConfiguration = projectConfiguration["Client"].toObject();
|
||||
|
||||
if (projectClientConfiguration.contains("ClientPath"))
|
||||
{
|
||||
project.ClientPath = projectClientConfiguration["ClientPath"].toString().toStdString();
|
||||
}
|
||||
|
||||
if (projectClientConfiguration.contains("ClientVersion"))
|
||||
{
|
||||
auto clientVersion = projectClientConfiguration["ClientVersion"].toString().toStdString();
|
||||
|
||||
auto clientVersionEnum = Noggit::Project::ProjectVersion::WOTLK;
|
||||
auto clientBuild = BlizzardDatabaseLib::Structures::Build("3.3.5.12340");
|
||||
auto clientArchiveVersion = BlizzardArchive::ClientVersion::WOTLK;
|
||||
auto clientArchiveLocale = BlizzardArchive::Locale::AUTO;
|
||||
if (clientVersion == std::string("Shadowlands"))
|
||||
{
|
||||
clientVersionEnum = Noggit::Project::ProjectVersion::SL;
|
||||
clientArchiveVersion = BlizzardArchive::ClientVersion::SL;
|
||||
clientBuild = BlizzardDatabaseLib::Structures::Build("9.1.0.39584");
|
||||
clientArchiveLocale = BlizzardArchive::Locale::enUS;
|
||||
}
|
||||
|
||||
if (clientVersion == std::string("Wrath Of The Lich King"))
|
||||
{
|
||||
clientVersionEnum = Noggit::Project::ProjectVersion::WOTLK;
|
||||
clientArchiveVersion = BlizzardArchive::ClientVersion::WOTLK;
|
||||
clientBuild = BlizzardDatabaseLib::Structures::Build("3.3.5.12340");
|
||||
clientArchiveLocale = BlizzardArchive::Locale::AUTO;
|
||||
}
|
||||
|
||||
project.ProjectVersion = clientVersionEnum;
|
||||
@@ -222,6 +236,7 @@ namespace Noggit::Project
|
||||
std::string dbdFileDirectory = _configuration->ApplicationDatabaseDefinitionsPath;
|
||||
|
||||
project.ClientDatabase = std::make_shared<BlizzardDatabaseLib::BlizzardDatabase>(dbcFileDirectory, dbdFileDirectory, clientBuild);
|
||||
project.ClientData = std::make_shared<BlizzardArchive::ClientData>(project.ClientPath, clientArchiveVersion, clientArchiveLocale, std::string(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,8 +65,9 @@ namespace Noggit::Ui
|
||||
setWindowTitle (QString::fromStdString (title.str()));
|
||||
setWindowIcon (QIcon (":/icon"));
|
||||
|
||||
setCentralWidget (_null_widget);
|
||||
OpenDBs();
|
||||
|
||||
setCentralWidget (_null_widget);
|
||||
createBookmarkList();
|
||||
|
||||
_about = new about(this);
|
||||
|
||||
@@ -60,6 +60,9 @@ namespace Noggit::Ui::Windows
|
||||
auto projectPath = std::filesystem::path(applicationProjectsFolderPath / projectName);
|
||||
_selectedProject = applicationProjectService.LoadProject(projectPath, projectName);
|
||||
|
||||
//This to not be static, but its hard to remove
|
||||
Noggit::Application::NoggitApplication::instance()->clientData(_selectedProject->ClientData);
|
||||
|
||||
close();
|
||||
projectSelectionPage = std::make_unique<Noggit::Ui::main_window>(_noggitApplication->GetConfiguration(), _selectedProject);
|
||||
projectSelectionPage->showMaximized();
|
||||
|
||||
Reference in New Issue
Block a user