Esempio n. 1
0
void ScreenshotButton::onClick(wxCommandEvent& WXUNUSED(event)) {
   SetBitmapPressed(normal);  //nechci aby na screenshotu vypadal zmacknuty
   Refresh();
   wxBitmap screenshot;
   GetScreenshot(screenshot);
   //screenshot.ClearAlpha();
   SetBitmapPressed(press);
   /**Ulozeni dp souboru**/
   wxFileDialog fileDialog(this, _("Save a screenshot"), wxT(""), wxT("spektrograf.bmp"), wxT("Rastr (*.bmp) | *.bmp|Obrázek PNG (nedoporuèuje se) (*.png) | *.png|JPEG formát (*.jpg) | *.jpeg;*.jpg"), wxFD_SAVE);
   if(fileDialog.ShowModal() == wxID_OK) {
          wxFileName namePath(fileDialog.GetPath());
          int fileType = wxBITMAP_TYPE_BMP;
          if( namePath.GetExt().CmpNoCase(wxT("jpeg")) == 0 ) fileType = wxBITMAP_TYPE_JPEG;
          if( namePath.GetExt().CmpNoCase(wxT("jpg")) == 0 )  fileType = wxBITMAP_TYPE_JPEG;
          if( namePath.GetExt().CmpNoCase(wxT("png")) == 0 )  fileType = wxBITMAP_TYPE_PNG;
		  if( namePath.GetExt().CmpNoCase(wxT("bmp")) == 0 )  fileType = wxBITMAP_TYPE_BMP;
		  wxImage tosave(screenshot.ConvertToImage());
		  if(tosave.HasAlpha())
		    tosave.ClearAlpha();

		  if(wxFileExists(fileDialog.GetPath())) 
		  {
			  wxMessageDialog potvrd(this, _("Soubor existuje! Chcete jej pøepsat?"), _("Soubor existuje"), wxYES_NO|wxNO_DEFAULT|wxICON_WARNING);
			  if(potvrd.ShowModal()==wxID_YES)
				  tosave.SaveFile(fileDialog.GetPath(),(wxBitmapType)fileType);

		  }
		  else 
		    tosave.SaveFile(fileDialog.GetPath(),(wxBitmapType)fileType);
   }
   return;
}
Esempio n. 2
0
QString FAlbum::prettyUrl() const
{
    QString u = i18n("Person ") + namePath(true);
    return u;
}