MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / openRecentFile

Method openRecentFile

Gui/Gui40.cpp:122–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void
123Gui::openRecentFile()
124{
125 QAction *action = qobject_cast<QAction *>( sender() );
126
127 if (action) {
128 QFileInfo f( action->data().toString() );
129 QString path = f.path() + QLatin1Char('/');
130 QString filename = path + f.fileName();
131 int openedProject = appPTR->isProjectAlreadyOpened( filename.toStdString() );
132 if (openedProject != -1) {
133 AppInstancePtr instance = appPTR->getAppInstance(openedProject);
134 if (instance) {
135 GuiAppInstance* guiApp = dynamic_cast<GuiAppInstance*>( instance.get() );
136 assert(guiApp);
137 if (guiApp) {
138 guiApp->getGui()->activateWindow();
139
140 return;
141 }
142 }
143 }
144
145 ///if the current graph has no value, just load the project in the same window
146 if ( getApp()->getProject()->isGraphWorthLess() ) {
147 getApp()->getProject()->loadProject( path, f.fileName() );
148 } else {
149 CLArgs cl;
150 AppInstancePtr newApp = appPTR->newAppInstance(cl, false);
151 newApp->getProject()->loadProject( path, f.fileName() );
152 }
153 }
154}
155
156void
157Gui::updateRecentFileActions()

Callers

nothing calls this directly

Calls 12

getAppFunction · 0.85
toStdStringMethod · 0.80
getAppInstanceMethod · 0.80
isGraphWorthLessMethod · 0.80
getProjectMethod · 0.80
newAppInstanceMethod · 0.80
dataMethod · 0.45
pathMethod · 0.45
getMethod · 0.45
getGuiMethod · 0.45
loadProjectMethod · 0.45

Tested by

no test coverage detected