Skip to content

Commit

Permalink
output for wordle advanced
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.last.fm/svn/clientside/trunk/desktop@123169 ab8f4a45-97f9-0310-bbd1-854ce3dcee89
  • Loading branch information
dougma committed Mar 4, 2009
1 parent a22423f commit cd3a3b7
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions app/boffin/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,27 +383,13 @@ App::onWordle()
WordleDialog* w = new WordleDialog( m_mainwindow );
QString output;
TagCloudModel m( this, 0 );
TagCloudModel::CustomRoles role = TagCloudModel::LinearWeightRole;
TagCloudModel::CustomRoles role = TagCloudModel::WeightRole;

float inc;
if( m.rowCount() > 1 )
{
inc = m.index( m.rowCount() - 2, 0 ).data(role).value<float>() -
m.index( m.rowCount() - 1, 0 ).data(role).value<float>() ;
}
else
{
inc = 0.1f;
}

for( int i = 0; i < m.rowCount(); ++i )
{
float weight = m.index( i, 0 ).data( role ).value<float>();
for( float c = 0; c < weight; c+= inc )
{
output += m.index( i, 0 ).data().toString().replace(QRegExp( "\\s" ), "~") + " ";
}
output += m.index( i, 0 ).data().toString().replace(QRegExp( "\\s" ), "~") + ":" + QString::number(weight) + "\n";
}
w->setText( output );
w->show();
}
}

0 comments on commit cd3a3b7

Please sign in to comment.