Пример #1
0
void Window::showDetails() {
    Pattern* pattern = m_board->pattern();
    if (!pattern) {
        return;
    }
    QString patternid = QSettings().value("Current/Pattern", 0).toString();
    static const QStringList sizes = QStringList() << NewGameDialog::tr("Low")
                                     << NewGameDialog::tr("Medium")
                                     << NewGameDialog::tr("High")
                                     << NewGameDialog::tr("Very High");
    QString number = "4"
                     + m_board->words()->language()
                     + patternid
                     + QString::number(pattern->wordCount())
                     + QString("%1").arg(int(pattern->wordLength() - 4), 2, 16, QLatin1Char('0'))
                     + QString::number(pattern->seed(), 16);
    QMessageBox dialog(QMessageBox::Information,
                       tr("Details"),
                       QString("<p><b>%1</b> %2<br><b>%3</b> %4<br><b>%5</b> %6<br><b>%7</b> %8<br><b>%9</b> %10</p>")
                       .arg(tr("Pattern:")).arg(pattern->name())
                       .arg(NewGameDialog::tr("Language:")).arg(LocaleDialog::languageName(m_board->words()->language()))
                       .arg(NewGameDialog::tr("Amount of Words:")).arg(sizes.value(pattern->wordCount()))
                       .arg(NewGameDialog::tr("Word Length:")).arg(NewGameDialog::tr("%n letter(s)", "", pattern->wordLength() + 1))
                       .arg(tr("Game Number:")).arg(number),
                       QMessageBox::NoButton,
                       this);
    dialog.setIconPixmap(QIcon(QString(":/patterns/%1.png").arg(patternid)).pixmap(96,96));
    dialog.exec();
}
Пример #2
0
// Find pattern by name
Pattern* Model::findPattern(QString name) const
{
	Messenger::enter("Model::findPattern");
	Pattern* p = NULL;
	for (p = patterns_.first(); p != NULL; p = p->next) if (p->name() == name) break;
	if (p == NULL) Messenger::print("Pattern '%s' does not exist in model '%s'.", qPrintable(name), qPrintable(name_));
	Messenger::exit("Model::findPattern");
	return p;
}
void InstrumentTrack::setName( const QString & _new_name )
{
	// when changing name of track, also change name of those patterns,
	// which have the same name as the instrument-track
	for( int i = 0; i < numOfTCOs(); ++i )
	{
		Pattern* p = dynamic_cast<Pattern*>( getTCO( i ) );
		if( ( p != NULL && p->name() == name() ) || p->name() == "" )
		{
			p->setName( _new_name );
		}
	}

	Track::setName( _new_name );
	m_midiPort.setName( name() );
	m_audioPort.setName( name() );

	emit nameChanged();
}
Пример #4
0
// Print patterns
void Model::printPatterns() const
{
	Messenger::enter("Model::printPatterns");
	Pattern* p = patterns_.first();
	if (p == NULL) Messenger::print("No patterns defined for model '%s'.", qPrintable(name_));
	else
	{
		Messenger::print("Pattern info for model '%s':", qPrintable(name_));
		Messenger::print("  ID  NMols  StartId EndId   Name              Forcefield");
		while (p != NULL)
		{
			Messenger::print("  %2i  %-5i  %-6i  %-6i  %-16s  %s", p->id(), p->nMolecules(), p->startAtom()+1, p->endAtom()+1, qPrintable(p->name()), p->forcefield() ? qPrintable(p->forcefield()->name()) : "< Inherited >");
			p = p->next;
		}
	}
	Messenger::exit("Model::printPatterns");
}