Пример #1
0
void
KdmItem::widgetGone()
{
    myWidget = 0;

    emit needPlugging();
    emit needPlacement();
}
Пример #2
0
void
KdmItem::setWidget(QWidget *widget)
{
    if ((myWidget = widget)) {
        myWidget->hide(); // yes, really
        connect(myWidget, SIGNAL(destroyed()), SLOT(widgetGone()));
        setWidgetAttribs(myWidget);
    }

    emit needPlugging();
    emit needPlacement();
}
Пример #3
0
void
KdmItem::updateThisVisible()
{
    bool show = m_shown;
    if (show && (!m_showType.isNull() || m_minScrWidth || m_minScrHeight)) {
        KdmThemer *thm = themer();
        if ((!m_showType.isNull() &&
             !(thm->typeVisible(m_showType) ^ m_showTypeInvert)) ||
            (thm->widget() &&
             (thm->widget()->width() < m_minScrWidth ||
              thm->widget()->height() < m_minScrHeight)))
        {
            show = false;
        }
    }
    if (m_visible != show) {
        m_visible = show;
        emit needPlacement();
    }
}
Пример #4
0
void
KdmThemer::generateItems( KdmItem *parent, const QDomNode &node )
{
	/*
	 * Go through each of the child nodes
	 */
	const QDomNodeList &subnodeList = node.childNodes();
	for (int nod = 0; nod < subnodeList.count(); nod++) {
		QDomNode subnode = subnodeList.item( nod );
		QDomElement el = subnode.toElement();
		QString tagName = el.tagName();

		if (tagName == "item") {
			QString showType;
			bool showTypeInvert = false;

			QDomNode showNode = subnode.namedItem( "show" );
			if (!showNode.isNull()) {
				QDomElement sel = showNode.toElement();

				QString modes = sel.attribute( "modes" );
				if (!modes.isNull() &&
				    (modes == "nowhere" ||
				     (modes != "everywhere" &&
				      !modes.split( ",", QString::SkipEmptyParts ).contains(
				          m_currentMode ))))
					continue;

				showType = sel.attribute( "type" );
				if (!showType.isNull()) {
					if (showType[0] == '!') {
						showType.remove( 0, 1 );
						showTypeInvert = true;
					}
					if (!showType.startsWith( "plugin-" ) &&
					    m_showTypes.contains( showType ) == showTypeInvert)
						continue;
				}
			}

			QString type = el.attribute( "type" );
			KdmItem *newItem;
			if (type == "label")
				newItem = new KdmLabel( parent, subnode );
			else if (type == "pixmap")
				newItem = new KdmPixmap( parent, subnode );
			else if (type == "rect")
				newItem = new KdmRect( parent, subnode );
			else if (type == "entry") {
				//newItem = new KdmEntry( parent, subnode );
				newItem = new KdmRect( parent, subnode );
				newItem->setType( type );
			} else if (type=="list")
				newItem = new KdmList( parent, subnode );
			else if (type == "svg")
				newItem = new KdmPixmap( parent, subnode );
			else
				continue;
			newItem->setIsButton( el.attribute( "button", "false" ) == "true" );
			newItem->setShowType( showType, showTypeInvert );
			connect( newItem, SIGNAL(needUpdate( int, int, int, int )),
			         SLOT(update( int, int, int, int )) );
			connect( newItem, SIGNAL(needPlacement()),
			         SLOT(slotNeedPlacement()) );
			connect( newItem, SIGNAL(needPlugging()),
			         SLOT(slotNeedPlugging()) );
			connect( newItem, SIGNAL(activated( const QString & )),
			         SIGNAL(activated( const QString & )) );
			generateItems( newItem, subnode );
		} else if (tagName == "box") {
			parent->setBoxLayout( subnode );
			generateItems( parent, subnode );
		} else if (tagName == "fixed") {
			parent->setFixedLayout( subnode );
			generateItems( parent, subnode );
		}
	}
}