gui_actions.cpp

changeset 147
291a1fe2d278
parent 146
2ab24976acaa
child 149
96b14d5e7365
equal deleted inserted replaced
146:2ab24976acaa 147:291a1fe2d278
344 344
345 str root = basename (g_CurrentFile->zFileName.chars ()); 345 str root = basename (g_CurrentFile->zFileName.chars ());
346 if (root.substr (~root - 4, -1) == ".dat") 346 if (root.substr (~root - 4, -1) == ".dat")
347 root -= 4; 347 root -= 4;
348 348
349 str defaultname = format ("%s.png", root.chars ()); 349 str defaultname = (~root > 0) ? format ("%s.png", root.chars ()) : "";
350 str fname = QFileDialog::getSaveFileName (g_ForgeWindow, "Save Screencap", defaultname, 350 str fname = QFileDialog::getSaveFileName (g_ForgeWindow, "Save Screencap", defaultname,
351 "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)"); 351 "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)");
352 352
353 if (~fname > 0 && !img.save (fname)) 353 if (~fname > 0 && !img.save (fname))
354 critical (format ("Couldn't open %s for writing to save screencap: %s", fname.chars(), strerror (errno))); 354 critical (format ("Couldn't open %s for writing to save screencap: %s", fname.chars(), strerror (errno)));

mercurial