Example #1
0
void StationTreeView::selectionChanged( const QItemSelection &selected,
                                        const QItemSelection &deselected )
{
    Q_UNUSED(deselected);
    if (!selected.isEmpty())
    {
        const QModelIndex idx = *(selected.indexes().begin());
        const TreeItem* tree_item = static_cast<TreeModel*>(this->model())->getItem(idx);

        const ModelTreeItem* list_item = dynamic_cast<const ModelTreeItem*>(tree_item->parentItem());
        if (list_item->getItem())
        {
            if (list_item)
                emit geoItemSelected(list_item->getItem()->vtkSource(), tree_item->row());
            emit enableRemoveButton(false);
            emit enableSaveButton(false);
        }
        else
        {
            emit removeGeoItemSelection();
            emit enableSaveButton(true);
            emit enableRemoveButton(true);
        }
    }
    //emit itemSelectionChanged(selected, deselected);
    //return QTreeView::selectionChanged(selected, deselected);
}
Example #2
0
void MshView::selectionChanged( const QItemSelection &selected, const QItemSelection &deselected )
{
	Q_UNUSED(deselected);
	if (!selected.isEmpty())
	{
		emit removeSelectedMeshComponent();
		const QModelIndex idx = *(selected.indexes().begin());
		const TreeItem* tree_item = static_cast<TreeModel*>(this->model())->getItem(idx);

		const MshItem* list_item = dynamic_cast<const MshItem*>(tree_item);
		if (list_item)
		{
			emit enableSaveButton(true);
			emit enableRemoveButton(true);
			emit meshSelected(list_item->getMesh());
		}
		else
		{
			emit enableSaveButton(false);
			emit enableRemoveButton(false);
			emit elementSelected(dynamic_cast<const MshItem*>(tree_item->parentItem())->vtkSource(), static_cast<unsigned>(tree_item->row()), true);
		}
	}
	//emit itemSelectionChanged(selected, deselected);
	//return QTreeView::selectionChanged(selected, deselected);
}
Example #3
0
void GeoTreeView::selectionChanged( const QItemSelection &selected,
                                    const QItemSelection &deselected )
{
    Q_UNUSED(deselected);
    if (!selected.isEmpty())
    {
        const QModelIndex idx = *(selected.indexes().begin());
        const TreeItem* tree_item = static_cast<TreeModel*>(this->model())->getItem(idx);
        emit removeGeoItemSelection();

        const GeoObjectListItem* geo_object = dynamic_cast<GeoObjectListItem*>(tree_item->parentItem());
        if (geo_object) // geometry object
        {
            emit enableSaveButton(false);
            emit enableRemoveButton(false);
            emit geoItemSelected(geo_object->vtkSource(), tree_item->row());
        }
        else
        {
            if (!idx.parent().isValid()) // geometry item
            {
                emit enableSaveButton(true);
                emit enableRemoveButton(true);
            }
            else // line points or surface triangles
            {
                emit enableSaveButton(false);
                const auto* geo_type =
                    dynamic_cast<const GeoObjectListItem*>(tree_item);
                if (geo_type) // geometry list item
                    emit enableRemoveButton(true);
                else
                {
                    // highlight a point for an expanded polyline
                    auto* list_item = dynamic_cast<GeoObjectListItem*>(
                        tree_item->parentItem()->parentItem());
                    if (list_item && list_item->getType() == GeoLib::GEOTYPE::POLYLINE)
                        geoItemSelected(
                            dynamic_cast<GeoObjectListItem*>(tree_item->parentItem()->parentItem()->parentItem()->child(0))->vtkSource(),
                            tree_item->data(0).toInt());

                    // highlight a point for an expanded surface
                    list_item = dynamic_cast<GeoObjectListItem*>(tree_item->parentItem()->parentItem()->parentItem());
                    if (list_item && list_item->getType() == GeoLib::GEOTYPE::SURFACE)
                        geoItemSelected(
                            dynamic_cast<GeoObjectListItem*>(tree_item->parentItem()->parentItem()->parentItem()->parentItem()->child(0))->vtkSource(),
                            tree_item->data(0).toInt());
                    emit enableRemoveButton(false);
                }
            }

        }

    }
    //emit itemSelectionChanged(selected, deselected);
    //return QTreeView::selectionChanged(selected, deselected);
}
Example #4
0
void LLPanelPickEdit::onOpen(const LLSD& key)
{
	LLUUID pick_id = key["pick_id"];
	mNeedData = true;

	// creating new Pick
	if(pick_id.isNull())
	{
		mNewPick = true;

		setAvatarId(gAgent.getID());

		resetData();
		resetControls();

		setPosGlobal(gAgent.getPositionGlobal());

		LLUUID parcel_id = LLUUID::null, snapshot_id = LLUUID::null;
		std::string pick_name, pick_desc, region_name;

		LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
		if(parcel)
		{
			parcel_id = parcel->getID();
			pick_name = parcel->getName();
			pick_desc = parcel->getDesc();
			snapshot_id = parcel->getSnapshotID();
		}

		LLViewerRegion* region = gAgent.getRegion();
		if(region)
		{
			region_name = region->getName();
		}

		setParcelID(parcel_id);
		childSetValue("pick_name", pick_name.empty() ? region_name : pick_name);
		childSetValue("pick_desc", pick_desc);
		setSnapshotId(snapshot_id);
		setPickLocation(createLocationText(getLocationNotice(), pick_name, region_name, getPosGlobal()));

		enableSaveButton(true);
	}
	// editing existing pick
	else
	{
		mNewPick = false;
		LLPanelPickInfo::onOpen(key);

		enableSaveButton(false);
	}

	resetDirty();
}
Example #5
0
void GeoTreeView::removeGeometry()
{
    QModelIndex index (this->selectionModel()->currentIndex());
    if (!index.isValid())
        OGSError::box("No geometry selected.");
    else
    {
        TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem(index);
        auto* list = dynamic_cast<GeoObjectListItem*>(item);
        if (list) {
            emit listRemoved((item->parentItem()->data(
                                      0).toString()).toStdString(), list->getType());
        } else {
            emit listRemoved((item->data(0).toString()).toStdString(), GeoLib::GEOTYPE::SURFACE);
            emit listRemoved((item->data(0).toString()).toStdString(), GeoLib::GEOTYPE::POLYLINE);
            emit listRemoved((item->data(0).toString()).toStdString(), GeoLib::GEOTYPE::POINT);
        }

        if(this->selectionModel()->selectedIndexes().count() == 0)
        {
            emit enableSaveButton(false);
            emit enableRemoveButton(false);
        }
    }
}
Example #6
0
void LLPanelPickEdit::onClickSetLocation()
{
	// Save location for later use.
	setPosGlobal(gAgent.getPositionGlobal());

	std::string parcel_name, region_name;

	LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
	if (parcel)
	{
		mParcelId = parcel->getID();
		parcel_name = parcel->getName();
	}

	LLViewerRegion* region = gAgent.getRegion();
	if(region)
	{
		region_name = region->getName();
	}

	setPickLocation(createLocationText(getLocationNotice(), parcel_name, region_name, getPosGlobal()));

	mLocationChanged = true;
	enableSaveButton(TRUE);
}
Example #7
0
void MshView::removeMesh()
{
	QModelIndex index (this->selectionModel()->currentIndex());
	if (!index.isValid())
		OGSError::box("No mesh selected.");
	else
	{
		emit requestMeshRemoval(index);
		emit enableSaveButton(false);
		emit enableRemoveButton(false);
	}
}
Example #8
0
void StationTreeView::removeStationList()
{
    QModelIndex index (this->selectionModel()->currentIndex());
    if (!index.isValid())
        OGSError::box("No station list selected.");
    else
    {
        TreeItem* item = static_cast<StationTreeModel*>(model())->getItem(index);
        emit stationListRemoved((item->data(0).toString()).toStdString());

        if(this->selectionModel()->selectedIndexes().count() == 0)
        {
            emit enableSaveButton(false);
            emit enableRemoveButton(false);
        }
    }
}
void EditMultipleAssignments::connectWidgets()
{
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
	connect(pointsBox, SIGNAL(textChanged(QString)), this, SLOT(enableSaveButton(QString)));
	connect(saveButton, SIGNAL(clicked()), this, SLOT(editAssignment()));
}
Example #10
0
void PhonemeEditorWidget::parseXmlFile()
{
    // Clear old text boxes
    QList<TimeLineTextEdit *> oldText= m_text->findChildren<TimeLineTextEdit *>();
    while(!oldText.isEmpty())
        delete oldText.takeFirst();

    // Clear old phoneme comboboxes
    QList<TimeLineComboBox *> oldPhoneme = m_phonemes->findChildren<TimeLineComboBox *>();
    while(!oldPhoneme.isEmpty())
        delete oldPhoneme.takeFirst();

    // Get new items from phoneme xml
    QDomElement timings = m_phonemeXml.firstChildElement("PhonemeTimings");

    // Get length of phoneme timings
    QDomElement last = timings.lastChildElement("word");
    int sentenceLength = 0;
    if(!last.isNull()) sentenceLength = last.attribute("end", "0").toInt();
    last = timings.lastChildElement("phn");
    if( !last.isNull() ) sentenceLength = max(sentenceLength, last.attribute("end", "0").toInt() );

    // Get minimal phoneme width
    QDomNodeList phnlist = timings.elementsByTagName("phn");
    int minPhnWidth = 999999;
    for(unsigned int i=0; i<phnlist.length(); i++)
    {
        QDomElement phn = phnlist.item(i).toElement();
        // Skip silence
        if( phn.attribute("value").compare("x") == 0 ) continue;
        int start = phn.attribute("start", "0").toInt();
        int end = phn.attribute("end", "999999").toInt();
        if( end-start < minPhnWidth ) minPhnWidth = end-start;
    }
    int minWidth =  (int)( 39.5f / minPhnWidth * sentenceLength );

    // Get length of panels and enlarge them if too small
    if( m_text->width()-2 < minWidth)
    {
        m_text->setFixedWidth(minWidth+2);
        m_phonemes->setFixedWidth(minWidth+2);
        m_phonemeScrollArea->setFixedWidth(m_text->x()+minWidth+2);
    }

    // Add wordBoxes in reverse direction, because first nodes have higher priority
    // and should be printed above of the others
    QDomNode wordNode = timings.lastChild();
    while(!wordNode.isNull())
    {
        // Get words
        if( wordNode.nodeName().compare("word") == 0)
        {
            QDomElement word = wordNode.toElement();
            TimeLineTextEdit* wordBox = new TimeLineTextEdit(word, sentenceLength, m_text);
            connect(wordBox, SIGNAL(xmlNodeChanged()), this, SLOT(enableSaveButton()) );
            wordBox->setVisible(true);

            // Get phonemes of a word
            QDomNodeList phonemeList = word.elementsByTagName("phn");
            // also reverse direction
            for(int i = phonemeList.size()-1; i >=0; i--)
            {
                QDomElement phoneme = phonemeList.item(i).toElement();
                // Skip silence
                if( phoneme.attribute("value").compare("x") == 0 ) continue;
                TimeLineComboBox* phonemeBox = new TimeLineComboBox(phoneme, sentenceLength, m_phonemeList, m_phonemes);
                connect(phonemeBox, SIGNAL(xmlNodeChanged()), this, SLOT(enableSaveButton()) );
                connect(phonemeBox, SIGNAL(xmlNodeChanged()), wordBox, SLOT(updateFromXml()));
                phonemeBox->setVisible(true);
            }
        }
        // Get phonemes which don't belong to words
        else if( wordNode.nodeName().compare("phn") == 0 )
        {
            QDomElement phoneme = wordNode.toElement();
            // Skip silence
            if( phoneme.attribute("value").compare("x") != 0 )
            {
                TimeLineComboBox* phonemeBox = new TimeLineComboBox(phoneme, sentenceLength, m_phonemeList, m_phonemes);
                connect(phonemeBox, SIGNAL(xmlNodeChanged()), this, SLOT(enableSaveButton()) );
                phonemeBox->setVisible(true);
            }
        }

        wordNode = wordNode.previousSibling();
    }
}
Example #11
0
void LLPanelPickEdit::onPickChanged(LLUICtrl* ctrl)
{
	enableSaveButton(isDirty());
}
Example #12
0
void LLPanelPickEdit::onSnapshotChanged()
{
	enableSaveButton(true);
}