Logo Search packages:      
Sourcecode: kmess version File versions  Download package

QString Emoticon::getHtml ( bool  small  )  const

Get a suitable bit of HTML which represents the emoticon

The images output as HTML are limited in width and height, though the original files keep their original dimensions - and are sent untouched to your contacts.

Parameters:
small If true, the HTML will paint a tiny version of the emoticon

Definition at line 158 of file emoticon.cpp.

Referenced by EmoticonTheme::updateCache().

{
  int width, height;
  QString emoticonClass;

  // Enforce minimum and maximum size limits
  if( small )
  {
    width  = width_; // QMIN( EMOTICONS_DEFAULT_SIZE, width_  ); // Require only a max height
    height = QMIN( EMOTICONS_DEFAULT_SIZE, height_ );
  }
  else
  {
    width  = width_; // QMIN( EMOTICONS_MAX_SIZE, width_  ); // Require only a max height
    height = QMIN( EMOTICONS_MAX_SIZE, height_ );
  }

  // Resize the image so the aspect ratio is kept, and its dimensions don't exceed the enforced
  // maximum size
  if( width_ > height_ )
  {
      height = ( width * height_ ) / width_;
  }
  else
  {
      width = ( height * width_ ) / height_;
  }

  if( isCustomEmoticon_ )
  {
    emoticonClass = "customEmoticon";
  }
  else
  {
    emoticonClass = "standardEmoticon";
  }

  return "<img src='" + picturePath_ + "' alt='" + shortcuts_.first() + "' height='" + QString::number(height)
       + "' width='" + QString::number(width) + "' valign='middle' class='"
       + emoticonClass + "' />";
}


Generated by  Doxygen 1.6.0   Back to index