Commit 5e05cba2 authored by Jan Möbius's avatar Jan Möbius

Docu, Fixed commandline Open for scripts

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7646 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 1a319b86
......@@ -456,15 +456,30 @@ private:
* are stored. After the event queue is started, all files in this list will be opened.
* This is necessary as the event queue has to run to schedule the events emitted
* during open operations.
*
* @param _filename filename of the file to be opened. If it does not contain a full path,
* the current path will be prepended.
* @param _asPolyMesh Load as a polymesh ( yes/no)
*/
void commandLineOpen(const char* _filename, bool asPolyMesh );
void commandLineOpen(const char* _filename, bool _asPolyMesh );
/// Execute a script from the command Line
/** \brief Load a script from the commandline on application start
*
* This function is called before the event queue is executed. The filename
* is stored. After the event queue is started, all files in this list will be opened.
* This is necessary as the event queue has to run to schedule the events emitted
* during open operations.
*
* @param _filename filename of the script to be opened. If it does not contain a full path,
* the current path will be prepended.
*/
void commandLineScript(const char* _filename );
private slots:
/// Executed after loading core completly
/** Executed after loading core completly
*
*/
void slotExecuteAfterStartup();
private:
......
......@@ -92,11 +92,11 @@ void Core::slotGetAllFilters ( QStringList& _list){
}
}
void Core::commandLineOpen(const char* _filename, bool asPolyMesh ){
void Core::commandLineOpen(const char* _filename, bool _asPolyMesh ){
QString file(_filename);
// Modify filename to containe full paths
// Modify filename to contain full paths if they were given as relative paths
if ( !file.startsWith("/") && !file.contains(":") ) {
file = QDir::currentPath();
file += OpenFlipper::Options::dirSeparator();
......@@ -104,11 +104,22 @@ void Core::commandLineOpen(const char* _filename, bool asPolyMesh ){
}
// Add to the open list
commandLineFileNames_.push_back(std::pair< std::string , bool >(file.toStdString(), asPolyMesh));
commandLineFileNames_.push_back(std::pair< std::string , bool >(file.toStdString(), _asPolyMesh));
}
void Core::commandLineScript(const char* _filename ) {
commandLineScriptNames_.push_back(_filename);
QString file(_filename);
// Modify filename to contain full paths if they were given as relative paths
if ( !file.startsWith("/") && !file.contains(":") ) {
file = QDir::currentPath();
file += OpenFlipper::Options::dirSeparator();
file += _filename;
}
// Add to the open list
commandLineScriptNames_.push_back(file.toStdString());
}
void Core::slotExecuteAfterStartup() {
......@@ -150,10 +161,7 @@ void Core::slotExecuteAfterStartup() {
if ( scriptingSupport )
for ( uint i = 0 ; i < commandLineScriptNames_.size() ; ++i ) {
// Add the full path to the script to set scripting dir right
QString tmp = QString::fromStdString(commandLineScriptNames_[i]);
tmp = QDir::currentPath() + QDir::separator() + tmp;
emit executeFileScript(tmp);
emit executeFileScript(QString::fromStdString(commandLineScriptNames_[i]));
}
if ( !OpenFlipper::Options::gui() && !OpenFlipper::Options::remoteControl())
......
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