mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-02 21:20:28 +12:00
Added QR code support
This commit is contained in:
parent
16155ffdc8
commit
73f3fa0a66
64
HelpersLib/Forms/QRCodeForm.Designer.cs
generated
Normal file
64
HelpersLib/Forms/QRCodeForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,64 @@
|
|||
namespace HelpersLib
|
||||
{
|
||||
partial class QRCodeForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.qrMain = new Gma.QrCodeNet.Encoding.Windows.Forms.QrCodeGraphicControl();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// qrMain
|
||||
//
|
||||
this.qrMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.qrMain.ErrorCorrectLevel = Gma.QrCodeNet.Encoding.ErrorCorrectionLevel.M;
|
||||
this.qrMain.Location = new System.Drawing.Point(0, 0);
|
||||
this.qrMain.Name = "qrMain";
|
||||
this.qrMain.QuietZoneModule = Gma.QrCodeNet.Encoding.Windows.Render.QuietZoneModules.Two;
|
||||
this.qrMain.Size = new System.Drawing.Size(384, 362);
|
||||
this.qrMain.TabIndex = 0;
|
||||
//
|
||||
// QRCodeForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(384, 362);
|
||||
this.Controls.Add(this.qrMain);
|
||||
this.Name = "QRCodeForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "ShareX - QR code";
|
||||
this.TopMost = true;
|
||||
this.Resize += new System.EventHandler(this.QRCodeForm_Resize);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Gma.QrCodeNet.Encoding.Windows.Forms.QrCodeGraphicControl qrMain;
|
||||
}
|
||||
}
|
53
HelpersLib/Forms/QRCodeForm.cs
Normal file
53
HelpersLib/Forms/QRCodeForm.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
#region License Information (GPL v3)
|
||||
|
||||
/*
|
||||
ShareX - A program that allows you to take screenshots and share any file type
|
||||
Copyright (C) 2007-2014 ShareX Developers
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HelpersLib
|
||||
{
|
||||
public partial class QRCodeForm : Form
|
||||
{
|
||||
public QRCodeForm(string text)
|
||||
{
|
||||
InitializeComponent();
|
||||
Icon = ShareXResources.Icon;
|
||||
Text = "QR code: " + text;
|
||||
ClientSize = new Size(400, 400);
|
||||
qrMain.Text = text;
|
||||
}
|
||||
|
||||
private void QRCodeForm_Resize(object sender, EventArgs e)
|
||||
{
|
||||
qrMain.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
120
HelpersLib/Forms/QRCodeForm.resx
Normal file
120
HelpersLib/Forms/QRCodeForm.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -55,6 +55,9 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\AsyncBridge.Net35.0.2.0\lib\net35-Client\AsyncBridge.Net35.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Gma.QrCodeNet.Encoding">
|
||||
<HintPath>..\packages\QrCode.Net.0.4.0.0\lib\net35\Gma.QrCodeNet.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
|
@ -92,6 +95,12 @@
|
|||
<Compile Include="EncoderProgram.cs" />
|
||||
<Compile Include="CLI\ExternalCLIManager.cs" />
|
||||
<Compile Include="FontSafe.cs" />
|
||||
<Compile Include="Forms\QRCodeForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\QRCodeForm.Designer.cs">
|
||||
<DependentUpon>QRCodeForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Helpers\MathHelpers.cs" />
|
||||
<Compile Include="MimeTypes.cs" />
|
||||
<Compile Include="Native\LayeredForm.cs">
|
||||
|
@ -326,6 +335,9 @@
|
|||
<EmbeddedResource Include="Forms\MonitorTestForm.resx">
|
||||
<DependentUpon>MonitorTestForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\QRCodeForm.resx">
|
||||
<DependentUpon>QRCodeForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UpdateChecker\DownloaderForm.resx">
|
||||
<DependentUpon>DownloaderForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
<packages>
|
||||
<package id="AsyncBridge.Net35" version="0.2.0" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net35" />
|
||||
<package id="QrCode.Net" version="0.4.0.0" targetFramework="net35" />
|
||||
<package id="TaskParallelLibrary" version="1.0.2856.0" targetFramework="net35" />
|
||||
</packages>
|
|
@ -139,6 +139,7 @@ FFmpeg Windows builds: http://ffmpeg.zeranoe.com/builds
|
|||
7-Zip: http://www.7-zip.org
|
||||
SevenZipSharp: http://sevenzipsharp.codeplex.com
|
||||
DirectShow video and audio device: https://github.com/rdp/screen-capture-recorder-to-video-windows-free
|
||||
QrCode.Net: https://qrcodenet.codeplex.com
|
||||
|
||||
Copyright © 2007 - 2014 ShareX Developers</value>
|
||||
</data>
|
||||
|
|
12
ShareX/Forms/MainForm.Designer.cs
generated
12
ShareX/Forms/MainForm.Designer.cs
generated
|
@ -201,6 +201,7 @@ private void InitializeComponent()
|
|||
this.tsmiTrayShow = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiTrayExit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ssToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiShowQRCode = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsMain.SuspendLayout();
|
||||
this.scMain.Panel1.SuspendLayout();
|
||||
this.scMain.Panel2.SuspendLayout();
|
||||
|
@ -897,6 +898,7 @@ private void InitializeComponent()
|
|||
this.tsmiOpen,
|
||||
this.tsmiCopy,
|
||||
this.tsmiShowResponse,
|
||||
this.tsmiShowQRCode,
|
||||
this.tsmiUploadSelectedFile,
|
||||
this.tsmiClearList,
|
||||
this.tssUploadInfo1,
|
||||
|
@ -907,7 +909,7 @@ private void InitializeComponent()
|
|||
this.tsmiHidePreview});
|
||||
this.cmsUploadInfo.Name = "cmsHistory";
|
||||
this.cmsUploadInfo.ShowImageMargin = false;
|
||||
this.cmsUploadInfo.Size = new System.Drawing.Size(155, 258);
|
||||
this.cmsUploadInfo.Size = new System.Drawing.Size(155, 302);
|
||||
//
|
||||
// tsmiShowErrors
|
||||
//
|
||||
|
@ -1703,6 +1705,13 @@ private void InitializeComponent()
|
|||
this.ssToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ssToolStripMenuItem.Text = "ss";
|
||||
//
|
||||
// tsmiShowQRCode
|
||||
//
|
||||
this.tsmiShowQRCode.Name = "tsmiShowQRCode";
|
||||
this.tsmiShowQRCode.Size = new System.Drawing.Size(154, 22);
|
||||
this.tsmiShowQRCode.Text = "Show QR code";
|
||||
this.tsmiShowQRCode.Click += new System.EventHandler(this.tsmiShowQRCode_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
@ -1906,5 +1915,6 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ToolStripMenuItem tsmiTrayImageEditor;
|
||||
private System.Windows.Forms.ToolStripDropDownButton tsddbWorkflows;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiTrayWorkflows;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiShowQRCode;
|
||||
}
|
||||
}
|
|
@ -252,7 +252,7 @@ private void UpdateControls()
|
|||
{
|
||||
cmsUploadInfo.SuspendLayout();
|
||||
|
||||
tsmiStopUpload.Visible = tsmiOpen.Visible = tsmiCopy.Visible = tsmiShowErrors.Visible = tsmiShowResponse.Visible =
|
||||
tsmiStopUpload.Visible = tsmiOpen.Visible = tsmiCopy.Visible = tsmiShowErrors.Visible = tsmiShowResponse.Visible = tsmiShowQRCode.Visible =
|
||||
tsmiUploadSelectedFile.Visible = tsmiClearList.Visible = tssUploadInfo1.Visible = false;
|
||||
pbPreview.Reset();
|
||||
uim.RefreshSelectedItems();
|
||||
|
@ -329,6 +329,8 @@ private void UpdateControls()
|
|||
tsmiShowResponse.Visible = true;
|
||||
}
|
||||
|
||||
tsmiShowQRCode.Visible = uim.SelectedItem.IsURLExist;
|
||||
|
||||
tsmiUploadSelectedFile.Visible = uim.SelectedItem.IsFileExist;
|
||||
}
|
||||
|
||||
|
@ -1111,6 +1113,11 @@ private void tsmiShowResponse_Click(object sender, EventArgs e)
|
|||
uim.ShowResponse();
|
||||
}
|
||||
|
||||
private void tsmiShowQRCode_Click(object sender, EventArgs e)
|
||||
{
|
||||
uim.ShowQRCode();
|
||||
}
|
||||
|
||||
private void tsmiUploadSelectedFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
uim.Upload();
|
||||
|
|
|
@ -297,6 +297,11 @@ public void ShowResponse()
|
|||
}
|
||||
}
|
||||
|
||||
public void ShowQRCode()
|
||||
{
|
||||
if (IsItemSelected && SelectedItem.IsURLExist) new QRCodeForm(SelectedItem.Info.Result.URL).Show();
|
||||
}
|
||||
|
||||
public void Upload()
|
||||
{
|
||||
if (IsItemSelected && SelectedItem.IsFileExist) UploadManager.UploadFile(SelectedItem.Info.FilePath);
|
||||
|
|
Loading…
Reference in a new issue