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

void DCOptions::SetUserPhoto ( QString  filename  )  [private]

Definition at line 469 of file dcoptions.cpp.

Referenced by SetValues(), and slotChangePhoto().

{
      QImage im;

      if ( filename != "" )
      {
            if ( im.load(filename) == TRUE )
            {
                  if ( (im.width() > 32) ||
                       (im.height() > 32) )
                  {
                        im = im.smoothScale(32,32,QImage::ScaleMin);
                  }

                  if ( im.depth() > 8 )
                        im = im.convertDepth(8);

                  if ( im.numColors() > 256 )
                        im.setNumColors(256);

                  if ( im.save( (g_pConfig->GetConfigPath() + "photo.png").Data(), "PNG", 0 ) == FALSE )
                  {
                        QMessageBox::critical( 0, "Valknut", QString(tr("Can't save Image!")));
                  }
                  else
                  {
                        ToolButton_PHOTO->setIconSet( QIconSet(im, QIconSet::Large) );
                        // ToolButton_PHOTO->setTextLabel(filename);
                        ToolButton_PHOTO->setTextLabel((g_pConfig->GetConfigPath() + "photo.png").Data());
                  }
            }
            else
            {
                  QMessageBox::critical( 0, "Valknut", QString(tr("Can't load Image!")));
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index