From 82f77b41ba8ad99671f332a33d3fe1a514caff14 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 16 Apr 2020 08:07:45 +0800 Subject: [PATCH] Refactoring the QR Share panel --- v2rayN/v2rayN/Forms/MainForm.Designer.cs | 23 +++- v2rayN/v2rayN/Forms/MainForm.cs | 8 ++ v2rayN/v2rayN/Forms/MainForm.resx | 27 ++++- v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx | 23 ++-- v2rayN/v2rayN/Forms/QRCodeControl.Designer.cs | 10 -- v2rayN/v2rayN/Forms/QRCodeControl.cs | 8 -- v2rayN/v2rayN/Forms/QRCodeControl.resx | 103 ++++++++++-------- .../v2rayN/Forms/QRCodeControl.zh-Hans.resx | 3 - 8 files changed, 118 insertions(+), 87 deletions(-) diff --git a/v2rayN/v2rayN/Forms/MainForm.Designer.cs b/v2rayN/v2rayN/Forms/MainForm.Designer.cs index 1b0bacb5..9bb10c68 100644 --- a/v2rayN/v2rayN/Forms/MainForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/MainForm.Designer.cs @@ -61,8 +61,8 @@ this.menuExport2ServerConfig = new System.Windows.Forms.ToolStripMenuItem(); this.menuExport2ShareUrl = new System.Windows.Forms.ToolStripMenuItem(); this.menuExport2SubContent = new System.Windows.Forms.ToolStripMenuItem(); - this.qrCodeControl = new v2rayN.Forms.QRCodeControl(); this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton(); + this.qrCodeControl = new v2rayN.Forms.QRCodeControl(); this.notifyMain = new System.Windows.Forms.NotifyIcon(this.components); this.cmsMain = new System.Windows.Forms.ContextMenuStrip(this.components); this.menuSysAgentMode = new System.Windows.Forms.ToolStripMenuItem(); @@ -102,6 +102,7 @@ this.tsbSub = new System.Windows.Forms.ToolStripDropDownButton(); this.tsbSubSetting = new System.Windows.Forms.ToolStripMenuItem(); this.tsbSubUpdate = new System.Windows.Forms.ToolStripMenuItem(); + this.tsbQRCodeSwitch = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.tsbOptionSetting = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); @@ -369,11 +370,6 @@ resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent"); this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click); // - // qrCodeControl - // - resources.ApplyResources(this.qrCodeControl, "qrCodeControl"); - this.qrCodeControl.Name = "qrCodeControl"; - // // tsbServer // this.tsbServer.DropDown = this.cmsLv; @@ -381,6 +377,11 @@ resources.ApplyResources(this.tsbServer, "tsbServer"); this.tsbServer.Name = "tsbServer"; // + // qrCodeControl + // + resources.ApplyResources(this.qrCodeControl, "qrCodeControl"); + this.qrCodeControl.Name = "qrCodeControl"; + // // notifyMain // this.notifyMain.ContextMenuStrip = this.cmsMain; @@ -619,6 +620,7 @@ this.tsbServer, this.toolStripSeparator4, this.tsbSub, + this.tsbQRCodeSwitch, this.toolStripSeparator8, this.tsbOptionSetting, this.toolStripSeparator5, @@ -659,6 +661,14 @@ resources.ApplyResources(this.tsbSubUpdate, "tsbSubUpdate"); this.tsbSubUpdate.Click += new System.EventHandler(this.tsbSubUpdate_Click); // + // tsbQRCodeSwitch + // + this.tsbQRCodeSwitch.CheckOnClick = true; + this.tsbQRCodeSwitch.ForeColor = System.Drawing.Color.Black; + resources.ApplyResources(this.tsbQRCodeSwitch, "tsbQRCodeSwitch"); + this.tsbQRCodeSwitch.Name = "tsbQRCodeSwitch"; + this.tsbQRCodeSwitch.CheckedChanged += new System.EventHandler(this.tsbQRCodeSwitch_CheckedChanged); + // // toolStripSeparator8 // this.toolStripSeparator8.Name = "toolStripSeparator8"; @@ -922,6 +932,7 @@ private System.Windows.Forms.ToolStripMenuItem menuKeepPACNothing; private System.Windows.Forms.ToolStripMenuItem tsbTestMe; private System.Windows.Forms.ToolStripButton tsbReload; + private System.Windows.Forms.ToolStripButton tsbQRCodeSwitch; } } diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs index 3c6b8472..dfbbfb94 100644 --- a/v2rayN/v2rayN/Forms/MainForm.cs +++ b/v2rayN/v2rayN/Forms/MainForm.cs @@ -46,6 +46,8 @@ namespace v2rayN.Forms private void MainForm_Load(object sender, EventArgs e) { + splitContainer1.Panel2Collapsed = true; + ConfigHandler.LoadConfig(ref config); v2rayHandler = new V2rayHandler(); v2rayHandler.ProcessEvent += v2rayHandler_ProcessEvent; @@ -1532,5 +1534,11 @@ namespace v2rayN.Forms SpeedtestHandler statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "", UpdateSpeedtestHandler); return statistics.RunAvailabilityCheck(); } + + private void tsbQRCodeSwitch_CheckedChanged(object sender, EventArgs e) + { + bool bShow = tsbQRCodeSwitch.Checked; + splitContainer1.Panel2Collapsed = !bShow; + } } } diff --git a/v2rayN/v2rayN/Forms/MainForm.resx b/v2rayN/v2rayN/Forms/MainForm.resx index c7d5562d..e59dd2d2 100644 --- a/v2rayN/v2rayN/Forms/MainForm.resx +++ b/v2rayN/v2rayN/Forms/MainForm.resx @@ -297,7 +297,7 @@ ImageAboveText - 356, 578 + 356, 556 cmsLv @@ -753,13 +753,13 @@ 6, 56 - 180, 22 + 125, 22 Settings - 180, 22 + 125, 22 Updates @@ -776,6 +776,21 @@ ImageAboveText + + Magenta + + + 65, 53 + + + QR Code + + + BottomCenter + + + ImageAboveText + 6, 56 @@ -1343,6 +1358,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tsbQRCodeSwitch + + + System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + toolStripSeparator8 diff --git a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx index 40c9e458..db884ceb 100644 --- a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx @@ -431,13 +431,13 @@ - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE3SURBVFhH7ZaBDQIhDEVvBEdwBDfQDXQER3AD3cARdAPd - QDfSDbQvuSb1AicFjJrwkxcN0FIolOuamv5VE2E+gLaPayWchEcE+hhTXVPhIoQmDcFYbKpoJtwEdX4X - jgIrXfTwnzb6dBw22BaJVdjJmWQs1/SdBRtE0U5cBXW2oSFRO0HtSEeW2FZ1wsq9sjuRdTDVAXnNuWLY - 6JnAl0sYa/Q5q1dhq35ci+Bkq2HJvbZpxGeybAAuw4Fq+cnW1wPITgHFYxvBUw+qHEIL1yq1vDKhVlH3 - NQwF4JkcFRWiUAB7IVW2FFPO3YqlgPd+LJf02e8Fdi3rMdIAcLDuf9UpeT0IS0G/hvhPm305vSl7EQFY - B6zCvozvYGzRM8zEoeg5TPZwDaGvpHQni1yzSxbXPW9q+hF13ROHuJnQcjbhtQAAAABJRU5ErkJggg== + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAATdJREFUWEftloENAiEMRW8ER3AEN9ANdARHcAPdwBF0A91AN9INtC+5JvUCJwWM + mvCTFw3QUiiU65qa/lUTYT6Ato9rJZyERwT6GFNdU+EihCYNwVhsqmgm3AR1fheOAitd9PCfNvp0HDbY + FolV2MmZZCzX9J0FG0TRTlwFdbahIVE7Qe1IR5bYVnXCyr2yO5F1MNUBec25YtjomcCXSxhr9DmrV2Gr + flyL4GSrYcm9tmnEZ7JsAC7DgWr5ydbXA8hOAcVjG8FTD6ocQgvXKrW8MqFWUfc1DAXgmRwVFaJQAHsh + VbYUU87diqWA934sl/TZ7wV2Lesx0gBwsO5/1Sl5PQhLQb+G+E+bfTm9KXsRAVgHrMK+jO9gbNEzzMSh + 6DlM9nANoa+kdCeLXLNLFtc9b2r6EXXdE4e4mdByNuG1AAAAAElFTkSuQmCC @@ -499,9 +499,9 @@ - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAySURBVFhH7c6xDQAgCEVBRnVTHU2ZABuMxV3yOvJDAAA/ - GqfZVG6X8mg1dfUAAPBQxAZd0SJruVXHWwAAAABJRU5ErkJggg== + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAADJJREFUWEftzrENACAIRUFGdVMdTZkAG4zFXfI68kMAAD8ap9lUbpfyaDV19QAA + 8FDEBl3RImu5VcdbAAAAAElFTkSuQmCC @@ -510,4 +510,7 @@ 关闭窗口 + + 分享二维码 + \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/QRCodeControl.Designer.cs b/v2rayN/v2rayN/Forms/QRCodeControl.Designer.cs index 5d0a2624..ca405968 100644 --- a/v2rayN/v2rayN/Forms/QRCodeControl.Designer.cs +++ b/v2rayN/v2rayN/Forms/QRCodeControl.Designer.cs @@ -31,7 +31,6 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(QRCodeControl)); this.txtUrl = new System.Windows.Forms.TextBox(); this.picQRCode = new System.Windows.Forms.PictureBox(); - this.chkShow = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.picQRCode)).BeginInit(); this.SuspendLayout(); // @@ -47,20 +46,12 @@ this.picQRCode.Name = "picQRCode"; this.picQRCode.TabStop = false; // - // chkShow - // - resources.ApplyResources(this.chkShow, "chkShow"); - this.chkShow.Name = "chkShow"; - this.chkShow.UseVisualStyleBackColor = true; - this.chkShow.CheckedChanged += new System.EventHandler(this.chkShow_CheckedChanged); - // // QRCodeControl // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.picQRCode); this.Controls.Add(this.txtUrl); - this.Controls.Add(this.chkShow); this.Name = "QRCodeControl"; this.Load += new System.EventHandler(this.QRCodeControl_Load); ((System.ComponentModel.ISupportInitialize)(this.picQRCode)).EndInit(); @@ -73,6 +64,5 @@ private System.Windows.Forms.TextBox txtUrl; private System.Windows.Forms.PictureBox picQRCode; - private System.Windows.Forms.CheckBox chkShow; } } diff --git a/v2rayN/v2rayN/Forms/QRCodeControl.cs b/v2rayN/v2rayN/Forms/QRCodeControl.cs index 3b2bd3bd..02d59b48 100644 --- a/v2rayN/v2rayN/Forms/QRCodeControl.cs +++ b/v2rayN/v2rayN/Forms/QRCodeControl.cs @@ -12,7 +12,6 @@ namespace v2rayN.Forms } private void QRCodeControl_Load(object sender, System.EventArgs e) { - chkShow_CheckedChanged(null, null); txtUrl.MouseUp += txtUrl_MouseUp; } @@ -36,12 +35,5 @@ namespace v2rayN.Forms picQRCode.Image = QRCodeHelper.GetQRCode(url); } } - - private void chkShow_CheckedChanged(object sender, System.EventArgs e) - { - picQRCode.Visible = - txtUrl.Visible = chkShow.Checked; - } - } } diff --git a/v2rayN/v2rayN/Forms/QRCodeControl.resx b/v2rayN/v2rayN/Forms/QRCodeControl.resx index d4e9e4a4..a6ceff05 100644 --- a/v2rayN/v2rayN/Forms/QRCodeControl.resx +++ b/v2rayN/v2rayN/Forms/QRCodeControl.resx @@ -117,60 +117,15 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - 6, 12 - - - True - - - QRCodeControl - - - 356, 441 - - - True - - - Top - - - 0, 0 - - - 356, 16 - - - 25 - - - Sharing panel - - - Fill - - - 0, 16 - - - 356, 355 - - - Zoom - - - 24 - Bottom + 0, 371 + True @@ -180,4 +135,58 @@ 0 + + txtUrl + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + Fill + + + 0, 0 + + + 356, 371 + + + Zoom + + + 24 + + + picQRCode + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + True + + + 6, 12 + + + 356, 441 + + + QRCodeControl + + + System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/QRCodeControl.zh-Hans.resx b/v2rayN/v2rayN/Forms/QRCodeControl.zh-Hans.resx index 991ed0d0..1af7de15 100644 --- a/v2rayN/v2rayN/Forms/QRCodeControl.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/QRCodeControl.zh-Hans.resx @@ -117,7 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 显示分享内容 - \ No newline at end of file