本文整理汇总了C++中ProjectPtr::saveProject方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectPtr::saveProject方法的具体用法?C++ ProjectPtr::saveProject怎么用?C++ ProjectPtr::saveProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectPtr
的用法示例。
在下文中一共展示了ProjectPtr::saveProject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveProjectAs
bool
Gui::saveProject()
{
ProjectPtr project = getApp()->getProject();
if ( project->hasProjectBeenSavedByUser() ) {
QString projectFilename = project->getProjectFilename();
QString projectPath = project->getProjectPath();
if ( !_imp->checkProjectLockAndWarn(projectPath, projectFilename) ) {
return false;
}
bool ret = project->saveProject(projectPath, projectFilename, 0);
///update the open recents
if ( !projectPath.endsWith( QLatin1Char('/') ) ) {
projectPath.append( QLatin1Char('/') );
}
if (ret) {
QString file = projectPath + projectFilename;
updateRecentFiles(file);
}
return ret;
} else {
return saveProjectAs();
}
}
示例2: toInsert
void
Gui::saveAndIncrVersion()
{
ProjectPtr project = getApp()->getProject();
QString path = project->getProjectPath();
QString name = project->getProjectFilename();
int currentVersion = 0;
int positionToInsertVersion;
bool mustAppendFileExtension = false;
// extension is everything after the last '.'
int lastDotPos = name.lastIndexOf( QLatin1Char('.') );
if (lastDotPos == -1) {
positionToInsertVersion = name.size();
mustAppendFileExtension = true;
} else {
//Extract the current version number if any
QString versionStr;
int i = lastDotPos - 1;
while ( i >= 0 && name.at(i).isDigit() ) {
versionStr.prepend( name.at(i) );
--i;
}
++i; //move back the head to the first digit
if ( !versionStr.isEmpty() ) {
name.remove( i, versionStr.size() );
--i; //move 1 char backward, if the char is a '_' remove it
if ( (i >= 0) && ( name.at(i) == QLatin1Char('_') ) ) {
name.remove(i, 1);
}
currentVersion = versionStr.toInt();
}
positionToInsertVersion = i;
}
//Incr version
++currentVersion;
QString newVersionStr = QString::number(currentVersion);
//Add enough 0s in the beginning of the version number to have at least 3 digits
int nb0s = 3 - newVersionStr.size();
nb0s = std::max(0, nb0s);
QString toInsert( QLatin1Char('_') );
for (int c = 0; c < nb0s; ++c) {
toInsert.append( QLatin1Char('0') );
}
toInsert.append(newVersionStr);
if (mustAppendFileExtension) {
toInsert.append( QString::fromUtf8("." NATRON_PROJECT_FILE_EXT) );
}
if ( positionToInsertVersion >= name.size() ) {
name.append(toInsert);
} else {
name.insert(positionToInsertVersion, toInsert);
}
project->saveProject(path, name, 0);
QString filename = path + QLatin1Char('/') + name;
updateRecentFiles(filename);
} // Gui::saveAndIncrVersion