Пример #1
0
void SelectPathWidgetBase::OpenClicked()
{
	DAVA::FilePath presentPath(text().toStdString());
	DAVA::FilePath dialogString(openDialogDefaultPath);
	if(presentPath.GetDirectory().Exists())//check if file text box clean
	{
		dialogString = presentPath.GetDirectory();
	}
	this->blockSignals(true);
	DAVA::String retString = QtFileDialog::getOpenFileName(this, openFileDialogTitle.c_str(), QString(dialogString.GetAbsolutePathname().c_str()), fileFormatFilter.c_str()).toStdString();
	this->blockSignals(false);

    if(retString.empty())
    {
        return;
    }
    
    DAVA::String projectPath = ProjectManager::Instance()->CurProjectPath().GetAbsolutePathname();

    if(checkForProjectPath && DAVA::String::npos == retString.find(projectPath))
    {
        QMessageBox::warning(NULL, "Wrong file selected", QString(DAVA::Format("Path %s doesn't belong to project.", retString.c_str()).c_str() ), QMessageBox::Ok);
        return;
    }
    
	HandlePathSelected(retString);
}
Пример #2
0
FontManagerDialog::FontManagerDialog(bool okButtonEnable,  const QString& graphicsFontPath, QDialog *parent) :
    QDialog(parent),
    ui(new Ui::FontManagerDialog)
{    
    ui->setupUi(this);
    // Setup ok button - it should be visible only if user want to change font of control.
    ui->okButton->setVisible(okButtonEnable);
    dialogResultFont = NULL;
	// Pack graphics fonts sprites each time sprite dialog is opened
	ResourcePacker2D *resPacker = new ResourcePacker2D();

	DAVA::String inDir = ResourcesManageHelper::GetFontSpritesDatasourceDirectory().toStdString();
	DAVA::String outDir = ResourcesManageHelper::GetFontSpritesDirectory().toStdString();
	// Do not pack resources if input/output folders are empty
	if (!inDir.empty() && !outDir.empty())
	{
		resPacker->InitFolders(inDir, outDir);
		resPacker->PackResources(GPU_PNG);
	}

    ui->setDefaultButton->setVisible(false);
    
    // Initialize dialog
    ConnectToSignals();
    InitializeTableView();
    UpdateTableViewContents();
 	UpdateDialogInformation();

	SafeDelete(resPacker);
	
	// Setup default path for graphics font sprites
	if (!graphicsFontPath.isEmpty())
	{
		currentFontPath = ResourcesManageHelper::GetFontAbsolutePath(graphicsFontPath);
	}
}