From f363b94fd6888ae8159df2a1f657f44d1a56d47d Mon Sep 17 00:00:00 2001 From: noisyfox Date: Tue, 13 Dec 2016 02:22:37 +1100 Subject: [PATCH] Show ss URL in QRCode form --- shadowsocks-csharp/Data/cn.txt | 4 ++-- shadowsocks-csharp/Data/zh_tw.txt | 4 ++-- shadowsocks-csharp/View/MenuViewController.cs | 2 +- shadowsocks-csharp/View/QRCodeForm.Designer.cs | 17 +++++++++++++++-- shadowsocks-csharp/View/QRCodeForm.cs | 11 +++++++++-- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/shadowsocks-csharp/Data/cn.txt b/shadowsocks-csharp/Data/cn.txt index 8070afef..35e42906 100644 --- a/shadowsocks-csharp/Data/cn.txt +++ b/shadowsocks-csharp/Data/cn.txt @@ -21,7 +21,7 @@ Update Local PAC from GFWList=从 GFWList 更新本地 PAC Edit User Rule for GFWList...=编辑 GFWList 的用户规则... Secure Local PAC=保护本地 PAC Copy Local PAC URL=复制本地 PAC 网址 -Show QRCode...=显示二维码... +Share Server Config...=分享服务器配置... Scan QRCode from Screen...=扫描屏幕上的二维码... Availability Statistics=统计可用性 Show Logs...=显示日志... @@ -83,7 +83,7 @@ Outbound=出站 # QRCode Form -QRCode=二维码 +QRCode and URL=二维码与 URL # PAC Url Form diff --git a/shadowsocks-csharp/Data/zh_tw.txt b/shadowsocks-csharp/Data/zh_tw.txt index f2e02882..b8d4277e 100644 --- a/shadowsocks-csharp/Data/zh_tw.txt +++ b/shadowsocks-csharp/Data/zh_tw.txt @@ -21,7 +21,7 @@ Update Local PAC from GFWList=從 GFWList 更新本地 PAC Edit User Rule for GFWList...=編輯 GFWList 的用戶規則... Secure Local PAC=保護本地 PAC Copy Local PAC URL=複製本地 PAC 網址 -Show QRCode...=顯示 QR 碼... +Share Server Config...=分享伺服器配置... Scan QRCode from Screen...=掃描螢幕上的 QR 碼... Availability Statistics=統計可用性 Show Logs...=顯示日誌... @@ -83,7 +83,7 @@ Outbound=出站 # QRCode Form -QRCode=QR 碼 +QRCode and URL=QR 碼与 URL # PAC Url Form diff --git a/shadowsocks-csharp/View/MenuViewController.cs b/shadowsocks-csharp/View/MenuViewController.cs index 3aba64d5..16ce9082 100644 --- a/shadowsocks-csharp/View/MenuViewController.cs +++ b/shadowsocks-csharp/View/MenuViewController.cs @@ -261,7 +261,7 @@ namespace Shadowsocks.View this.SeperatorItem = new MenuItem("-"), this.ConfigItem = CreateMenuItem("Edit Servers...", new EventHandler(this.Config_Click)), CreateMenuItem("Statistics Config...", StatisticsConfigItem_Click), - CreateMenuItem("Show QRCode...", new EventHandler(this.QRCodeItem_Click)), + CreateMenuItem("Share Server Config...", new EventHandler(this.QRCodeItem_Click)), CreateMenuItem("Scan QRCode from Screen...", new EventHandler(this.ScanQRCodeItem_Click)) }), CreateMenuGroup("PAC ", new MenuItem[] { diff --git a/shadowsocks-csharp/View/QRCodeForm.Designer.cs b/shadowsocks-csharp/View/QRCodeForm.Designer.cs index b1cfc65d..69bf8702 100755 --- a/shadowsocks-csharp/View/QRCodeForm.Designer.cs +++ b/shadowsocks-csharp/View/QRCodeForm.Designer.cs @@ -30,6 +30,7 @@ { this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.listBox1 = new System.Windows.Forms.ListBox(); + this.textBoxURL = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -56,6 +57,15 @@ this.listBox1.ValueMember = "Key"; this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); // + // textBoxURL + // + this.textBoxURL.Location = new System.Drawing.Point(10, 227); + this.textBoxURL.Name = "textBoxURL"; + this.textBoxURL.ReadOnly = true; + this.textBoxURL.Size = new System.Drawing.Size(441, 21); + this.textBoxURL.TabIndex = 3; + this.textBoxURL.Click += new System.EventHandler(this.textBoxURL_Click); + // // QRCodeForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -63,7 +73,8 @@ this.AutoSize = true; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(457, 228); + this.ClientSize = new System.Drawing.Size(457, 257); + this.Controls.Add(this.textBoxURL); this.Controls.Add(this.listBox1); this.Controls.Add(this.pictureBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; @@ -72,10 +83,11 @@ this.Name = "QRCodeForm"; this.Padding = new System.Windows.Forms.Padding(10); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "QRCode"; + this.Text = "QRCode and URL"; this.Load += new System.EventHandler(this.QRCodeForm_Load); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -83,5 +95,6 @@ private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.TextBox textBoxURL; } } \ No newline at end of file diff --git a/shadowsocks-csharp/View/QRCodeForm.cs b/shadowsocks-csharp/View/QRCodeForm.cs index 41c8ae24..eb009cbf 100755 --- a/shadowsocks-csharp/View/QRCodeForm.cs +++ b/shadowsocks-csharp/View/QRCodeForm.cs @@ -24,7 +24,7 @@ namespace Shadowsocks.View this.code = code; InitializeComponent(); this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); - this.Text = I18N.GetString("QRCode"); + this.Text = I18N.GetString("QRCode and URL"); } private void GenQR(string ssconfig) @@ -69,7 +69,14 @@ namespace Shadowsocks.View private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { - GenQR((sender as ListBox)?.SelectedValue.ToString()); + var url = (sender as ListBox)?.SelectedValue.ToString(); + GenQR(url); + textBoxURL.Text = url; + } + + private void textBoxURL_Click(object sender, EventArgs e) + { + textBoxURL.SelectAll(); } } }