Ticket #5724: screenshotEnhancement-filenameInSilentMode.patch
File screenshotEnhancement-filenameInSilentMode.patch, 3.5 KB (added by , 15 years ago) |
---|
-
src/apps/screenshot/ScreenshotWindow.cpp
91 91 92 92 ScreenshotWindow::ScreenshotWindow(bigtime_t delay, bool includeBorder, 93 93 bool includeMouse, bool grabActiveWindow, bool showConfigWindow, 94 bool saveScreenshotSilent, int32 imageFileType, int32 translator) 94 bool saveScreenshotSilent, int32 imageFileType, int32 translator, 95 BString outputFilename) 95 96 : 96 97 BWindow(BRect(0, 0, 200.0, 100.0), TR("Retake screenshot"), B_TITLED_WINDOW, 97 98 B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_QUIT_ON_WINDOW_CLOSE | … … 107 108 fGrabActiveWindow(grabActiveWindow), 108 109 fShowConfigWindow(showConfigWindow), 109 110 fSaveScreenshotSilent(saveScreenshotSilent), 111 fOutputFilename(outputFilename), 110 112 fExtension(""), 111 113 fTranslator(translator), 112 114 fImageFileType(imageFileType) … … 805 807 if (path == NULL) 806 808 return B_ERROR; 807 809 808 if (fSaveScreenshotSilent) 809 path.Append(_FindValidFileName( 810 TR_CMT("screenshot1", "!! Filename of first screenshot !!")).String()); 811 else 810 if (fSaveScreenshotSilent) { 811 if (!fOutputFilename.Compare("")) 812 path.Append(_FindValidFileName( 813 TR_CMT("screenshot1", "!! Filename of first screenshot !!")).String()); 814 else 815 path.SetTo(fOutputFilename); 816 } else 812 817 path.Append(fNameControl->Text()); 813 818 814 819 BEntry entry; -
src/apps/screenshot/ScreenshotWindow.h
37 37 bool showConfigWindow = false, 38 38 bool saveScreenshotSilent = false, 39 39 int32 imageFileType = B_PNG_FORMAT, 40 int32 translator = 8); 40 int32 translator = 8, 41 BString outputFilename = ""); 41 42 virtual ~ScreenshotWindow(); 42 43 43 44 virtual void MessageReceived(BMessage* message); … … 93 94 bool fGrabActiveWindow; 94 95 bool fShowConfigWindow; 95 96 bool fSaveScreenshotSilent; 97 BString fOutputFilename; 96 98 BString fExtension; 97 99 98 100 int32 fTranslator; -
src/apps/screenshot/Screenshot.cpp
85 85 { 86 86 bigtime_t delay = 0; 87 87 88 BString outputFilename = BString(""); 88 89 bool includeBorder = false; 89 90 bool includeMouse = false; 90 91 bool grabActiveWindow = false; … … 127 128 , argv[i]); 128 129 exit(0); 129 130 } 131 } else if (i == argc - 1) { 132 outputFilename << argv[i]; 130 133 } 131 134 } 132 135 … … 134 137 135 138 new ScreenshotWindow(delay, includeBorder, includeMouse, grabActiveWindow, 136 139 showConfigureWindow, saveScreenshotSilent, fImageFileType, 137 fTranslator );140 fTranslator, outputFilename); 138 141 } 139 142 140 143 141 144 void 142 145 Screenshot::_ShowHelp() const 143 146 { 144 printf("Screenshot [OPTION]... Creates a bitmap of the current screen\n\n"); 145 printf("OPTION\n"); 147 printf("Screenshot [OPTIONS] [FILE] Creates a bitmap of the current screen\n\n"); 148 printf("FILE is the optional output path / filename used in silent mode. If FILE is not given, a default filename will be generated in the prefered directory.\n\n"); 149 printf("OPTIONS\n"); 146 150 printf(" -o, --options Show options window first\n"); 147 151 printf(" -m, --mouse-pointer Include the mouse pointer\n"); 148 152 printf(" -b, --border Include the window border\n");