mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-05 02:34:07 +02:00
parent
c75058b1da
commit
cddce8596f
Configuration
Core
@ -27,6 +27,7 @@ sealed class UserConfig{
|
||||
public Point CustomNotificationPosition { get; set; }
|
||||
public int NotificationEdgeDistance { get; set; }
|
||||
public int NotificationDisplay { get; set; }
|
||||
public int NotificationIdlePauseSeconds { get; set; }
|
||||
public int NotificationDurationValue { get; set; }
|
||||
|
||||
public bool EnableSpellCheck { get; set; }
|
||||
|
@ -31,6 +31,7 @@ protected override void Dispose(bool disposing) {
|
||||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.timerCursorCheck = new System.Windows.Forms.Timer(this.components);
|
||||
this.timerIdlePauseCheck = new System.Windows.Forms.Timer(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// timerCursorCheck
|
||||
@ -38,6 +39,11 @@ private void InitializeComponent() {
|
||||
this.timerCursorCheck.Interval = 200;
|
||||
this.timerCursorCheck.Tick += new System.EventHandler(this.timerCursorCheck_Tick);
|
||||
//
|
||||
// timerIdlePauseCheck
|
||||
//
|
||||
this.timerIdlePauseCheck.Interval = 750;
|
||||
this.timerIdlePauseCheck.Tick += new System.EventHandler(this.timerIdlePauseCheck_Tick);
|
||||
//
|
||||
// FormNotificationTweet
|
||||
//
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormNotificationTweet_FormClosing);
|
||||
@ -48,5 +54,6 @@ private void InitializeComponent() {
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Timer timerCursorCheck;
|
||||
private System.Windows.Forms.Timer timerIdlePauseCheck;
|
||||
}
|
||||
}
|
@ -52,6 +52,13 @@ private void timerCursorCheck_Tick(object sender, EventArgs e){
|
||||
}
|
||||
}
|
||||
|
||||
private void timerIdlePauseCheck_Tick(object sender, EventArgs e){
|
||||
if (NativeMethods.GetIdleSeconds() < Program.UserConfig.NotificationIdlePauseSeconds){
|
||||
ResumeNotification();
|
||||
timerIdlePauseCheck.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
// notification methods
|
||||
|
||||
public override void ShowNotification(TweetNotification notification){
|
||||
@ -87,15 +94,26 @@ public override void ResumeNotification(){
|
||||
}
|
||||
|
||||
private void LoadNextNotification(){
|
||||
if (Program.UserConfig.NotificationNonIntrusiveMode && !IsNotificationVisible && IsCursorOverNotificationArea && NativeMethods.GetIdleSeconds() < NonIntrusiveIdleLimit){
|
||||
if (!timerCursorCheck.Enabled){
|
||||
PauseNotification();
|
||||
timerCursorCheck.Start();
|
||||
if (!IsNotificationVisible){
|
||||
if (Program.UserConfig.NotificationNonIntrusiveMode && IsCursorOverNotificationArea && NativeMethods.GetIdleSeconds() < NonIntrusiveIdleLimit){
|
||||
if (!timerCursorCheck.Enabled){
|
||||
PauseNotification();
|
||||
timerCursorCheck.Start();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (Program.UserConfig.NotificationIdlePauseSeconds > 0 && NativeMethods.GetIdleSeconds() >= Program.UserConfig.NotificationIdlePauseSeconds){
|
||||
if (!timerIdlePauseCheck.Enabled){
|
||||
PauseNotification();
|
||||
timerIdlePauseCheck.Start();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
LoadTweet(tweetQueue.Dequeue());
|
||||
}
|
||||
|
||||
LoadTweet(tweetQueue.Dequeue());
|
||||
}
|
||||
|
||||
protected override void UpdateTitle(){
|
||||
|
@ -43,6 +43,8 @@ private void InitializeComponent() {
|
||||
this.labelDurationValue = new System.Windows.Forms.Label();
|
||||
this.trackBarDuration = new System.Windows.Forms.TrackBar();
|
||||
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
||||
this.labelIdlePause = new System.Windows.Forms.Label();
|
||||
this.comboBoxIdlePause = new System.Windows.Forms.ComboBox();
|
||||
this.checkNonIntrusive = new System.Windows.Forms.CheckBox();
|
||||
this.checkTimerCountDown = new System.Windows.Forms.CheckBox();
|
||||
this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
|
||||
@ -192,7 +194,7 @@ private void InitializeComponent() {
|
||||
this.groupNotificationDuration.Controls.Add(this.tableLayoutDurationButtons);
|
||||
this.groupNotificationDuration.Controls.Add(this.labelDurationValue);
|
||||
this.groupNotificationDuration.Controls.Add(this.trackBarDuration);
|
||||
this.groupNotificationDuration.Location = new System.Drawing.Point(9, 106);
|
||||
this.groupNotificationDuration.Location = new System.Drawing.Point(9, 160);
|
||||
this.groupNotificationDuration.Name = "groupNotificationDuration";
|
||||
this.groupNotificationDuration.Size = new System.Drawing.Size(183, 89);
|
||||
this.groupNotificationDuration.TabIndex = 9;
|
||||
@ -290,16 +292,40 @@ private void InitializeComponent() {
|
||||
//
|
||||
// groupUserInterface
|
||||
//
|
||||
this.groupUserInterface.Controls.Add(this.labelIdlePause);
|
||||
this.groupUserInterface.Controls.Add(this.comboBoxIdlePause);
|
||||
this.groupUserInterface.Controls.Add(this.checkNonIntrusive);
|
||||
this.groupUserInterface.Controls.Add(this.checkTimerCountDown);
|
||||
this.groupUserInterface.Controls.Add(this.checkNotificationTimer);
|
||||
this.groupUserInterface.Location = new System.Drawing.Point(9, 9);
|
||||
this.groupUserInterface.Name = "groupUserInterface";
|
||||
this.groupUserInterface.Size = new System.Drawing.Size(183, 91);
|
||||
this.groupUserInterface.Size = new System.Drawing.Size(183, 145);
|
||||
this.groupUserInterface.TabIndex = 10;
|
||||
this.groupUserInterface.TabStop = false;
|
||||
this.groupUserInterface.Text = "General";
|
||||
//
|
||||
// labelIdlePause
|
||||
//
|
||||
this.labelIdlePause.AutoSize = true;
|
||||
this.labelIdlePause.Location = new System.Drawing.Point(3, 99);
|
||||
this.labelIdlePause.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelIdlePause.Name = "labelIdlePause";
|
||||
this.labelIdlePause.Size = new System.Drawing.Size(89, 13);
|
||||
this.labelIdlePause.TabIndex = 10;
|
||||
this.labelIdlePause.Text = "Pause When Idle";
|
||||
//
|
||||
// comboBoxIdlePause
|
||||
//
|
||||
this.comboBoxIdlePause.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.comboBoxIdlePause.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxIdlePause.FormattingEnabled = true;
|
||||
this.comboBoxIdlePause.Location = new System.Drawing.Point(6, 115);
|
||||
this.comboBoxIdlePause.Name = "comboBoxIdlePause";
|
||||
this.comboBoxIdlePause.Size = new System.Drawing.Size(171, 21);
|
||||
this.comboBoxIdlePause.TabIndex = 9;
|
||||
this.toolTip.SetToolTip(this.comboBoxIdlePause, "Pauses new notifications after going idle for a set amount of time.");
|
||||
//
|
||||
// checkNonIntrusive
|
||||
//
|
||||
this.checkNonIntrusive.AutoSize = true;
|
||||
@ -383,5 +409,7 @@ private void InitializeComponent() {
|
||||
private TweetDck.Core.Controls.FlatButton btnDurationLong;
|
||||
private TweetDck.Core.Controls.FlatButton btnDurationShort;
|
||||
private System.Windows.Forms.CheckBox checkNonIntrusive;
|
||||
private System.Windows.Forms.Label labelIdlePause;
|
||||
private System.Windows.Forms.ComboBox comboBoxIdlePause;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
namespace TweetDck.Core.Other.Settings{
|
||||
partial class TabSettingsNotifications : BaseTabSettings{
|
||||
private static readonly int[] IdlePauseSeconds = { 0, 30, 60, 120, 300 };
|
||||
|
||||
private readonly FormNotificationMain notification;
|
||||
|
||||
public TabSettingsNotifications(FormNotificationMain notification){
|
||||
@ -38,6 +40,13 @@ public TabSettingsNotifications(FormNotificationMain notification){
|
||||
trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
|
||||
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
||||
|
||||
comboBoxIdlePause.Items.Add("Disabled");
|
||||
comboBoxIdlePause.Items.Add("30 seconds");
|
||||
comboBoxIdlePause.Items.Add("1 minute");
|
||||
comboBoxIdlePause.Items.Add("2 minutes");
|
||||
comboBoxIdlePause.Items.Add("5 minutes");
|
||||
comboBoxIdlePause.SelectedIndex = Math.Max(0, Array.FindIndex(IdlePauseSeconds, val => val == Config.NotificationIdlePauseSeconds));
|
||||
|
||||
comboBoxDisplay.Items.Add("(Same As "+Program.BrandName+")");
|
||||
|
||||
foreach(Screen screen in Screen.AllScreens){
|
||||
@ -73,6 +82,8 @@ public override void OnReady(){
|
||||
checkTimerCountDown.CheckedChanged += checkTimerCountDown_CheckedChanged;
|
||||
checkNonIntrusive.CheckedChanged += checkNonIntrusive_CheckedChanged;
|
||||
|
||||
comboBoxIdlePause.SelectedValueChanged += comboBoxIdlePause_SelectedValueChanged;
|
||||
|
||||
comboBoxDisplay.SelectedValueChanged += comboBoxDisplay_SelectedValueChanged;
|
||||
trackBarEdgeDistance.ValueChanged += trackBarEdgeDistance_ValueChanged;
|
||||
}
|
||||
@ -142,6 +153,10 @@ private void checkNonIntrusive_CheckedChanged(object sender, EventArgs e){
|
||||
Config.NotificationNonIntrusiveMode = checkNonIntrusive.Checked;
|
||||
}
|
||||
|
||||
private void comboBoxIdlePause_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.NotificationIdlePauseSeconds = IdlePauseSeconds[comboBoxIdlePause.SelectedIndex];
|
||||
}
|
||||
|
||||
private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.NotificationDisplay = comboBoxDisplay.SelectedIndex;
|
||||
notification.ShowNotificationForSettings(false);
|
||||
|
Loading…
Reference in New Issue
Block a user