Example #1
0
void DatabaseThread::callSlot( const char *file, unsigned int line, const char *func, QObject *target,
                               const QByteArray &method, const QStringList &stringList, const QVariant &payload )
{
   const char *signal1 = SIGNAL(signal(QStringList));
   const char *signal2 = SIGNAL(signal(QStringList,QVariant));

   if( QMetaObject::checkConnectArgs( signal1, method.constData() ) )
   {
      if( !QMetaObject::invokeMethod( target, slotName( method ).constData(), Qt::QueuedConnection,
                                      Q_ARG( QStringList, stringList ) ) )
      {
         qFatal( call_failed_msg, file, line, method.constData(), func );
      }
   }
   else if( QMetaObject::checkConnectArgs( signal2, method.constData() ) )
   {
      if( !QMetaObject::invokeMethod( target, slotName( method ).constData(), Qt::QueuedConnection,
                                      Q_ARG( QStringList, stringList ),
                                      Q_ARG( QVariant, payload ) ) )
      {
         qFatal( call_failed_msg, file, line, method.constData(), func );
      }
   }
   else
   {
      qFatal( signature_mismatch_msg, file, line, method.constData(), signal1, signal2, func );
   }
}
Example #2
0
QMenu* Scene_item::contextMenu()
{
    if(defaultContextMenu) {
        defaultContextMenu->setTitle(name());
        return defaultContextMenu;
    }

    defaultContextMenu = new QMenu(name());
    // defaultContextMenu->addAction(name());
    // defaultContextMenu->addSeparator();
    // QMenu* modeMenu = new QMenu(QObject::tr("Rendering mode"),
    //                             defaultContextMenu);
    for(unsigned int mode = 0; mode < NumberOfRenderingMode;
        ++mode)
    {
        if(!supportsRenderingMode(RenderingMode(mode))) continue;
        QString mName = modeName(RenderingMode(mode));
        defaultContextMenu->addAction(tr("Set %1 mode")
                                      .arg(mName),
                                      this,
                                      slotName(RenderingMode(mode)));
    }
    // defaultContextMenu->addAction(modeMenu->menuAction());
    return defaultContextMenu;
}
InputDlg::InputDlg()
{

    setWindowTitle(tr("Input Dialog"));

    label1 = new QLabel(tr("Name : "));
    label2 = new QLabel(tr("Sex : "));
    label3 = new QLabel(tr("Age : "));
    label4 = new QLabel(tr("Stature : "));
    
    nameLabel = new QLabel(tr("LiMing"));
    nameLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
    sexLabel = new QLabel(tr("male"));
    sexLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
    ageLabel = new QLabel(tr("25"));
    ageLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
    statureLabel = new QLabel("175.5");
    statureLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
    
    nameButton = new QPushButton;
    nameButton->setIcon(QIcon(":/images/btn.png"));
    sexButton = new QPushButton;
    sexButton->setIcon(QIcon(":/images/btn.png"));
    ageButton = new QPushButton;
    ageButton->setIcon(QIcon(":/images/btn.png"));
    statureButton = new QPushButton;
    statureButton->setIcon(QIcon(":/images/btn.png"));
    

    QGridLayout *layout = new QGridLayout( this );
    int name = 0;
    int sex = 1;
    int age = 2;
    int stature = 3;
    layout->addWidget( label1, name, 0 );	
    layout->addWidget( nameLabel, name, 1 );
    layout->addWidget( nameButton, name, 2 );
    layout->addWidget( label2, sex, 0 );
    layout->addWidget( sexLabel, sex, 1 );
    layout->addWidget( sexButton, sex, 2 );
    layout->addWidget( label3, age, 0 );
    layout->addWidget( ageLabel, age, 1 );
    layout->addWidget( ageButton, age, 2 );
    layout->addWidget( label4, stature, 0 );
    layout->addWidget( statureLabel, stature, 1 );
    layout->addWidget( statureButton, stature, 2 );
    layout->setMargin(15);
    layout->setSpacing(10);
    layout->setColumnMinimumWidth(1,120);
    
    connect(nameButton,SIGNAL(clicked()),this,SLOT(slotName()));
    connect(sexButton,SIGNAL(clicked()),this,SLOT(slotSex()));
    connect(ageButton,SIGNAL(clicked()),this,SLOT(slotAge()));
    connect(statureButton,SIGNAL(clicked()),this,SLOT(slotStature()));
}
Example #4
0
void PrincessModel::cleanupChangeGloveSlot(WJSkeletonAnimation *skeleton)
{
	/* 将手套的所有的变换用Slot清空 */
	// glove07、glove08、glove09、glove010、glove011、glove012、glove013
	for (int iSlot = 6; iSlot < 13; ++iSlot)
	{
		std::string slotName(GLOVE_SLOT);
		WJUtils::stringAddInt(slotName, iSlot + 1, 3);
		skeleton->setSlotTexture(slotName.c_str(), BASE_NONE_PNG);
	}
}
Example #5
0
InputDialog::InputDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::InputDialog)
{
    setWindowTitle(tr("Input Dialog"));

        //创建各种标签对象
    label1=new QLabel(tr("Name"));
    label2=new QLabel(tr("Sex"));
    label3=new QLabel(tr("Age"));
    label4=new QLabel(tr("Stature"));

        //创建各种显示标签
    nameLabel=new QLabel(tr("LiMing"));
    sexLabel=new QLabel(tr("F"));
    ageLabel=new QLabel(tr("12"));
    statureLabel=new QLabel(tr("123"));

        //创建各种修改按钮
    nameButton=new QPushButton(tr("Modify"));
    sexButton=new QPushButton(tr("Modify"));
    ageButton=new QPushButton(tr("Modify"));
    statureButton=new QPushButton(tr("Modify"));

        //布局管理
    QGridLayout *layout=new QGridLayout(this);

    layout->addWidget(label1,0,0);
    layout->addWidget(nameLabel,0,1);
    layout->addWidget(nameButton,0,2);

    layout->addWidget(label2,1,0);
    layout->addWidget(sexLabel,1,1);
    layout->addWidget(sexButton,1,2);

    layout->addWidget(label3,2,0);
    layout->addWidget(ageLabel,2,1);
    layout->addWidget(ageButton,2,2);

    layout->addWidget(label4,3,0);
    layout->addWidget(statureLabel,3,1);
    layout->addWidget(statureButton,3,2);

    setLayout(layout);

        //信号处理
    connect(nameButton,SIGNAL(clicked()),this,SLOT(slotName()));
    connect(sexButton,SIGNAL(clicked()),this,SLOT(slotSex()));
    connect(ageButton,SIGNAL(clicked()),this,SLOT(slotAge()));
    connect(statureButton,SIGNAL(clicked()),this,SLOT(slotStature()));

}
void ArrangementDescriptor::load_0000(Iff &iff)
{
	iff.enterForm(TAG_0000);
	{
		CrcLowerString  slotName("");
		char            buffer[1024];

		SlotIdVector    arrangement;

		// load the arrangement list
		while (!iff.atEndOfForm())
		{
			iff.enterChunk(TAG_ARG);
			{
				// load the arrangement
				while (iff.getChunkLengthLeft())
				{
					// load slot name
					iff.read_string(buffer, sizeof(buffer) - 1);
					slotName.setString(buffer);

					// convert slot name to SlotId
					const SlotId slotId = SlotIdManager::findSlotId(slotName);
					if (slotId == SlotId::invalid)
						WARNING(true, ("ArrangementDescriptor [%s] specified invalid slot name [%s], ignoring", m_name->getString(), slotName.getString()));
					else
						arrangement.push_back(slotId);
				}
			}
			iff.exitChunk(TAG_ARG);

			// add arrangement to list of arrangements
			m_arrangements->push_back(arrangement);

			// cleanup temp vector
			arrangement.clear();
		}
	}
	iff.exitForm(TAG_0000);
}
Example #7
0
QVariant OnSlotExecutedHandler::operator()(const QString &name, const std::vector<QVariant> &args)
{
    QVariant result;

    if (!m_dObjectCallback || !m_dObjectPointer)
        return result;

    // prepare slot name
    QVariant slotName(name);

    // prepare void* for the QVariants
    std::vector<void *> argumentsAsVoidPointers;
    argumentsAsVoidPointers.reserve(args.size() + 1);
    argumentsAsVoidPointers.emplace_back(&result);
    for (size_t i = 0; i < args.size(); ++i)
        argumentsAsVoidPointers.emplace_back((void *)(&args[i]));

    // send them to the binding handler
    m_dObjectCallback(m_dObjectPointer, &slotName, argumentsAsVoidPointers.size(), &argumentsAsVoidPointers[0]);

    return result;
}
    bool validate(const IntegralBusPort *port, ProblemList &problemList) const {
        QVariant busMap = port->getParameter(Workflow::IntegralBusPort::BUS_MAP_ATTR_ID)->getAttributePureValue();
        bool data = isBinded(busMap.value<QStrStrMap>(), READS_URL_SLOT_ID);
        if (!data){
            QString dataName = slotName(port, READS_URL_SLOT_ID);
            problemList.append(Problem(GenomeAlignerWorker::tr("The slot must be not empty: '%1'").arg(dataName)));
            return false;
        }

        QString slot1Val = busMap.value<QStrStrMap>().value(READS_URL_SLOT_ID);
        QString slot2Val = busMap.value<QStrStrMap>().value(READS_PAIRED_URL_SLOT_ID);
        U2OpStatusImpl os;
        const QList<IntegralBusSlot>& slots1 = IntegralBusSlot::listFromString(slot1Val, os);
        const QList<IntegralBusSlot>& slots2 = IntegralBusSlot::listFromString(slot2Val, os);

        bool hasCommonElements = false;

        foreach(const IntegralBusSlot& ibsl1, slots1){
            if (hasCommonElements){
                break;
            }
            foreach(const IntegralBusSlot& ibsl2, slots2){
                if (ibsl1 == ibsl2){
                    hasCommonElements = true;
                    break;
                }
            }
        }

        if (hasCommonElements){
            problemList.append(Problem(GenomeAlignerWorker::tr("Bowtie2 cannot recognize read pairs from the same file. Please, perform demultiplexing first.")));
            return false;
        }

        return true;
    }
//====================================
// import
//------------------------------------
void SCCTouchSelection::import ( void ) {
	//=====================================
	// search touchscreen ID's
	//-------------------------------------
	int n = 0;
	int x = 0;
	int touchID[mSection["Pointers"]->getCount()];
	for (int i=SAX_CORE_POINTER;i<mSection["Pointers"]->getCount();i+=2) {
		touchID[x] = 0;
		if (mSaxToucher->selectPointer (i)) {
		if (mSaxToucher->isTouchpanel()) {
			touchID[n] = i;
			n++;
		}
		}
		x++;
	}
	//=====================================
	// no touchers found... return
	//-------------------------------------
	if (touchID[mDisplay] == 0) {
		return;
	}
	//=====================================
	// select touchscreen
	//-------------------------------------
	mSaxToucher -> selectPointer ( touchID[mDisplay] );

	//=====================================
	// select vendor and name
	//-------------------------------------
	QString vendorName = mSaxToucher -> getVendor();
	QString modelName  = mSaxToucher -> getName(); 
	if ((! vendorName.isEmpty()) && (! modelName.isEmpty())) {
		QListBoxItem* vendor = mVendorList -> findItem ( vendorName );
		if ( vendor ) {
			mVendorList -> setSelected ( vendor, true );
			slotVendor ( vendor );
			QListBoxItem* name = mModelList -> findItem ( modelName );
			if ( name ) {
				mModelList -> setSelected ( name, true );
				slotName ( name );
			}
		}
	}
	//=====================================
	// setup port
	//-------------------------------------
	QString device = mSaxToucher -> getDevice();
	QRegExp identifier ("/dev/input/mice");
	if (identifier.search (device) >= 0) {
		mPortBox -> setCurrentItem ( 0 );
		mPortBox -> setCurrentText (device);
	}
	if (device == "/dev/ttyS0") {
		mPortBox -> setCurrentItem ( 1 );
	}
	if (device == "/dev/ttyS1") {
		mPortBox -> setCurrentItem ( 2 );
	}

	//=====================================
	// setup touchscreen display state
	//-------------------------------------
	SaXManipulateLayout saxLayout ( mSection["Layout"],mSection["Card"] );
	QList<QString> inputLayout = saxLayout.getInputLayout();
	QListIterator<QString> it (inputLayout);
	bool foundID = false;
	for (; it.current();++it) {
		if (touchID[mDisplay] == it.current()->toInt()) {
			foundID = true;
			break;
		}
	}
	if ( foundID ) {
		mCheckEnable -> setChecked ( true );
		slotActivateToucher();
	}
}
//====================================
// import
//------------------------------------
void SCCMonitorDualModel::import ( void ) {
	if ( mNeedImport ) {
		//====================================
		// create needed manipulators
		//------------------------------------
		SaXManipulateCard saxCard (
			mSection["Card"]
		);
		//====================================
		// select card
		//------------------------------------
		saxCard.selectCard ( mDisplay );

		//====================================
		// get options defined for the card
		//------------------------------------
		QDict<QString> mOptions = saxCard.getOptions();

		//====================================
		// handle monitor vendor/model name
		//------------------------------------
		if ((mOptions["SaXDualMonitorVendor"]) &&
			(mOptions["SaXDualMonitorModel"])
		) {
			mSelectedMonitorVendor = *mOptions["SaXDualMonitorVendor"];
			mSelectedMonitorName   = *mOptions["SaXDualMonitorModel"];
		} else
		if ((mProfileDriverOptions["SaXDualMonitorVendor"]) &&
			(mProfileDriverOptions["SaXDualMonitorModel"])
		) {
			QString vendor = *mProfileDriverOptions["SaXDualMonitorVendor"];
			QString model  = *mProfileDriverOptions["SaXDualMonitorModel"];
			mSelectedMonitorVendor = vendor;
			mSelectedMonitorName   = model;
		}
		//====================================
		// handle hsync/vsync values
		//------------------------------------
		if (mOptions["SaXDualHSync"]) {
			QStringList hsyncRange = QStringList::split ("-",
				*mOptions["SaXDualHSync"]
			);
			mHsyncMin = hsyncRange.first().toInt();
			mHsyncMax = hsyncRange.last().toInt();
		} else
		if (mProfileDriverOptions["SaXDualHSync"]) {
			QStringList hsyncRange = QStringList::split ("-",
				*mProfileDriverOptions["SaXDualHSync"]
			);
			mHsyncMin = hsyncRange.first().toInt();
			mHsyncMax = hsyncRange.last().toInt();
		}
		if (mOptions["SaXDualVSync"]) {
			QStringList vsyncRange = QStringList::split ("-",
				*mOptions["SaXDualVSync"]
            );
			mVsyncMin = vsyncRange.first().toInt();
			mVsyncMax = vsyncRange.last().toInt();
		} else
		if (mProfileDriverOptions["SaXDualVSync"]) {
			QStringList vsyncRange = QStringList::split ("-",
				*mProfileDriverOptions["SaXDualVSync"]
			);
			mVsyncMin = vsyncRange.first().toInt();
			mVsyncMax = vsyncRange.last().toInt();
		}
		//====================================
		// import done set flag
		//------------------------------------
		mNeedImport = false;
	}
	//====================================
	// setup vendor name listboxes
	//------------------------------------
	QListBoxItem* vendor = mVendorList -> findItem ( mSelectedMonitorVendor );
	if ( vendor ) {
		mVendorList -> setSelected ( vendor, true );
		slotVendor ( vendor );
		QListBoxItem* name = mModelList -> findItem ( mSelectedMonitorName );
		if ( name ) {
			mModelList -> setSelected ( name, true );
			slotName ( name );
		}
	}
	//====================================
	// setup hsync/vsync widgets
	//------------------------------------
	mHSpinMin -> setValue ( mHsyncMin );
	mHSpinMax -> setValue ( mHsyncMax );
	mVSpinMin -> setValue ( mVsyncMin );
	mVSpinMax -> setValue ( mVsyncMax );
}