void AMDetectorInitializeAction::startImplementation(){
	// If you still don't have a detector, check the exposed detectors one last time.
	if(!detector_)
		detector_ = AMBeamline::bl()->exposedDetectorByInfo(*(detectorInitializeInfo()->detectorInfo()));

	if(!detector_) {
		AMErrorMon::alert(this,
						  AMDETECTORINITIALIZEACTION_NO_VALID_DETECTOR,
						  QString("There was an error initializing the detector '%1', because the detector was not found. Please report this problem to the Acquaman developers.").arg(detectorInitializeInfo()->name()));
		setFailed();
		return;
	}

	if(detector_->initializationState() == AMDetector::InitializationRequired){
		// connect to detector initialization signals
		connect(detector_, SIGNAL(initializing()), this, SLOT(onInitializeStarted()));
		connect(detector_, SIGNAL(initialized()), this, SLOT(onInitializeFinished()));

		detector_->initialize();
	}
	else{
		setStarted();
		setSucceeded();
	}
}
void InputManager::init()
{
	if(initialized())
		deinit();

	SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, 
		Settings::getInstance()->getBool("BackgroundJoystickInput") ? "1" : "0");
	SDL_InitSubSystem(SDL_INIT_JOYSTICK);
	SDL_JoystickEventState(SDL_ENABLE);

	// first, open all currently present joysticks
	int numJoysticks = SDL_NumJoysticks();
	for(int i = 0; i < numJoysticks; i++)
	{
		addJoystickByDeviceIndex(i);
	}

	mKeyboardInputConfig = new InputConfig(DEVICE_KEYBOARD, "Keyboard", KEYBOARD_GUID_STRING);
	loadInputConfig(mKeyboardInputConfig);

	SDL_USER_CECBUTTONDOWN = SDL_RegisterEvents(2);
	SDL_USER_CECBUTTONUP   = SDL_USER_CECBUTTONDOWN + 1;
	CECInput::init();
	mCECInputConfig = new InputConfig(DEVICE_CEC, "CEC", CEC_GUID_STRING);
	loadInputConfig(mCECInputConfig);
}
示例#3
0
AMReadOnlyPVControl::AMReadOnlyPVControl(const QString& name, const QString& readPVname, QObject* parent, const QString description)
	: AMControl(name, "?", parent, description)  {

	wasConnected_ = false;
	readPV_ = new AMProcessVariable(readPVname, true, this);

	lowLimitPV_ = 0;
	highLimitPV_ = 0;

	allowLowLimitValuePVUpdates_ = true;
	allowHighLimitValuePVUpdates_ = true;

	lowLimitValue_ = -1;
	highLimitValue_ = -1;

	connect(readPV_, SIGNAL(valueChanged(double)), this, SIGNAL(valueChanged(double)));
	connect(readPV_, SIGNAL(alarmChanged(int,int)), this, SIGNAL(alarmChanged(int,int)));
	connect(readPV_, SIGNAL(readReadyChanged(bool)), this, SLOT(onPVConnected(bool)));
	connect(readPV_, SIGNAL(connectionTimeout()), this, SIGNAL(readConnectionTimeoutOccurred()));
	connect(readPV_, SIGNAL(error(int)), this, SLOT(onReadPVError(int)));
	connect(readPV_, SIGNAL(connectionTimeout()), this, SLOT(onConnectionTimeout()));

	connect(readPV_, SIGNAL(initialized()), this, SLOT(onReadPVInitialized()));

	// If the readPV_ is already initialized as soon as we create it [possible if it's sharing an existing connection], we'll never get the inialized() signal, do it here now:
	wasConnected_ = readPV_->readReady();	// same as isConnected(), but we cannot call virtual functions from a constructor, potentially breaks subclasses.
	if(readPV_->isInitialized())
		onReadPVInitialized();

}
void LoggingManager::assertInitialized() const
{
  if (!initialized())
  {
    assert(0);
  }
}
示例#5
0
bool PTU::initialize()
{
  ser_->write("ft ");  // terse feedback
  ser_->write("ed ");  // disable echo
  ser_->write("ci ");  // position mode
  ser_->read(20);

  // get pan tilt encoder res
  tr = getRes(PTU_TILT);
  pr = getRes(PTU_PAN);

  PMin = getLimit(PTU_PAN, PTU_MIN);
  PMax = getLimit(PTU_PAN, PTU_MAX);
  TMin = getLimit(PTU_TILT, PTU_MIN);
  TMax = getLimit(PTU_TILT, PTU_MAX);
  PSMin = getLimit(PTU_PAN, PTU_MIN_SPEED);
  PSMax = getLimit(PTU_PAN, PTU_MAX_SPEED);
  TSMin = getLimit(PTU_TILT, PTU_MIN_SPEED);
  TSMax = getLimit(PTU_TILT, PTU_MAX_SPEED);

  if (tr <= 0 || pr <= 0 || PMin == -1 || PMax == -1 || TMin == -1 || TMax == -1)
  {
    initialized_ = false;
  }
  else
  {
    initialized_ = true;
  }

  return initialized();
}
/* The first of our put operators sends a simple string object to the
  peer.  */
Client &
Client::operator<< (ACE_SString &str)
{
  /* We have to be able to allow: server << foo << bar << stuff;

    To accomplish that, every << operator must check that the object
    is in a valid state before doing work.  */

  if (initialized () && !error ())
    {
      /* Get the actual data held in the string object */
      const char *cp = str.fast_rep ();

      /* Send that data to the peer using send_n() as before.  If we
        have a problem, we'll set error_ so that subsequent <<
        operations won't try to use a broken stream.  */
      if (this->send_n (cp,
                        ACE_OS::strlen (cp)) == -1)
        error_ = 1;
    }
  else
    /* Be sure that error_ is set if somebody tries to use us when
        we're not initialized.  */
    error_ = 1;

  /* We have to return a reference to ourselves to allow chaining of
    put operations (eg -- "server << foo << bar").  Without the
    reference, you would have to do each put operation as a statement.
    That's OK but doesn't have the same feel as standard C++
    iostreams.  */
  return *this ;
}
DeviceManager::~DeviceManager()
{
    if (initialized())
        uninitialize();
    if (_watcher)
        delete _watcher;
}
示例#8
0
// set position in radians
bool PTU::setPosition(char type, float pos, bool block)
{
  if (!initialized()) return false;

  // get raw encoder count to move
  int count = static_cast<int>(pos / getResolution(type));

  // Check limits
  if (count < (type == PTU_TILT ? TMin : PMin) || count > (type == PTU_TILT ? TMax : PMax))
  {
    ROS_ERROR("Pan Tilt Value out of Range: %c %f(%d) (%d-%d)\n",
              type, pos, count, (type == PTU_TILT ? TMin : PMin), (type == PTU_TILT ? TMax : PMax));
    return false;
  }

  std::string buffer = sendCommand(std::string() + type + "p" +
                                   lexical_cast<std::string>(count) + " ");

  if (buffer.empty() || buffer[0] != '*')
  {
    ROS_ERROR("Error setting pan-tilt pos");
    return false;
  }

  if (block)
    while (getPosition(type) != pos) {};

  return true;
}
示例#9
0
/*!
    Creates thread
*/
RemoteFileInfoGatherer::RemoteFileInfoGatherer(QObject *parent)
    : AbstractFileInfoGatherer(parent), abort(false)
#ifndef QT_NO_FILESYSTEMWATCHER
    , watcher(0)
#endif
{
    qDebug() << "new RemoteFileInfoGatherer";
#ifndef QT_NO_FILESYSTEMWATCHER
    watcher = new QFileSystemWatcher(this);
    connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(list(QString)));
    connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString)));

#  if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
    const QVariant listener = watcher->property("_q_driveListener");
    if (listener.canConvert<QObject *>()) {
        if (QObject *driveListener = listener.value<QObject *>()) {
            connect(driveListener, SIGNAL(driveAdded()), this, SLOT(driveAdded()));
            connect(driveListener, SIGNAL(driveRemoved()), this, SLOT(driveRemoved()));
        }
    }
#  endif // Q_OS_WIN && !Q_OS_WINRT
#endif
    start(LowPriority);

    emit initialized();
}
示例#10
0
文件: tss.cpp 项目: louiz/botan
byte RTSS_Share::share_id() const
   {
   if(!initialized())
      throw Invalid_State("RTSS_Share::share_id not initialized");

   return m_contents[20];
   }
示例#11
0
/*!
    Update the state of initialized() to \a value and emit the initializedChanged() signal.

    \sa initialized(), initializedChanged()
*/
void QNetworkRegistrationServer::updateInitialized( bool value )
{
    if ( value != initialized() ) {
        setValue( "initialized", value );
        emit initializedChanged();
    }
}
示例#12
0
void
IsoMonitor_c::close()
{
  isoaglib_assert (initialized());

  isoaglib_assert( m_arrClientC1.empty() );
  isoaglib_assert( mvec_saClaimHandler.empty() );

  getSchedulerInstance().deregisterTask( *this );

  // We can clear the list of remote nodes.
  /// NOTE: We do currently NOT call "internalIsoItemErase",
  ///       because the list of SaClaimHandlers is empty anyway.
  ///       But if the erase does some more stuff, it may be needed
  ///       to call "internalIsoItemErase" for each item instead
  ///       of just clearing the container of isoMembers.
  mvec_isoMember.clear();

  getIsoRequestPgnInstance4Comm().unregisterPGN (mt_handler, ADDRESS_CLAIM_PGN);
#ifdef USE_WORKING_SET
  getIsoRequestPgnInstance4Comm().unregisterPGN (mt_handler, WORKING_SET_MASTER_PGN);
  getIsoRequestPgnInstance4Comm().unregisterPGN (mt_handler, WORKING_SET_MEMBER_PGN);
#endif

  getIsoBusInstance4Comm().deleteFilter( mt_customer, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, ((ADDRESS_CLAIM_PGN+0xFF) << 8) ) );
#ifdef USE_WORKING_SET
  getIsoBusInstance4Comm().deleteFilter( mt_customer, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, ((WORKING_SET_MASTER_PGN) << 8) ) );
  getIsoBusInstance4Comm().deleteFilter( mt_customer, IsoAgLib::iMaskFilter_c( 0x3FFFF00UL, ((WORKING_SET_MEMBER_PGN) << 8) ) );
#endif

  setClosed();
}
示例#13
0
MainWindow::MainWindow(QWidget *_parent) :
    QMainWindow{_parent, Qt::Widget},
    ui{new Ui::MainWindow}
{
    ui->setupUi(this);
    connect(ui->mRenderWindow, SIGNAL(initialized()), this, SLOT(onGLInitialized()));
}
cv::Rect PinholeCameraModel::rawRoi() const
{
  assert( initialized() );

  return cv::Rect(cam_info_.roi.x_offset, cam_info_.roi.y_offset,
                  cam_info_.roi.width, cam_info_.roi.height);
}
示例#15
0
CGImageRef ImageSource::createFrameAtIndex(size_t index, SubsamplingLevel subsamplingLevel)
{
    if (!initialized())
        return 0;

    RetainPtr<CGImageRef> image = adoptCF(CGImageSourceCreateImageAtIndex(m_decoder, index, imageSourceOptions(SkipMetadata, subsamplingLevel)));

#if PLATFORM(IOS)
    // <rdar://problem/7371198> - CoreGraphics changed the default caching behaviour in iOS 4.0 to kCGImageCachingTransient
    // which caused a performance regression for us since the images had to be resampled/recreated every time we called
    // CGContextDrawImage. We now tell CG to cache the drawn images. See also <rdar://problem/14366755> -
    // CoreGraphics needs to un-deprecate kCGImageCachingTemporary since it's still not the default.
#if COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
    CGImageSetCachingFlags(image.get(), kCGImageCachingTemporary);
#if COMPILER(CLANG)
#pragma clang diagnostic pop
#endif
#endif // !PLATFORM(IOS)

    CFStringRef imageUTI = CGImageSourceGetType(m_decoder);
    static const CFStringRef xbmUTI = CFSTR("public.xbitmap-image");
    if (!imageUTI || !CFEqual(imageUTI, xbmUTI))
        return image.leakRef();
    
    // If it is an xbm image, mask out all the white areas to render them transparent.
    const CGFloat maskingColors[6] = {255, 255,  255, 255, 255, 255};
    RetainPtr<CGImageRef> maskedImage = adoptCF(CGImageCreateWithMaskingColors(image.get(), maskingColors));
    if (!maskedImage)
        return image.leakRef();

    return maskedImage.leakRef();
}
示例#16
0
void Audio_Queue::cleanup()
{
    if (!initialized()) {
        AQ_TRACE("%s: warning: attempt to cleanup an uninitialized audio queue. return.\n", __PRETTY_FUNCTION__);
        
        return;
    }
    
    Stream_Configuration *config = Stream_Configuration::configuration();
    
    if (m_state != IDLE) {
        AQ_TRACE("%s: attemping to cleanup the audio queue when it is still playing, force stopping\n",
                 __PRETTY_FUNCTION__);
        
        AudioQueueRemovePropertyListener(m_outAQ,
                                         kAudioQueueProperty_IsRunning,
                                         audioQueueIsRunningCallback,
                                         this);
        
        AudioQueueStop(m_outAQ, true);
        setState(IDLE);
    }
    
    if (AudioQueueDispose(m_outAQ, true) != 0) {
        AQ_TRACE("%s: AudioQueueDispose failed!\n", __PRETTY_FUNCTION__);
    }
    m_outAQ = 0;
    m_fillBufferIndex = m_bytesFilled = m_packetsFilled = m_buffersUsed = 0;
    
    for (size_t i=0; i < config->bufferCount; i++) {
        m_bufferInUse[i] = false;
    }
    
    m_lastError = noErr;
}
示例#17
0
bool RGS_Service::recv_msg( BasicProtocol* pro)
{
	USE_PROTOCOL_NAMESPACE;
	//MODULE_LOG_DEBUG((MODULE_TEMP, "receive protocol id:%d", protocol->iid_));
	ACE_Auto_Ptr<BasicProtocol> a_ps( pro);

	if( !initialized()) return false;

	if( pro->iid_ == SVR_REGIST_ACK)
	{
		//注册回复
		Pro_SvrRegist_ack* pack =dynamic_cast<Pro_SvrRegist_ack*>(pro);
		if( pack->result_ == 1)
		{
			this->close_service();
		}
		else
		{
			SystemCommand<RGS_Service>* pcmd =
				TASKCMD_NEW SystemCommand<RGS_Service>( boost::bind( &BasicModule::fin_registservice, CTSMODULE, this));

			CTSMODULE->regist_syscmd( pcmd);
		}
	}
	else
		assort_protocol( a_ps.release());

	return true;
}
示例#18
0
// set speed in radians/sec
bool PTU::setSpeed(char type, float pos)
{
  if (!initialized()) return false;

  // get raw encoder speed to move
  int count = static_cast<int>(pos / getResolution(type));

  // Check limits
  if (abs(count) < (type == PTU_TILT ? TSMin : PSMin) || abs(count) > (type == PTU_TILT ? TSMax : PSMax))
  {
    ROS_ERROR("Pan Tilt Speed Value out of Range: %c %f(%d) (%d-%d)\n",
              type, pos, count, (type == PTU_TILT ? TSMin : PSMin), (type == PTU_TILT ? TSMax : PSMax));
    return false;
  }

  std::string buffer = sendCommand(std::string() + type + "s" +
                                   lexical_cast<std::string>(count) + " ");

  if (buffer.empty() || buffer[0] != '*')
  {
    ROS_ERROR("Error setting pan-tilt speed\n");
    return false;
  }

  return true;
}
示例#19
0
void CSpaceRestriction::remove_border			()
{
	if (!initialized())
		return;
	
	VERIFY							(m_applied);
	
	m_applied						= false;
	
	if (m_out_space_restriction) {
		ai().level_graph().clear_mask	(border());
		return;
	}

#ifdef USE_FREE_IN_RESTRICTIONS
	FREE_IN_RESTRICTIONS::iterator	I = m_free_in_restrictions.begin();
	FREE_IN_RESTRICTIONS::iterator	E = m_free_in_restrictions.end();
	for ( ; I != E; ++I)
		if ((*I).m_enabled) {
			VERIFY							((*I).m_restriction);
			(*I).m_enabled					= false;
			ai().level_graph().clear_mask	((*I).m_restriction->border());
		}
#else
	ai().level_graph().clear_mask	(m_in_space_restriction->border());
#endif
}
示例#20
0
float ImageSource::frameDurationAtIndex(size_t index)
{
    if (!initialized())
        return 0;

    float duration = 0;
    RetainPtr<CFDictionaryRef> properties = adoptCF(CGImageSourceCopyPropertiesAtIndex(m_decoder, index, imageSourceOptions(SkipMetadata)));
    if (properties) {
        CFDictionaryRef typeProperties = (CFDictionaryRef)CFDictionaryGetValue(properties.get(), kCGImagePropertyGIFDictionary);
        if (typeProperties) {
            if (CFNumberRef num = (CFNumberRef)CFDictionaryGetValue(typeProperties, WebCoreCGImagePropertyGIFUnclampedDelayTime)) {
                // Use the unclamped frame delay if it exists.
                CFNumberGetValue(num, kCFNumberFloatType, &duration);
            } else if (CFNumberRef num = (CFNumberRef)CFDictionaryGetValue(typeProperties, kCGImagePropertyGIFDelayTime)) {
                // Fall back to the clamped frame delay if the unclamped frame delay does not exist.
                CFNumberGetValue(num, kCFNumberFloatType, &duration);
            }
        }
    }

    // Many annoying ads specify a 0 duration to make an image flash as quickly as possible.
    // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify
    // a duration of <= 10 ms. See <rdar://problem/7689300> and <http://webkit.org/b/36082>
    // for more information.
    if (duration < 0.011f)
        return 0.100f;
    return duration;
}
const char *LH_DataViewerConnector::userInit(){
    LH_QtInstance::userInit();
    hide();

    setup_feedback_ = new LH_Qt_QString(this, "Feedback", "", LH_FLAG_READONLY | LH_FLAG_NOSAVE | LH_FLAG_NOSINK | LH_FLAG_NOSOURCE);
    QStringList langs = listLanguages();
    qDebug() << "languages: " << langs.count() << ": " << langs.join(",");
    setup_language_ = new LH_Qt_QStringList(this,"Language",langs, LH_FLAG_AUTORENDER | LH_FLAG_NOSINK | LH_FLAG_NOSOURCE);
    setup_language_->setHelp("To add a new language copy the \"[List:<name>]\" blocks from the data map into a new file called lists.XX.txt (where XX is the language code, e.g. Spanish lists would go in a file called lists.ES.txt, French in lists.FR.txt) and translate the text values into the desired language.");
    setup_language_->setFlag(LH_FLAG_HIDDEN, langs.length()<=1);
    connect( setup_language_, SIGNAL(changed()), this, SLOT(languageFileChanged()) );

    setup_map_file_ = new LH_Qt_QFileInfo(this,"Data Map",QFileInfo(), LH_FLAG_AUTORENDER | LH_FLAG_NOSINK | LH_FLAG_NOSOURCE );
    setup_map_file_->setHelp("The data map file contains information needed to understand and parse the data source.<br><br>"
                             "(Unlike text files, XML data sources do not require a map file, although they do support them if advanced data parsing or data-expiriation is required.)");
    connect( setup_map_file_, SIGNAL(changed()), this, SLOT(mapFileChanged()) );

    setup_data_file_ = new LH_Qt_QFileInfo(this,"Data Source",QFileInfo(), LH_FLAG_AUTORENDER | LH_FLAG_NOSINK | LH_FLAG_NOSOURCE );
    setup_data_file_ ->setHelp("The data source. Only XML data sources can be understood without a data map. If the datamap specifies \"MEM\" as the type then no source file is required.");
    connect( setup_data_file_, SIGNAL(changed()), this, SLOT(sourceFileChanged()) );

    sourceWatcher_ = new QFileSystemWatcher(this);
    connect( sourceWatcher_, SIGNAL(fileChanged(const QString)), this, SLOT(sourceFileUpdated(const QString)) );

    rootNode = new dataNode();
    sharedData = new sharedCollection();

    connect( this, SIGNAL(initialized()), this, SLOT(sourceFileUpdated()) );

    return NULL;
}
示例#22
0
void InputManager::deinit()
{
	if(!initialized())
		return;

	for(auto iter = mJoysticks.begin(); iter != mJoysticks.end(); iter++)
	{
		SDL_JoystickClose(iter->second);
	}
	mJoysticks.clear();

	for(auto iter = mInputConfigs.begin(); iter != mInputConfigs.end(); iter++)
	{
		delete iter->second;
	}
	mInputConfigs.clear();

	for(auto iter = mPrevAxisValues.begin(); iter != mPrevAxisValues.end(); iter++)
	{
		delete[] iter->second;
	}
	mPrevAxisValues.clear();

	if(mKeyboardInputConfig != NULL)
	{
		delete mKeyboardInputConfig;
		mKeyboardInputConfig = NULL;
	}

	SDL_JoystickEventState(SDL_DISABLE);
	SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}
void StereoCameraModel::projectDisparityImageTo3d(const cv::Mat& disparity, cv::Mat& point_cloud,
                                                  bool handleMissingValues) const
{
  assert( initialized() );

  cv::reprojectImageTo3D(disparity, point_cloud, Q_, handleMissingValues);
}
示例#24
0
int64_t decode(void *buffer, size_t size, int64_t sum)
{
    unsigned int i;
    C(table_t) foobarcontainer;
    FooBar(vec_t) list;
    FooBar(table_t) foobar;
    Bar(struct_t) bar;
    Foo(struct_t) foo;

    foobarcontainer = C(as_root(buffer));
    sum += C(initialized(foobarcontainer));
    sum += StringLen(C(location(foobarcontainer)));
    sum += C(fruit(foobarcontainer));
    list = C(list(foobarcontainer));
    for (i = 0; i < FooBar(vec_len(list)); ++i) {
        foobar = FooBar(vec_at(list, i));
        sum += StringLen(FooBar(name(foobar)));
        sum += FooBar(postfix(foobar));
        sum += (int64_t)FooBar(rating(foobar));
        bar = FooBar(sibling(foobar));
        sum += (int64_t)Bar(ratio(bar));
        sum += Bar(size(bar));
        sum += Bar(time(bar));
        foo = Bar(parent(bar));
        sum += Foo(count(foo));
        sum += Foo(id(foo));
        sum += Foo(length(foo));
        sum += Foo(prefix(foo));
    }
    return sum + 2 * sum;
}
    void testMultipleTransitions() {
        QSignalSpy init1(transition, SIGNAL(initialized(QString,QVariant,QString,QVariant)));
        QSignalSpy init2(transition2, SIGNAL(initialized(QString,QVariant,QString,QVariant)));
        QSignalSpy final1(transition, SIGNAL(finalized(QuickGlobalStateTransition*)));
        QSignalSpy final2(transition2, SIGNAL(finalized(QuickGlobalStateTransition*)));

        machine->registerTransition("initial", "next", transition);
        machine->registerTransition("initial", "next", transition2);
        machine->push("next");
        QCOMPARE(init1.count(), 1);
        QCOMPARE(init2.count(), 1);
        transition->finalize();
        transition2->finalize();
        QCOMPARE(final1.count(), 1);
        QCOMPARE(final2.count(), 1);
    }
cv::Size PinholeCameraModel::reducedResolution() const
{
  assert( initialized() );

  cv::Rect roi = rectifiedRoi();
  return cv::Size(roi.width / binningX(), roi.height / binningY());
}
示例#27
0
void QDesigner::initialize()
{
    // initialize the sub components
    QStringList files;
    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
    parseCommandLineArgs(files, resourceDir);

    QTranslator *translator = new QTranslator(this);
    QTranslator *qtTranslator = new QTranslator(this);

    const QString localSysName = QLocale::system().name();
    QString  translatorFileName = QStringLiteral("designer_");
    translatorFileName += localSysName;
    translator->load(translatorFileName, resourceDir);

    translatorFileName = QStringLiteral("qt_");
    translatorFileName += localSysName;
    qtTranslator->load(translatorFileName, resourceDir);
    installTranslator(translator);
    installTranslator(qtTranslator);

    if (QLibraryInfo::licensedProducts() == QStringLiteral("Console")) {
        QMessageBox::information(0, tr("Qt Designer"),
                tr("This application cannot be used for the Console edition of Qt"));
        QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
        return;
    }

    m_workbench = new QDesignerWorkbench();

    emit initialized();
    previousMessageHandler = qInstallMessageHandler(designerMessageHandler); // Warn when loading faulty forms
    Q_ASSERT(previousMessageHandler);

    m_suppressNewFormShow = m_workbench->readInBackup();

    if (!files.empty()) {
        const QStringList::const_iterator cend = files.constEnd();
        for (QStringList::const_iterator it = files.constBegin(); it != cend; ++it) {
            // Ensure absolute paths for recent file list to be unique
            QString fileName = *it;
            const QFileInfo fi(fileName);
            if (fi.exists() && fi.isRelative())
                fileName = fi.absoluteFilePath();
            m_workbench->readInForm(fileName);
        }
    }
    if ( m_workbench->formWindowCount())
        m_suppressNewFormShow = true;

    // Show up error box with parent now if something went wrong
    if (m_initializationErrors.isEmpty()) {
        if (!m_suppressNewFormShow && QDesignerSettings(m_workbench->core()).showNewFormOnStartup())
            QTimer::singleShot(100, this, SLOT(callCreateForm())); // won't show anything if suppressed
    } else {
        showErrorMessageBox(m_initializationErrors);
        m_initializationErrors.clear();
    }
}
示例#28
0
void QuickGlobalStateTransition::initialize(const QString & from, const QVariant & fromParameters,
                                            const QString & to, const QVariant & toParameters)
{
    Q_ASSERT(m_finalized == true);
    m_finalized = false;
    emit finalizedChanged();
    emit initialized(from, fromParameters, to, toParameters);
}
示例#29
0
void Communicator::Bcast(Data data,int root){
#if defined(__PLUMED_MPI)
  if(initialized()) MPI_Bcast(data.pointer,data.size,data.type,root,communicator);
#else
  (void) data;
  (void) root;
#endif
}
示例#30
0
 environment(int& argc, char**& argv, bool abort_on_exception=true)
     : initialized_(false), abort_on_exception_(abort_on_exception)
 {
     if (!initialized()) {
         MPI_Init(&argc, &argv);
         initialized_=true;
     }
 }