From 6b5a055084d2373c8611799aa424a66acc6fdf6f Mon Sep 17 00:00:00 2001 From: Jaex Date: Sun, 25 Jul 2021 07:17:10 +0300 Subject: [PATCH] Added history settings form --- .../Forms/HistoryForm.Designer.cs | 205 +++++++++--------- ShareX.HistoryLib/Forms/HistoryForm.cs | 21 +- ShareX.HistoryLib/Forms/HistoryForm.resx | 107 ++++----- .../Forms/HistorySettingsForm.Designer.cs | 74 +++++++ .../Forms/HistorySettingsForm.cs | 50 +++++ .../Forms/HistorySettingsForm.resx | 195 +++++++++++++++++ .../ImageHistorySettingsForm.Designer.cs | 1 - .../Forms/ImageHistorySettingsForm.resx | 22 +- ShareX.HistoryLib/HistoryFilter.cs | 6 +- ShareX.HistoryLib/ShareX.HistoryLib.csproj | 9 + 10 files changed, 490 insertions(+), 200 deletions(-) create mode 100644 ShareX.HistoryLib/Forms/HistorySettingsForm.Designer.cs create mode 100644 ShareX.HistoryLib/Forms/HistorySettingsForm.cs create mode 100644 ShareX.HistoryLib/Forms/HistorySettingsForm.resx diff --git a/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs b/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs index f117d9869..b7ebc462f 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs +++ b/ShareX.HistoryLib/Forms/HistoryForm.Designer.cs @@ -30,15 +30,21 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HistoryForm)); - this.scMain = new ShareX.HelpersLib.SplitContainerCustomSplitter(); + this.tscHistory = new System.Windows.Forms.ToolStripContainer(); this.lvHistory = new ShareX.HelpersLib.MyListView(); this.chIcon = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chDateTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chFilename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chURL = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.nudMaxItemCount = new System.Windows.Forms.NumericUpDown(); + this.tssHistory = new System.Windows.Forms.ToolStrip(); + this.tslSearch = new System.Windows.Forms.ToolStripLabel(); + this.tstbSearch = new System.Windows.Forms.ToolStripTextBox(); + this.tsbSearch = new System.Windows.Forms.ToolStripButton(); + this.tss1 = new System.Windows.Forms.ToolStripSeparator(); + this.tsbSettings = new System.Windows.Forms.ToolStripButton(); + this.scMain = new ShareX.HelpersLib.SplitContainerCustomSplitter(); + this.btnCopyStats = new System.Windows.Forms.Button(); this.pbThumbnail = new ShareX.HelpersLib.MyPictureBox(); - this.lblMaxItemCount = new System.Windows.Forms.Label(); this.gbFilters = new System.Windows.Forms.GroupBox(); this.lblURLFilter = new System.Windows.Forms.Label(); this.txtURLFilter = new System.Windows.Forms.TextBox(); @@ -55,44 +61,30 @@ private void InitializeComponent() this.cbDateFilter = new System.Windows.Forms.CheckBox(); this.dtpFilterTo = new System.Windows.Forms.DateTimePicker(); this.txtFilenameFilter = new System.Windows.Forms.TextBox(); - this.tscHistory = new System.Windows.Forms.ToolStripContainer(); - this.tssHistory = new System.Windows.Forms.ToolStrip(); - this.tslSearch = new System.Windows.Forms.ToolStripLabel(); - this.tstbSearch = new System.Windows.Forms.ToolStripTextBox(); - this.tsbSearch = new System.Windows.Forms.ToolStripButton(); - this.btnCopyStats = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit(); - this.scMain.Panel1.SuspendLayout(); - this.scMain.Panel2.SuspendLayout(); - this.scMain.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nudMaxItemCount)).BeginInit(); - this.gbFilters.SuspendLayout(); this.tscHistory.ContentPanel.SuspendLayout(); this.tscHistory.TopToolStripPanel.SuspendLayout(); this.tscHistory.SuspendLayout(); this.tssHistory.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit(); + this.scMain.Panel1.SuspendLayout(); + this.scMain.Panel2.SuspendLayout(); + this.scMain.SuspendLayout(); + this.gbFilters.SuspendLayout(); this.SuspendLayout(); // - // scMain + // tscHistory // - resources.ApplyResources(this.scMain, "scMain"); - this.scMain.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.scMain.Name = "scMain"; // - // scMain.Panel1 + // tscHistory.ContentPanel // - this.scMain.Panel1.Controls.Add(this.tscHistory); + this.tscHistory.ContentPanel.Controls.Add(this.lvHistory); + resources.ApplyResources(this.tscHistory.ContentPanel, "tscHistory.ContentPanel"); + resources.ApplyResources(this.tscHistory, "tscHistory"); + this.tscHistory.Name = "tscHistory"; // - // scMain.Panel2 + // tscHistory.TopToolStripPanel // - this.scMain.Panel2.Controls.Add(this.btnCopyStats); - this.scMain.Panel2.Controls.Add(this.nudMaxItemCount); - this.scMain.Panel2.Controls.Add(this.pbThumbnail); - this.scMain.Panel2.Controls.Add(this.lblMaxItemCount); - this.scMain.Panel2.Controls.Add(this.gbFilters); - this.scMain.SplitterColor = System.Drawing.Color.White; - this.scMain.SplitterLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(189)))), ((int)(((byte)(189))))); - this.scMain.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.scMain_SplitterMoved); + this.tscHistory.TopToolStripPanel.Controls.Add(this.tssHistory); // // lvHistory // @@ -131,16 +123,76 @@ private void InitializeComponent() // resources.ApplyResources(this.chURL, "chURL"); // - // nudMaxItemCount + // tssHistory // - resources.ApplyResources(this.nudMaxItemCount, "nudMaxItemCount"); - this.nudMaxItemCount.Maximum = new decimal(new int[] { - 10000, - 0, - 0, - 0}); - this.nudMaxItemCount.Name = "nudMaxItemCount"; - this.nudMaxItemCount.ValueChanged += new System.EventHandler(this.nudMaxItemCount_ValueChanged); + resources.ApplyResources(this.tssHistory, "tssHistory"); + this.tssHistory.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.tssHistory.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.tslSearch, + this.tstbSearch, + this.tsbSearch, + this.tss1, + this.tsbSettings}); + this.tssHistory.Name = "tssHistory"; + this.tssHistory.ShowItemToolTips = false; + // + // tslSearch + // + this.tslSearch.Name = "tslSearch"; + resources.ApplyResources(this.tslSearch, "tslSearch"); + // + // tstbSearch + // + this.tstbSearch.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + resources.ApplyResources(this.tstbSearch, "tstbSearch"); + this.tstbSearch.Name = "tstbSearch"; + this.tstbSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tstbSearch_KeyDown); + // + // tsbSearch + // + this.tsbSearch.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbSearch.Image = global::ShareX.HistoryLib.Properties.Resources.magnifier; + resources.ApplyResources(this.tsbSearch, "tsbSearch"); + this.tsbSearch.Name = "tsbSearch"; + this.tsbSearch.Click += new System.EventHandler(this.tsbSearch_Click); + // + // tss1 + // + this.tss1.Name = "tss1"; + resources.ApplyResources(this.tss1, "tss1"); + // + // tsbSettings + // + this.tsbSettings.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + resources.ApplyResources(this.tsbSettings, "tsbSettings"); + this.tsbSettings.Name = "tsbSettings"; + this.tsbSettings.Click += new System.EventHandler(this.tsbSettings_Click); + // + // scMain + // + resources.ApplyResources(this.scMain, "scMain"); + this.scMain.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.scMain.Name = "scMain"; + // + // scMain.Panel1 + // + this.scMain.Panel1.Controls.Add(this.tscHistory); + // + // scMain.Panel2 + // + this.scMain.Panel2.Controls.Add(this.btnCopyStats); + this.scMain.Panel2.Controls.Add(this.pbThumbnail); + this.scMain.Panel2.Controls.Add(this.gbFilters); + this.scMain.SplitterColor = System.Drawing.Color.White; + this.scMain.SplitterLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(189)))), ((int)(((byte)(189))))); + this.scMain.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.scMain_SplitterMoved); + // + // btnCopyStats + // + resources.ApplyResources(this.btnCopyStats, "btnCopyStats"); + this.btnCopyStats.Name = "btnCopyStats"; + this.btnCopyStats.UseVisualStyleBackColor = true; + this.btnCopyStats.Click += new System.EventHandler(this.btnCopyStats_Click); // // pbThumbnail // @@ -153,11 +205,6 @@ private void InitializeComponent() this.pbThumbnail.PictureBoxBackColor = System.Drawing.SystemColors.Control; this.pbThumbnail.ShowImageSizeLabel = true; // - // lblMaxItemCount - // - resources.ApplyResources(this.lblMaxItemCount, "lblMaxItemCount"); - this.lblMaxItemCount.Name = "lblMaxItemCount"; - // // gbFilters // resources.ApplyResources(this.gbFilters, "gbFilters"); @@ -266,58 +313,6 @@ private void InitializeComponent() this.txtFilenameFilter.Name = "txtFilenameFilter"; this.txtFilenameFilter.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtFilenameFilter_KeyDown); // - // tscHistory - // - // - // tscHistory.ContentPanel - // - this.tscHistory.ContentPanel.Controls.Add(this.lvHistory); - resources.ApplyResources(this.tscHistory.ContentPanel, "tscHistory.ContentPanel"); - resources.ApplyResources(this.tscHistory, "tscHistory"); - this.tscHistory.Name = "tscHistory"; - // - // tscHistory.TopToolStripPanel - // - this.tscHistory.TopToolStripPanel.Controls.Add(this.tssHistory); - // - // tssHistory - // - resources.ApplyResources(this.tssHistory, "tssHistory"); - this.tssHistory.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this.tssHistory.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.tslSearch, - this.tstbSearch, - this.tsbSearch}); - this.tssHistory.Name = "tssHistory"; - this.tssHistory.ShowItemToolTips = false; - // - // tslSearch - // - this.tslSearch.Name = "tslSearch"; - resources.ApplyResources(this.tslSearch, "tslSearch"); - // - // tstbSearch - // - this.tstbSearch.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - resources.ApplyResources(this.tstbSearch, "tstbSearch"); - this.tstbSearch.Name = "tstbSearch"; - this.tstbSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tstbSearch_KeyDown); - // - // tsbSearch - // - this.tsbSearch.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.tsbSearch.Image = global::ShareX.HistoryLib.Properties.Resources.magnifier; - resources.ApplyResources(this.tsbSearch, "tsbSearch"); - this.tsbSearch.Name = "tsbSearch"; - this.tsbSearch.Click += new System.EventHandler(this.tsbSearch_Click); - // - // btnCopyStats - // - resources.ApplyResources(this.btnCopyStats, "btnCopyStats"); - this.btnCopyStats.Name = "btnCopyStats"; - this.btnCopyStats.UseVisualStyleBackColor = true; - this.btnCopyStats.Click += new System.EventHandler(this.btnCopyStats_Click); - // // HistoryForm // resources.ApplyResources(this, "$this"); @@ -329,14 +324,6 @@ private void InitializeComponent() this.Shown += new System.EventHandler(this.HistoryForm_Shown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.HistoryForm_KeyDown); this.Resize += new System.EventHandler(this.HistoryForm_Resize); - this.scMain.Panel1.ResumeLayout(false); - this.scMain.Panel2.ResumeLayout(false); - this.scMain.Panel2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.scMain)).EndInit(); - this.scMain.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.nudMaxItemCount)).EndInit(); - this.gbFilters.ResumeLayout(false); - this.gbFilters.PerformLayout(); this.tscHistory.ContentPanel.ResumeLayout(false); this.tscHistory.TopToolStripPanel.ResumeLayout(false); this.tscHistory.TopToolStripPanel.PerformLayout(); @@ -344,6 +331,12 @@ private void InitializeComponent() this.tscHistory.PerformLayout(); this.tssHistory.ResumeLayout(false); this.tssHistory.PerformLayout(); + this.scMain.Panel1.ResumeLayout(false); + this.scMain.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.scMain)).EndInit(); + this.scMain.ResumeLayout(false); + this.gbFilters.ResumeLayout(false); + this.gbFilters.PerformLayout(); this.ResumeLayout(false); } @@ -373,13 +366,13 @@ private void InitializeComponent() private System.Windows.Forms.Label lblFilenameFilter; private System.Windows.Forms.Label lblURLFilter; private System.Windows.Forms.TextBox txtURLFilter; - private System.Windows.Forms.Label lblMaxItemCount; - private System.Windows.Forms.NumericUpDown nudMaxItemCount; private System.Windows.Forms.ToolStripContainer tscHistory; private System.Windows.Forms.ToolStrip tssHistory; private System.Windows.Forms.ToolStripLabel tslSearch; private System.Windows.Forms.ToolStripTextBox tstbSearch; private System.Windows.Forms.ToolStripButton tsbSearch; private System.Windows.Forms.Button btnCopyStats; + private System.Windows.Forms.ToolStripSeparator tss1; + private System.Windows.Forms.ToolStripButton tsbSettings; } } \ No newline at end of file diff --git a/ShareX.HistoryLib/Forms/HistoryForm.cs b/ShareX.HistoryLib/Forms/HistoryForm.cs index c678e8dae..ce549992b 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.cs +++ b/ShareX.HistoryLib/Forms/HistoryForm.cs @@ -77,8 +77,6 @@ public HistoryForm(string historyPath, HistorySettings settings, Action scMain.SplitterDistance = Settings.SplitterDistance; } - nudMaxItemCount.SetValue(Settings.MaxItemCount); - ShareXResources.ApplyTheme(this); Settings.WindowState.AutoHandleFormState(this); @@ -121,7 +119,7 @@ private void ApplyFilterSimple() { HistoryFilter filter = new HistoryFilter() { - FileName = tstbSearch.Text, + Filename = tstbSearch.Text, MaxItemCount = Settings.MaxItemCount }; @@ -132,7 +130,7 @@ private void ApplyFilterAdvanced() { HistoryFilter filter = new HistoryFilter() { - FileName = txtFilenameFilter.Text, + Filename = txtFilenameFilter.Text, URL = txtURLFilter.Text, FilterDate = cbDateFilter.Checked, FromDate = dtpFilterFrom.Value.Date, @@ -372,6 +370,16 @@ private void tsbSearch_Click(object sender, EventArgs e) ApplyFilterSimple(); } + private void tsbSettings_Click(object sender, EventArgs e) + { + using (HistorySettingsForm form = new HistorySettingsForm(Settings)) + { + form.ShowDialog(); + } + + RefreshHistoryItems(); + } + private void txtFilenameFilter_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) @@ -404,11 +412,6 @@ private void btnRemoveFilters_Click(object sender, EventArgs e) AddHistoryItems(allHistoryItems); } - private void nudMaxItemCount_ValueChanged(object sender, EventArgs e) - { - Settings.MaxItemCount = (int)nudMaxItemCount.Value; - } - private void btnCopyStats_Click(object sender, EventArgs e) { string stats = OutputStats(allHistoryItems); diff --git a/ShareX.HistoryLib/Forms/HistoryForm.resx b/ShareX.HistoryLib/Forms/HistoryForm.resx index 734937152..70ec165d5 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.resx +++ b/ShareX.HistoryLib/Forms/HistoryForm.resx @@ -117,14 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Fill - - - - 0, 0 - tscHistory.BottomToolStripPanel @@ -162,9 +154,11 @@ 230 + Fill + 0, 0 @@ -264,11 +258,23 @@ 23, 22 + + 6, 25 + + + Magenta + + + 62, 22 + + + Settings... + 3, 0 - 373, 25 + 441, 25 0 @@ -309,6 +315,12 @@ 0 + + Fill + + + 0, 0 + scMain.Panel1 @@ -351,33 +363,6 @@ 0 - - Bottom, Left - - - 224, 576 - - - 80, 20 - - - 7 - - - Center - - - nudMaxItemCount - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - scMain.Panel2 - - - 1 - Top, Bottom, Left, Right @@ -385,7 +370,7 @@ 8, 8 - 400, 352 + 406, 352 3 @@ -400,37 +385,7 @@ scMain.Panel2 - 2 - - - Bottom, Left - - - True - - - 5, 580 - - - 96, 13 - - - 6 - - - Maximum item limit: - - - lblMaxItemCount - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - scMain.Panel2 - - - 3 + 1 Bottom, Left @@ -829,7 +784,7 @@ 8, 368 - 404, 200 + 408, 200 4 @@ -847,7 +802,7 @@ scMain.Panel2 - 4 + 2 scMain.Panel2 @@ -948,6 +903,18 @@ System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tss1 + + + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tsbSettings + + + System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + HistoryForm diff --git a/ShareX.HistoryLib/Forms/HistorySettingsForm.Designer.cs b/ShareX.HistoryLib/Forms/HistorySettingsForm.Designer.cs new file mode 100644 index 000000000..655b4f12e --- /dev/null +++ b/ShareX.HistoryLib/Forms/HistorySettingsForm.Designer.cs @@ -0,0 +1,74 @@ + +namespace ShareX.HistoryLib +{ + partial class HistorySettingsForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HistorySettingsForm)); + this.lblMaximumItemLimit = new System.Windows.Forms.Label(); + this.nudMaximumItemLimit = new System.Windows.Forms.NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)(this.nudMaximumItemLimit)).BeginInit(); + this.SuspendLayout(); + // + // lblMaximumItemLimit + // + resources.ApplyResources(this.lblMaximumItemLimit, "lblMaximumItemLimit"); + this.lblMaximumItemLimit.Name = "lblMaximumItemLimit"; + // + // nudMaximumItemLimit + // + resources.ApplyResources(this.nudMaximumItemLimit, "nudMaximumItemLimit"); + this.nudMaximumItemLimit.Maximum = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + this.nudMaximumItemLimit.Name = "nudMaximumItemLimit"; + this.nudMaximumItemLimit.ValueChanged += new System.EventHandler(this.nudMaximumItemLimit_ValueChanged); + // + // HistorySettingsForm + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.Controls.Add(this.nudMaximumItemLimit); + this.Controls.Add(this.lblMaximumItemLimit); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.Name = "HistorySettingsForm"; + ((System.ComponentModel.ISupportInitialize)(this.nudMaximumItemLimit)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lblMaximumItemLimit; + private System.Windows.Forms.NumericUpDown nudMaximumItemLimit; + } +} \ No newline at end of file diff --git a/ShareX.HistoryLib/Forms/HistorySettingsForm.cs b/ShareX.HistoryLib/Forms/HistorySettingsForm.cs new file mode 100644 index 000000000..518d1ee19 --- /dev/null +++ b/ShareX.HistoryLib/Forms/HistorySettingsForm.cs @@ -0,0 +1,50 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (c) 2007-2020 ShareX Team + + 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 . +*/ + +#endregion License Information (GPL v3) + +using ShareX.HelpersLib; +using System; +using System.Windows.Forms; + +namespace ShareX.HistoryLib +{ + public partial class HistorySettingsForm : Form + { + public HistorySettings Settings { get; private set; } + + public HistorySettingsForm(HistorySettings settings) + { + InitializeComponent(); + ShareXResources.ApplyTheme(this); + + Settings = settings; + nudMaximumItemLimit.SetValue(Settings.MaxItemCount); + } + + private void nudMaximumItemLimit_ValueChanged(object sender, EventArgs e) + { + Settings.MaxItemCount = (int)nudMaximumItemLimit.Value; + } + } +} \ No newline at end of file diff --git a/ShareX.HistoryLib/Forms/HistorySettingsForm.resx b/ShareX.HistoryLib/Forms/HistorySettingsForm.resx new file mode 100644 index 000000000..45b4734a7 --- /dev/null +++ b/ShareX.HistoryLib/Forms/HistorySettingsForm.resx @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + True + + + + 13, 16 + + + 96, 13 + + + 0 + + + Maximum item limit: + + + lblMaximumItemLimit + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + 16, 32 + + + 64, 20 + + + 1 + + + + Center + + + nudMaximumItemLimit + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + True + + + 96, 96 + + + 305, 191 + + + CenterScreen + + + ShareX - History settings + + + HistorySettingsForm + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShareX.HistoryLib/Forms/ImageHistorySettingsForm.Designer.cs b/ShareX.HistoryLib/Forms/ImageHistorySettingsForm.Designer.cs index fd07dd618..936dfec07 100644 --- a/ShareX.HistoryLib/Forms/ImageHistorySettingsForm.Designer.cs +++ b/ShareX.HistoryLib/Forms/ImageHistorySettingsForm.Designer.cs @@ -119,7 +119,6 @@ private void InitializeComponent() // ImageHistorySettingsForm // resources.ApplyResources(this, "$this"); - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.SystemColors.Window; this.Controls.Add(this.cbFilterMissingFiles); diff --git a/ShareX.HistoryLib/Forms/ImageHistorySettingsForm.resx b/ShareX.HistoryLib/Forms/ImageHistorySettingsForm.resx index d4a5b7da7..fd9d424c3 100644 --- a/ShareX.HistoryLib/Forms/ImageHistorySettingsForm.resx +++ b/ShareX.HistoryLib/Forms/ImageHistorySettingsForm.resx @@ -123,7 +123,7 @@ - 5, 8 + 13, 16 62, 13 @@ -150,7 +150,7 @@ True - 5, 56 + 13, 64 80, 13 @@ -177,7 +177,7 @@ True - 5, 104 + 13, 112 105, 13 @@ -201,7 +201,7 @@ 6 - 8, 24 + 16, 32 120, 21 @@ -222,7 +222,7 @@ 5 - 8, 72 + 16, 80 64, 20 @@ -247,7 +247,7 @@ 4 - 8, 120 + 16, 128 64, 20 @@ -274,7 +274,7 @@ True - 77, 76 + 85, 84 18, 13 @@ -304,7 +304,7 @@ NoControl - 8, 176 + 16, 184 138, 17 @@ -331,7 +331,7 @@ True - 8, 152 + 16, 160 106, 17 @@ -358,10 +358,10 @@ True - 6, 13 + 96, 96 - 344, 226 + 344, 218 CenterScreen diff --git a/ShareX.HistoryLib/HistoryFilter.cs b/ShareX.HistoryLib/HistoryFilter.cs index 74b0a41a8..68c5a5c07 100644 --- a/ShareX.HistoryLib/HistoryFilter.cs +++ b/ShareX.HistoryLib/HistoryFilter.cs @@ -33,7 +33,7 @@ namespace ShareX.HistoryLib { public class HistoryFilter { - public string FileName { get; set; } + public string Filename { get; set; } public string URL { get; set; } public bool FilterDate { get; set; } public DateTime FromDate { get; set; } @@ -62,9 +62,9 @@ public IEnumerable ApplyFilter(IEnumerable historyItem historyItems = historyItems.Where(x => !string.IsNullOrEmpty(x.Host) && x.Host.Contains(Host, StringComparison.InvariantCultureIgnoreCase)); } - if (!string.IsNullOrEmpty(FileName)) + if (!string.IsNullOrEmpty(Filename)) { - string pattern = Regex.Escape(FileName).Replace("\\?", ".").Replace("\\*", ".*"); + string pattern = Regex.Escape(Filename).Replace("\\?", ".").Replace("\\*", ".*"); Regex regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); historyItems = historyItems.Where(x => (x.FileName != null && regex.IsMatch(x.FileName)) || (SearchInTags && x.Tags != null && x.Tags.Any(tag => regex.IsMatch(tag.Value)))); diff --git a/ShareX.HistoryLib/ShareX.HistoryLib.csproj b/ShareX.HistoryLib/ShareX.HistoryLib.csproj index 068c1c6b1..6aa574387 100644 --- a/ShareX.HistoryLib/ShareX.HistoryLib.csproj +++ b/ShareX.HistoryLib/ShareX.HistoryLib.csproj @@ -86,6 +86,12 @@ Properties\SharedAssemblyInfo.cs + + Form + + + HistorySettingsForm.cs + @@ -247,6 +253,9 @@ HistoryItemInfoForm.cs + + HistorySettingsForm.cs + ImageHistoryForm.cs