diff --git a/ShareX.HelpersLib/UpdateChecker/DownloaderForm.cs b/ShareX.HelpersLib/UpdateChecker/DownloaderForm.cs index 0b9676cfd..0de0536e7 100644 --- a/ShareX.HelpersLib/UpdateChecker/DownloaderForm.cs +++ b/ShareX.HelpersLib/UpdateChecker/DownloaderForm.cs @@ -198,16 +198,17 @@ private void ChangeStatus(string status) private void HandleDownloadException(Exception ex) { - if(ex is WebException) + if (ex is WebException) { - var webEx = (WebException)ex; + WebException webEx = (WebException)ex; if (webEx.Status == WebExceptionStatus.ProtocolError) { - var response = webEx.Response as HttpWebResponse; + HttpWebResponse response = webEx.Response as HttpWebResponse; + if (response != null) { - var responseCode = (int)response.StatusCode; + int responseCode = (int)response.StatusCode; if (responseCode == 401) { diff --git a/ShareX/Forms/MainForm.Designer.cs b/ShareX/Forms/MainForm.Designer.cs index bdc79c54a..dd754ae6d 100644 --- a/ShareX/Forms/MainForm.Designer.cs +++ b/ShareX/Forms/MainForm.Designer.cs @@ -165,6 +165,7 @@ private void InitializeComponent() this.tsmiImagePreviewShow = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiImagePreviewHide = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiImagePreviewAutomatic = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiSearchImage = new System.Windows.Forms.ToolStripMenuItem(); this.niTray = new System.Windows.Forms.NotifyIcon(this.components); this.cmsTray = new System.Windows.Forms.ContextMenuStrip(this.components); this.tsmiTrayCapture = new System.Windows.Forms.ToolStripMenuItem(); @@ -894,6 +895,7 @@ private void InitializeComponent() this.tsmiDeleteSelectedFile, this.tsmiShortenSelectedURL, this.tsmiShareSelectedURL, + this.tsmiSearchImage, this.tsmiShowQRCode, this.tsmiOCRImage, this.tsmiCombineImages, @@ -1285,6 +1287,13 @@ private void InitializeComponent() resources.ApplyResources(this.tsmiImagePreviewAutomatic, "tsmiImagePreviewAutomatic"); this.tsmiImagePreviewAutomatic.Click += new System.EventHandler(this.tsmiImagePreviewAutomatic_Click); // + // tsmiSearchImage + // + this.tsmiSearchImage.Image = global::ShareX.Properties.Resources.Google; + this.tsmiSearchImage.Name = "tsmiSearchImage"; + resources.ApplyResources(this.tsmiSearchImage, "tsmiSearchImage"); + this.tsmiSearchImage.Click += new System.EventHandler(this.tsmiSearchImage_Click); + // // niTray // this.niTray.ContextMenuStrip = this.cmsTray; @@ -2094,5 +2103,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem tsmiCombineImages; private System.Windows.Forms.ToolStripMenuItem tsmiOpenActionsToolbar; private System.Windows.Forms.ToolStripMenuItem tsmiDeleteSelectedItem; + private System.Windows.Forms.ToolStripMenuItem tsmiSearchImage; } } \ No newline at end of file diff --git a/ShareX/Forms/MainForm.cs b/ShareX/Forms/MainForm.cs index 40dc89de0..89ca16386 100644 --- a/ShareX/Forms/MainForm.cs +++ b/ShareX/Forms/MainForm.cs @@ -524,9 +524,10 @@ private void UpdateContextMenu() { cmsTaskInfo.SuspendLayout(); - tsmiStopUpload.Visible = tsmiOpen.Visible = tsmiCopy.Visible = tsmiShowErrors.Visible = tsmiShowResponse.Visible = tsmiShowQRCode.Visible = tsmiOCRImage.Visible = - tsmiCombineImages.Visible = tsmiUploadSelectedFile.Visible = tsmiDownloadSelectedURL.Visible = tsmiEditSelectedFile.Visible = tsmiDeleteSelectedItem.Visible = - tsmiDeleteSelectedFile.Visible = tsmiShortenSelectedURL.Visible = tsmiShareSelectedURL.Visible = tsmiClearList.Visible = tssUploadInfo1.Visible = false; + tsmiStopUpload.Visible = tsmiOpen.Visible = tsmiCopy.Visible = tsmiShowErrors.Visible = tsmiShowResponse.Visible = tsmiSearchImage.Visible = + tsmiShowQRCode.Visible = tsmiOCRImage.Visible = tsmiCombineImages.Visible = tsmiUploadSelectedFile.Visible = tsmiDownloadSelectedURL.Visible = + tsmiEditSelectedFile.Visible = tsmiDeleteSelectedItem.Visible = tsmiDeleteSelectedFile.Visible = tsmiShortenSelectedURL.Visible = + tsmiShareSelectedURL.Visible = tsmiClearList.Visible = tssUploadInfo1.Visible = false; pbPreview.Reset(); uim.RefreshSelectedItems(); @@ -614,6 +615,7 @@ private void UpdateContextMenu() tsmiDeleteSelectedFile.Visible = uim.SelectedItem.IsFileExist; tsmiShortenSelectedURL.Visible = uim.SelectedItem.IsURLExist; tsmiShareSelectedURL.Visible = uim.SelectedItem.IsURLExist; + tsmiSearchImage.Visible = uim.SelectedItem.IsURLExist; tsmiShowQRCode.Visible = uim.SelectedItem.IsURLExist; tsmiOCRImage.Visible = uim.SelectedItem.IsImageFile; tsmiCombineImages.Visible = uim.SelectedItems.Where(x => x.IsImageFile).Count() > 1; @@ -1891,6 +1893,11 @@ private void tsmiEditSelectedFile_Click(object sender, EventArgs e) uim.EditImage(); } + private void tsmiSearchImage_Click(object sender, EventArgs e) + { + uim.SearchImage(); + } + private void tsmiShowQRCode_Click(object sender, EventArgs e) { uim.ShowQRCode(); diff --git a/ShareX/Forms/MainForm.resx b/ShareX/Forms/MainForm.resx index ada542923..3cfb8a4fd 100644 --- a/ShareX/Forms/MainForm.resx +++ b/ShareX/Forms/MainForm.resx @@ -183,45 +183,6 @@ 1 - - Filename - - - 150 - - - Status - - - Progress - - - 125 - - - Speed - - - 75 - - - Elapsed - - - 45 - - - Remaining - - - 45 - - - URL - - - 145 - Fill @@ -318,12 +279,105 @@ 3 + + Filename + + + 150 + + + Status + + + Progress + + + 125 + + + Speed + + + 75 + + + Elapsed + + + 45 + + + Remaining + + + 45 + + + URL + + + 145 + Bottom, Right True + + pbPatreonOpen + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flpPatreon + + + 0 + + + pbPatreonHide + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flpPatreon + + + 1 + + + 613, 356 + + + 215, 45 + + + 3 + + + False + + + False + + + flpPatreon + + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + 567, 17 + 0, 0 @@ -339,9 +393,6 @@ 0 - - 567, 17 - Open ShareX Patreon campaign web page @@ -387,33 +438,6 @@ 1 - - 613, 356 - - - 215, 45 - - - 3 - - - False - - - False - - - flpPatreon - - - System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - 17, 17 @@ -423,6 +447,42 @@ Left + + 0, 0 + + + 6, 6, 6, 6 + + + 160, 407 + + + 1 + + + tsMain + + + System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + MiddleLeft + + + Magenta + + + 147, 20 + + + Capture + 191, 22 @@ -501,17 +561,17 @@ Auto capture... - + MiddleLeft - + Magenta - + 147, 20 - - Capture + + Upload 203, 22 @@ -543,18 +603,6 @@ Drag and drop upload... - - MiddleLeft - - - Magenta - - - 147, 20 - - - Upload - BottomLeft @@ -567,6 +615,18 @@ Workflows + + MiddleLeft + + + Magenta + + + 147, 20 + + + Tools + 183, 22 @@ -651,18 +711,6 @@ Monitor test... - - MiddleLeft - - - Magenta - - - 147, 20 - - - Tools - 147, 6 @@ -690,6 +738,18 @@ After upload tasks + + MiddleLeft + + + Magenta + + + 147, 20 + + + Destinations + 187, 22 @@ -729,18 +789,6 @@ Destination settings... - - MiddleLeft - - - Magenta - - - 147, 20 - - - Destinations - MiddleLeft @@ -816,6 +864,18 @@ Image history... + + MiddleLeft + + + Magenta + + + 147, 20 + + + Debug + 172, 22 @@ -852,18 +912,6 @@ Test URL sharing - - MiddleLeft - - - Magenta - - - 147, 20 - - - Debug - MiddleLeft @@ -888,30 +936,6 @@ About... - - 0, 0 - - - 6, 6, 6, 6 - - - 160, 407 - - - 1 - - - tsMain - - - System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 4 - 286, 17 @@ -927,6 +951,147 @@ Stop upload + + + + + 228, 22 + + + Open + + + + + + 228, 22 + + + Copy + + + Ctrl+U + + + 228, 22 + + + Upload + + + Ctrl+D + + + 228, 22 + + + Download + + + Ctrl+E + + + 228, 22 + + + Edit image... + + + Del + + + 228, 22 + + + Remove task from list + + + Shift+Del + + + 228, 22 + + + Delete file locally... + + + 228, 22 + + + Shorten URL + + + 228, 22 + + + Share URL + + + 228, 22 + + + Search image... + + + 228, 22 + + + Show QR code... + + + 228, 22 + + + OCR image... + + + 228, 22 + + + Combine images... + + + 228, 22 + + + Show response... + + + 228, 22 + + + Clear list + + + 225, 6 + + + 228, 22 + + + Hide menu + + + 228, 22 + + + Hide columns + + + 228, 22 + + + Image preview + + + 229, 472 + + + cmsTaskInfo + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + Enter @@ -981,15 +1146,6 @@ Thumbnail file - - - - - 228, 22 - - - Open - Ctrl+C @@ -1134,117 +1290,6 @@ False - - - - - 228, 22 - - - Copy - - - Ctrl+U - - - 228, 22 - - - Upload - - - Ctrl+D - - - 228, 22 - - - Download - - - Ctrl+E - - - 228, 22 - - - Edit image... - - - Del - - - 228, 22 - - - Remove task from list - - - Shift+Del - - - 228, 22 - - - Delete file locally... - - - 228, 22 - - - Shorten URL - - - 228, 22 - - - Share URL - - - 228, 22 - - - Show QR code... - - - 228, 22 - - - OCR image... - - - 228, 22 - - - Combine images... - - - 228, 22 - - - Show response... - - - 228, 22 - - - Clear list - - - 225, 6 - - - 228, 22 - - - Hide menu - - - 228, 22 - - - Hide columns - 130, 22 @@ -1263,27 +1308,30 @@ Automatic - - 228, 22 - - - Image preview - - - 229, 428 - - - cmsTaskInfo - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 105, 17 190, 17 + + 193, 484 + + + cmsTray + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ShareX + + + 192, 22 + + + Capture + 191, 22 @@ -1362,11 +1410,11 @@ Auto capture... - + 192, 22 - - Capture + + Upload 203, 22 @@ -1398,18 +1446,18 @@ Drag and drop upload... - - 192, 22 - - - Upload - 192, 22 Workflows + + 192, 22 + + + Tools + 183, 22 @@ -1494,12 +1542,6 @@ Monitor test... - - 192, 22 - - - Tools - 189, 6 @@ -1515,6 +1557,12 @@ After upload tasks + + 192, 22 + + + Destinations + 187, 22 @@ -1554,12 +1602,6 @@ Destination settings... - - 192, 22 - - - Destinations - 192, 22 @@ -1605,6 +1647,12 @@ Image history... + + 192, 22 + + + Debug + 172, 22 @@ -1641,12 +1689,6 @@ Test URL sharing - - 192, 22 - - - Debug - 192, 22 @@ -1689,21 +1731,12 @@ Exit - - 193, 484 - - - cmsTray - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ShareX - 405, 17 + + 567, 17 + True @@ -2472,6 +2505,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tsmiSearchImage + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + niTray diff --git a/ShareX/Properties/Resources.Designer.cs b/ShareX/Properties/Resources.Designer.cs index 1ab3f507f..27be66dc7 100644 --- a/ShareX/Properties/Resources.Designer.cs +++ b/ShareX/Properties/Resources.Designer.cs @@ -1068,6 +1068,16 @@ public class Resources { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap Google { + get { + object obj = ResourceManager.GetObject("Google", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShareX/Properties/Resources.resx b/ShareX/Properties/Resources.resx index c512a26ea..a2978c683 100644 --- a/ShareX/Properties/Resources.resx +++ b/ShareX/Properties/Resources.resx @@ -877,4 +877,7 @@ Would you like to restart ShareX? ..\Resources\script--minus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Google.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShareX/Resources/Google.png b/ShareX/Resources/Google.png new file mode 100644 index 000000000..11a9253ad Binary files /dev/null and b/ShareX/Resources/Google.png differ diff --git a/ShareX/ShareX.csproj b/ShareX/ShareX.csproj index f95defc93..3be55a540 100644 --- a/ShareX/ShareX.csproj +++ b/ShareX/ShareX.csproj @@ -1316,6 +1316,7 @@ + diff --git a/ShareX/TaskHelpers.cs b/ShareX/TaskHelpers.cs index 0877f9f90..98f8da3dd 100644 --- a/ShareX/TaskHelpers.cs +++ b/ShareX/TaskHelpers.cs @@ -977,6 +977,11 @@ public static void OCRImage(Image img) } } + public static void SearchImage(string url) + { + URLHelpers.OpenURL("https://www.google.com/searchbyimage?image_url=" + URLHelpers.URLEncode(url)); + } + public static void OCRImage(string filePath) { if (File.Exists(filePath)) @@ -1102,8 +1107,7 @@ public static bool CheckFFmpeg(TaskSettings taskSettings) if (MessageBox.Show(string.Format(Resources.ScreenRecordForm_StartRecording_does_not_exist, ffmpegPath), "ShareX - " + Resources.ScreenRecordForm_StartRecording_Missing + " ffmpeg.exe", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { - - var downloadDialogResult = FFmpegDownloader.DownloadFFmpeg(false, DownloaderForm_InstallRequested); + DialogResult downloadDialogResult = FFmpegDownloader.DownloadFFmpeg(false, DownloaderForm_InstallRequested); if (downloadDialogResult == DialogResult.OK) { @@ -1115,7 +1119,7 @@ public static bool CheckFFmpeg(TaskSettings taskSettings) taskSettings.CaptureSettings.FFmpegOptions.OverrideCLIPath = true; #endif } - else if(downloadDialogResult == DialogResult.Cancel) + else if (downloadDialogResult == DialogResult.Cancel) { return false; } diff --git a/ShareX/UploadInfoManager.cs b/ShareX/UploadInfoManager.cs index a32df46ba..af64c436d 100644 --- a/ShareX/UploadInfoManager.cs +++ b/ShareX/UploadInfoManager.cs @@ -337,6 +337,11 @@ public void ShareURL(URLSharingServices urlSharingService) if (IsItemSelected && SelectedItem.IsURLExist) UploadManager.ShareURL(SelectedItem.Info.Result.ToString(), urlSharingService); } + public void SearchImage() + { + if (IsItemSelected && SelectedItem.IsURLExist) TaskHelpers.SearchImage(SelectedItem.Info.Result.URL); + } + public void ShowQRCode() { if (IsItemSelected && SelectedItem.IsURLExist) new QRCodeForm(SelectedItem.Info.Result.URL).Show();