This commit is contained in:
Cekis
2023-08-27 21:34:07 -07:00
8 changed files with 88 additions and 944 deletions

View File

@@ -17,7 +17,6 @@
#include "ConfigGodClient.h"
#include "FavoritesWindow.h"
#include "GodClientData.h"
#include "GodClientPerforce.h"
#include "IconLoader.h"
#include "MainFrame.h"
#include "ServerCommander.h"
@@ -280,19 +279,6 @@ void ActionsObjectTemplate::onServerRevert()
return;
}
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(getServerObjectTemplateTpfFilePath());
sv.push_back(getServerObjectTemplateIffFilePath());
std::string result;
if(!GodClientPerforce::getInstance().revertFiles(sv, false, result))
{
const std::string msg = "Could not revert class files: " + sv [0] + ", " + sv [1] + "\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
m_serverRefresh->doActivate();
}
@@ -314,14 +300,6 @@ void ActionsObjectTemplate::onServerView() const
std::string result;
//-- map the desired ObjectTemplate classpath to a local source directory
if(!GodClientPerforce::getInstance().getFileMapping(path, dummy, dummy, local, result))
{
const std::string msg = "Can't 'where' directory. User error? Perhaps.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
doEditFile(local);
}
@@ -340,28 +318,6 @@ void ActionsObjectTemplate::onServerEdit()
std::string local;
std::string result;
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(getServerObjectTemplateTpfFilePath());
sv.push_back(getServerObjectTemplateIffFilePath());
if(!GodClientPerforce::getInstance().editFiles(sv, result))
{
const std::string msg = "Could not open file(s) for perforce edit. View Will be read-only." + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
// TODO: missing a return here???
}
//-- map the desired ObjectTemplate classpath to a local source directory
if(!GodClientPerforce::getInstance().getFileMapping(sv [0], dummy, dummy, local, result))
{
const std::string msg = "Can't 'where' directory. User error? Perhaps.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
m_serverRefresh->doActivate();
doEditFile(local);
}
@@ -388,62 +344,7 @@ void ActionsObjectTemplate::onServerNew()
actualPath = actualPath.substr(0, slashpos);
}
const char * const srcPath = NON_NULL(ConfigGodClient::getData().templateServerSourcePath);
std::string path = GodClientPerforce::concatenateSubpath(srcPath, actualPath);
std::string dummy;
std::string local;
std::string result;
//-- map the desired ObjectTemplate classpath to a local source directory
if(!GodClientPerforce::getInstance().getFileMapping(path, dummy, dummy, local, result))
{
const std::string msg = "Can't 'where' directory. User error? Perhaps.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
const QString qselection = QFileDialog::getSaveFileName(local.c_str(), "*.tpf",&MainFrame::getInstance());
if(qselection == QString::null)
return;
std::string selection = qselection.latin1();
if(selection.size() < 4 || selection.substr(selection.size() - 4) != ms_objectTemplateSourceExtension)
selection += ms_objectTemplateSourceExtension;
UNREF(selection);
//-- discover the depot path to the .class file
size_t dsrc_pos = selection.find("\\dsrc\\");
if(dsrc_pos == selection.npos) //lint !e737 implicit promotion, bug in STL with size_t and std::string::npos being of different signage
dsrc_pos = selection.find("/dsrc/");
if(dsrc_pos == selection.npos) //lint !e737 implicit promotion, bug in STL with size_t and std::string::npos being of different signage
{
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", "Can't translate ObjectTemplate path to Iff path."));
return;
}
std::string compiledLocalPath = selection;
IGNORE_RETURN(compiledLocalPath.replace(dsrc_pos + 1, 4, "data"));
IGNORE_RETURN(compiledLocalPath.replace(compiledLocalPath.size() - 6, 6, "iff"));
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(selection);
sv.push_back(compiledLocalPath);
if(!GodClientPerforce::getInstance().addFiles(sv, result))
{
const std::string msg = "Unable to add new files to perforce.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
m_serverRefresh->doActivate();
doEditFile(selection);
}
//-----------------------------------------------------------------------
@@ -486,21 +387,6 @@ void ActionsObjectTemplate::onServerSubmit()
if (retval == QMessageBox::No)
return;
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(getServerObjectTemplateTpfFilePath());
sv.push_back(getServerObjectTemplateIffFilePath());
std::string result;
IGNORE_RETURN(GodClientPerforce::getInstance().revertFiles(sv, true, result));
if(!GodClientPerforce::getInstance().submitFiles(sv, result))
{
const std::string msg = "Could not submit file(s) to perforce! Beanhead.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
m_serverRefresh->doActivate();
}
@@ -525,7 +411,7 @@ const std::string ActionsObjectTemplate::getServerObjectTemplateTpfFilePath() co
return "";
const char* const srcPath = NON_NULL(ConfigGodClient::getData().templateServerSourcePath);
return GodClientPerforce::concatenateSubpath(srcPath, m_selectedServerPath) + ms_objectTemplateSourceExtension;
return srcPath;
}
//-----------------------------------------------------------------------
@@ -536,7 +422,7 @@ const std::string ActionsObjectTemplate::getServerObjectTemplateIffFilePath() co
return "";
const char* const iffPath = NON_NULL(ConfigGodClient::getData().templateServerIffPath);
return GodClientPerforce::concatenateSubpath(iffPath, m_selectedServerPath) + ms_objectTemplateCompiledExtension;
return iffPath;
}
//-----------------------------------------------------------------------
@@ -595,19 +481,6 @@ void ActionsObjectTemplate::onClientRevert()
return;
}
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(getClientObjectTemplateTpfFilePath());
sv.push_back(getClientObjectTemplateIffFilePath());
std::string result;
if(!GodClientPerforce::getInstance().revertFiles(sv, false, result))
{
const std::string msg = "Could not revert class files: " + sv [0] + ", " + sv [1] + "\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
m_clientRefresh->doActivate();
}
@@ -628,14 +501,6 @@ void ActionsObjectTemplate::onClientView() const
const std::string path = getClientObjectTemplateTpfFilePath();
//-- map the desired ObjectTemplate classpath to a local source directory
if(!GodClientPerforce::getInstance().getFileMapping(path, dummy, dummy, local, result))
{
const std::string msg = "Can't 'where' directory. User error? Perhaps.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
doEditFile(local);
}
@@ -654,25 +519,6 @@ void ActionsObjectTemplate::onClientEdit()
std::string local;
std::string result;
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(getClientObjectTemplateTpfFilePath());
sv.push_back(getClientObjectTemplateIffFilePath());
if(!GodClientPerforce::getInstance().editFiles(sv, result))
{
const std::string msg = "Could not open file(s) for perforce edit. View Will be read-only.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
//-- map the desired ObjectTemplate classpath to a local source directory
if(!GodClientPerforce::getInstance().getFileMapping(sv [0], dummy, dummy, local, result))
{
const std::string msg = "Can't 'where' directory. User error? Perhaps.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
m_clientRefresh->doActivate();
doEditFile(local);
}
@@ -699,62 +545,7 @@ void ActionsObjectTemplate::onClientNew()
actualPath = actualPath.substr(0, slashpos);
}
const char* const srcPath = NON_NULL(ConfigGodClient::getData().templateClientSourcePath);
std::string path = GodClientPerforce::concatenateSubpath(srcPath, actualPath);
std::string dummy;
std::string local;
std::string result;
//-- map the desired ObjectTemplate classpath to a local source directory
if(!GodClientPerforce::getInstance().getFileMapping(path, dummy, dummy, local, result))
{
const std::string msg = "Can't 'where' directory. User error? Perhaps.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
const QString qselection = QFileDialog::getSaveFileName(local.c_str(), "*.tpf",&MainFrame::getInstance());
if(qselection == QString::null)
return;
std::string selection = qselection.latin1();
if(selection.size() < 4 || selection.substr(selection.size() - 4) != ms_objectTemplateSourceExtension)
selection += ms_objectTemplateSourceExtension;
UNREF(selection);
//-- discover the depot path to the .class file
size_t dsrc_pos = selection.find("\\dsrc\\");
if(dsrc_pos == selection.npos) //lint !e737 implicit promotion, bug in STL with size_t and std::string::npos being of different signage
dsrc_pos = selection.find("/dsrc/");
if(dsrc_pos == selection.npos) //lint !e737 implicit promotion, bug in STL with size_t and std::string::npos being of different signage
{
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", "Can't translate ObjectTemplate path to Iff path."));
return;
}
std::string compiledLocalPath = selection;
IGNORE_RETURN(compiledLocalPath.replace(dsrc_pos + 1, 4, "data"));
IGNORE_RETURN(compiledLocalPath.replace(compiledLocalPath.size() - 6, 6, "iff"));
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(selection);
sv.push_back(compiledLocalPath);
if(!GodClientPerforce::getInstance().addFiles(sv, result))
{
const std::string msg = "Unable to add new files to perforce.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
m_clientRefresh->doActivate();
doEditFile(selection);
}
//-----------------------------------------------------------------------
@@ -775,21 +566,6 @@ void ActionsObjectTemplate::onClientSubmit()
if (retval == QMessageBox::No)
return;
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(getClientObjectTemplateTpfFilePath());
sv.push_back(getClientObjectTemplateIffFilePath());
std::string result;
IGNORE_RETURN(GodClientPerforce::getInstance().revertFiles(sv, true, result));
if(!GodClientPerforce::getInstance().submitFiles(sv, result))
{
const std::string msg = "Could not submit file(s) to perforce! Beanhead.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
m_clientRefresh->doActivate();
}
@@ -814,7 +590,7 @@ const std::string ActionsObjectTemplate::getClientObjectTemplateTpfFilePath() co
return "";
const char* const srcPath = NON_NULL(ConfigGodClient::getData().templateClientSourcePath);
return GodClientPerforce::concatenateSubpath(srcPath, m_selectedClientPath) + ms_objectTemplateSourceExtension;
return srcPath;
}
//-----------------------------------------------------------------------
@@ -825,7 +601,7 @@ const std::string ActionsObjectTemplate::getClientObjectTemplateIffFilePath() co
return "";
const char* const iffPath = NON_NULL(ConfigGodClient::getData().templateClientIffPath);
return GodClientPerforce::concatenateSubpath(iffPath, m_selectedClientPath) + ms_objectTemplateCompiledExtension;
return iffPath;
}
//-----------------------------------------------------------------------

View File

@@ -16,7 +16,6 @@
#include "ActionHack.h"
#include "ConfigGodClient.h"
#include "GodClientData.h"
#include "GodClientPerforce.h"
#include "IconLoader.h"
#include "MainFrame.h"
#include "ServerCommander.h"
@@ -188,19 +187,6 @@ void ActionsScript::onRevert()
return;
}
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(getScriptFilePath());
sv.push_back(getClassFilePath());
std::string result;
if(!GodClientPerforce::getInstance().revertFiles(sv, false, result))
{
const std::string msg = "Could not revert class files: " + sv [0] + ", " + sv [1] + "\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
refresh->doActivate();
}
@@ -222,14 +208,6 @@ void ActionsScript::onView() const
std::string result;
//-- map the desired script classpath to a local source directory
if(!GodClientPerforce::getInstance().getFileMapping(path, dummy, dummy, local, result))
{
const std::string msg = "Can't 'where' directory. User error? Perhaps.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
doEditFile(local);
}
@@ -247,27 +225,6 @@ void ActionsScript::onEdit()
std::string dummy;
std::string local;
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(getScriptFilePath());
sv.push_back(getClassFilePath());
std::string result;
if(!GodClientPerforce::getInstance().editFiles(sv, result))
{
const std::string msg = "Could not open file(s) for perforce edit. View Will be read-only.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
//-- map the desired script classpath to a local source directory
if(!GodClientPerforce::getInstance().getFileMapping(sv [0], dummy, dummy, local, result))
{
const std::string msg = "Can't 'where' directory. User error? Perhaps.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
refresh->doActivate();
doEditFile(local);
}
@@ -295,63 +252,7 @@ void ActionsScript::onNew()
actualPath = actualPath.substr(0, slashpos);
}
const char * const srcPath = NON_NULL(ConfigGodClient::getData().scriptSourcePath);
std::string path = GodClientPerforce::concatenateSubpath(srcPath, actualPath);
std::string dummy;
std::string local;
std::string result;
//-- map the desired script classpath to a local source directory
if(!GodClientPerforce::getInstance().getFileMapping(path, dummy, dummy, local, result))
{
const std::string msg = "Can't 'where' directory. User error? Perhaps.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
const QString qselection = QFileDialog::getSaveFileName(local.c_str(), "*.script", &MainFrame::getInstance());
if(qselection == QString::null)
return;
std::string selection = qselection.latin1();
if(selection.size() < 7 || selection.substr(selection.size() - 7) != ".script")
selection += ".script";
UNREF(selection);
//-- discover the depot path to the .class file
size_t dsrc_pos = selection.find("\\dsrc\\");
if(dsrc_pos == selection.npos) //lint !e737 implicit promotion, bug in STL with size_t and std::string::npos being of different signage
dsrc_pos = selection.find("/dsrc/");
if(dsrc_pos == selection.npos) //lint !e737 implicit promotion, bug in STL with size_t and std::string::npos being of different signage
{
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", "Can't translate script path to class path."));
return;
}
std::string compiledLocalPath = selection;
IGNORE_RETURN(compiledLocalPath.replace(dsrc_pos + 1, 4, "data"));
IGNORE_RETURN(compiledLocalPath.replace(compiledLocalPath.size() - 6, 6, "class"));
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(selection);
sv.push_back(compiledLocalPath);
if(!GodClientPerforce::getInstance().addFiles(sv, result))
{
const std::string msg = "Unable to add new files to perforce." + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return;
}
refresh->doActivate();
doEditFile(selection);
}
//----------------------------------------------------------------------
@@ -393,21 +294,6 @@ void ActionsScript::onSubmit()
if (retval == QMessageBox::No)
return;
GodClientPerforce::StringVector sv;
sv.reserve(2);
sv.push_back(getScriptFilePath());
sv.push_back(getClassFilePath());
std::string result;
IGNORE_RETURN(GodClientPerforce::getInstance().revertFiles(sv, true, result));
if(!GodClientPerforce::getInstance().submitFiles(sv, result))
{
const std::string msg = "Could not submit file(s) to perforce! Beanhead.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
refresh->doActivate();
}
@@ -454,7 +340,7 @@ const std::string ActionsScript::getScriptFilePath() const
return "";
const char* const srcPath = NON_NULL(ConfigGodClient::getData().scriptSourcePath);
return GodClientPerforce::concatenateSubpath(srcPath, m_selectedPath) + ".script";
return srcPath;
}
//----------------------------------------------------------------------
@@ -465,7 +351,7 @@ const std::string ActionsScript::getClassFilePath() const
return "";
const char* const classPath = NON_NULL(ConfigGodClient::getData().scriptClassPath);
return GodClientPerforce::concatenateSubpath(classPath, m_selectedPath) + ".class";
return classPath;
}
//----------------------------------------------------------------------

View File

@@ -33,7 +33,6 @@
#include "FilesystemTree.h"
#include "ConfigGodClient.h"
#include "MainFrame.h"
#include "GodClientPerforce.h"
#include "ServerObjectData.h"
#include <hash_set>
#include <string>
@@ -178,112 +177,6 @@ void BuildoutAreaSupport::getBuildoutAreaList(std::string const &sceneName, std:
areaPath += "/datatables/buildout/";
areaPath += sceneName;
if (ConfigGodClient::getConnectToPerforce())
{
// scan the datatable directory for the specified scene and update status
std::string result;
AbstractFilesystemTree *afst = GodClientPerforce::getInstance().getFileTree(areaPath, "tab", result, GodClientPerforce::FileState_depot);
if (afst)
{
AbstractFilesystemTree::Node const * const node = afst->getRootNode();
if (node)
{
for (AbstractFilesystemTree::Node::ConstIterator i = node->begin (); i != node->end (); ++i)
{
std::string name((*i)->name);
if (name.size() > 4)
name.erase(name.size()-4, 4);
bool found = false;
for (unsigned int areaIndex = 0; areaIndex < areaNames.size(); ++areaIndex)
{
if (areaNames[areaIndex] == name)
{
areaStatuses[areaIndex] = "Active";
found = true;
}
}
if (!found)
{
areaNames.push_back(name);
areaLocations.push_back();
areaStatuses.push_back("Inactive");
}
}
}
delete afst;
}
afst = GodClientPerforce::getInstance().getFileTree(areaPath, "tab", result, GodClientPerforce::FileState_add);
if (afst)
{
AbstractFilesystemTree::Node const * const node = afst->getRootNode();
if (node)
{
for (AbstractFilesystemTree::Node::ConstIterator i = node->begin (); i != node->end (); ++i)
{
std::string name((*i)->name);
if (name.size() > 4)
name.erase(name.size()-4, 4);
bool found = false;
for (unsigned int areaIndex = 0; areaIndex < areaNames.size(); ++areaIndex)
{
if (areaNames[areaIndex] == name)
{
areaStatuses[areaIndex] = "New";
found = true;
}
}
if (!found)
{
areaNames.push_back(name);
areaLocations.push_back();
areaStatuses.push_back("New+Inactive");
}
}
}
delete afst;
}
afst = GodClientPerforce::getInstance().getFileTree(areaPath, "tab", result, GodClientPerforce::FileState_edit);
if (afst)
{
AbstractFilesystemTree::Node const * const node = afst->getRootNode();
if (node)
{
for (AbstractFilesystemTree::Node::ConstIterator i = node->begin (); i != node->end (); ++i)
{
std::string name((*i)->name);
if (name.size() > 4)
name.erase(name.size()-4, 4);
bool found = false;
for (unsigned int areaIndex = 0; areaIndex < areaNames.size(); ++areaIndex)
{
if (areaNames[areaIndex] == name)
{
areaStatuses[areaIndex] = "Edit";
found = true;
}
}
if (!found)
{
areaNames.push_back(name);
areaLocations.push_back();
areaStatuses.push_back("Edit+Inactive");
}
}
}
delete afst;
}
}
else
{
FilesystemTree* fst = new FilesystemTree();
fst->setRootPath(areaPath);
@@ -320,7 +213,6 @@ void BuildoutAreaSupport::getBuildoutAreaList(std::string const &sceneName, std:
delete fst;
}
}
// ----------------------------------------------------------------------
@@ -330,72 +222,6 @@ bool BuildoutAreaSupport::openBuildoutFilesForEditing( const std::string &areaNa
std::string serverTabFilename, serverIffFilename, clientTabFilename, clientIffFilename;
getBuildoutAreaTableNames(areaName, serverTabFilename, serverIffFilename, clientTabFilename, clientIffFilename);
if (ConfigGodClient::getConnectToPerforce())
{
// open the files for edit, in case they already exist
std::vector<std::string> perforceFiles;
perforceFiles.push_back(serverTabFilename);
perforceFiles.push_back(serverIffFilename);
perforceFiles.push_back(clientTabFilename);
perforceFiles.push_back(clientIffFilename);
std::string result;
//warn, and possibly abort, if anyone else has the buildout files checked out already
std::vector<std::string> alsoOpenedBy;
for(std::vector<std::string>::const_iterator it = perforceFiles.begin(); it != perforceFiles.end(); ++it)
{
bool ok = GodClientPerforce::getInstance().fileAlsoOpenedBy(*it, alsoOpenedBy, result);
if (!ok)
{
QMessageBox::critical (0, "GodClientPerforce::getInstance().fileAlsoOpenedBy error!", result.c_str());
return false;
}
if(!alsoOpenedBy.empty())
{
//build the warning message string
std::string msg = "File:\n";
msg += *it + " is also checked out by:\n";
for(std::vector<std::string>::const_iterator it2 = alsoOpenedBy.begin(); it2 != alsoOpenedBy.end(); ++it2)
{
msg += *it2 + "\n";
}
if ( !Game::getSinglePlayer() )
{
QMessageBox::warning (0, "I can not check these files out because...", msg.c_str(), QMessageBox::Ok, 0 );
return false;
}
QMessageBox::warning (0, "Uh oh!", msg.c_str(), QMessageBox::Ok, 0 );
}
}
preModifyBuildoutArea(serverTabFilename, serverIffFilename, clientTabFilename, clientIffFilename);
if ( Game::getSinglePlayer() )
{
if (!GodClientPerforce::getInstance().editFiles(perforceFiles, result))
{
const std::string msg = "Could not open file(s) for perforce edit.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return false;
}
}
else
{
if (!GodClientPerforce::getInstance().editFilesAndLock(perforceFiles, result))
{
const std::string msg = "Could not open file(s) for perforce edit and lock!\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
return false;
}
}
}
return true;
}
@@ -417,73 +243,6 @@ void BuildoutAreaSupport::saveBuildoutArea(std::string const &areaName)
std::vector<ServerBuildoutAreaRow> const& serverRows = cachedBuildoutArea.serverRows;
std::vector<ClientBuildoutAreaRow> const& clientRows = cachedBuildoutArea.clientRows;
if (ConfigGodClient::getConnectToPerforce())
{
// open the files for edit, in case they already exist
std::vector<std::string> perforceFiles;
perforceFiles.push_back(serverTabFilename);
perforceFiles.push_back(serverIffFilename);
perforceFiles.push_back(clientTabFilename);
perforceFiles.push_back(clientIffFilename);
std::string result;
//warn, and possibly abort, if anyone else has the buildout files checked out already
std::vector<std::string> alsoOpenedBy;
for(std::vector<std::string>::const_iterator it = perforceFiles.begin(); it != perforceFiles.end(); ++it)
{
bool ok = GodClientPerforce::getInstance().fileAlsoOpenedBy(*it, alsoOpenedBy, result);
if (!ok)
{
QMessageBox::critical (0, "Error", result.c_str());
return;
}
if(!alsoOpenedBy.empty())
{
//build the warning message string
std::string msg = "File:\n";
msg += *it + " is also checked out by:\n";
for(std::vector<std::string>::const_iterator it2 = alsoOpenedBy.begin(); it2 != alsoOpenedBy.end(); ++it2)
{
msg += *it2 + "\n";
}
msg += "Check out anyway?";
switch (QMessageBox::warning (0, "Someone else has this file checked out!", msg.c_str(), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No))
{
case QMessageBox::No:
{
QMessageBox::information (0, "Aborted", "Buildout save aborted.", QMessageBox::Ok);
return;
}
break;
default:
break;
}
}
}
preModifyBuildoutArea(serverTabFilename, serverIffFilename, clientTabFilename, clientIffFilename);
if ( Game::getSinglePlayer () )
{
if (!GodClientPerforce::getInstance().editFiles(perforceFiles, result))
{
const std::string msg = "Could not open file(s) for perforce edit.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
}
else
{
if (!GodClientPerforce::getInstance().editFilesAndLock(perforceFiles, result))
{
const std::string msg = "Could not open file(s) for perforce edit.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
}
}
// write the tables
{
@@ -523,7 +282,7 @@ void BuildoutAreaSupport::saveBuildoutArea(std::string const &areaName)
{
ConstCharCrcString const& serverTemplateName = getServerTemplateName((*i).serverTemplateCrc);
char buf[512];
IGNORE_RETURN(snprintf(buf, sizeof(buf)-1, "%d\t%d\t%s\t%d\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t",
IGNORE_RETURN(_snprintf(buf, sizeof(buf) - 1, "%d\t%d\t%s\t%d\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t",
(*i).id,
(*i).container,
serverTemplateName.getString(),
@@ -553,7 +312,7 @@ void BuildoutAreaSupport::saveBuildoutArea(std::string const &areaName)
if (eventIter == serverEventObjectMap.end())
{
std::pair<std::map<std::string, std::vector<std::string>>::iterator, bool> insertIter;
insertIter = serverEventObjectMap.insert(std::make_pair<std::string, std::vector<std::string>>(eventName, std::vector<std::string>()));
insertIter = serverEventObjectMap.insert(std::make_pair(eventName, std::vector<std::string>()));
if (insertIter.second)
eventList = &(*insertIter.first).second;
}
@@ -587,7 +346,7 @@ void BuildoutAreaSupport::saveBuildoutArea(std::string const &areaName)
{
ConstCharCrcString const& sharedTemplateName = getSharedTemplateName((*i).sharedTemplateCrc);
char buf[512];
IGNORE_RETURN(snprintf(buf, sizeof(buf)-1, "%d\t%d\t%d\t%s\t%d\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%d\n",
IGNORE_RETURN(_snprintf(buf, sizeof(buf) - 1, "%d\t%d\t%d\t%s\t%d\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%d\n",
(*i).id,
(*i).container,
(*i).type,
@@ -1243,38 +1002,7 @@ void BuildoutAreaSupportNamespace::install()
{
std::string depotPath, clientPath, localPath, result;
if (ConfigGodClient::getConnectToPerforce())
{
if (!GodClientPerforce::getInstance().getFileMapping(".", depotPath, clientPath, localPath, result))
{
WARNING(true, ("BuildoutAreaSupportNamespace::install(): %s", result.c_str()));
IGNORE_RETURN(QMessageBox::warning(0, "Perforce Buildout Warning", result.c_str()));
return;
}
std::string prefix("//depot/swg/");
prefix += depotPath.substr(12, depotPath.find("/", 12)-12);
GodClientPerforce::getInstance().getFileMapping(
prefix + "/dsrc/sku.0/sys.server/compiled/game",
s_serverSrcDepotPath, clientPath, s_serverSrcPath, result);
GodClientPerforce::getInstance().getFileMapping(
prefix + "/data/sku.0/sys.server/compiled/game",
depotPath, clientPath, s_serverDataPath, result);
GodClientPerforce::getInstance().getFileMapping(
prefix + "/dsrc/sku.0/sys.client/compiled/game",
depotPath, clientPath, s_clientSrcPath, result);
GodClientPerforce::getInstance().getFileMapping(
prefix + "/data/sku.0/sys.client/compiled/game",
depotPath, clientPath, s_clientDataPath, result);
GodClientPerforce::getInstance().getFileMapping(
prefix + "/data/sku.0/sys.server/built/game/misc/object_template_crc_string_table.iff",
depotPath, clientPath, localPath, result);
s_serverTemplateCrcStringTable.load(localPath.c_str());
}
else
{
s_clientSrcPath = ConfigGodClient::getData().localClientSrcPath;
s_clientDataPath = ConfigGodClient::getData().localClientDataPath;
s_serverSrcPath = ConfigGodClient::getData().localServerSrcPath;
@@ -1283,8 +1011,6 @@ void BuildoutAreaSupportNamespace::install()
s_serverSrcDepotPath = "";
s_serverTemplateCrcStringTable.load(ConfigGodClient::getData().localServerCrcStringTable);
}
s_installed = true;
}
@@ -1327,13 +1053,6 @@ void BuildoutAreaSupportNamespace::preModifyBuildoutArea(std::string const &serv
// create the directories to contain the files as needed
createDirectoriesForFiles(perforceFiles);
// open the files for edit, in case they already exist
if (ConfigGodClient::getConnectToPerforce())
{
std::string result;
IGNORE_RETURN(GodClientPerforce::getInstance().editFiles(perforceFiles, result));
}
}
// ----------------------------------------------------------------------
@@ -1352,30 +1071,6 @@ void BuildoutAreaSupportNamespace::postModifyBuildoutArea(std::string const &ser
writer.save(clientIffFilename.c_str());
}
if (ConfigGodClient::getConnectToPerforce())
{
std::vector<std::string> perforceFiles;
perforceFiles.push_back(serverTabFilename);
perforceFiles.push_back(serverIffFilename);
perforceFiles.push_back(clientTabFilename);
perforceFiles.push_back(clientIffFilename);
std::string result;
// add the files, in case they didn't already exist
if (!GodClientPerforce::getInstance().addFiles(perforceFiles, result))
{
const std::string msg = "Could not open file(s) for perforce add.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
// revert unchanged
if (!GodClientPerforce::getInstance().revertFiles(perforceFiles, true, result))
{
const std::string msg = "Could not revert unchanged file(s).\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
}
}
// ----------------------------------------------------------------------
@@ -2195,13 +1890,6 @@ void BuildoutAreaSupportNamespace::writeOutServerEventArea(std::string const eve
// create the directories to contain the files as needed
createDirectoriesForFiles(eventFiles);
// open the files for edit, in case they already exist
if (ConfigGodClient::getConnectToPerforce())
{
std::string result;
IGNORE_RETURN(GodClientPerforce::getInstance().editFiles(eventFiles, result));
}
StdioFile serverEventOutputFile(serverTabFilename.c_str(), "w");
if (!serverEventOutputFile.isOpen())
@@ -2232,29 +1920,6 @@ void BuildoutAreaSupportNamespace::writeOutServerEventArea(std::string const eve
writer.save(serverIffFilename.c_str());
}
if (ConfigGodClient::getConnectToPerforce())
{
std::vector<std::string> perforceFiles;
perforceFiles.push_back(serverTabFilename);
perforceFiles.push_back(serverIffFilename);
std::string result;
// add the files, in case they didn't already exist
if (!GodClientPerforce::getInstance().addFiles(perforceFiles, result))
{
const std::string msg = "Could not open file(s) for perforce add.\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
// revert unchanged
if (!GodClientPerforce::getInstance().revertFiles(perforceFiles, true, result))
{
const std::string msg = "Could not revert unchanged file(s).\n" + result;
IGNORE_RETURN(QMessageBox::warning(&MainFrame::getInstance(), "Warning", msg.c_str()));
}
}
}
}

View File

@@ -14,7 +14,6 @@
#include "ActionsObjectTemplate.h"
#include "ConfigGodClient.h"
#include "FileSystemTree.h"
#include "GodClientPerforce.h"
#include "IconLoader.h"
#include "ObjectTemplateData.h"
@@ -149,50 +148,6 @@ void ClientTemplateListView::onRefreshList()
setCursor(static_cast<int>(Qt::WaitCursor));
if ( ConfigGodClient::getConnectToPerforce() )
{
const char* const templateIffPath = NON_NULL(ConfigGodClient::getData().templateClientIffPath);
std::string result;
AbstractFilesystemTree* afst = GodClientPerforce::getInstance().getFileTree(templateIffPath, "iff", result, GodClientPerforce::FileState_depot);
if(!afst)
{
const std::string msg = "Unable to retrieve info from perforce:\n" + result;
IGNORE_RETURN(QMessageBox::warning(this, "Warning", msg.c_str()));
return;
}
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_red);
populateTemplateTree(0,&pix,&folderPix, this, afst);
}
delete afst;
afst = GodClientPerforce::getInstance().getFileTree(templateIffPath, "iff", result, GodClientPerforce::FileState_add);
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_blue);
populateTemplateTree("[NEW]",&pix,&folderPix, this, afst);
}
delete afst;
afst = GodClientPerforce::getInstance().getFileTree(templateIffPath, "iff", result, GodClientPerforce::FileState_edit);
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_violet);
populateTemplateTree("[EDIT]",&pix,&folderPix, this, afst);
}
delete afst;
}
else
{
FilesystemTree* fst = new FilesystemTree();
std::string path = ConfigGodClient::getData().localClientDataPath;
@@ -209,7 +164,6 @@ void ClientTemplateListView::onRefreshList()
}
delete fst;
}
unsetCursor();

View File

@@ -9,7 +9,6 @@
#include "ObjectTemplateData.h"
#include "ConfigGodClient.h"
#include "GodClientPerforce.h"
#include "AbstractFilesystemTree.h"
#include <qmessagebox.h>
@@ -49,14 +48,6 @@ void ObjectTemplateData::repopulate()
const char* const templatePath = NON_NULL(ConfigGodClient::getData().templateServerIffPath);
std::string result;
m_tree = GodClientPerforce::getInstance().getFileTree(templatePath, "iff", result, GodClientPerforce::FileState_depot);
if(!m_tree)
{
const std::string msg = "Unable to retrieve info from perforce:\n" + result;
IGNORE_RETURN(QMessageBox::warning(0, "Warning", msg.c_str()));
return;
}
}
// ======================================================================

View File

@@ -14,7 +14,6 @@
#include "AbstractFilesystemTree.h"
#include "ConfigGodClient.h"
#include "FilesystemTree.h"
#include "GodClientPerforce.h"
#include "IconLoader.h"
#include "fileInterface/StdioFile.h"
@@ -136,49 +135,7 @@ void ScriptListView::onRefreshList()
setCursor(static_cast<int>(Qt::WaitCursor));
if ( ConfigGodClient::getConnectToPerforce() )
{
const char* const classPath = NON_NULL(ConfigGodClient::getData().scriptClassPath);
std::string result;
AbstractFilesystemTree* afst = GodClientPerforce::getInstance().getFileTree(classPath, "class", result, GodClientPerforce::FileState_depot);
if(!afst)
{
const std::string msg = "Unable to retrieve info from perforce:\n" + result;
IGNORE_RETURN(QMessageBox::warning(this, "Warning", msg.c_str()));
return;
}
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_green);
poulateScriptTree(0,&pix,&folderPix, this, afst);
}
delete afst;
afst = GodClientPerforce::getInstance().getFileTree(classPath, "class", result, GodClientPerforce::FileState_add);
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_red);
poulateScriptTree("[NEW]",&pix,&folderPix, this, afst);
}
delete afst;
afst = GodClientPerforce::getInstance().getFileTree(classPath, "class", result, GodClientPerforce::FileState_edit);
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_violet);
poulateScriptTree("[EDIT]",&pix,&folderPix, this, afst);
}
}
else
{
FilesystemTree* fst = new FilesystemTree();
@@ -194,9 +151,7 @@ void ScriptListView::onRefreshList()
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_green);
poulateScriptTree(0,&pix,&folderPix, this, fst);
}
delete fst;
}
unsetCursor();
}

View File

@@ -14,7 +14,6 @@
#include "ActionsObjectTemplate.h"
#include "ConfigGodClient.h"
#include "FileSystemTree.h"
#include "GodClientPerforce.h"
#include "IconLoader.h"
#include "ObjectTemplateData.h"
@@ -148,50 +147,6 @@ void ServerTemplateListView::onRefreshList()
setCursor(static_cast<int>(Qt::WaitCursor));
if ( ConfigGodClient::getConnectToPerforce() )
{
const char* const templateIffPath = NON_NULL(ConfigGodClient::getData().templateServerIffPath);
std::string result;
AbstractFilesystemTree* afst = GodClientPerforce::getInstance().getFileTree(templateIffPath, "iff", result, GodClientPerforce::FileState_depot);
if(!afst)
{
const std::string msg = "Unable to retrieve info from perforce:\n" + result;
IGNORE_RETURN(QMessageBox::warning(this, "Warning", msg.c_str()));
return;
}
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_blue);
populateTemplateTree(0,&pix,&folderPix, this, afst);
}
delete afst;
afst = GodClientPerforce::getInstance().getFileTree(templateIffPath, "iff", result, GodClientPerforce::FileState_add);
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_red);
populateTemplateTree("[NEW]",&pix,&folderPix, this, afst);
}
delete afst;
afst = GodClientPerforce::getInstance().getFileTree(templateIffPath, "iff", result, GodClientPerforce::FileState_edit);
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_violet);
populateTemplateTree("[EDIT]",&pix,&folderPix, this, afst);
}
delete afst;
}
else
{
FilesystemTree* fst = new FilesystemTree();
std::string path = ConfigGodClient::getData().localServerDataPath;
@@ -208,7 +163,6 @@ void ServerTemplateListView::onRefreshList()
}
delete fst;
}
unsetCursor();

View File

@@ -14,7 +14,6 @@
#include "ActionsObjectTemplate.h"
#include "ConfigGodClient.h"
#include "FileSystemTree.h"
#include "GodClientPerforce.h"
#include "IconLoader.h"
#include "ObjectTemplateData.h"
@@ -149,42 +148,6 @@ void TemplateListView::onRefreshList()
const char* const templateIffPath = NON_NULL(ConfigGodClient::getData().templateServerIffPath);
std::string result;
AbstractFilesystemTree* afst = GodClientPerforce::getInstance().getFileTree(templateIffPath, "iff", result, GodClientPerforce::FileState_depot);
if(!afst)
{
const std::string msg = "Unable to retrieve info from perforce:\n" + result;
IGNORE_RETURN(QMessageBox::warning(this, "Warning", msg.c_str()));
return;
}
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_blue);
populateTemplateTree(0,&pix,&folderPix, this, afst);
}
delete afst;
afst = GodClientPerforce::getInstance().getFileTree(templateIffPath, "iff", result, GodClientPerforce::FileState_add);
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_red);
populateTemplateTree("[NEW]",&pix,&folderPix, this, afst);
}
delete afst;
afst = GodClientPerforce::getInstance().getFileTree(templateIffPath, "iff", result, GodClientPerforce::FileState_edit);
{
const QPixmap pix = IL_PIXMAP(hi16_mime_document);
const QPixmap folderPix = IL_PIXMAP(hi16_filesys_folder_violet);
populateTemplateTree("[EDIT]",&pix,&folderPix, this, afst);
}
delete afst;
unsetCursor();
}