OpenFunctionThread.cc 1.25 KB
Newer Older
Matthias Möller's avatar
Matthias Möller committed
1 2 3 4
#include "OpenFunctionThread.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>

5

Matthias Möller's avatar
Matthias Möller committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
void LoadFromPluginThread::loadFromPlugin()
{
  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
    PluginFunctions::viewerProperties(i).lockUpdate();

  for (int i = 0; i < infos_.size(); ++i)
  {
    LoadInfos info = infos_[i];
    if (info.type != DATA_UNKNOWN)
      loadedIds_[i] = info.plugin->loadObject(info.filename,info.type );
    else
      loadedIds_[i] = info.plugin->loadObject(info.filename);
    emit state(this->jobId(),i);
  }
  for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
    PluginFunctions::viewerProperties(i).unLockUpdate();
  emit updateView();
}
24 25


Matthias Möller's avatar
Matthias Möller committed
26 27 28 29
LoadFromPluginThread::~LoadFromPluginThread()
{

}
30 31 32 33



LoadFromPluginThread::LoadFromPluginThread(const QVector<LoadInfos>& _loadInfos, const QString& _jobName)
Matthias Möller's avatar
Matthias Möller committed
34 35 36 37
: OpenFlipperThread(_jobName), infos_(_loadInfos), loadedIds_(_loadInfos.size(),-1)
{
  connect( this ,SIGNAL(function()), this, SLOT(loadFromPlugin()), Qt::DirectConnection) ;
}
38 39 40



Matthias Möller's avatar
Matthias Möller committed
41 42 43 44
int LoadFromPluginThread::getObjId(int index)const
{
  return loadedIds_[index];
}
45 46 47



Matthias Möller's avatar
Matthias Möller committed
48 49 50 51 52
const QString& LoadFromPluginThread::getFilename(int index) const
{
  return infos_[index].filename;
}