Ejemplo n.º 1
0
void WidgetTreeWidget::selectWidget(QWidget *w, KFormDesigner::Form::WidgetSelectionFlags flags)
{
    if (!d->selectWidget_enabled)
        return;
    blockSignals(true); // to avoid recursion

    if (!w) {
        clearSelection();
        blockSignals(false);
        return;
    }

    if (selectedItems().count() == 0) {
        flags |= Form::ReplacePreviousSelection;
    }

    if ((flags & Form::ReplacePreviousSelection))
        clearSelection();

    QTreeWidgetItem *item = findItem(w->objectName());
    if ((flags & Form::ReplacePreviousSelection)) {
        setCurrentItem(item);
        item->setSelected(true);
    } else {
        item->setSelected(true);
    }

    blockSignals(false);
}
Ejemplo n.º 2
0
void KoRdfSemanticTreePrivate::update(KoDocumentRdf *rdf, QSharedPointer<Soprano::Model> model)
{
    QSet<QString> selectedPeople;
    QSet<QString> selectedEvents;
    QSet<QString> selectedLocations;

    buildSelectedSet(m_peopleItem, selectedPeople);
    buildSelectedSet(m_eventsItem, selectedEvents);
    buildSelectedSet(m_locationsItem, selectedLocations);
    clear(m_peopleItem);
    clear(m_eventsItem);
    clear(m_locationsItem);
    m_peopleItem->setSelected(false);
    m_eventsItem->setSelected(false);
    m_locationsItem->setSelected(false);
    m_foafs.clear();
    m_cals.clear();
    m_locations.clear();

    // people
    m_foafs = rdf->foaf(model);
    foreach (hKoRdfFoaF foaf, m_foafs) {
        KoRdfSemanticTreeWidgetItem *item = foaf->createQTreeWidgetItem(m_peopleItem);
        if (selectedPeople.contains(item->semanticItem()->name())) {
            item->setSelected(true);
        }
    }
Ejemplo n.º 3
0
void FormEphem::showActiveSatellites(void)
{

  QStringList tlelist = sats->GetActiveSatList();
  QStringList::Iterator it2 = tlelist.begin();
  QString str1, str2, str3, str4, str5, str6;
  int nRes, st;
  bool ok;

  QTreeWidgetItem *item;

  ui->satlisttreewidget->clear();

  while( it2 != tlelist.end() )
  {
      qDebug() << (*it2);
    st=0;
    nRes = (*it2).indexOf( ",", st);
    str1 = (*it2).mid(st, nRes-st);
    st=nRes+1;
    nRes = (*it2).indexOf( ",", st);
    str2 = (*it2).mid(st, nRes-st);
    st=nRes+1;
    nRes = (*it2).indexOf( ",", st);
    str3 = (*it2).mid(st, nRes-st);
    st=nRes+1;
    nRes = (*it2).indexOf( ",", st);
    str4 = (*it2).mid(st, nRes-st);
    st=nRes+1;
    nRes = (*it2).indexOf( ",", st);
    str5 = (*it2).mid(st, nRes-st);
    st=nRes+1;
    str6 = (*it2).mid(st);

    QStringList actsat;
    actsat << str1.toLatin1() << str2.toLatin1() << str3.toLatin1() << str4.toLatin1() << str5.toLatin1() << str6.toLatin1();
    item = new QTreeWidgetItem( ui->satlisttreewidget, actsat, 0  );

    if(str2.toInt(&ok, 10) == sats->GetSelectedSat())
        item->setSelected(true);
    else
        item->setSelected(false);

    ++it2;
  }


}
Ejemplo n.º 4
0
    void moveDownClicked()
    {
        QList<QTreeWidgetItem*> selectedPaths = m_treeView->selectedItems();

        if( selectedPaths.isEmpty() )
        {
            return;
        }
        else if( m_treeView->indexOfTopLevelItem(selectedPaths.last()) == m_treeView->topLevelItemCount() -1)
        {
            return;
        }
        else
        {
            // Retrieves the value that is before the first selected row.
            int index = m_treeView->indexOfTopLevelItem( selectedPaths.last() );
            QTreeWidgetItem*	newRow	= m_treeView->takeTopLevelItem(index);
            newRow->setFlags(newRow->flags() | Qt::ItemIsEditable);
            m_treeView->insertTopLevelItem( index + 1, newRow);

            newRow->setSelected(true);
            m_treeView->topLevelItem(index)->setSelected(false);
            rebuildRowIndexes();

            // Sends a change notification.
            Q_EMIT signalChanged();
        }
    }
Ejemplo n.º 5
0
    void moveUpClicked()
    {
        QList<QTreeWidgetItem*> selectedPaths = m_treeView->selectedItems();

        if( selectedPaths.isEmpty() )
        {
            return;
        }
        else if( m_treeView->indexOfTopLevelItem(selectedPaths.last()) == 0 )
        {
            return;
        }
        else
        {
            int index = m_treeView->indexOfTopLevelItem( selectedPaths.last() );
            QTreeWidgetItem*	newRow	= m_treeView->takeTopLevelItem(index);
            if(index < m_treeView->topLevelItemCount())
            {
                m_treeView->topLevelItem(index)->setSelected(false);
            }
            else
            {
                m_treeView->topLevelItem(m_treeView->topLevelItemCount() - 1 )->setSelected(false);
            }
            newRow->setFlags(newRow->flags() | Qt::ItemIsEditable);
            m_treeView->insertTopLevelItem( index - 1, newRow);

            newRow->setSelected(true);
            rebuildRowIndexes();

            // Sends a change notification.
            Q_EMIT signalChanged();
        }
    }
Ejemplo n.º 6
0
void FunctionManager::slotFunctionRemoved(t_function_id id)
{
	QTreeWidgetItem* item;

	// The function manager has its own routines for functions that are
	// removed with it.
	if (m_blockRemoveFunctionSignal == true)
		return;

	item = getItem(id, m_functionTree);
	if (item != NULL)
	{
		if (item->isSelected() == true)
		{
			QTreeWidgetItem* nextItem;

			// Try to select the closest neighbour
			if (m_functionTree->itemAbove(item) != NULL)
				nextItem = m_functionTree->itemAbove(item);
			else
				nextItem = m_functionTree->itemBelow(item);
	  
			if (nextItem != NULL)
				nextItem->setSelected(true);
		}

		delete item;
	}
}
void GameDosBoxDialog::lineEditSearchTextChanged( const QString &txt )
{
	treeWidgetDosboxGames->setSelectionMode( QAbstractItemView::MultiSelection );

	if( comboBoxSearch->currentIndex() <= -1 )
	{
		QMessageBox::information( this, "Gamedatabase", tr("Please select a column for search.") );
		return;
	}

	if( txt.isNull() || txt.isEmpty() )
		return;

	for( int a = 0; a < treeWidgetDosboxGames->topLevelItemCount(); a++ )
	{
		qApp->processEvents();
		treeWidgetDosboxGames->topLevelItem( a )->setSelected( false );
	}

	QList<QTreeWidgetItem *> search( treeWidgetDosboxGames->findItems( txt, Qt::MatchCaseSensitive | Qt::MatchContains, comboBoxSearch->currentIndex() ) );
	if( !search.isEmpty() && !(search.size() <= 0) )
	{
		for( int i = 0; i < search.size(); i++ )
		{
			QTreeWidgetItem *item = search.value( i );
			item->setSelected( true );
		}
	}		
}
Ejemplo n.º 8
0
void HierarchyTreeWidget::OnSelectedControlNodesChanged(const HierarchyTreeController::SELECTEDCONTROLNODES &selectedControls)
{
	if (internalSelectionChanged)
		return;
	
	internalSelectionChanged = true;
	ResetSelection();
	
	TREEITEMS items = GetAllItems();
	for (HierarchyTreeController::SELECTEDCONTROLNODES::const_iterator iter = selectedControls.begin();
		 iter != selectedControls.end();
		 ++iter)
	{
		const HierarchyTreeControlNode* node = (*iter);
		TREEITEMS::iterator itemIter = items.find(node->GetId());
		if (itemIter != items.end())
		{
            QTreeWidgetItem* item = itemIter->second;
			item->setSelected(true);
			
			// Force show selected item
            QTreeWidgetItem* parentItem = item->parent();
            while (parentItem)
            {
                parentItem->setExpanded(true);
                parentItem = parentItem->parent();
            }
		}
	}

	internalSelectionChanged = false;
}
Ejemplo n.º 9
0
void FMODSoundBrowser::SelectItemAndExpandTreeByEventName(const DAVA::String & eventName)
{
    DAVA::Vector<DAVA::String> tokens;
    DAVA::Split(eventName, "/", tokens);
    DAVA::int32 tokensCount = tokens.size();
    QTreeWidgetItem * currentItem = ui->treeWidget->invisibleRootItem();
    for(DAVA::int32 i = 0; i < tokensCount; i++)
    {
        QString currentToken = QString(tokens[i].c_str());
        DAVA::int32 childrenCount = currentItem->childCount();
        QTreeWidgetItem * findedItem = 0;
        for(DAVA::int32 k = 0; k < childrenCount; k++)
        {
            QTreeWidgetItem * currentChild = currentItem->child(k);
            if(currentChild->text(0) == currentToken)
            {
                findedItem = currentChild;
                findedItem->setExpanded(true);
                break;
            }
        }
        if(!findedItem)
            return;

        currentItem = findedItem;
    }
    currentItem->setSelected(true);
}
void MainWindow::addSubscriber()
{
    QTreeWidgetItemIterator it(ui->treeWidget);
    while (*it)
    {
        (*it)->setSelected(false);
        (*it)->setExpanded(false);
        ++it;
    }

    QTreeWidgetItem *sub = new QTreeWidgetItem(ui->treeWidget);
        sub->setText(0, QString("Brak identyfikatora #") + QString::number(ui->treeWidget->model()->rowCount()));
    QTreeWidgetItem *id = new QTreeWidgetItem(sub);
        id->setText(0, "#:");
        id->setText(1, QString::number(ui->treeWidget->model()->rowCount()));
    QTreeWidgetItem *mail = new QTreeWidgetItem(sub);
        mail->setText(0, "E-mail:");
        mail->setText(1, "brak");
    QTreeWidgetItem *phone = new QTreeWidgetItem(sub);
        phone->setText(0, "Telefon:");
        phone->setText(1, "brak");
    QTreeWidgetItem *notification = new QTreeWidgetItem(sub);
        notification->setText(0, "Typ powiadomienia:");
        notification->setText(1, "brak");

    sub->setSelected(true);
    sub->setExpanded(true);

    ui->treeWidget->insertTopLevelItem(0, sub);
    ui->treeWidget->scrollToBottom();

    selectedSubscriber = NULL;
}
Ejemplo n.º 11
0
void HierarchyTreeWidget::AddControlItem(QTreeWidgetItem* parent, const EXPANDEDITEMS& selectedItems, const EXPANDEDITEMS& expandedItems, const HierarchyTreeNode::HIERARCHYTREENODESLIST& items)
{
	for (HierarchyTreeNode::HIERARCHYTREENODESLIST::const_iterator iter = items.begin();
		 iter != items.end();
		 ++iter)
	{
		const HierarchyTreeControlNode* controlNode = (const HierarchyTreeControlNode*)(*iter);
		
		QTreeWidgetItem* controlItem = new QTreeWidgetItem();
		controlItem->setData(ITEM_ID, controlNode->GetId());
		controlItem->setText(0, controlNode->GetName());

		Decorate(controlItem, controlNode->GetUIObject());

		parent->insertChild(parent->childCount(), controlItem);
		
		AddControlItem(controlItem, selectedItems, expandedItems, controlNode->GetChildNodes());
		
		if (expandedItems.find(controlNode->GetId()) != expandedItems.end())
			controlItem->setExpanded(true);
		if (selectedItems.find(controlNode->GetId()) != selectedItems.end())
		{
			controlItem->setSelected(true);
		}
	}
}
Ejemplo n.º 12
0
void SceneEditor::addFixtureItem(Fixture* fixture)
{
    QTreeWidgetItem* item;

    Q_ASSERT(fixture != NULL);

    item = new QTreeWidgetItem(m_tree);
    item->setText(KColumnName, fixture->name());
    item->setText(KColumnID, QString("%1").arg(fixture->id()));

    if (fixture->fixtureDef() == NULL)
    {
        item->setText(KColumnManufacturer, tr("Generic"));
        item->setText(KColumnModel, tr("Generic"));
    }
    else
    {
        item->setText(KColumnManufacturer,
                      fixture->fixtureDef()->manufacturer());
        item->setText(KColumnModel, fixture->fixtureDef()->model());
    }

    /* Select newly-added fixtures so that their channels can be
       quickly disabled/enabled */
    item->setSelected(true);
}
Ejemplo n.º 13
0
void FunctionManager::addFunction(Function* function)
{
	QTreeWidgetItem* item;

	Q_ASSERT(function != NULL);
	
	/* Create a new item for the function */
	item = new QTreeWidgetItem(m_tree);
	updateFunctionItem(item, function);

	/* Clear current selection and select only the new one */
	m_tree->clearSelection();
	item->setSelected(true);

	/* Start editing immediately */
	if (slotEdit() == QDialog::Rejected)
	{
		/* Edit dialog was rejected -> delete function */
		deleteSelectedFunctions();
	}
	else
	{
		m_tree->sortItems(KColumnName, Qt::AscendingOrder);
		m_tree->scrollToItem(item);
	}
}
Ejemplo n.º 14
0
void
LTMSidebar::resetSeasons()
{
    if (active == true) return;

    active = true;
    int i;
    for (i=allDateRanges->childCount(); i > 0; i--) {
        delete allDateRanges->takeChild(0);
    }
    QString id = appsettings->cvalue(main->cyclist, GC_LTM_LAST_DATE_RANGE, seasons->seasons.at(0).id().toString()).toString();
    for (i=0; i <seasons->seasons.count(); i++) {
        Season season = seasons->seasons.at(i);
        QTreeWidgetItem *add = new QTreeWidgetItem(allDateRanges, season.getType());
        if (season.id().toString()==id)
            add->setSelected(true);

        // No Drag/Drop for temporary  Season
        if (season.getType() == Season::temporary)
            add->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        else
            add->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
        add->setText(0, season.getName());
    }

    active = false;
}
Ejemplo n.º 15
0
/**
 * Selects a list item whose string begins with the text entered in the edit
 * widget.
 * This slot is connected to the textChanged() signal of the line edit widget.
 * @param	sText	The new text in the edit widget
 */
void SearchList::slotFindItem(const QString& sText)
{
	QList<QTreeWidgetItem*> itemsList;

	// To avoid selecting everything when clearing QLineEdit text
	if (sText.isEmpty())
		return;

	// Find & select all matching items
	itemsList = m_pList->findItems(sText, Qt::MatchStartsWith, m_nSearchCol);

	// If `AutoSortFiles' is true selected items are contiguous. Scroll the central
	// item (if true) or the first (if not) of the selected items to the center of
	// the view
	if (! itemsList.isEmpty()) {
		int i = (Config().getAutoSortFiles()) ? itemsList.count() / 2 : 0;

		m_pList->scrollToItem(itemsList[i], QAbstractItemView::PositionAtCenter);

		QListIterator<QTreeWidgetItem*> it(itemsList);

		m_pList->clearSelection();
		while (it.hasNext()){
			QTreeWidgetItem* pItem = it.next();
			pItem->setSelected(true);
		}
	}
}
Ejemplo n.º 16
0
/*! \brief Select/deselect all resources
    \param check
*/
void ApplicationViewWidget::selectAllResources(bool check)
{
    for(int i=0;i<ui->resourcesList->topLevelItemCount();i++){
        QTreeWidgetItem *it = ui->resourcesList->topLevelItem(i);
        it->setSelected(check);
    }
}
Ejemplo n.º 17
0
void KEquityPriceUpdateDlg::slotQuoteFailed(const QString& _id, const QString& _symbol)
{
  QList<QTreeWidgetItem*> foundItems = lvEquityList->findItems(_id, Qt::MatchExactly, ID_COL);
  QTreeWidgetItem* item = 0;

  if (! foundItems.empty())
    item = foundItems.at(0);

  // Give the user some options
  int result;
  if (_id.contains(" ")) {
    result = KMessageBox::warningContinueCancel(this, i18n("Failed to retrieve an exchange rate for %1 from %2. It will be skipped this time.", _symbol, item->text(SOURCE_COL)), i18n("Price Update Failed"));
  } else {
    result = KMessageBox::questionYesNoCancel(this, QString("<qt>%1</qt>").arg(i18n("Failed to retrieve a quote for %1 from %2.  Press <b>No</b> to remove the online price source from this security permanently, <b>Yes</b> to continue updating this security during future price updates or <b>Cancel</b> to stop the current update operation.", _symbol, item->text(SOURCE_COL))), i18n("Price Update Failed"), KStandardGuiItem::yes(), KStandardGuiItem::no());
  }

  if (result == KMessageBox::No) {
    // Disable price updates for this security

    MyMoneyFileTransaction ft;
    try {
      // Get this security (by ID)
      MyMoneySecurity security = MyMoneyFile::instance()->security(_id.toUtf8());

      // Set the quote source to blank
      security.setValue("kmm-online-source", QString());
      security.setValue("kmm-online-quote-system", QString());

      // Re-commit the security
      MyMoneyFile::instance()->modifySecurity(security);
      ft.commit();
    } catch (const MyMoneyException &e) {
      KMessageBox::error(this, QString("<qt>") + i18n("Cannot update security <b>%1</b>: %2", _symbol, e.what()) + QString("</qt>"), i18n("Price Update Failed"));
    }
  }

  // As long as the user doesn't want to cancel, move on!
  if (result != KMessageBox::Cancel) {
    QTreeWidgetItem* next = 0;
    prgOnlineProgress->setValue(prgOnlineProgress->value() + 1);
    item->setSelected(false);

    // launch the NEXT one ... in case of m_fUpdateAll == false, we
    // need to parse the list to find the next selected one
    next = lvEquityList->invisibleRootItem()->child(lvEquityList->invisibleRootItem()->indexOfChild(item) + 1);
    if (!m_fUpdateAll) {
      while (next && !next->isSelected()) {
        prgOnlineProgress->setValue(prgOnlineProgress->value() + 1);
        next = lvEquityList->invisibleRootItem()->child(lvEquityList->invisibleRootItem()->indexOfChild(next) + 1);
      }
    }
    if (next) {
      m_webQuote.launch(next->text(SYMBOL_COL), next->text(ID_COL), next->text(SOURCE_COL));
    } else {
      finishUpdate();
    }
  } else {
    finishUpdate();
  }
}
Ejemplo n.º 18
0
void HierarchyTreeWidget::ResetSelection()
{
	QList<QTreeWidgetItem*> selectedList = ui->treeWidget->selectedItems();
	for (QList<QTreeWidgetItem*>::iterator iter = selectedList.begin(); iter != selectedList.end(); ++iter) {
		QTreeWidgetItem* item = (*iter);
		item->setSelected(false);
	}
}
Ejemplo n.º 19
0
void IrcMainWindow::selectNetwork(const QString& name)
{
    QTreeWidgetItem *item = ircSessionTreeView->findItems(name,
			    Qt::MatchExactly).at(0);
    item->setSelected(false);
    ircSessionTreeView->setCurrentItem(item);
    ircTextInput->setFocus(Qt::OtherFocusReason);
}
Ejemplo n.º 20
0
void pListView::setSelection(unsigned selection) {
  locked = true;
  QTreeWidgetItem* item = qtListView->currentItem();
  if(item) item->setSelected(false);
  item = qtListView->topLevelItem(selection);
  if(item) qtListView->setCurrentItem(item);
  locked = false;
}
Ejemplo n.º 21
0
void FixtureList::init()
{
	QTreeWidgetItem* item;
	
	m_listView->clear();

	connect(m_listView, SIGNAL(itemSelectionChanged()),
		this, SLOT(slotSelectionChanged()));
	connect(m_listView, SIGNAL(itemDoubleClicked(QTreeWidgetItem*)),
		this, SLOT(slotItemDoubleClicked()));
	
	for (t_fixture_id fxi_id = 0; fxi_id < KFixtureArraySize; fxi_id++)
	{
		Fixture* fxi = _app->doc()->fixture(fxi_id);
		if (fxi == NULL)
			continue;

		for (unsigned int n = 0; n < fxi->channels(); n++)
		{
			QLCChannel* channel;
			QString s;

			// Create a new item for a channel
			item = new QTreeWidgetItem(m_listView);

			// Fixture name
			item->setText(KColumnFixtureName, fxi->name());
			
			// Channel name
			channel = fxi->channel(n);
			if (channel != NULL)
			{
				s.sprintf("%.3d: ", n + 1);
				s += channel->name();
				item->setText(KColumnChannelName, s);
			}
			else
			{
				delete item;
				break;
			}
			
			// Relative channel number (not shown)
			s.sprintf("%.3d", n);
			item->setText(KColumnChannelNum, s);
			
			// Fixture ID (not shown)
			item->setText(KColumnFixtureID,
				      QString("%1").arg(fxi_id));
		}   
	}
	
	/* Select the first item */
	item = m_listView->topLevelItem(0);
	if (item != NULL)
		item->setSelected(true);
}
Ejemplo n.º 22
0
void CFontFileListView::selectionChanged()
{
    QList<QTreeWidgetItem *> items(selectedItems());
    QTreeWidgetItem          *item;

    foreach(item, items)
        if(!item->parent() && item->isSelected())
            item->setSelected(false);
}
Ejemplo n.º 23
0
bool wxListCtrl::SetItem(wxListItem& info)
{
    const long id = info.GetId();
    QTreeWidgetItem *qitem = QtGetItem(id);
    if ( qitem != NULL )
    {
        if ((info.m_mask & wxLIST_MASK_TEXT) && !info.GetText().IsNull() )
            qitem->setText(info.GetColumn(), wxQtConvertString(info.GetText()));
        qitem->setTextAlignment(info.GetColumn(), wxQtConvertTextAlign(info.GetAlign()));

        if ( info.m_mask & wxLIST_MASK_DATA )
        {
            QVariant variant = qVariantFromValue(info.GetData());
            qitem->setData(0, Qt::UserRole, variant);
        }
        if (info.m_mask & wxLIST_MASK_STATE)
        {
            if ((info.m_stateMask & wxLIST_STATE_FOCUSED) &&
                (info.m_state & wxLIST_STATE_FOCUSED))
                    m_qtTreeWidget->setCurrentItem(qitem, 0);
            if (info.m_stateMask & wxLIST_STATE_SELECTED)
                qitem->setSelected(info.m_state & wxLIST_STATE_SELECTED);
        }
        if (info.m_mask & wxLIST_MASK_IMAGE)
        {
            if (info.m_image >= 0)
            {
                wxImageList *imglst = GetImageList(InReportView() ? wxIMAGE_LIST_SMALL : wxIMAGE_LIST_NORMAL);
                wxCHECK_MSG(imglst, false, "invalid listctrl imagelist");
                const wxBitmap* bitmap = imglst->GetBitmapPtr(info.m_image);
                if (bitmap != NULL)
                {
                    // set the new image:
                    qitem->setIcon( info.GetColumn(), QIcon( *bitmap->GetHandle() ));
                }
            }
            else
            {
                // remove the image using and empty qt icon:
                qitem->setIcon( info.GetColumn(), QIcon() );
            }
        }
        for (int col=0; col<GetColumnCount(); col++)
        {
            if ( info.GetFont().IsOk() )
                qitem->setFont(col, info.GetFont().GetHandle() );
            if ( info.GetTextColour().IsOk() )
                qitem->setTextColor(col, info.GetTextColour().GetHandle());
            if ( info.GetBackgroundColour().IsOk() )
                qitem->setBackgroundColor(col, info.GetBackgroundColour().GetHandle());
        }
        return true;
    }
    else
        return false;
}
Ejemplo n.º 24
0
//---------------------------------------------------------------------------
void customActionsDialog::addItem()
{
    treeWidget->clearSelection();
    QTreeWidgetItem *temp = new QTreeWidgetItem(treeWidget,QStringList() << "*",0);
    temp->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled|Qt::ItemIsDragEnabled|Qt::ItemIsUserCheckable);
    temp->setCheckState(3,Qt::Unchecked);
    temp->setSelected(true);
    treeWidget->setCurrentItem(temp);
    treeWidget->scrollToItem(temp);
}
Ejemplo n.º 25
0
void HierarchyTreeWidget::on_treeWidget_itemSelectionChanged()
{
	QTreeWidgetItem* selectedItem = ui->treeWidget->currentItem();
	if (!selectedItem)
	{
		return;
	}

	if (internalSelectionChanged)
	{
		return;
	}

	QVariant data = selectedItem->data(ITEM_ID);
	HierarchyTreeNode::HIERARCHYTREENODEID id = data.toInt();
	HierarchyTreeNode* baseNode = HierarchyTreeController::Instance()->GetTree().GetNode(id);
	HierarchyTreePlatformNode* selectedPlatform = dynamic_cast<HierarchyTreePlatformNode* >(baseNode);
	HierarchyTreeScreenNode* selectedScreen =  dynamic_cast<HierarchyTreeScreenNode* >(baseNode);
	HierarchyTreeControlNode* selectedControl = dynamic_cast<HierarchyTreeControlNode* >(baseNode);
	
	if (!selectedPlatform && !selectedScreen && !selectedControl)
		return;
	
	internalSelectionChanged = true;
	
	//only platform or screen node can be seleted
	if (selectedPlatform || selectedScreen)
	{
		ResetSelection();
		HierarchyTreeController::Instance()->ResetSelectedControl();
		selectedItem->setSelected(true);
	}
	
	if (selectedControl)
	{
		selectedScreen = selectedControl->GetScreenNode();
		selectedPlatform = selectedScreen->GetPlatform();
	}
	else if (selectedScreen)
	{
		selectedPlatform = selectedScreen->GetPlatform();
	}
		
	HierarchyTreeController::Instance()->UpdateSelection(selectedPlatform, selectedScreen);
	HierarchyTreeController::Instance()->UpdateSelection(baseNode);
	
	internalSelectionChanged = false;
	
	if (selectedControl)
	{
		if (ui->treeWidget->selectedItems().size() == 1)
			HierarchyTreeController::Instance()->ResetSelectedControl();
		HierarchyTreeController::Instance()->SelectControl(selectedControl);
	}
}
Ejemplo n.º 26
0
void MusicBrowser::setupBrowser()
{
	QTreeWidgetItem *item;
	Loading *loading = new Loading;
	loading->show();
	item = new QTreeWidgetItem;
	item->setText(0, "(OFF)");
	item->setText(1, "null");
	item->setText(2, "");
	item->setIcon(0, QIcon(":/icons/music.png"));
	item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
	twMusicFiles->addTopLevelItem(item);
	twMusicFiles->setCurrentItem(item);
	item->setSelected(true);
	item = new QTreeWidgetItem;
	item->setText(0, "Global Data");
	item->setText(1, "dir");
	item->setText(2, ProjectData::datadir + "/music");
	item->setIcon(0, QIcon(":/icons/folder.png"));
	item->setFlags(Qt::ItemIsEnabled);
	twMusicFiles->addTopLevelItem(item);
	QCoreApplication::processEvents();
	setupDirectoryTree(item);
	QCoreApplication::processEvents();
	item = new QTreeWidgetItem;
	item->setText(0, "Project Data");
	item->setText(1, "dir");
	item->setText(2, ProjectData::projectLocation + "/music");
	item->setIcon(0, QIcon(":/icons/folder.png"));
	item->setFlags(Qt::ItemIsEnabled);
	twMusicFiles->addTopLevelItem(item);
	QCoreApplication::processEvents();
	setupDirectoryTree(item);
	QCoreApplication::processEvents();
	if (AudioManager::isMusicPlaying())
	{
		unsigned int length, position, minutes, seconds, deciSeconds;
		musicPlaySpeed = AudioManager::getMusicPlaySpeed();
		length = (unsigned int)(AudioManager::getMusicLength() / musicPlaySpeed);
		minutes = length / 60000;
		seconds = (length / 1000) % 60;
		deciSeconds = (length / 100) % 10;
		lblTotalLength->setText(QString("%1:%2.%3").arg(minutes).arg(seconds, 2, 10, QChar('0')).arg(deciSeconds));
		position = (unsigned int)(AudioManager::getMusicPosition() / musicPlaySpeed);
		minutes = ((unsigned int)(position / musicPlaySpeed)) / 60000;
		seconds = (((unsigned int)(position / musicPlaySpeed)) / 1000) % 60;
		deciSeconds = (((unsigned int)(position / musicPlaySpeed)) / 100) % 10;
		lblCurrentPosition->setText(QString("%1:%2.%3").arg(minutes).arg(seconds, 2, 10, QChar('0')).arg(deciSeconds));
		bStop->setEnabled(true);
	}
	else
		bStop->setEnabled(false);
	loading->doneLoading();
	delete loading;
}
Ejemplo n.º 27
0
void IdentityPage::slotNewIdentity()
{
    Q_ASSERT(!mIdentityDialog);

    QScopedPointer<NewIdentityDialog> dialog(new NewIdentityDialog(
                mIdentityManager, this));
    dialog->setObjectName(QStringLiteral("new"));

    if (dialog->exec() == QDialog::Accepted && dialog) {
        QString identityName = dialog->identityName().trimmed();
        Q_ASSERT(!identityName.isEmpty());

        //
        // Construct a new Identity:
        //
        switch (dialog->duplicateMode()) {
        case NewIdentityDialog::ExistingEntry: {
            KIdentityManagement::Identity &dupThis = mIdentityManager->modifyIdentityForName(dialog->duplicateIdentity());
            mIdentityManager->newFromExisting(dupThis, identityName);
            break;
        }
        case NewIdentityDialog::ControlCenter:
            mIdentityManager->newFromControlCenter(identityName);
            break;
        case NewIdentityDialog::Empty:
            mIdentityManager->newFromScratch(identityName);
        default:;
        }

        //
        // Insert into listview:
        //
        KIdentityManagement::Identity &newIdent = mIdentityManager->modifyIdentityForName(identityName);
        QTreeWidgetItem *item = Q_NULLPTR;
        if (!mIPage.mIdentityList->selectedItems().isEmpty()) {
            item = mIPage.mIdentityList->selectedItems()[0];
        }

        QTreeWidgetItem *newItem = Q_NULLPTR;
        if (item) {
            newItem = new IdentityListViewItem(mIPage.mIdentityList, mIPage.mIdentityList->itemAbove(item), newIdent);
        } else {
            newItem = new IdentityListViewItem(mIPage.mIdentityList, newIdent);
        }

        mIPage.mIdentityList->selectionModel()->clearSelection();
        if (newItem) {
            newItem->setSelected(true);
        }

        slotModifyIdentity();
        updateButtons();
    }
}
Ejemplo n.º 28
0
void ChannelModifierEditor::updateModifiersList(QString modifier)
{
    QList<QString> names = m_doc->modifiersCache()->templateNames();
    m_templatesTree->clear();
    foreach(QString name, names)
    {
        QTreeWidgetItem *item = new QTreeWidgetItem(m_templatesTree);
        item->setText(0, name);
        if (name == modifier)
            item->setSelected(true);
    }
Ejemplo n.º 29
0
// Make cell list match cells displayed in 3d view.
void EdgeWin::on_refreshButton_clicked(bool) {
  // TODO: Use selectedItems in QTreeWidget!!!
  if(project == NULL) return;
  for(int i = 0; i < project->num_cells(cur_stack); i++) {
    QTreeWidgetItem *model = mTree->topLevelItem(i);
    model->setSelected(project->stacks[cur_stack]->cells[i]->displayed);
    for(int k = 0; k < model->childCount(); k++) {
      model->child(k)->setSelected(project->stacks[cur_stack]->cells[i]->parts[k]->displayed);
    }
  }
}
Ejemplo n.º 30
0
void StaffTextProperties::channelItemChanged(QTreeWidgetItem* item, QTreeWidgetItem* pitem)
      {
      if (pitem)
            saveChannel(pitem->data(0, Qt::UserRole).toInt());
      if (item == 0)
            return;

      actionList->clear();
      Part* part = _staffText->staff()->part();

      int channelIdx      = item->data(0, Qt::UserRole).toInt();
      int tick = static_cast<Segment*>(_staffText->parent())->tick();
      Channel* channel    = part->instrument(tick)->channel(channelIdx);
      QString channelName = channel->name;

      for (const NamedEventList& e : part->instrument(tick)->midiActions()) {
            QTreeWidgetItem* ti = new QTreeWidgetItem(actionList);
            if (e.name.isEmpty() || e.name == "normal") {
                  ti->setText(0, tr("normal"));
                  ti->setData(0, Qt::UserRole, "normal");
                  }
            else {
                  ti->setText(0, qApp->translate("InstrumentsXML", e.name.toUtf8().data()));
                  ti->setData(0, Qt::UserRole, e.name);
                  }
            ti->setText(1, qApp->translate("InstrumentsXML", e.descr.toUtf8().data()));
            }
      for (const NamedEventList& e : channel->midiActions) {
            QTreeWidgetItem* ti = new QTreeWidgetItem(actionList);
            if (e.name.isEmpty() || e.name == "normal") {
                  ti->setText(0, tr("normal"));
                  ti->setData(0, Qt::UserRole, "normal");
                  }
            else {
                  ti->setText(0, qApp->translate("InstrumentsXML", e.name.toUtf8().data()));
                  ti->setData(0, Qt::UserRole, e.name);
                  }
            ti->setText(1, qApp->translate("InstrumentsXML", e.descr.toUtf8().data()));
            }
      for (const ChannelActions& ca : *_staffText->channelActions()) {
            if (ca.channel == channelIdx) {
                  for (QString s : ca.midiActionNames) {
                        QList<QTreeWidgetItem*> items;
                        for (int i = 0; i < actionList->topLevelItemCount(); i++) {
                              QTreeWidgetItem* ti = actionList->topLevelItem(i);
                              if (ti->data(0, Qt::UserRole) == s) {
                                    ti->setSelected(true);
                                    }
                              }
                        }
                  }
            }
      }