void AssetTemplatesDialog::setAssetType( const AssetType & assetType )
{
	if( assetType.isRecord() ) {
		mAssetType = assetType;
		mTypeCombo->setCurrent( assetType );
	}
	updateTemplates();
}
void AssetTemplatesDialog::assetTypeChanged( const Record & assetType )
{
	AssetType at = assetType;
	if( at.isRecord() ) {
		mAssetType = at;
		updateTemplates();
	}
}
void AssetTemplatesDialog::setProject( const Project & project )
{
	mProject = project;
	if( project.isRecord() )
		mProjectCombo->setCurrent( project );
	else
		mProjectCombo->setCurrentIndex( 0 );
	updateTemplates();
}
void AssetTemplatesDialog::removeTemplate()
{
	if( mTemplate.isRecord() ) { //&& mTemplate.name() != "Default" ) {
		if( mAdded.contains( mTemplate ) ) {
			mAdded -= mTemplate;
			mTemplate.remove();
		} else
			mRemoved += mTemplate;
		updateTemplates();
	}
}
Example #5
0
void VNewFileDialog::handleInputChanged()
{
    bool showWarnLabel = false;
    const QString name = m_nameEdit->getEvaluatedText();
    bool nameOk = !name.isEmpty();
    if (nameOk) {
        // Check if the name conflicts with existing note name.
        // Case-insensitive when creating note.
        QString warnText;
        if (m_directory->findFile(name, false)) {
            nameOk = false;
            warnText = tr("<span style=\"%1\">WARNING</span>: "
                          "Name (case-insensitive) <span style=\"%2\">%3</span> already exists. "
                          "Please choose another name.")
                         .arg(g_config->c_warningTextStyle)
                         .arg(g_config->c_dataTextStyle)
                         .arg(name);
        } else if (!VUtils::checkFileNameLegal(name)) {
            // Check if evaluated name contains illegal characters.
            nameOk = false;
            warnText = tr("<span style=\"%1\">WARNING</span>: "
                          "Name <span style=\"%2\">%3</span> contains illegal characters "
                          "(after magic word evaluation).")
                         .arg(g_config->c_warningTextStyle)
                         .arg(g_config->c_dataTextStyle)
                         .arg(name);
        }

        if (!nameOk) {
            showWarnLabel = true;
            m_warnLabel->setText(warnText);
        }
    }

    m_warnLabel->setVisible(showWarnLabel);

    QPushButton *okBtn = m_btnBox->button(QDialogButtonBox::Ok);
    okBtn->setEnabled(nameOk);

    if (nameOk) {
        updateTemplates(VUtils::docTypeFromName(name));
    }
}
void AssetTemplatesDialog::addTemplate()
{
	bool valid;
	QString name = QInputDialog::getText( this, "Enter Template Name", "Enter Template Name", QLineEdit::Normal, QString(), &valid );
	if( valid ) {
		if( name.isEmpty() ) {
			ResinError::nameEmpty( this, "Template" );
			return;
		}
		if( mTemplates.names().contains( name ) ) {
			ResinError::nameTaken( this, "Template" );
			return;
		}
		AssetTemplate t;
		t.setProject( mProject );
		t.setAssetType( mAssetType );
		t.setName( name );
		t.commit();
		mAdded += t;
		updateTemplates();
	}
}
WizardPageMain::WizardPageMain( MainWizard *parent ) :
	QWizardPage(parent),
	ui(new Ui::WizardPageMain), mParent( parent ), mInitialized( false )
{
    // UI
    ui->setupUi( this );
	ui->projectNameLineEdit->setValidator( new QRegExpValidator( QRegExp( "[A-Za-z_][\\w]*" ), ui->projectNameLineEdit ) );
	ui->projectNameLineEdit->setText( "CinderProject" );
	mLocationPaletteOrig = ui->locationLineEdit->palette();

    // setup platform conditions; MUST MATCH enum above
	QMap<QString,QString> xcodePlatCond; xcodePlatCond["os"] = "macosx";
	mPlatformConditions.push_back( xcodePlatCond );
	QMap<QString,QString> xcodeIosPlatCond; xcodeIosPlatCond["os"] = "ios";
	mPlatformConditions.push_back( xcodeIosPlatCond );
	QMap<QString,QString> vc2013PlatCond; vc2013PlatCond["os"] = "msw"; vc2013PlatCond["compiler"] = "vc2013";
	mPlatformConditions.push_back( vc2013PlatCond );
    QMap<QString,QString> vc2013WinrtPlatCond; vc2013WinrtPlatCond["os"] = "winrt"; vc2013WinrtPlatCond["compiler"] = "vc2013";
    mPlatformConditions.push_back( vc2013WinrtPlatCond );

	updateTemplates();

	ui->locationLineEdit->setText( Preferences::getOutputPath() );
	ui->sourceControlCheckBox->setChecked( Preferences::getCreateGitRepoDefault() );

#if defined Q_OS_MAC
    ui->compilerList->item( XCODE_INDEX )->setSelected( true );
#endif

#if defined Q_OS_WIN
    ui->compilerList->item( VC2013_INDEX )->setSelected( true );
#endif

	// Update controls
    updateCinderVersionsCtrl();
	validateNextButton();
}
void AssetTemplatesDialog::projectChanged( const Record & project )
{
	mProject = project;
	updateTemplates();
}
void WizardPageMain::setCinderLocationByIndex( int index )
{
	ui->cinderVersionComboBox->setCurrentIndex( index );
	ui->cinderVersionPathLabel->setText( QDir::toNativeSeparators( mParent->getCinderLocation() ) );
	updateTemplates();
}