Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 4f81573f authored by Frédéric Larue's avatar Frédéric Larue
Browse files

UI state saved in a separate XML file for each project.

parent a1fb2573
......@@ -905,6 +905,85 @@ void UIMainWindow::removeFromCurrentProject()
}
bool UIMainWindow::saveProjectOptions( const QString &filePath, UIProject *project )
{
// Open the destination file.
QFile file( filePath );
if( !file.open( QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text ) )
return false;
// Create a stream for writing formatted text to the file.
QTextStream stream( &file );
// Write the opening tag of the project option XML root node.
stream << "<PROJECTOPTIONS Name=\"" << project->GetFileName() << "\">\n";
// Save current display options for each project datum.
for( auto d : project->GetAll() )
if( d->GetDisplayOptions() )
{
QList<UIParam*> params = d->GetDisplayOptions()->GetAll();
if( params.isEmpty() )
continue;
stream << " <DISPLAYOPTIONS Source=\"" << d->GetFileName() << "\">\n";
for( auto p : params )
{
stream << " <PARAM Id=\"" << p->Id() << "\" ";
stream << "Value=\"" << p->ValueString().replace( '\\', "\\\\" ).replace( '"', "\\\"" ) << "\"/>\n";
}
stream << " </DISPLAYOPTIONS>\n";
}
// Save current option values for each tool.
for( auto &tool : ui->toolSelector->allTools() )
if( tool.param )
{
QString name = tool.plugin->name( tool.id );
QList<UIParam*> params = tool.param->GetAll();
if( params.isEmpty() )
continue;
stream << " <TOOLOPTIONS Name=\"" << name << "\">\n";
for( auto p : params )
{
stream << " <PARAM Id=\"" << p->Id() << "\" ";
stream << "Value=\"" << p->ValueString().replace( '\\', "\\\\" ).replace( '"', "\\\"" ) << "\"/>\n";
}
stream << " </TOOLOPTIONS>\n";
}
// Save current viewer state.
// Save the list of displayed data.
stream << " <DATASTATE>\n";
for( auto &d : m_CurrentViewer->getDisplayables() )
stream << " <DISPLAYED Source=\"" << d.first->GetFileName() << "\"/>\n";
// Save the list of selected data.
for( auto d : ui->tableCurrentProjContent->selectedData() )
stream << " <SELECTED Source=\"" << d->GetFileName() << "\"/>\n";
stream << " </DATASTATE>\n";
// Write the closing tag of the project option XML root node.
// ... rajouter dans le menu Settings une dialog box permettant de choisir ce qui doit tre sauvegard en mme temps que le projet
// ou bien le rajouter en tant qu'option lors de la sauvegarde indpendante d'un projet.
stream << "</PROJECTOPTIONS>\n";
return true;
}
void UIMainWindow::saveCurrentProject()
{
UIProject *project = getCurrentProject();
......@@ -932,7 +1011,8 @@ void UIMainWindow::saveCurrentProject()
{
std::cout << "Project <B>" << project->Name().toStdString() << "</B> successfully saved to file <B>" << file.toStdString() << "</B>." << std::endl;
//SetMainWindowTitleInfos( m_CurrentProject->GetSaveDir()+m_CurrentProject->GetFilename() );
}
saveProjectOptions( project->GetSaveDir()+".project.opt", project );
}
else
{
QMessageBox::critical(
......
......@@ -137,6 +137,8 @@ private:
bool saveUISettings() const;
bool loadUISettings();
bool saveProjectOptions( const QString &filePath, UIProject *project );
void updateRecentListEntry( const QString& path );
inline void setCentralWidget( QWidget *widget ) { QMainWindow::setCentralWidget(widget); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment