Skip to content

Commit

Permalink
Merge branch 'release/1.0.6.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
tautcony committed Nov 15, 2019
2 parents 88beeb4 + 92ce6f6 commit 7d4a758
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 79 deletions.
93 changes: 54 additions & 39 deletions RPChecker/Forms/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 82 additions & 23 deletions RPChecker/Forms/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,39 +62,60 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e)
#region SystemMenu
private SystemMenu _systemMenu;

private void UpdateText()
private void UpdateText(string value = null)
{
label1.Text = _coreProcess.ValueText;
label1.Text = value ?? _coreProcess.ValueText;
cbVpyFile.Enabled = _coreProcess is VsPipePSNRProcess;
Text = $"[VCB-Studio] RP Checker v{Assembly.GetExecutingAssembly().GetName().Version} [{_coreProcess.Title}][{(UseOriginPath ? "ORG" : "LINK")}]";
Text = $"[VCB-Studio] RP Checker v{Assembly.GetExecutingAssembly().GetName().Version} [{_coreProcess.Title}][{(UseOriginPath ? "O" : "L")}]";
_threshold = _coreProcess.Threshold;
numericUpDown1.Value = _threshold;
}

void SwitchPath()
{
_useOriginPath = !_useOriginPath;
Text = Text.Substring(0, Text.Length - 3) + $"[{(UseOriginPath ? "O" : "L")}]";
}

void Set2VSPSNR()
{
_coreProcess = _coreProcess as VsPipePSNRProcess ?? new VsPipePSNRProcess();
cbVpyFile.SelectedIndex = 0;
UpdateText();
}

void Set2VSGMSD()
{
_coreProcess = _coreProcess as VsPipePSNRProcess ?? new VsPipePSNRProcess();
cbVpyFile.SelectedIndex = 1;
UpdateText("梯度幅度相似性");
cbVpyFile_SelectedIndexChanged(cbVpyFile, null);
}

void Set2FFPSNR()
{
_coreProcess = _coreProcess as FFmpegPSNRProcess ?? new FFmpegPSNRProcess();
cbVpyFile.SelectedIndex = 0;
UpdateText();
}

void Set2FFSSIM()
{
_coreProcess = _coreProcess as FFmpegSSIMProcess ?? new FFmpegSSIMProcess();
cbVpyFile.SelectedIndex = 0;
UpdateText();
}


private void AddCommand()
{
_systemMenu = new SystemMenu(this);
_systemMenu.AddCommand("检查更新(&U)", () => { Updater.Utils.CheckUpdate(true); }, true);
_systemMenu.AddCommand("使用PSNR(VS)", () =>
{
_coreProcess = _coreProcess as VsPipePSNRProcess ?? new VsPipePSNRProcess();
UpdateText();
}, true);
_systemMenu.AddCommand("使用PSNR(FF)", () =>
{
_coreProcess = _coreProcess as FFmpegPSNRProcess ?? new FFmpegPSNRProcess();
UpdateText();
}, false);
_systemMenu.AddCommand("使用SSIM(FF)", () =>
{
_coreProcess = _coreProcess as FFmpegSSIMProcess ?? new FFmpegSSIMProcess();
UpdateText();
}, false);
_systemMenu.AddCommand("使用原始路径", () =>
{
_useOriginPath = true;
UpdateText();
}, true);
_systemMenu.AddCommand("使用 PSNR(VS)", Set2VSPSNR, true);
_systemMenu.AddCommand("使用 GMSD(VS)", Set2VSGMSD, false);
_systemMenu.AddCommand("使用 PSNR(FF)", Set2FFPSNR, false);
_systemMenu.AddCommand("使用 SSIM(FF)", Set2FFSSIM, false);
_systemMenu.AddCommand("使用原始路径", SwitchPath, true);
_systemMenu.AddCommand("导出结果", () =>
{
try
Expand Down Expand Up @@ -146,6 +167,38 @@ protected override void WndProc(ref Message msg)
// (This method is inlined)
_systemMenu.HandleMessage(ref msg);
}

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Alt | Keys.NumPad1:
case Keys.Alt | Keys.D1:
Set2VSPSNR();
return true;
case Keys.Alt | Keys.NumPad2:
case Keys.Alt | Keys.D2:
Set2VSGMSD();
return true;
case Keys.Alt | Keys.NumPad3:
case Keys.Alt | Keys.D3:
Set2FFPSNR();
return true;
case Keys.Alt | Keys.NumPad4:
case Keys.Alt | Keys.D4:
Set2FFSSIM();
return true;
case Keys.Control | Keys.O:
btnLoad_Click(btnLoad, null);
return true;
case Keys.Alt | Keys.Oem3:
SwitchPath();
return true;
}

return base.ProcessCmdKey(ref msg, keyData);
}

#endregion

#region LoadFile
Expand Down Expand Up @@ -593,6 +646,12 @@ private void toolStripProgressBar1_Click(object sender, EventArgs e)
_poi[1] += 10;
}
#endregion

private void cbVpyFile_SelectedIndexChanged(object sender, EventArgs e)
{
_threshold = ((ComboBox) sender).SelectedIndex == 1 ? 80 : 30;
numericUpDown1.Value = _threshold;
}
}

public struct ReSulT
Expand Down
Loading

0 comments on commit 7d4a758

Please sign in to comment.