mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-01 04:30:49 +12:00
Merge branch 'history-form-improvements'
This commit is contained in:
commit
2a3c214ea7
378
ShareX.HistoryLib/Forms/HistoryForm.Designer.cs
generated
378
ShareX.HistoryLib/Forms/HistoryForm.Designer.cs
generated
|
@ -30,25 +30,14 @@ 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.pStats = new System.Windows.Forms.Panel();
|
||||
this.rtbStats = new System.Windows.Forms.RichTextBox();
|
||||
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.pbThumbnail = new ShareX.HelpersLib.MyPictureBox();
|
||||
this.btnShowStats = new System.Windows.Forms.Button();
|
||||
this.lblMaxItemCount = new System.Windows.Forms.Label();
|
||||
this.gbFilters = new System.Windows.Forms.GroupBox();
|
||||
this.tscHistory = new System.Windows.Forms.ToolStripContainer();
|
||||
this.gbAdvancedSearch = new System.Windows.Forms.GroupBox();
|
||||
this.btnAdvancedSearchReset = new System.Windows.Forms.Button();
|
||||
this.btnAdvancedSearch = new System.Windows.Forms.Button();
|
||||
this.lblURLFilter = new System.Windows.Forms.Label();
|
||||
this.txtURLFilter = new System.Windows.Forms.TextBox();
|
||||
this.lblFilenameFilter = new System.Windows.Forms.Label();
|
||||
this.cbHostFilterSelection = new System.Windows.Forms.ComboBox();
|
||||
this.btnRemoveFilters = new System.Windows.Forms.Button();
|
||||
this.btnApplyFilters = new System.Windows.Forms.Button();
|
||||
this.cbTypeFilterSelection = new System.Windows.Forms.ComboBox();
|
||||
this.cbHostFilter = new System.Windows.Forms.CheckBox();
|
||||
this.cbTypeFilter = new System.Windows.Forms.CheckBox();
|
||||
|
@ -58,140 +47,82 @@ 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.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.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.tsbAdvancedSearch = new System.Windows.Forms.ToolStripButton();
|
||||
this.tss1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.tsbCopyStats = new System.Windows.Forms.ToolStripButton();
|
||||
this.tss2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.tsbSettings = new System.Windows.Forms.ToolStripButton();
|
||||
this.scMain = new ShareX.HelpersLib.SplitContainerCustomSplitter();
|
||||
this.pbThumbnail = new ShareX.HelpersLib.MyPictureBox();
|
||||
this.tscHistory.ContentPanel.SuspendLayout();
|
||||
this.tscHistory.TopToolStripPanel.SuspendLayout();
|
||||
this.tscHistory.SuspendLayout();
|
||||
this.gbAdvancedSearch.SuspendLayout();
|
||||
this.tssHistory.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit();
|
||||
this.scMain.Panel1.SuspendLayout();
|
||||
this.scMain.Panel2.SuspendLayout();
|
||||
this.scMain.SuspendLayout();
|
||||
this.pStats.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudMaxItemCount)).BeginInit();
|
||||
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.pStats);
|
||||
this.scMain.Panel1.Controls.Add(this.lvHistory);
|
||||
this.tscHistory.ContentPanel.Controls.Add(this.gbAdvancedSearch);
|
||||
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.nudMaxItemCount);
|
||||
this.scMain.Panel2.Controls.Add(this.pbThumbnail);
|
||||
this.scMain.Panel2.Controls.Add(this.btnShowStats);
|
||||
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);
|
||||
//
|
||||
// pStats
|
||||
// gbAdvancedSearch
|
||||
//
|
||||
this.pStats.Controls.Add(this.rtbStats);
|
||||
resources.ApplyResources(this.pStats, "pStats");
|
||||
this.pStats.Name = "pStats";
|
||||
this.gbAdvancedSearch.Controls.Add(this.btnAdvancedSearchReset);
|
||||
this.gbAdvancedSearch.Controls.Add(this.btnAdvancedSearch);
|
||||
this.gbAdvancedSearch.Controls.Add(this.lblURLFilter);
|
||||
this.gbAdvancedSearch.Controls.Add(this.txtURLFilter);
|
||||
this.gbAdvancedSearch.Controls.Add(this.lblFilenameFilter);
|
||||
this.gbAdvancedSearch.Controls.Add(this.cbHostFilterSelection);
|
||||
this.gbAdvancedSearch.Controls.Add(this.cbTypeFilterSelection);
|
||||
this.gbAdvancedSearch.Controls.Add(this.cbHostFilter);
|
||||
this.gbAdvancedSearch.Controls.Add(this.cbTypeFilter);
|
||||
this.gbAdvancedSearch.Controls.Add(this.dtpFilterFrom);
|
||||
this.gbAdvancedSearch.Controls.Add(this.lblFilterFrom);
|
||||
this.gbAdvancedSearch.Controls.Add(this.lblFilterTo);
|
||||
this.gbAdvancedSearch.Controls.Add(this.cbDateFilter);
|
||||
this.gbAdvancedSearch.Controls.Add(this.dtpFilterTo);
|
||||
this.gbAdvancedSearch.Controls.Add(this.txtFilenameFilter);
|
||||
resources.ApplyResources(this.gbAdvancedSearch, "gbAdvancedSearch");
|
||||
this.gbAdvancedSearch.Name = "gbAdvancedSearch";
|
||||
this.gbAdvancedSearch.TabStop = false;
|
||||
//
|
||||
// rtbStats
|
||||
// btnAdvancedSearchReset
|
||||
//
|
||||
this.rtbStats.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
resources.ApplyResources(this.rtbStats, "rtbStats");
|
||||
this.rtbStats.Name = "rtbStats";
|
||||
resources.ApplyResources(this.btnAdvancedSearchReset, "btnAdvancedSearchReset");
|
||||
this.btnAdvancedSearchReset.Name = "btnAdvancedSearchReset";
|
||||
this.btnAdvancedSearchReset.UseVisualStyleBackColor = true;
|
||||
this.btnAdvancedSearchReset.Click += new System.EventHandler(this.btnAdvancedSearchReset_Click);
|
||||
//
|
||||
// lvHistory
|
||||
// btnAdvancedSearch
|
||||
//
|
||||
this.lvHistory.AllowColumnSort = true;
|
||||
this.lvHistory.AutoFillColumn = true;
|
||||
this.lvHistory.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.lvHistory.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.chIcon,
|
||||
this.chDateTime,
|
||||
this.chFilename,
|
||||
this.chURL});
|
||||
resources.ApplyResources(this.lvHistory, "lvHistory");
|
||||
this.lvHistory.FullRowSelect = true;
|
||||
this.lvHistory.HideSelection = false;
|
||||
this.lvHistory.Name = "lvHistory";
|
||||
this.lvHistory.UseCompatibleStateImageBehavior = false;
|
||||
this.lvHistory.View = System.Windows.Forms.View.Details;
|
||||
this.lvHistory.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.lvHistory_ItemDrag);
|
||||
this.lvHistory.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvHistory_ItemSelectionChanged);
|
||||
this.lvHistory.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lvHistory_KeyDown);
|
||||
this.lvHistory.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvHistory_MouseDoubleClick);
|
||||
//
|
||||
// chIcon
|
||||
//
|
||||
resources.ApplyResources(this.chIcon, "chIcon");
|
||||
//
|
||||
// chDateTime
|
||||
//
|
||||
resources.ApplyResources(this.chDateTime, "chDateTime");
|
||||
//
|
||||
// chFilename
|
||||
//
|
||||
resources.ApplyResources(this.chFilename, "chFilename");
|
||||
//
|
||||
// chURL
|
||||
//
|
||||
resources.ApplyResources(this.chURL, "chURL");
|
||||
//
|
||||
// nudMaxItemCount
|
||||
//
|
||||
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);
|
||||
//
|
||||
// pbThumbnail
|
||||
//
|
||||
resources.ApplyResources(this.pbThumbnail, "pbThumbnail");
|
||||
this.pbThumbnail.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.pbThumbnail.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.pbThumbnail.DrawCheckeredBackground = true;
|
||||
this.pbThumbnail.FullscreenOnClick = true;
|
||||
this.pbThumbnail.Name = "pbThumbnail";
|
||||
this.pbThumbnail.PictureBoxBackColor = System.Drawing.SystemColors.Control;
|
||||
this.pbThumbnail.ShowImageSizeLabel = true;
|
||||
//
|
||||
// btnShowStats
|
||||
//
|
||||
resources.ApplyResources(this.btnShowStats, "btnShowStats");
|
||||
this.btnShowStats.Name = "btnShowStats";
|
||||
this.btnShowStats.UseVisualStyleBackColor = true;
|
||||
this.btnShowStats.Click += new System.EventHandler(this.BtnShowStats_Click);
|
||||
//
|
||||
// lblMaxItemCount
|
||||
//
|
||||
resources.ApplyResources(this.lblMaxItemCount, "lblMaxItemCount");
|
||||
this.lblMaxItemCount.Name = "lblMaxItemCount";
|
||||
//
|
||||
// gbFilters
|
||||
//
|
||||
resources.ApplyResources(this.gbFilters, "gbFilters");
|
||||
this.gbFilters.Controls.Add(this.lblURLFilter);
|
||||
this.gbFilters.Controls.Add(this.txtURLFilter);
|
||||
this.gbFilters.Controls.Add(this.lblFilenameFilter);
|
||||
this.gbFilters.Controls.Add(this.cbHostFilterSelection);
|
||||
this.gbFilters.Controls.Add(this.btnRemoveFilters);
|
||||
this.gbFilters.Controls.Add(this.btnApplyFilters);
|
||||
this.gbFilters.Controls.Add(this.cbTypeFilterSelection);
|
||||
this.gbFilters.Controls.Add(this.cbHostFilter);
|
||||
this.gbFilters.Controls.Add(this.cbTypeFilter);
|
||||
this.gbFilters.Controls.Add(this.dtpFilterFrom);
|
||||
this.gbFilters.Controls.Add(this.lblFilterFrom);
|
||||
this.gbFilters.Controls.Add(this.lblFilterTo);
|
||||
this.gbFilters.Controls.Add(this.cbDateFilter);
|
||||
this.gbFilters.Controls.Add(this.dtpFilterTo);
|
||||
this.gbFilters.Controls.Add(this.txtFilenameFilter);
|
||||
this.gbFilters.Name = "gbFilters";
|
||||
this.gbFilters.TabStop = false;
|
||||
resources.ApplyResources(this.btnAdvancedSearch, "btnAdvancedSearch");
|
||||
this.btnAdvancedSearch.Name = "btnAdvancedSearch";
|
||||
this.btnAdvancedSearch.UseVisualStyleBackColor = true;
|
||||
this.btnAdvancedSearch.Click += new System.EventHandler(this.btnAdvancedSearch_Click);
|
||||
//
|
||||
// lblURLFilter
|
||||
//
|
||||
|
@ -215,20 +146,6 @@ private void InitializeComponent()
|
|||
resources.ApplyResources(this.cbHostFilterSelection, "cbHostFilterSelection");
|
||||
this.cbHostFilterSelection.Name = "cbHostFilterSelection";
|
||||
//
|
||||
// btnRemoveFilters
|
||||
//
|
||||
resources.ApplyResources(this.btnRemoveFilters, "btnRemoveFilters");
|
||||
this.btnRemoveFilters.Name = "btnRemoveFilters";
|
||||
this.btnRemoveFilters.UseVisualStyleBackColor = true;
|
||||
this.btnRemoveFilters.Click += new System.EventHandler(this.btnRemoveFilters_Click);
|
||||
//
|
||||
// btnApplyFilters
|
||||
//
|
||||
resources.ApplyResources(this.btnApplyFilters, "btnApplyFilters");
|
||||
this.btnApplyFilters.Name = "btnApplyFilters";
|
||||
this.btnApplyFilters.UseVisualStyleBackColor = true;
|
||||
this.btnApplyFilters.Click += new System.EventHandler(this.btnApplyFilters_Click);
|
||||
//
|
||||
// cbTypeFilterSelection
|
||||
//
|
||||
this.cbTypeFilterSelection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
|
@ -280,6 +197,140 @@ private void InitializeComponent()
|
|||
this.txtFilenameFilter.Name = "txtFilenameFilter";
|
||||
this.txtFilenameFilter.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtFilenameFilter_KeyDown);
|
||||
//
|
||||
// lvHistory
|
||||
//
|
||||
this.lvHistory.AllowColumnSort = true;
|
||||
this.lvHistory.AutoFillColumn = true;
|
||||
this.lvHistory.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.lvHistory.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.chIcon,
|
||||
this.chDateTime,
|
||||
this.chFilename,
|
||||
this.chURL});
|
||||
resources.ApplyResources(this.lvHistory, "lvHistory");
|
||||
this.lvHistory.FullRowSelect = true;
|
||||
this.lvHistory.HideSelection = false;
|
||||
this.lvHistory.Name = "lvHistory";
|
||||
this.lvHistory.UseCompatibleStateImageBehavior = false;
|
||||
this.lvHistory.View = System.Windows.Forms.View.Details;
|
||||
this.lvHistory.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.lvHistory_ItemDrag);
|
||||
this.lvHistory.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvHistory_ItemSelectionChanged);
|
||||
this.lvHistory.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lvHistory_KeyDown);
|
||||
this.lvHistory.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvHistory_MouseDoubleClick);
|
||||
//
|
||||
// chIcon
|
||||
//
|
||||
resources.ApplyResources(this.chIcon, "chIcon");
|
||||
//
|
||||
// chDateTime
|
||||
//
|
||||
resources.ApplyResources(this.chDateTime, "chDateTime");
|
||||
//
|
||||
// chFilename
|
||||
//
|
||||
resources.ApplyResources(this.chFilename, "chFilename");
|
||||
//
|
||||
// chURL
|
||||
//
|
||||
resources.ApplyResources(this.chURL, "chURL");
|
||||
//
|
||||
// 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.tsbAdvancedSearch,
|
||||
this.tss1,
|
||||
this.tsbCopyStats,
|
||||
this.tss2,
|
||||
this.tsbSettings});
|
||||
this.tssHistory.Name = "tssHistory";
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// tsbAdvancedSearch
|
||||
//
|
||||
this.tsbAdvancedSearch.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.tsbAdvancedSearch.Image = global::ShareX.HistoryLib.Properties.Resources.magnifier__plus;
|
||||
resources.ApplyResources(this.tsbAdvancedSearch, "tsbAdvancedSearch");
|
||||
this.tsbAdvancedSearch.Name = "tsbAdvancedSearch";
|
||||
this.tsbAdvancedSearch.Click += new System.EventHandler(this.tsbAdvancedSearch_Click);
|
||||
//
|
||||
// tss1
|
||||
//
|
||||
this.tss1.Name = "tss1";
|
||||
resources.ApplyResources(this.tss1, "tss1");
|
||||
//
|
||||
// tsbCopyStats
|
||||
//
|
||||
this.tsbCopyStats.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.tsbCopyStats.Image = global::ShareX.HistoryLib.Properties.Resources.clipboard_list;
|
||||
resources.ApplyResources(this.tsbCopyStats, "tsbCopyStats");
|
||||
this.tsbCopyStats.Name = "tsbCopyStats";
|
||||
this.tsbCopyStats.Click += new System.EventHandler(this.tsbCopyStats_Click);
|
||||
//
|
||||
// tss2
|
||||
//
|
||||
this.tss2.Name = "tss2";
|
||||
resources.ApplyResources(this.tss2, "tss2");
|
||||
//
|
||||
// tsbSettings
|
||||
//
|
||||
this.tsbSettings.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.tsbSettings.Image = global::ShareX.HistoryLib.Properties.Resources.gear;
|
||||
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.pbThumbnail);
|
||||
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);
|
||||
//
|
||||
// pbThumbnail
|
||||
//
|
||||
resources.ApplyResources(this.pbThumbnail, "pbThumbnail");
|
||||
this.pbThumbnail.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.pbThumbnail.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.pbThumbnail.DrawCheckeredBackground = true;
|
||||
this.pbThumbnail.FullscreenOnClick = true;
|
||||
this.pbThumbnail.Name = "pbThumbnail";
|
||||
this.pbThumbnail.PictureBoxBackColor = System.Drawing.SystemColors.Control;
|
||||
this.pbThumbnail.ShowImageSizeLabel = true;
|
||||
//
|
||||
// HistoryForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
|
@ -291,15 +342,19 @@ 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.tscHistory.ContentPanel.ResumeLayout(false);
|
||||
this.tscHistory.TopToolStripPanel.ResumeLayout(false);
|
||||
this.tscHistory.TopToolStripPanel.PerformLayout();
|
||||
this.tscHistory.ResumeLayout(false);
|
||||
this.tscHistory.PerformLayout();
|
||||
this.gbAdvancedSearch.ResumeLayout(false);
|
||||
this.gbAdvancedSearch.PerformLayout();
|
||||
this.tssHistory.ResumeLayout(false);
|
||||
this.tssHistory.PerformLayout();
|
||||
this.scMain.Panel1.ResumeLayout(false);
|
||||
this.scMain.Panel2.ResumeLayout(false);
|
||||
this.scMain.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.scMain)).EndInit();
|
||||
this.scMain.ResumeLayout(false);
|
||||
this.pStats.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudMaxItemCount)).EndInit();
|
||||
this.gbFilters.ResumeLayout(false);
|
||||
this.gbFilters.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -313,10 +368,8 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ColumnHeader chIcon;
|
||||
private ShareX.HelpersLib.SplitContainerCustomSplitter scMain;
|
||||
private HelpersLib.MyPictureBox pbThumbnail;
|
||||
private System.Windows.Forms.GroupBox gbFilters;
|
||||
private System.Windows.Forms.GroupBox gbAdvancedSearch;
|
||||
private System.Windows.Forms.ComboBox cbHostFilterSelection;
|
||||
private System.Windows.Forms.Button btnRemoveFilters;
|
||||
private System.Windows.Forms.Button btnApplyFilters;
|
||||
private System.Windows.Forms.ComboBox cbTypeFilterSelection;
|
||||
private System.Windows.Forms.CheckBox cbHostFilter;
|
||||
private System.Windows.Forms.CheckBox cbTypeFilter;
|
||||
|
@ -329,10 +382,17 @@ 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.Button btnShowStats;
|
||||
private System.Windows.Forms.RichTextBox rtbStats;
|
||||
private System.Windows.Forms.Panel pStats;
|
||||
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.ToolStripSeparator tss1;
|
||||
private System.Windows.Forms.ToolStripButton tsbSettings;
|
||||
private System.Windows.Forms.ToolStripButton tsbAdvancedSearch;
|
||||
private System.Windows.Forms.Button btnAdvancedSearch;
|
||||
private System.Windows.Forms.Button btnAdvancedSearchReset;
|
||||
private System.Windows.Forms.ToolStripButton tsbCopyStats;
|
||||
private System.Windows.Forms.ToolStripSeparator tss2;
|
||||
}
|
||||
}
|
|
@ -30,7 +30,6 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShareX.HistoryLib
|
||||
|
@ -39,13 +38,11 @@ public partial class HistoryForm : Form
|
|||
{
|
||||
public string HistoryPath { get; private set; }
|
||||
public HistorySettings Settings { get; private set; }
|
||||
public bool SearchInTags { get; set; } = true;
|
||||
|
||||
private HistoryManager history;
|
||||
private HistoryItemManager him;
|
||||
private HistoryItem[] allHistoryItems;
|
||||
private string defaultTitle;
|
||||
private bool showingStats;
|
||||
|
||||
public HistoryForm(string historyPath, HistorySettings settings, Action<string> uploadFile = null, Action<string> editImage = null)
|
||||
{
|
||||
|
@ -80,72 +77,32 @@ public HistoryForm(string historyPath, HistorySettings settings, Action<string>
|
|||
scMain.SplitterDistance = Settings.SplitterDistance;
|
||||
}
|
||||
|
||||
nudMaxItemCount.SetValue(Settings.MaxItemCount);
|
||||
|
||||
ShareXResources.ApplyTheme(this);
|
||||
|
||||
Settings.WindowState.AutoHandleFormState(this);
|
||||
}
|
||||
|
||||
private void RefreshHistoryItems()
|
||||
private void ResetFilters()
|
||||
{
|
||||
allHistoryItems = GetHistoryItems();
|
||||
ApplyFiltersAndAdd();
|
||||
tstbSearch.Text = "";
|
||||
txtFilenameFilter.ResetText();
|
||||
txtURLFilter.ResetText();
|
||||
cbDateFilter.Checked = false;
|
||||
dtpFilterFrom.ResetText();
|
||||
dtpFilterTo.ResetText();
|
||||
cbTypeFilter.Checked = false;
|
||||
if (cbTypeFilterSelection.Items.Count > 0)
|
||||
{
|
||||
cbTypeFilterSelection.SelectedIndex = 0;
|
||||
}
|
||||
cbHostFilter.Checked = false;
|
||||
cbHostFilterSelection.ResetText();
|
||||
}
|
||||
|
||||
private void OutputStats(HistoryItem[] historyItems)
|
||||
private void RefreshHistoryItems(bool mockData = false)
|
||||
{
|
||||
rtbStats.ResetText();
|
||||
|
||||
rtbStats.SetFontBold();
|
||||
rtbStats.AppendLine(Resources.HistoryItemCounts);
|
||||
rtbStats.SetFontRegular();
|
||||
rtbStats.AppendLine(Resources.HistoryStats_Total + " " + historyItems.Length);
|
||||
|
||||
IEnumerable<string> types = historyItems.
|
||||
GroupBy(x => x.Type).
|
||||
OrderByDescending(x => x.Count()).
|
||||
Select(x => string.Format("{0}: {1} ({2:N0}%)", x.Key, x.Count(), x.Count() / (float)historyItems.Length * 100));
|
||||
|
||||
rtbStats.AppendLine(string.Join(Environment.NewLine, types));
|
||||
|
||||
rtbStats.AppendLine();
|
||||
rtbStats.SetFontBold();
|
||||
rtbStats.AppendLine(Resources.HistoryStats_YearlyUsages);
|
||||
rtbStats.SetFontRegular();
|
||||
|
||||
IEnumerable<string> yearlyUsages = historyItems.
|
||||
GroupBy(x => x.DateTime.Year).
|
||||
OrderByDescending(x => x.Key).
|
||||
Select(x => string.Format("{0}: {1} ({2:N0}%)", x.Key, x.Count(), x.Count() / (float)historyItems.Length * 100));
|
||||
|
||||
rtbStats.AppendLine(string.Join(Environment.NewLine, yearlyUsages));
|
||||
|
||||
rtbStats.AppendLine();
|
||||
rtbStats.SetFontBold();
|
||||
rtbStats.AppendLine(Resources.HistoryStats_FileExtensions);
|
||||
rtbStats.SetFontRegular();
|
||||
|
||||
IEnumerable<string> fileExtensions = historyItems.
|
||||
Where(x => !string.IsNullOrEmpty(x.FileName) && !x.FileName.EndsWith(")")).
|
||||
Select(x => Helpers.GetFilenameExtension(x.FileName)).
|
||||
GroupBy(x => x).
|
||||
OrderByDescending(x => x.Count()).
|
||||
Select(x => string.Format("{0} ({1})", x.Key, x.Count()));
|
||||
|
||||
rtbStats.AppendLine(string.Join(Environment.NewLine, fileExtensions));
|
||||
|
||||
rtbStats.AppendLine();
|
||||
rtbStats.SetFontBold();
|
||||
rtbStats.AppendLine(Resources.HistoryStats_Hosts);
|
||||
rtbStats.SetFontRegular();
|
||||
|
||||
IEnumerable<string> hosts = historyItems.
|
||||
GroupBy(x => x.Host).
|
||||
OrderByDescending(x => x.Count()).
|
||||
Select(x => string.Format("{0} ({1})", x.Key, x.Count()));
|
||||
|
||||
rtbStats.AppendLine(string.Join(Environment.NewLine, hosts));
|
||||
allHistoryItems = GetHistoryItems(mockData);
|
||||
ApplyFilterSimple();
|
||||
}
|
||||
|
||||
private HistoryItem[] him_GetHistoryItems()
|
||||
|
@ -153,9 +110,13 @@ private HistoryItem[] him_GetHistoryItems()
|
|||
return lvHistory.SelectedItems.Cast<ListViewItem>().Select(x => x.Tag as HistoryItem).ToArray();
|
||||
}
|
||||
|
||||
private HistoryItem[] GetHistoryItems()
|
||||
private HistoryItem[] GetHistoryItems(bool mockData = false)
|
||||
{
|
||||
if (history == null)
|
||||
if (mockData)
|
||||
{
|
||||
history = new HistoryManagerMock(HistoryPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
history = new HistoryManagerJSON(HistoryPath);
|
||||
}
|
||||
|
@ -165,76 +126,44 @@ private HistoryItem[] GetHistoryItems()
|
|||
return historyItems.ToArray();
|
||||
}
|
||||
|
||||
private void ApplyFiltersAndAdd()
|
||||
private void ApplyFilter(HistoryFilter filter)
|
||||
{
|
||||
if (allHistoryItems != null && allHistoryItems.Length > 0)
|
||||
{
|
||||
HistoryItem[] historyItems = ApplyFilters(allHistoryItems);
|
||||
IEnumerable<HistoryItem> historyItems = filter.ApplyFilter(allHistoryItems);
|
||||
|
||||
if (Settings.MaxItemCount > 0 && historyItems.Length > Settings.MaxItemCount)
|
||||
{
|
||||
historyItems = historyItems.Take(Settings.MaxItemCount).ToArray();
|
||||
}
|
||||
|
||||
AddHistoryItems(historyItems);
|
||||
AddHistoryItems(historyItems.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
private HistoryItem[] ApplyFilters(HistoryItem[] historyItems)
|
||||
private void ApplyFilterSimple()
|
||||
{
|
||||
if (!cbTypeFilter.Checked && !cbHostFilter.Checked && string.IsNullOrEmpty(txtFilenameFilter.Text) && string.IsNullOrEmpty(txtURLFilter.Text) && !cbDateFilter.Checked)
|
||||
HistoryFilter filter = new HistoryFilter()
|
||||
{
|
||||
return historyItems;
|
||||
}
|
||||
Filename = tstbSearch.Text,
|
||||
MaxItemCount = Settings.MaxItemCount
|
||||
};
|
||||
|
||||
IEnumerable<HistoryItem> result = historyItems.AsEnumerable();
|
||||
ApplyFilter(filter);
|
||||
}
|
||||
|
||||
if (cbTypeFilter.Checked)
|
||||
private void ApplyFilterAdvanced()
|
||||
{
|
||||
HistoryFilter filter = new HistoryFilter()
|
||||
{
|
||||
string type = cbTypeFilterSelection.Text;
|
||||
Filename = txtFilenameFilter.Text,
|
||||
URL = txtURLFilter.Text,
|
||||
FilterDate = cbDateFilter.Checked,
|
||||
FromDate = dtpFilterFrom.Value.Date,
|
||||
ToDate = dtpFilterTo.Value.Date,
|
||||
FilterType = cbTypeFilter.Checked,
|
||||
Type = cbTypeFilterSelection.Text,
|
||||
FilterHost = cbHostFilter.Checked,
|
||||
Host = cbHostFilterSelection.Text,
|
||||
MaxItemCount = Settings.MaxItemCount
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(type))
|
||||
{
|
||||
result = result.Where(x => !string.IsNullOrEmpty(x.Type) && x.Type.Equals(type, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
}
|
||||
|
||||
if (cbHostFilter.Checked)
|
||||
{
|
||||
string host = cbHostFilterSelection.Text;
|
||||
|
||||
if (!string.IsNullOrEmpty(host))
|
||||
{
|
||||
result = result.Where(x => !string.IsNullOrEmpty(x.Host) && x.Host.Contains(host, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
}
|
||||
|
||||
string filenameFilter = txtFilenameFilter.Text;
|
||||
|
||||
if (!string.IsNullOrEmpty(filenameFilter))
|
||||
{
|
||||
string pattern = Regex.Escape(filenameFilter).Replace("\\?", ".").Replace("\\*", ".*");
|
||||
Regex regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
result = result.Where(x => (x.FileName != null && regex.IsMatch(x.FileName)) ||
|
||||
(SearchInTags && x.Tags != null && x.Tags.Any(tag => regex.IsMatch(tag.Value))));
|
||||
}
|
||||
|
||||
string urlFilter = txtURLFilter.Text;
|
||||
|
||||
if (!string.IsNullOrEmpty(urlFilter))
|
||||
{
|
||||
result = result.Where(x => x.URL != null && x.URL.Contains(urlFilter, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
if (cbDateFilter.Checked)
|
||||
{
|
||||
DateTime fromDate = dtpFilterFrom.Value.Date;
|
||||
DateTime toDate = dtpFilterTo.Value.Date;
|
||||
|
||||
result = result.Where(x => x.DateTime.Date >= fromDate && x.DateTime.Date <= toDate);
|
||||
}
|
||||
|
||||
return result.ToArray();
|
||||
ApplyFilter(filter);
|
||||
}
|
||||
|
||||
private void AddHistoryItems(HistoryItem[] historyItems)
|
||||
|
@ -279,6 +208,11 @@ private void AddHistoryItems(HistoryItem[] historyItems)
|
|||
lvHistory.FillLastColumn();
|
||||
lvHistory.Focus();
|
||||
|
||||
if (lvHistory.Items.Count > 0)
|
||||
{
|
||||
lvHistory.Items[0].Selected = true;
|
||||
}
|
||||
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
|
@ -347,6 +281,55 @@ private void UpdatePictureBox()
|
|||
}
|
||||
}
|
||||
|
||||
private string OutputStats(HistoryItem[] historyItems)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine(Resources.HistoryItemCounts);
|
||||
sb.AppendLine(Resources.HistoryStats_Total + " " + historyItems.Length);
|
||||
|
||||
IEnumerable<string> types = historyItems.
|
||||
GroupBy(x => x.Type).
|
||||
OrderByDescending(x => x.Count()).
|
||||
Select(x => string.Format("{0}: {1} ({2:N0}%)", x.Key, x.Count(), x.Count() / (float)historyItems.Length * 100));
|
||||
|
||||
sb.AppendLine(string.Join(Environment.NewLine, types));
|
||||
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(Resources.HistoryStats_YearlyUsages);
|
||||
|
||||
IEnumerable<string> yearlyUsages = historyItems.
|
||||
GroupBy(x => x.DateTime.Year).
|
||||
OrderByDescending(x => x.Key).
|
||||
Select(x => string.Format("{0}: {1} ({2:N0}%)", x.Key, x.Count(), x.Count() / (float)historyItems.Length * 100));
|
||||
|
||||
sb.AppendLine(string.Join(Environment.NewLine, yearlyUsages));
|
||||
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(Resources.HistoryStats_FileExtensions);
|
||||
|
||||
IEnumerable<string> fileExtensions = historyItems.
|
||||
Where(x => !string.IsNullOrEmpty(x.FileName) && !x.FileName.EndsWith(")")).
|
||||
Select(x => Helpers.GetFilenameExtension(x.FileName)).
|
||||
GroupBy(x => x).
|
||||
OrderByDescending(x => x.Count()).
|
||||
Select(x => string.Format("{0} ({1})", x.Key, x.Count()));
|
||||
|
||||
sb.AppendLine(string.Join(Environment.NewLine, fileExtensions));
|
||||
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(Resources.HistoryStats_Hosts);
|
||||
|
||||
IEnumerable<string> hosts = historyItems.
|
||||
GroupBy(x => x.Host).
|
||||
OrderByDescending(x => x.Count()).
|
||||
Select(x => string.Format("{0} ({1})", x.Key, x.Count()));
|
||||
|
||||
sb.Append(string.Join(Environment.NewLine, hosts));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#region Form events
|
||||
|
||||
private void HistoryForm_Shown(object sender, EventArgs e)
|
||||
|
@ -357,18 +340,11 @@ private void HistoryForm_Shown(object sender, EventArgs e)
|
|||
|
||||
if (lvHistory.Items.Count > 0)
|
||||
{
|
||||
lvHistory.Items[0].Selected = true;
|
||||
|
||||
cbTypeFilterSelection.Items.Clear();
|
||||
cbTypeFilterSelection.Items.AddRange(allHistoryItems.Select(x => x.Type).Distinct().Where(x => !string.IsNullOrEmpty(x)).ToArray());
|
||||
|
||||
if (cbTypeFilterSelection.Items.Count > 0)
|
||||
{
|
||||
cbTypeFilterSelection.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
cbHostFilterSelection.Items.Clear();
|
||||
cbHostFilterSelection.Items.AddRange(allHistoryItems.Select(x => x.Host).Distinct().Where(x => !string.IsNullOrEmpty(x)).ToArray());
|
||||
ResetFilters();
|
||||
}
|
||||
|
||||
this.ForceActivate();
|
||||
|
@ -387,6 +363,12 @@ private void HistoryForm_KeyDown(object sender, KeyEventArgs e)
|
|||
RefreshHistoryItems();
|
||||
e.Handled = true;
|
||||
break;
|
||||
#if DEBUG
|
||||
case Keys.Control | Keys.F5:
|
||||
RefreshHistoryItems(true);
|
||||
e.Handled = true;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,13 +377,50 @@ private void scMain_SplitterMoved(object sender, SplitterEventArgs e)
|
|||
Settings.SplitterDistance = scMain.SplitterDistance;
|
||||
}
|
||||
|
||||
private void tstbSearch_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
e.Handled = true;
|
||||
e.SuppressKeyPress = true;
|
||||
ApplyFilterSimple();
|
||||
tstbSearch.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void tsbSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
ApplyFilterSimple();
|
||||
}
|
||||
|
||||
private void tsbAdvancedSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
gbAdvancedSearch.Visible = !gbAdvancedSearch.Visible;
|
||||
}
|
||||
|
||||
private void tsbCopyStats_Click(object sender, EventArgs e)
|
||||
{
|
||||
string stats = OutputStats(allHistoryItems);
|
||||
ClipboardHelpers.CopyText(stats);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
e.Handled = true;
|
||||
e.SuppressKeyPress = true;
|
||||
ApplyFiltersAndAdd();
|
||||
ApplyFilterAdvanced();
|
||||
txtFilenameFilter.Focus();
|
||||
}
|
||||
}
|
||||
|
@ -412,45 +431,21 @@ private void txtURLFilter_KeyDown(object sender, KeyEventArgs e)
|
|||
{
|
||||
e.Handled = true;
|
||||
e.SuppressKeyPress = true;
|
||||
ApplyFiltersAndAdd();
|
||||
ApplyFilterAdvanced();
|
||||
txtURLFilter.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnApplyFilters_Click(object sender, EventArgs e)
|
||||
private void btnAdvancedSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
ApplyFiltersAndAdd();
|
||||
gbAdvancedSearch.Visible = false;
|
||||
ApplyFilterAdvanced();
|
||||
}
|
||||
|
||||
private void btnRemoveFilters_Click(object sender, EventArgs e)
|
||||
private void btnAdvancedSearchReset_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddHistoryItems(allHistoryItems);
|
||||
}
|
||||
|
||||
private void BtnShowStats_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (showingStats)
|
||||
{
|
||||
lvHistory.Visible = true;
|
||||
pStats.Visible = false;
|
||||
btnShowStats.Text = Resources.BtnShowStats_ShowStats;
|
||||
showingStats = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
pStats.Visible = true;
|
||||
lvHistory.Visible = false;
|
||||
btnShowStats.Text = Resources.BtnShowStats_HideStats;
|
||||
Cursor = Cursors.WaitCursor;
|
||||
OutputStats(allHistoryItems);
|
||||
Cursor = Cursors.Default;
|
||||
showingStats = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void nudMaxItemCount_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
Settings.MaxItemCount = (int)nudMaxItemCount.Value;
|
||||
ResetFilters();
|
||||
ApplyFilterAdvanced();
|
||||
}
|
||||
|
||||
private void lvHistory_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
|
||||
|
|
File diff suppressed because it is too large
Load diff
74
ShareX.HistoryLib/Forms/HistorySettingsForm.Designer.cs
generated
Normal file
74
ShareX.HistoryLib/Forms/HistorySettingsForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,74 @@
|
|||
|
||||
namespace ShareX.HistoryLib
|
||||
{
|
||||
partial class HistorySettingsForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
50
ShareX.HistoryLib/Forms/HistorySettingsForm.cs
Normal file
50
ShareX.HistoryLib/Forms/HistorySettingsForm.cs
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
195
ShareX.HistoryLib/Forms/HistorySettingsForm.resx
Normal file
195
ShareX.HistoryLib/Forms/HistorySettingsForm.resx
Normal file
|
@ -0,0 +1,195 @@
|
|||
<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="lblMaximumItemLimit.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="lblMaximumItemLimit.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>13, 16</value>
|
||||
</data>
|
||||
<data name="lblMaximumItemLimit.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>96, 13</value>
|
||||
</data>
|
||||
<data name="lblMaximumItemLimit.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="lblMaximumItemLimit.Text" xml:space="preserve">
|
||||
<value>Maximum item limit:</value>
|
||||
</data>
|
||||
<data name=">>lblMaximumItemLimit.Name" xml:space="preserve">
|
||||
<value>lblMaximumItemLimit</value>
|
||||
</data>
|
||||
<data name=">>lblMaximumItemLimit.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>lblMaximumItemLimit.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>lblMaximumItemLimit.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="nudMaximumItemLimit.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 32</value>
|
||||
</data>
|
||||
<data name="nudMaximumItemLimit.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>64, 20</value>
|
||||
</data>
|
||||
<data name="nudMaximumItemLimit.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="nudMaximumItemLimit.TextAlign" type="System.Windows.Forms.HorizontalAlignment, System.Windows.Forms">
|
||||
<value>Center</value>
|
||||
</data>
|
||||
<data name=">>nudMaximumItemLimit.Name" xml:space="preserve">
|
||||
<value>nudMaximumItemLimit</value>
|
||||
</data>
|
||||
<data name=">>nudMaximumItemLimit.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>nudMaximumItemLimit.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>nudMaximumItemLimit.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>305, 191</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterScreen</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>ShareX - History settings</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>HistorySettingsForm</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
|
@ -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);
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="lblViewMode.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>5, 8</value>
|
||||
<value>13, 16</value>
|
||||
</data>
|
||||
<data name="lblViewMode.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>62, 13</value>
|
||||
|
@ -150,7 +150,7 @@
|
|||
<value>True</value>
|
||||
</data>
|
||||
<data name="lblThumbnailSize.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>5, 56</value>
|
||||
<value>13, 64</value>
|
||||
</data>
|
||||
<data name="lblThumbnailSize.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>80, 13</value>
|
||||
|
@ -177,7 +177,7 @@
|
|||
<value>True</value>
|
||||
</data>
|
||||
<data name="lblMaximumImageLimit.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>5, 104</value>
|
||||
<value>13, 112</value>
|
||||
</data>
|
||||
<data name="lblMaximumImageLimit.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>105, 13</value>
|
||||
|
@ -201,7 +201,7 @@
|
|||
<value>6</value>
|
||||
</data>
|
||||
<data name="cbViewMode.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>8, 24</value>
|
||||
<value>16, 32</value>
|
||||
</data>
|
||||
<data name="cbViewMode.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>120, 21</value>
|
||||
|
@ -222,7 +222,7 @@
|
|||
<value>5</value>
|
||||
</data>
|
||||
<data name="nudThumbnailSize.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>8, 72</value>
|
||||
<value>16, 80</value>
|
||||
</data>
|
||||
<data name="nudThumbnailSize.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>64, 20</value>
|
||||
|
@ -247,7 +247,7 @@
|
|||
<value>4</value>
|
||||
</data>
|
||||
<data name="nudMaximumImageLimit.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>8, 120</value>
|
||||
<value>16, 128</value>
|
||||
</data>
|
||||
<data name="nudMaximumImageLimit.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>64, 20</value>
|
||||
|
@ -274,7 +274,7 @@
|
|||
<value>True</value>
|
||||
</data>
|
||||
<data name="lblThumbnailSizeUnit.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>77, 76</value>
|
||||
<value>85, 84</value>
|
||||
</data>
|
||||
<data name="lblThumbnailSizeUnit.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>18, 13</value>
|
||||
|
@ -304,7 +304,7 @@
|
|||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="cbRememberSearchText.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>8, 176</value>
|
||||
<value>16, 184</value>
|
||||
</data>
|
||||
<data name="cbRememberSearchText.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>138, 17</value>
|
||||
|
@ -331,7 +331,7 @@
|
|||
<value>True</value>
|
||||
</data>
|
||||
<data name="cbFilterMissingFiles.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>8, 152</value>
|
||||
<value>16, 160</value>
|
||||
</data>
|
||||
<data name="cbFilterMissingFiles.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>106, 17</value>
|
||||
|
@ -358,10 +358,10 @@
|
|||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>344, 226</value>
|
||||
<value>344, 218</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterScreen</value>
|
||||
|
|
91
ShareX.HistoryLib/HistoryFilter.cs
Normal file
91
ShareX.HistoryLib/HistoryFilter.cs
Normal file
|
@ -0,0 +1,91 @@
|
|||
#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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using ShareX.HelpersLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ShareX.HistoryLib
|
||||
{
|
||||
public class HistoryFilter
|
||||
{
|
||||
public string Filename { get; set; }
|
||||
public string URL { get; set; }
|
||||
public bool FilterDate { get; set; }
|
||||
public DateTime FromDate { get; set; }
|
||||
public DateTime ToDate { get; set; }
|
||||
public bool FilterType { get; set; }
|
||||
public string Type { get; set; }
|
||||
public bool FilterHost { get; set; }
|
||||
public string Host { get; set; }
|
||||
|
||||
public int MaxItemCount { get; set; }
|
||||
public bool SearchInTags { get; set; } = true;
|
||||
|
||||
public HistoryFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<HistoryItem> ApplyFilter(IEnumerable<HistoryItem> historyItems)
|
||||
{
|
||||
if (FilterType && !string.IsNullOrEmpty(Type))
|
||||
{
|
||||
historyItems = historyItems.Where(x => !string.IsNullOrEmpty(x.Type) && x.Type.Equals(Type, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
if (FilterHost && !string.IsNullOrEmpty(Host))
|
||||
{
|
||||
historyItems = historyItems.Where(x => !string.IsNullOrEmpty(x.Host) && x.Host.Contains(Host, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Filename))
|
||||
{
|
||||
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))));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(URL))
|
||||
{
|
||||
historyItems = historyItems.Where(x => x.URL != null && x.URL.Contains(URL, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
if (FilterDate)
|
||||
{
|
||||
historyItems = historyItems.Where(x => x.DateTime.Date >= FromDate && x.DateTime.Date <= ToDate);
|
||||
}
|
||||
|
||||
if (MaxItemCount > 0)
|
||||
{
|
||||
historyItems = historyItems.Take(MaxItemCount);
|
||||
}
|
||||
|
||||
return historyItems;
|
||||
}
|
||||
}
|
||||
}
|
79
ShareX.HistoryLib/HistoryManagerMock.cs
Normal file
79
ShareX.HistoryLib/HistoryManagerMock.cs
Normal file
|
@ -0,0 +1,79 @@
|
|||
#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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using ShareX.HelpersLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ShareX.HistoryLib
|
||||
{
|
||||
public class HistoryManagerMock : HistoryManager
|
||||
{
|
||||
private int itemCount = 10000;
|
||||
|
||||
public HistoryManagerMock(string filePath) : base(filePath)
|
||||
{
|
||||
}
|
||||
|
||||
protected override List<HistoryItem> Load(string filePath)
|
||||
{
|
||||
List<HistoryItem> items = new List<HistoryItem>();
|
||||
|
||||
for (int i = 0; i < itemCount; i++)
|
||||
{
|
||||
items.Add(CreateMockHistoryItem());
|
||||
}
|
||||
|
||||
return items.OrderBy(x => x.DateTime).ToList();
|
||||
}
|
||||
|
||||
private HistoryItem CreateMockHistoryItem()
|
||||
{
|
||||
string fileName = $"ShareX_{Helpers.GetRandomAlphanumeric(10)}.png";
|
||||
|
||||
HistoryItem historyItem = new HistoryItem()
|
||||
{
|
||||
FileName = fileName,
|
||||
FilePath = @"..\..\..\ShareX.HelpersLib\Resources\ShareX_Logo.png",
|
||||
DateTime = DateTime.Now.AddSeconds(-RandomFast.Next(0, 1000000)),
|
||||
Type = "Image",
|
||||
Host = "Amazon S3",
|
||||
URL = "https://i.example.com/" + fileName,
|
||||
ThumbnailURL = "https://t.example.com/" + fileName,
|
||||
DeletionURL = "https://d.example.com/" + fileName,
|
||||
ShortenedURL = "https://s.example.com/" + fileName
|
||||
};
|
||||
|
||||
return historyItem;
|
||||
}
|
||||
|
||||
protected override bool Append(string filePath, IEnumerable<HistoryItem> historyItems)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
36
ShareX.HistoryLib/Properties/Resources.Designer.cs
generated
36
ShareX.HistoryLib/Properties/Resources.Designer.cs
generated
|
@ -71,20 +71,12 @@ internal class Resources {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Hide stats.
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static string BtnShowStats_HideStats {
|
||||
internal static System.Drawing.Bitmap clipboard_list {
|
||||
get {
|
||||
return ResourceManager.GetString("BtnShowStats_HideStats", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show stats.
|
||||
/// </summary>
|
||||
internal static string BtnShowStats_ShowStats {
|
||||
get {
|
||||
return ResourceManager.GetString("BtnShowStats_ShowStats", resourceCulture);
|
||||
object obj = ResourceManager.GetObject("clipboard-list", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,6 +89,16 @@ internal class Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap gear {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("gear", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
@ -433,6 +435,16 @@ internal class Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap magnifier__plus {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("magnifier--plus", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
|
|
@ -117,33 +117,45 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="HistoryManager_GetHistoryItems_Error" xml:space="preserve">
|
||||
<value>Error</value>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="magnifier" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\magnifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Thumbnail_URL" xml:space="preserve">
|
||||
<value>Thumbnail URL</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_File_path" xml:space="preserve">
|
||||
<value>File path</value>
|
||||
</data>
|
||||
<data name="HistoryStats_Hosts" xml:space="preserve">
|
||||
<value>Hosts:</value>
|
||||
</data>
|
||||
<data name="HistoryItemCounts" xml:space="preserve">
|
||||
<value>History item counts:</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Image_preview" xml:space="preserve">
|
||||
<value>Image preview...</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_File" xml:space="preserve">
|
||||
<value>File</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Image" xml:space="preserve">
|
||||
<value>Image</value>
|
||||
<data name="HistoryForm_UpdateItemCount___Filtered___0_" xml:space="preserve">
|
||||
<value>Filtered: {0}</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Shortened_URL" xml:space="preserve">
|
||||
<value>Shortened URL</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Markdown__link" xml:space="preserve">
|
||||
<value>Markdown link</value>
|
||||
</data>
|
||||
<data name="HistoryStats_FileExtensions" xml:space="preserve">
|
||||
<value>File extensions:</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Folder" xml:space="preserve">
|
||||
<value>Folder</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_URL" xml:space="preserve">
|
||||
<value>URL</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="globe" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\globe.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="HistoryItemManager_InitializeComponent_File_name" xml:space="preserve">
|
||||
<value>File name</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_File_name_with_extension" xml:space="preserve">
|
||||
<value>File name with extension</value>
|
||||
|
@ -151,6 +163,9 @@
|
|||
<data name="HistoryItemManager_InitializeComponent_Copy" xml:space="preserve">
|
||||
<value>Copy</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Forum__BBCode__image" xml:space="preserve">
|
||||
<value>Forum (BBCode) image</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_HTML_image" xml:space="preserve">
|
||||
<value>HTML image</value>
|
||||
</data>
|
||||
|
@ -160,8 +175,11 @@
|
|||
<data name="HistoryForm_UpdateItemCount_Total___0_" xml:space="preserve">
|
||||
<value>Total: {0}</value>
|
||||
</data>
|
||||
<data name="HistoryForm_UpdateItemCount___Filtered___0_" xml:space="preserve">
|
||||
<value>Filtered: {0}</value>
|
||||
<data name="globe" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\globe.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="clipboard-list" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\clipboard-list.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Open" xml:space="preserve">
|
||||
<value>Open</value>
|
||||
|
@ -169,6 +187,9 @@
|
|||
<data name="HistoryItemManager_InitializeComponent_More_info" xml:space="preserve">
|
||||
<value>More info...</value>
|
||||
</data>
|
||||
<data name="magnifier--plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\magnifier--plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_HTML_link" xml:space="preserve">
|
||||
<value>HTML link</value>
|
||||
</data>
|
||||
|
@ -181,67 +202,49 @@
|
|||
<data name="HistoryItemManager_InitializeComponent_HTML_linked_image" xml:space="preserve">
|
||||
<value>HTML linked image</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_EditImage" xml:space="preserve">
|
||||
<value>Edit image...</value>
|
||||
</data>
|
||||
<data name="HistoryManager_GetHistoryItems_Error" xml:space="preserve">
|
||||
<value>Error</value>
|
||||
</data>
|
||||
<data name="HistoryStats_Total" xml:space="preserve">
|
||||
<value>Total:</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Forum__BBCode__linked_image" xml:space="preserve">
|
||||
<value>Forum (BBCode) linked image</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Deletion_URL" xml:space="preserve">
|
||||
<value>Deletion URL</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Forum__BBCode__image" xml:space="preserve">
|
||||
<value>Forum (BBCode) image</value>
|
||||
<data name="HistoryItemManager_InitializeComponent_UploadFile" xml:space="preserve">
|
||||
<value>Upload file</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Text" xml:space="preserve">
|
||||
<value>Text</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Image" xml:space="preserve">
|
||||
<value>Image</value>
|
||||
</data>
|
||||
<data name="image" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\image.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="application_block" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\application-block.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Shortened_URL" xml:space="preserve">
|
||||
<value>Shortened URL</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_File_name" xml:space="preserve">
|
||||
<value>File name</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_File_path" xml:space="preserve">
|
||||
<value>File path</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_Forum__BBCode__link" xml:space="preserve">
|
||||
<value>Forum (BBCode) link</value>
|
||||
</data>
|
||||
<data name="magnifier" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\magnifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_UploadFile" xml:space="preserve">
|
||||
<value>Upload file</value>
|
||||
</data>
|
||||
<data name="HistoryItemManager_InitializeComponent_EditImage" xml:space="preserve">
|
||||
<value>Edit image...</value>
|
||||
</data>
|
||||
<data name="BtnShowStats_ShowStats" xml:space="preserve">
|
||||
<value>Show stats</value>
|
||||
</data>
|
||||
<data name="BtnShowStats_HideStats" xml:space="preserve">
|
||||
<value>Hide stats</value>
|
||||
</data>
|
||||
<data name="HistoryItemCounts" xml:space="preserve">
|
||||
<value>History item counts:</value>
|
||||
</data>
|
||||
<data name="HistoryStats_Total" xml:space="preserve">
|
||||
<value>Total:</value>
|
||||
<data name="ErrorOccuredWhileReadingHistoryFile" xml:space="preserve">
|
||||
<value>Error occured while reading history file:</value>
|
||||
</data>
|
||||
<data name="HistoryStats_YearlyUsages" xml:space="preserve">
|
||||
<value>Yearly usages:</value>
|
||||
</data>
|
||||
<data name="HistoryStats_FileExtensions" xml:space="preserve">
|
||||
<value>File extensions:</value>
|
||||
<data name="HistoryItemManager_InitializeComponent_URL" xml:space="preserve">
|
||||
<value>URL</value>
|
||||
</data>
|
||||
<data name="HistoryStats_Hosts" xml:space="preserve">
|
||||
<value>Hosts:</value>
|
||||
<data name="HistoryItemManager_InitializeComponent_Forum__BBCode__link" xml:space="preserve">
|
||||
<value>Forum (BBCode) link</value>
|
||||
</data>
|
||||
<data name="ErrorOccuredWhileReadingHistoryFile" xml:space="preserve">
|
||||
<value>Error occured while reading history file:</value>
|
||||
<data name="gear" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\gear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
ShareX.HistoryLib/Resources/clipboard-list.png
Normal file
BIN
ShareX.HistoryLib/Resources/clipboard-list.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 600 B |
BIN
ShareX.HistoryLib/Resources/gear.png
Normal file
BIN
ShareX.HistoryLib/Resources/gear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 721 B |
BIN
ShareX.HistoryLib/Resources/magnifier--plus.png
Normal file
BIN
ShareX.HistoryLib/Resources/magnifier--plus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 803 B |
|
@ -86,6 +86,13 @@
|
|||
<Compile Include="..\SharedAssemblyInfo.cs">
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Forms\HistorySettingsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\HistorySettingsForm.Designer.cs">
|
||||
<DependentUpon>HistorySettingsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HistoryFilter.cs" />
|
||||
<Compile Include="HistoryItemManager_ContextMenu.cs" />
|
||||
<Compile Include="Forms\ImageHistoryForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
@ -100,6 +107,7 @@
|
|||
<DependentUpon>ImageHistorySettingsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HistoryManagerJSON.cs" />
|
||||
<Compile Include="HistoryManagerMock.cs" />
|
||||
<Compile Include="HistoryManagerXML.cs" />
|
||||
<Compile Include="HistorySettings.cs" />
|
||||
<Compile Include="ImageHistorySettings.cs" />
|
||||
|
@ -246,6 +254,9 @@
|
|||
<EmbeddedResource Include="Forms\HistoryItemInfoForm.zh-TW.resx">
|
||||
<DependentUpon>HistoryItemInfoForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\HistorySettingsForm.resx">
|
||||
<DependentUpon>HistorySettingsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ImageHistoryForm.de.resx">
|
||||
<DependentUpon>ImageHistoryForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -379,6 +390,15 @@
|
|||
<ItemGroup>
|
||||
<None Include="Resources\magnifier.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\magnifier--plus.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\clipboard-list.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\gear.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
|
|
Loading…
Reference in a new issue