예제 #1
0
void HierarchyTreeWidget::OnCopyAction()
{
	QList<QTreeWidgetItem*> items = ui->treeWidget->selectedItems();
	if (!items.size())
		return;

	QTreeWidgetItem* item = items.at(0);
	QVariant data = item->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 (selectedControl)
	{
		CopyPasteController::Instance()->CopyControls(HierarchyTreeController::Instance()->GetActiveControlNodes());
	}
	else if (selectedScreen)
	{
		HierarchyTreeNode::HIERARCHYTREENODESLIST list;
		list.push_back(selectedScreen);
		CopyPasteController::Instance()->Copy(list);
	}
	else if (selectedPlatform)
	{
		HierarchyTreeNode::HIERARCHYTREENODESLIST list;
		list.push_back(selectedPlatform);
		CopyPasteController::Instance()->Copy(list);
		CopyPasteController::Instance()->Paste(selectedPlatform->GetRoot());
	}
}
예제 #2
0
void PlatformMetadata::SetWidth(float value)
{
    HierarchyTreePlatformNode* platformNode = GetPlatformNode();
    if (platformNode)
    {
        platformNode->SetSize(value, platformNode->GetHeight());
    }
}
예제 #3
0
void PlatformMetadata::SetName(const QString& name)
{
    HierarchyTreePlatformNode* platformNode = GetPlatformNode();
    if (platformNode)
    {
        platformNode->SetName(name);
    }
}
예제 #4
0
float PlatformMetadata::GetWidth() const
{
    HierarchyTreePlatformNode* platformNode = GetPlatformNode();
    if (platformNode)
    {
        return platformNode->GetWidth();
    }
    
    return -1.0f;
}
예제 #5
0
void CreateAggregatorDlg::SetDefaultPlatform(HierarchyTreeNode::HIERARCHYTREENODEID platformId)
{
	HierarchyTreePlatformNode* node = dynamic_cast<HierarchyTreePlatformNode*>(HierarchyTreeController::Instance()->GetTree().GetNode(platformId));
	if (!node)
	{
		node = HierarchyTreeController::Instance()->GetActivePlatform();
		if (node)
		{
			platformId = node->GetId();
		}
	}

	int id = ui->platformsCombo->findData(QVariant(platformId));
	ui->platformsCombo->setCurrentIndex(id);

	if (node)
	{
		ui->width->setValue(node->GetWidth());
		ui->height->setValue(node->GetHeight());
	}
}
예제 #6
0
void CreateAggregatorDlg::accept()
{
	const QString name = GetName();
	QString errorMsg("");
	if (!name.isNull() && !name.isEmpty())
	{
		// Get current selected patform in combobox. It could differ from active one.
		int platformId = GetPlatformId();
		HierarchyTreePlatformNode* paltfromNode = dynamic_cast<HierarchyTreePlatformNode*>(HierarchyTreeController::Instance()->GetTree().GetNode(platformId));
		
		if(paltfromNode && !paltfromNode->IsAggregatorOrScreenNamePresent(name))
		{
            if(LibraryController::Instance()->IsControlNameExists(name))
            {
                errorMsg = "Please fill aggregator name field with unique value.\r\n The same name with any of library controls is forbidden.";
            }
            else
            {
                QDialog::accept();
            }
		}
		else
		{
			errorMsg = "Please fill aggregator name field with unique value.\r\n The same name with any of screen is forbidden.";
		}
	}
	else
	{
		errorMsg = "Please fill aggregator name field with value. It can't be empty.";
	}
	
	if(!errorMsg.isEmpty())
	{
		QMessageBox msgBox;
		msgBox.setText(errorMsg);
		msgBox.exec();
	}
	
}
예제 #7
0
void HierarchyTreeController::UpdateLocalization(bool takePathFromLocalizationSystem)
{
    // Update the Active Platform.
    HierarchyTreePlatformNode* activePlatformNode = GetActivePlatform();
    if (!activePlatformNode)
    {
        return;
    }

    if (takePathFromLocalizationSystem)
    {
        // FROM LocalizationSystem TO Active Platform
        activePlatformNode->SetLocalizationPath(LocalizationSystem::Instance()->GetDirectoryPath());
        activePlatformNode->SetLocale(LocalizationSystem::Instance()->GetCurrentLocale());
    }
    else
    {
        // FROM Active Platform TO Localization System.
        const FilePath & localizationPath = activePlatformNode->GetLocalizationPath();
        const String& locale = activePlatformNode->GetLocale();

        if (localizationPath.IsEmpty() || locale.empty())
        {
            // No Localization Path is already set - cleanup the Localization System.
            LocalizationSystem::Instance()->Cleanup();
        }
        else
        {
            // Re-setup the Localization System with the values stored on Platform level.
            LocalizationSystem::Instance()->SetCurrentLocale(locale);
            LocalizationSystem::Instance()->InitWithDirectory(localizationPath);
        }
    }
    
    // Localization System is updated; need to look through all controls
    // and cause them to update their texts according to the new Localization.
    hierarchyTree.UpdateLocalization();
}
예제 #8
0
void HierarchyTreeController::DeleteNodesFiles(const HierarchyTreeNode::HIERARCHYTREENODESLIST &nodes)
{
	HierarchyTreeNode::HIERARCHYTREENODESLIST::const_iterator iter;
	for (iter = nodes.begin(); iter != nodes.end(); ++iter)
	{
		HierarchyTreeScreenNode* screenNode = dynamic_cast<HierarchyTreeScreenNode*>(*iter);
		HierarchyTreePlatformNode* platformNode = dynamic_cast<HierarchyTreePlatformNode*>(*iter);

		if (screenNode)
		{
			screenNode->SetMarked(true);
			QString path = screenNode->GetPlatform()->GetScreenPath(screenNode->GetName());
			FileSystem::Instance()->DeleteFile(path.toStdString());
		}

		if (platformNode)
		{
			platformNode->SetMarked(true);
			platformNode->SetChildrenMarked(true);
			FileSystem::Instance()->DeleteDirectory(platformNode->GetPlatformFolder(), true);
		}
	}
}
void HierarchyTreeScreenNode::SetParent(HierarchyTreeNode* node, HierarchyTreeNode* insertAfter)
{
	HierarchyTreePlatformNode* newPlatform = dynamic_cast<HierarchyTreePlatformNode*>(node);
	DVASSERT(newPlatform);
	if (!newPlatform)
		return;

	HierarchyTreePlatformNode* oldPlatform = GetPlatform();
	if (oldPlatform)
	{
		oldPlatform->RemoveTreeNode(this, false, false);
	}
	
	parent = newPlatform;
	GetScreen()->SetRect(Rect(0, 0, newPlatform->GetWidth(), newPlatform->GetHeight()));
	newPlatform->AddTreeNode(this, insertAfter);
}