Commit cff7f471 authored by Jan Möbius's avatar Jan Möbius

Commandline open objects after core has been launched!

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5336 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 682ab4be
......@@ -513,8 +513,10 @@ Core::init() {
scenegraphCheckTimer_->start ();
}
QTimer::singleShot(100, this, SLOT(slotCommandLineOpen()));
}
//-----------------------------------------------------------------------------
Core::~Core()
......@@ -1127,7 +1129,7 @@ void Core::setDescriptions(){
emit setSlotDescription("loadObject()", "Show the dialog to load an object. (only works if GUI is available)",QStringList(), QStringList());
emit setSlotDescription("loadSettings()", "Show the dialog to load settings. (only works if GUI is available)",QStringList(), QStringList());
emit setSlotDescription("loadSettings(QString)", "load settings from file.",QStringList(), QStringList());
emit setSlotDescription("createWidget(QString,QString)", "Create a widget from an ui file",
QString("Object name,ui file").split(","),
QString("Name of the new widget in script,ui file to load").split(","));
......@@ -1155,8 +1157,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget) {
break;
}
}
if ( id == -1 ) {
std::cerr << "Unknown sender plugin when adding Toolbox!" << std::endl;
return;
......
......@@ -345,6 +345,17 @@ private:
/// Execute a script from the command Line
void commandLineScript(const char* _filename );
private slots:
/// Executed after loading core completly
void slotCommandLineOpen();
private:
std::vector< std::pair < const char* , bool > > commandLineFileNames_;
std::vector< const char* > commandLineScriptNames_;
public:
/** Add an empty Object of the given Type
* @return id of the new object or -1 if unsupported
*/
......
......@@ -67,6 +67,8 @@ void Core::slotObjectUpdated(int _identifier) {
emit log(LOGINFO,"updatedObject( " + QString::number(_identifier) + " ) called by " +
QString( sender()->metaObject()->className() ) );
}
} else {
emit log(LOGINFO,"updatedObject( " + QString::number(_identifier) + " ) called by Core" );
}
}
......
......@@ -77,22 +77,39 @@ void Core::slotGetAllFilters ( QStringList& _list){
}
void Core::commandLineOpen(const char* _filename, bool asPolyMesh ){
if (asPolyMesh)
loadObject(DATA_POLY_MESH, _filename);
else
loadObject(_filename);
commandLineFileNames_.push_back(std::pair< const char* , bool >(_filename,asPolyMesh));
std::cerr << "Open" << std::endl;
}
void Core::commandLineScript(const char* _filename ) {
//check if we have scripting support:
bool ok = false;
slotPluginExists("scripting",ok);
if ( ! ok ) {
emit log(LOGERR ,"No scripting support available, please check if we load a scripting plugin");
return;
commandLineScriptNames_.push_back(_filename);
}
void Core::slotCommandLineOpen() {
std::cerr << "1" << std::endl;
for ( uint i = 0 ; i < commandLineFileNames_.size() ; ++i ) {
std::cerr << i << std::endl;
if (commandLineFileNames_[i].second)
loadObject(DATA_POLY_MESH, commandLineFileNames_[i].first);
else
loadObject(commandLineFileNames_[i].first);
}
std::cerr << "2" << std::endl;
for ( uint i = 0 ; i < commandLineScriptNames_.size() ; ++i ) {
std::cerr << i << std::endl;
//check if we have scripting support:
bool ok = false;
slotPluginExists("scripting",ok);
if ( ! ok ) {
emit log(LOGERR ,"No scripting support available, please check if we load a scripting plugin");
return;
}
emit executeFileScript(commandLineScriptNames_[i]);
}
emit executeFileScript(_filename);
}
/// Load object by guessing DataType depending on the files extension
......
......@@ -349,7 +349,7 @@ int main(int argc, char **argv)
for ( int i = 0 ; i < args.FileCount(); ++i )
w->commandLineScript(args.File(i));
if ( remoteControl)
if ( remoteControl )
return app.exec();
}
......
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