TIconView::TIconView( QWidget *parent, const char* name )
    : KIconView( parent, name ), _module(0L)
{
    setResizeMode( Adjust );
    setItemsMovable( false );

    setItemTextPos( Right );

    setGridX( 200 );
    setGridY( 70 );

    QFont f = font();
    f.setWeight( QFont::Bold );
    setFont( f );

    setShowToolTips( false );

    KConfig *config = KGlobal::config();
    config->setGroup("Extra");
    showExtras = config->readNumEntry( "Selected" );

    toolTip = 0;

    connect( this, SIGNAL( executed( QIconViewItem* ) ), SLOT( slotItemSelected( QIconViewItem* ) ) );

    /* comment those signals due to bug#7761
    connect( this, SIGNAL( executed( QIconViewItem* ) ), SLOT( removeToolTip()) );
    connect( this, SIGNAL( onItem( QIconViewItem* ) ), SLOT( showToolTip( QIconViewItem* ) ) );
    connect( this, SIGNAL( onViewport() ),  SLOT( removeToolTip() ) );
    */

}
Example #2
0
/**********************************************************************
 *
 * KivioIconView
 *
 **********************************************************************/
KivioIconView::KivioIconView( bool _readWrite,QWidget *parent, const char *name )
: QIconView( parent, name )
{
  m_pSpawnerSet = NULL;
  m_pCurDrag = NULL;
  isReadWrite=_readWrite;
  objList.append(this);

  setGridX( 64 );
  setGridY( 64 );
  setResizeMode( Adjust );
  setWordWrapIconText(true);
  setHScrollBarMode( AlwaysOff );
  setVScrollBarMode( Auto );
  setAutoArrange(true);
  setSorting(true);

  setItemsMovable(false);

  setArrangement(LeftToRight);
  setAcceptDrops(false);
  viewport()->setAcceptDrops(false);
  if(isReadWrite) {
    connect(this, SIGNAL(doubleClicked(QIconViewItem*)), this, SLOT(slotDoubleClicked(QIconViewItem*)));
    connect(this, SIGNAL(clicked(QIconViewItem*)), this, SLOT(slotClicked(QIconViewItem*)));
  }
}
Example #3
0
void Keypad::updateXYPosition(int x, int y) {
  if ( 0 <= x && x <= _winSize && 0 <= y && y <= _winSize ) {
    setGridX(x);
    setGridY(y);

    for(int i=0; i < _width; i++) {
      for(int j=0; i < _width; j++) {
        if ( i*_cellSize <= x && x <= (i+1)*_cellSize &&
             j*_cellSize <= y && y <= (j+1)*_cellSize ) {
          _currentIndex = (KeypadEnum)((i*3)+j);
        }
      }
    }
  }
}
Example #4
0
TIconView::TIconView( QWidget *parent, const char* name )
    : KIconView( parent, name )
{
    setResizeMode( Adjust );
    setItemsMovable( false );

    setItemTextPos( Right );

    setGridX( 200 );
    setGridY( 70 );

    QFont f = font();
    f.setWeight( QFont::Bold );
    setFont( f );

}
Example #5
0
bool VCProperties::loadProperties(const QDomElement& root)
{
    if (root.tagName() != KXMLQLCVCProperties)
    {
        qWarning() << Q_FUNC_INFO << "Virtual console properties node not found";
        return false;
    }

    QString str;
    QDomNode node = root.firstChild();
    while (node.isNull() == false)
    {
        QDomElement tag = node.toElement();
        if (tag.tagName() == KXMLQLCVCPropertiesGrid)
        {
            /* Grid X resolution */
            str = tag.attribute(KXMLQLCVCPropertiesGridXResolution);
            setGridX(str.toInt());

            /* Grid Y resolution */
            str = tag.attribute(KXMLQLCVCPropertiesGridYResolution);
            setGridY(str.toInt());

            /* Grid enabled */
            str = tag.attribute(KXMLQLCVCPropertiesGridEnabled);
            if (str == KXMLQLCTrue)
                setGridEnabled(true);
            else
                setGridEnabled(false);
        }
        else if (tag.tagName() == KXMLQLCVCPropertiesKeyboard)
        {
            /* Keyboard grab */
            str = tag.attribute(KXMLQLCVCPropertiesKeyboardGrab);
            if (str == KXMLQLCTrue)
                setGrabKeyboard(true);
            else
                setGrabKeyboard(false);

            /* Key repeat */
            str = tag.attribute(KXMLQLCVCPropertiesKeyboardRepeatOff);
            if (str == KXMLQLCTrue)
                setKeyRepeatOff(true);
            else
                setKeyRepeatOff(false);
        }
        else if (tag.tagName() == KXMLQLCVCPropertiesDefaultSlider)
        {
            quint32 low = 0;
            quint32 high = 10;
            quint32 universe = InputMap::invalidUniverse();
            quint32 channel = InputMap::invalidChannel();
            QDomElement subtag;

            /* Bus low limit */
            str = tag.attribute(KXMLQLCVCPropertiesLowLimit);
            if (str.isEmpty() == false)
                low = quint32(str.toUInt());

            /* Bus high limit */
            str = tag.attribute(KXMLQLCVCPropertiesHighLimit);
            if (str.isEmpty() == false)
                high = quint32(str.toUInt());

            /* Sliders' visibility (on by default) */
            str = tag.attribute(KXMLQLCVCPropertiesDefaultSliderVisible);
            if (str.isEmpty() == false)
            {
                if (str == KXMLQLCTrue)
                    setSlidersVisible(true);
                else
                    setSlidersVisible(false);
            }

            /* External input */
            bool ok = loadXMLInput(tag.firstChild().toElement(), &universe, &channel);
            if (tag.attribute(KXMLQLCBusRole) == KXMLQLCBusFade)
            {
                setFadeLimits(low, high);
                if (ok == true)
                    setFadeInputSource(universe, channel);
            }
            else
            {
                setHoldLimits(low, high);
                if (ok == true)
                    setHoldInputSource(universe, channel);
            }
        }
        else if (tag.tagName() == KXMLQLCVCPropertiesGrandMaster)
        {
            quint32 universe = InputMap::invalidUniverse();
            quint32 channel = InputMap::invalidChannel();

            str = tag.attribute(KXMLQLCVCPropertiesGrandMasterChannelMode);
            setGrandMasterChannelMode(UniverseArray::stringToGMChannelMode(str));

            str = tag.attribute(KXMLQLCVCPropertiesGrandMasterValueMode);
            setGrandMasterValueMode(UniverseArray::stringToGMValueMode(str));

            /* External input */
            if (loadXMLInput(tag.firstChild().toElement(), &universe, &channel) == true)
                setGrandMasterInputSource(universe, channel);
        }
        else if (tag.tagName() == KXMLQLCVCPropertiesBlackout)
        {
            /* External input */
            quint32 universe = InputMap::invalidUniverse();
            quint32 channel = InputMap::invalidChannel();
            if (loadXMLInput(tag.firstChild().toElement(), &universe, &channel) == true)
                setBlackoutInputSource(universe, channel);
        }
        else if (tag.tagName() == KXMLQLCWidgetProperties)
        {
            VCWidgetProperties::loadXML(tag);
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown virtual console property tag:" << tag.tagName();
        }

        /* Next node */
        node = node.nextSibling();
    }

    return true;
}
Example #6
0
bool BattleSquad::init(std::string srcpath, int team, int unitnum, int x, int y, int d)
{
	if(!Squad::init(srcpath))
		return false;
	DataLibrary *datalib = DataLibrary::getSingletonPtr();
	setTeam(team);
	setGridX(x);
	setGridY(y);
	setDirection(d);

	setUnitNum(unitnum);
	int squadtype2;
	datalib->getData(srcpath + std::string("/Type"), squadtype2);
	if(squadtype2 == SQUAD_NORMAL)
	{
		setUnitMaxNum(unitnum);
		setFormation(Line);
	}
	else
	{
		setUnitMaxNum(20);
		setFormation(Loose);
	}

	float covert;
	covert = getAttr(ATTR_COVERT, ATTRCALC_FULL);
	if(covert > 0.0f)
	{
		switch(getFaction())
		{
		case 0:
			setViewbyPlayer(1);
			setViewbyEnemy1(0);
			setViewbyEnemy2(0);
			setViewbyEnemy3(0);
			break;
		case 1:
			setViewbyPlayer(0);
			setViewbyEnemy1(1);
			setViewbyEnemy2(0);
			setViewbyEnemy3(0);
			break;
		case 2:
			setViewbyPlayer(0);
			setViewbyEnemy1(0);
			setViewbyEnemy2(1);
			setViewbyEnemy3(0);

			break;
		case 3:
			setViewbyPlayer(0);
			setViewbyEnemy1(0);
			setViewbyEnemy2(0);
			setViewbyEnemy3(1);
			break;
		}
	}
	else
	{
		setViewbyPlayer(1);
		setViewbyEnemy1(1);
		setViewbyEnemy2(1);
		setViewbyEnemy3(1);
	}

	setAmbushPlayer(0);
	setAmbushEnemy1(0);
	setAmbushEnemy2(0);
	setAmbushEnemy3(0);

	setActionPoint(0.0f);
	setAPSetup(0.0f);
	setAPBattle(0.0f);
	return true;
}
Example #7
0
bool VCProperties::loadProperties(const QDomElement* root)
{
	QDomElement tag;
	QDomNode node;
	QString str;

	Q_ASSERT(root != NULL);

	if (root->tagName() != KXMLQLCVCProperties)
	{
		qDebug() << "Virtual console properties node not found!";
		return false;
	}

	node = root->firstChild();
	while (node.isNull() == false)
	{
		tag = node.toElement();
		if (tag.tagName() == KXMLQLCVCPropertiesGrid)
		{
			/* Grid X resolution */
			str = tag.attribute(KXMLQLCVCPropertiesGridXResolution);
			setGridX(str.toInt());

			/* Grid Y resolution */
			str = tag.attribute(KXMLQLCVCPropertiesGridYResolution);
			setGridY(str.toInt());

			/* Grid enabled */
			str = tag.attribute(KXMLQLCVCPropertiesGridEnabled);
			if (str == KXMLQLCTrue)
				setGridEnabled(true);
			else
				setGridEnabled(false);
		}
		else if (tag.tagName() == KXMLQLCVCPropertiesKeyboard)
		{
			/* Keyboard grab */
			str = tag.attribute(KXMLQLCVCPropertiesKeyboardGrab);
			if (str == KXMLQLCTrue)
				setGrabKeyboard(true);
			else
				setGrabKeyboard(false);

			/* Key repeat */
			str = tag.attribute(KXMLQLCVCPropertiesKeyboardRepeatOff);
			if (str == KXMLQLCTrue)
				setKeyRepeatOff(true);
			else
				setKeyRepeatOff(false);
		}
		else if (tag.tagName() == KXMLQLCVCPropertiesDefaultSlider)
		{
			quint32 low = 0;
			quint32 high = 10;
			t_input_universe universe = KInputUniverseInvalid;
			t_input_channel channel = KInputChannelInvalid;
			QDomElement subtag;

			/* Bus low limit */
			str = tag.attribute(KXMLQLCVCPropertiesLowLimit);
			if (str.isNull() == false)
				low = quint32(str.toUInt());

			/* Bus high limit */
			str = tag.attribute(KXMLQLCVCPropertiesHighLimit);
			if (str.isNull() == false)
				high = quint32(str.toUInt());

			/* Sliders' visibility (on by default) */
			str = tag.attribute(KXMLQLCVCPropertiesDefaultSliderVisible);
			if (str == KXMLQLCFalse)
				setSlidersVisible(false);
			else
				setSlidersVisible(true);

			/* External input */
			subtag = tag.firstChild().toElement();
			if (subtag.isNull() == false &&
			    subtag.tagName() == KXMLQLCVCPropertiesInput)
			{
				/* Universe */
				str = subtag.attribute(KXMLQLCVCPropertiesInputUniverse);
				if (str.isNull() == false)
					universe = str.toInt();

				/* Channel */
				str = subtag.attribute(KXMLQLCVCPropertiesInputChannel);
				if (str.isNull() == false)
					channel = str.toInt();
			}

			/* Set the gathered properties to the correct slider */
			if (tag.attribute(KXMLQLCBusRole) == KXMLQLCBusFade)
			{
				setFadeLimits(low, high);
				setFadeInputSource(universe, channel);
			}
			else
			{
				setHoldLimits(low, high);
				setHoldInputSource(universe, channel);
			}
		}
		else if (tag.tagName() == KXMLQLCWidgetProperties)
		{
			QLCWidgetProperties::loadXML(&tag);
		}
		else
		{
			qDebug() << "Unknown virtual console property tag:"
				 << tag.tagName();
		}

		/* Next node */
		node = node.nextSibling();
	}

	return true;
}
int Q3IconView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = Q3ScrollView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: selectionChanged(); break;
        case 1: selectionChanged((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break;
        case 2: currentChanged((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break;
        case 3: clicked((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break;
        case 4: clicked((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 5: pressed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break;
        case 6: pressed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 7: doubleClicked((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break;
        case 8: returnPressed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break;
        case 9: rightButtonClicked((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 10: rightButtonPressed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 11: mouseButtonPressed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3IconViewItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break;
        case 12: mouseButtonClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3IconViewItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break;
        case 13: contextMenuRequested((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 14: dropped((*reinterpret_cast< QDropEvent*(*)>(_a[1])),(*reinterpret_cast< const Q3ValueList<Q3IconDragItem>(*)>(_a[2]))); break;
        case 15: moved(); break;
        case 16: onItem((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break;
        case 17: onViewport(); break;
        case 18: itemRenamed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break;
        case 19: itemRenamed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break;
        case 20: arrangeItemsInGrid((*reinterpret_cast< const QSize(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 21: arrangeItemsInGrid((*reinterpret_cast< const QSize(*)>(_a[1]))); break;
        case 22: arrangeItemsInGrid((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 23: arrangeItemsInGrid(); break;
        case 24: setContentsPos((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 25: updateContents(); break;
        case 26: doAutoScroll(); break;
        case 27: adjustItems(); break;
        case 28: slotUpdate(); break;
        case 29: movedContents((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        }
        _id -= 30;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = sorting(); break;
        case 1: *reinterpret_cast< bool*>(_v) = sortDirection(); break;
        case 2: *reinterpret_cast< SelectionMode*>(_v) = selectionMode(); break;
        case 3: *reinterpret_cast< int*>(_v) = gridX(); break;
        case 4: *reinterpret_cast< int*>(_v) = gridY(); break;
        case 5: *reinterpret_cast< int*>(_v) = spacing(); break;
        case 6: *reinterpret_cast< ItemTextPos*>(_v) = itemTextPos(); break;
        case 7: *reinterpret_cast< QBrush*>(_v) = itemTextBackground(); break;
        case 8: *reinterpret_cast< Arrangement*>(_v) = arrangement(); break;
        case 9: *reinterpret_cast< ResizeMode*>(_v) = resizeMode(); break;
        case 10: *reinterpret_cast< int*>(_v) = maxItemWidth(); break;
        case 11: *reinterpret_cast< int*>(_v) = maxItemTextLength(); break;
        case 12: *reinterpret_cast< bool*>(_v) = autoArrange(); break;
        case 13: *reinterpret_cast< bool*>(_v) = itemsMovable(); break;
        case 14: *reinterpret_cast< bool*>(_v) = wordWrapIconText(); break;
        case 15: *reinterpret_cast< bool*>(_v) = showToolTips(); break;
        case 16: *reinterpret_cast< uint*>(_v) = count(); break;
        }
        _id -= 17;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 2: setSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break;
        case 3: setGridX(*reinterpret_cast< int*>(_v)); break;
        case 4: setGridY(*reinterpret_cast< int*>(_v)); break;
        case 5: setSpacing(*reinterpret_cast< int*>(_v)); break;
        case 6: setItemTextPos(*reinterpret_cast< ItemTextPos*>(_v)); break;
        case 7: setItemTextBackground(*reinterpret_cast< QBrush*>(_v)); break;
        case 8: setArrangement(*reinterpret_cast< Arrangement*>(_v)); break;
        case 9: setResizeMode(*reinterpret_cast< ResizeMode*>(_v)); break;
        case 10: setMaxItemWidth(*reinterpret_cast< int*>(_v)); break;
        case 11: setMaxItemTextLength(*reinterpret_cast< int*>(_v)); break;
        case 12: setAutoArrange(*reinterpret_cast< bool*>(_v)); break;
        case 13: setItemsMovable(*reinterpret_cast< bool*>(_v)); break;
        case 14: setWordWrapIconText(*reinterpret_cast< bool*>(_v)); break;
        case 15: setShowToolTips(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 17;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 17;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
bool QIconView::qt_property( int id, int f, QVariant* v)
{
    switch ( id - staticMetaObject()->propertyOffset() ) {
    case 0: switch( f ) {
	case 1: *v = QVariant( this->sorting(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 1: switch( f ) {
	case 1: *v = QVariant( this->sortDirection(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 2: switch( f ) {
	case 0: setSelectionMode((SelectionMode&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->selectionMode() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 3: switch( f ) {
	case 0: setGridX(v->asInt()); break;
	case 1: *v = QVariant( this->gridX() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 4: switch( f ) {
	case 0: setGridY(v->asInt()); break;
	case 1: *v = QVariant( this->gridY() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 5: switch( f ) {
	case 0: setSpacing(v->asInt()); break;
	case 1: *v = QVariant( this->spacing() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 6: switch( f ) {
	case 0: setItemTextPos((ItemTextPos&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->itemTextPos() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 7: switch( f ) {
	case 0: setItemTextBackground(v->asBrush()); break;
	case 1: *v = QVariant( this->itemTextBackground() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 8: switch( f ) {
	case 0: setArrangement((Arrangement&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->arrangement() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 9: switch( f ) {
	case 0: setResizeMode((ResizeMode&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->resizeMode() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 10: switch( f ) {
	case 0: setMaxItemWidth(v->asInt()); break;
	case 1: *v = QVariant( this->maxItemWidth() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 11: switch( f ) {
	case 0: setMaxItemTextLength(v->asInt()); break;
	case 1: *v = QVariant( this->maxItemTextLength() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 12: switch( f ) {
	case 0: setAutoArrange(v->asBool()); break;
	case 1: *v = QVariant( this->autoArrange(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 13: switch( f ) {
	case 0: setItemsMovable(v->asBool()); break;
	case 1: *v = QVariant( this->itemsMovable(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 14: switch( f ) {
	case 0: setWordWrapIconText(v->asBool()); break;
	case 1: *v = QVariant( this->wordWrapIconText(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 15: switch( f ) {
	case 0: setShowToolTips(v->asBool()); break;
	case 1: *v = QVariant( this->showToolTips(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 16: switch( f ) {
	case 1: *v = QVariant( this->count() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    default:
	return QScrollView::qt_property( id, f, v );
    }
    return TRUE;
}