Update: Fixed a specific crash when only one server was checked and configured. Added mission publication.

This commit is contained in:
sfb 2011-07-20 15:39:23 -05:00
parent 32b6e5e05f
commit d0e2b77260
2 changed files with 59 additions and 10 deletions

View file

@ -245,17 +245,63 @@ void MissionCompilerMainWindow::compileMission(bool publish)
nbMission += mc.getMissionsCount(); nbMission += mc.getMissionsCount();
// publish files to selected servers // publish files to selected servers
//if (publish) if (publish)
//for (uint i=0 ; i<ServerPathPrim.size() ; i++) {
//{ m_compileLog.append("Begin publishing missions...\n");
// if (IsDlgButtonChecked(IDC_CHECK_SRV1 + i) != BST_CHECKED) QSettings *settings = Core::ICore::instance()->settings();
// continue; settings->beginGroup(MISSION_COMPILER_SECTION);
// compileLog += toString("\r\nPublishing to %s ...\r\n", ServerName[i].c_str()); // Retrieve the local text path.
// for (uint j=0 ; j<mc.getFileToPublishCount() ; j++) QString localPath = settings->value(SETTING_LOCAL_TEXT_PATH).toString();
// compileLog += toString(" %s\r\n", (NLMISC::CFile::getFilename(mc.getFileToPublish(j))).c_str()); settings->endGroup();
// mc.publishFiles(ServerPathPrim[i], ServerPathText[i], LocalTextPath); QStringList checkedServers;
//} for(int i = 0; i<ui->publishServersList->count(); i++)
{
// Retrieve each checked server.
QListWidgetItem *item = ui->publishServersList->item(i);
if(item->checkState() == Qt::Checked)
checkedServers << item->text();
}
Q_FOREACH(QString checkedServer, checkedServers)
{
m_compileLog.append("Processing publication configuration for '"+checkedServer+"'\n");
QStringList items = settings->value(SETTING_SERVERS_TABLE_ITEMS).toStringList();
int column = 0;
int row = 0;
QString servName;
QString primPath;
QString textPath;
Q_FOREACH(QString var, items)
{
// Check to see if we're starting a new row.
if(column > 2)
{
column = 0;
row++;
}
if(column == 0)
servName = var;
else if(column == 1)
textPath = var;
else if(column == 2)
{
primPath = var;
m_compileLog.append("Publishing to "+servName+" ...\n");
for (uint j=0 ; j<mc.getFileToPublishCount() ; j++)
{
m_compileLog.append(" "+QString(NLMISC::CFile::getFilename(mc.getFileToPublish(j)).c_str())+"\n");
}
mc.publishFiles(primPath.toStdString(), textPath.toStdString(), localPath.toStdString());
}
column++;
}
}
m_compileLog.append("End publishing missions...\n");
}
} }
catch(const EParseException &e) catch(const EParseException &e)
{ {
@ -449,6 +495,8 @@ void MissionCompilerMainWindow::applyCheckboxes(const QStringList &servers)
Q_FOREACH(QString server, servers) Q_FOREACH(QString server, servers)
{ {
QList<QListWidgetItem*> items = ui->publishServersList->findItems(server, Qt::MatchExactly); QList<QListWidgetItem*> items = ui->publishServersList->findItems(server, Qt::MatchExactly);
if(items.size() != 1)
continue;
items.at(0)->setCheckState(Qt::Checked); items.at(0)->setCheckState(Qt::Checked);
} }
} }

View file

@ -59,6 +59,7 @@ private:
void moveSelectedItem(const QModelIndex &index, QStringListModel *from, QStringListModel *to); void moveSelectedItem(const QModelIndex &index, QStringListModel *from, QStringListModel *to);
void applyCheckboxes(const QStringList &servers); void applyCheckboxes(const QStringList &servers);
QMenu *_toolModeMenu; QMenu *_toolModeMenu;
QUndoStack *m_undoStack; QUndoStack *m_undoStack;
QStringListModel *m_allPrimitivesModel; QStringListModel *m_allPrimitivesModel;