1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-30 14:34:09 +02:00

Add an option to toggle Shift key switch in account selectors

Closes 
This commit is contained in:
chylex 2017-04-28 20:06:53 +02:00
parent dca3410a5b
commit e400d86d75
6 changed files with 70 additions and 33 deletions

View File

@ -14,7 +14,7 @@ namespace TweetDck.Configuration{
sealed class UserConfig{ sealed class UserConfig{
private static readonly IFormatter Formatter = new BinaryFormatter(); private static readonly IFormatter Formatter = new BinaryFormatter();
private const int CurrentFileVersion = 8; private const int CurrentFileVersion = 9;
// START OF CONFIGURATION // START OF CONFIGURATION
@ -34,6 +34,7 @@ sealed class UserConfig{
public bool EnableSpellCheck { get; set; } public bool EnableSpellCheck { get; set; }
public bool ExpandLinksOnHover { get; set; } public bool ExpandLinksOnHover { get; set; }
public bool SwitchAccountSelectors { get; set; }
public bool EnableTrayHighlight { get; set; } public bool EnableTrayHighlight { get; set; }
public bool EnableUpdateCheck { get; set; } public bool EnableUpdateCheck { get; set; }
@ -121,6 +122,7 @@ private UserConfig(string file){
NotificationDurationValue = 25; NotificationDurationValue = 25;
EnableUpdateCheck = true; EnableUpdateCheck = true;
ExpandLinksOnHover = true; ExpandLinksOnHover = true;
SwitchAccountSelectors = true;
EnableTrayHighlight = true; EnableTrayHighlight = true;
PluginsWindow = new WindowState(); PluginsWindow = new WindowState();
} }
@ -172,6 +174,11 @@ private void UpgradeFile(){
++fileVersion; ++fileVersion;
} }
if (fileVersion == 8){
SwitchAccountSelectors = true;
++fileVersion;
}
// update the version // update the version
fileVersion = CurrentFileVersion; fileVersion = CurrentFileVersion;
Save(); Save();

View File

@ -9,7 +9,8 @@ public enum Properties{
MuteNotifications = 2, MuteNotifications = 2,
HasCustomNotificationSound = 4, HasCustomNotificationSound = 4,
SkipOnLinkClick = 8, SkipOnLinkClick = 8,
AllBrowser = ExpandLinksOnHover | MuteNotifications | HasCustomNotificationSound, SwitchAccountSelectors = 16,
AllBrowser = ExpandLinksOnHover | SwitchAccountSelectors | MuteNotifications | HasCustomNotificationSound,
AllNotification = ExpandLinksOnHover | SkipOnLinkClick AllNotification = ExpandLinksOnHover | SkipOnLinkClick
} }
@ -21,6 +22,10 @@ public static string GenerateScript(Properties properties){
build.Append("c.expandLinksOnHover=").Append(Program.UserConfig.ExpandLinksOnHover ? "true;" : "false;"); build.Append("c.expandLinksOnHover=").Append(Program.UserConfig.ExpandLinksOnHover ? "true;" : "false;");
} }
if (properties.HasFlag(Properties.SwitchAccountSelectors)){
build.Append("c.switchAccountSelectors=").Append(Program.UserConfig.SwitchAccountSelectors ? "true;" : "false;");
}
if (properties.HasFlag(Properties.MuteNotifications)){ if (properties.HasFlag(Properties.MuteNotifications)){
build.Append("c.muteNotifications=").Append(Program.UserConfig.MuteNotifications ? "true;" : "false;"); build.Append("c.muteNotifications=").Append(Program.UserConfig.MuteNotifications ? "true;" : "false;");
} }

View File

@ -392,7 +392,7 @@ public void OpenSettings(int tabIndex){
trayIcon.HasNotifications = false; trayIcon.HasNotifications = false;
} }
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.HasCustomNotificationSound); UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.SwitchAccountSelectors | PropertyBridge.Properties.HasCustomNotificationSound);
form.Dispose(); form.Dispose();
}; };

View File

@ -31,10 +31,11 @@ private void InitializeComponent() {
this.checkSpellCheck = new System.Windows.Forms.CheckBox(); this.checkSpellCheck = new System.Windows.Forms.CheckBox();
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox(); this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
this.btnCheckUpdates = new System.Windows.Forms.Button(); this.btnCheckUpdates = new System.Windows.Forms.Button();
this.labelZoomValue = new System.Windows.Forms.Label();
this.checkSwitchAccountSelectors = new System.Windows.Forms.CheckBox();
this.groupTray = new System.Windows.Forms.GroupBox(); this.groupTray = new System.Windows.Forms.GroupBox();
this.labelTrayIcon = new System.Windows.Forms.Label(); this.labelTrayIcon = new System.Windows.Forms.Label();
this.groupInterface = new System.Windows.Forms.GroupBox(); this.groupInterface = new System.Windows.Forms.GroupBox();
this.labelZoomValue = new System.Windows.Forms.Label();
this.trackBarZoom = new System.Windows.Forms.TrackBar(); this.trackBarZoom = new System.Windows.Forms.TrackBar();
this.labelZoom = new System.Windows.Forms.Label(); this.labelZoom = new System.Windows.Forms.Label();
this.groupUpdates = new System.Windows.Forms.GroupBox(); this.groupUpdates = new System.Windows.Forms.GroupBox();
@ -84,11 +85,11 @@ private void InitializeComponent() {
// checkSpellCheck // checkSpellCheck
// //
this.checkSpellCheck.AutoSize = true; this.checkSpellCheck.AutoSize = true;
this.checkSpellCheck.Location = new System.Drawing.Point(9, 44); this.checkSpellCheck.Location = new System.Drawing.Point(9, 67);
this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.checkSpellCheck.Name = "checkSpellCheck"; this.checkSpellCheck.Name = "checkSpellCheck";
this.checkSpellCheck.Size = new System.Drawing.Size(119, 17); this.checkSpellCheck.Size = new System.Drawing.Size(119, 17);
this.checkSpellCheck.TabIndex = 1; this.checkSpellCheck.TabIndex = 2;
this.checkSpellCheck.Text = "Enable Spell Check"; this.checkSpellCheck.Text = "Enable Spell Check";
this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly."); this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly.");
this.checkSpellCheck.UseVisualStyleBackColor = true; this.checkSpellCheck.UseVisualStyleBackColor = true;
@ -116,12 +117,38 @@ private void InitializeComponent() {
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed."); this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
this.btnCheckUpdates.UseVisualStyleBackColor = true; this.btnCheckUpdates.UseVisualStyleBackColor = true;
// //
// labelZoomValue
//
this.labelZoomValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.labelZoomValue.BackColor = System.Drawing.Color.Transparent;
this.labelZoomValue.Location = new System.Drawing.Point(139, 116);
this.labelZoomValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelZoomValue.Name = "labelZoomValue";
this.labelZoomValue.Size = new System.Drawing.Size(38, 13);
this.labelZoomValue.TabIndex = 5;
this.labelZoomValue.Text = "100%";
this.labelZoomValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.toolTip.SetToolTip(this.labelZoomValue, "Changes the zoom level.\r\nAlso affects notifications and screenshots.");
//
// checkSwitchAccountSelectors
//
this.checkSwitchAccountSelectors.AutoSize = true;
this.checkSwitchAccountSelectors.Location = new System.Drawing.Point(9, 44);
this.checkSwitchAccountSelectors.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.checkSwitchAccountSelectors.Name = "checkSwitchAccountSelectors";
this.checkSwitchAccountSelectors.Size = new System.Drawing.Size(172, 17);
this.checkSwitchAccountSelectors.TabIndex = 1;
this.checkSwitchAccountSelectors.Text = "Shift Selects Multiple Accounts";
this.toolTip.SetToolTip(this.checkSwitchAccountSelectors, "When (re)tweeting, click to select a single account or hold Shift to\r\nselect mult" +
"iple accounts, instead of TweetDeck\'s default behavior.");
this.checkSwitchAccountSelectors.UseVisualStyleBackColor = true;
//
// groupTray // groupTray
// //
this.groupTray.Controls.Add(this.checkTrayHighlight); this.groupTray.Controls.Add(this.checkTrayHighlight);
this.groupTray.Controls.Add(this.labelTrayIcon); this.groupTray.Controls.Add(this.labelTrayIcon);
this.groupTray.Controls.Add(this.comboBoxTrayType); this.groupTray.Controls.Add(this.comboBoxTrayType);
this.groupTray.Location = new System.Drawing.Point(9, 145); this.groupTray.Location = new System.Drawing.Point(9, 168);
this.groupTray.Name = "groupTray"; this.groupTray.Name = "groupTray";
this.groupTray.Size = new System.Drawing.Size(183, 93); this.groupTray.Size = new System.Drawing.Size(183, 93);
this.groupTray.TabIndex = 1; this.groupTray.TabIndex = 1;
@ -140,6 +167,7 @@ private void InitializeComponent() {
// //
// groupInterface // groupInterface
// //
this.groupInterface.Controls.Add(this.checkSwitchAccountSelectors);
this.groupInterface.Controls.Add(this.labelZoomValue); this.groupInterface.Controls.Add(this.labelZoomValue);
this.groupInterface.Controls.Add(this.trackBarZoom); this.groupInterface.Controls.Add(this.trackBarZoom);
this.groupInterface.Controls.Add(this.labelZoom); this.groupInterface.Controls.Add(this.labelZoom);
@ -147,48 +175,37 @@ private void InitializeComponent() {
this.groupInterface.Controls.Add(this.checkExpandLinks); this.groupInterface.Controls.Add(this.checkExpandLinks);
this.groupInterface.Location = new System.Drawing.Point(9, 9); this.groupInterface.Location = new System.Drawing.Point(9, 9);
this.groupInterface.Name = "groupInterface"; this.groupInterface.Name = "groupInterface";
this.groupInterface.Size = new System.Drawing.Size(183, 130); this.groupInterface.Size = new System.Drawing.Size(183, 153);
this.groupInterface.TabIndex = 0; this.groupInterface.TabIndex = 0;
this.groupInterface.TabStop = false; this.groupInterface.TabStop = false;
this.groupInterface.Text = "User Interface"; this.groupInterface.Text = "User Interface";
// //
// labelZoomValue
//
this.labelZoomValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelZoomValue.BackColor = System.Drawing.Color.Transparent;
this.labelZoomValue.Location = new System.Drawing.Point(139, 93);
this.labelZoomValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelZoomValue.Name = "labelZoomValue";
this.labelZoomValue.Size = new System.Drawing.Size(38, 13);
this.labelZoomValue.TabIndex = 4;
this.labelZoomValue.Text = "100%";
this.labelZoomValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.toolTip.SetToolTip(this.labelZoomValue, "Changes the zoom level.\r\nAlso affects notifications and screenshots.");
//
// trackBarZoom // trackBarZoom
// //
this.trackBarZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.trackBarZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.trackBarZoom.AutoSize = false; this.trackBarZoom.AutoSize = false;
this.trackBarZoom.LargeChange = 25; this.trackBarZoom.LargeChange = 25;
this.trackBarZoom.Location = new System.Drawing.Point(6, 92); this.trackBarZoom.Location = new System.Drawing.Point(6, 115);
this.trackBarZoom.Maximum = 200; this.trackBarZoom.Maximum = 200;
this.trackBarZoom.Minimum = 50; this.trackBarZoom.Minimum = 50;
this.trackBarZoom.Name = "trackBarZoom"; this.trackBarZoom.Name = "trackBarZoom";
this.trackBarZoom.Size = new System.Drawing.Size(141, 30); this.trackBarZoom.Size = new System.Drawing.Size(141, 30);
this.trackBarZoom.SmallChange = 5; this.trackBarZoom.SmallChange = 5;
this.trackBarZoom.TabIndex = 3; this.trackBarZoom.TabIndex = 4;
this.trackBarZoom.TickFrequency = 25; this.trackBarZoom.TickFrequency = 25;
this.trackBarZoom.Value = 100; this.trackBarZoom.Value = 100;
// //
// labelZoom // labelZoom
// //
this.labelZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelZoom.AutoSize = true; this.labelZoom.AutoSize = true;
this.labelZoom.Location = new System.Drawing.Point(5, 76); this.labelZoom.Location = new System.Drawing.Point(5, 99);
this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0); this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
this.labelZoom.Name = "labelZoom"; this.labelZoom.Name = "labelZoom";
this.labelZoom.Size = new System.Drawing.Size(34, 13); this.labelZoom.Size = new System.Drawing.Size(34, 13);
this.labelZoom.TabIndex = 2; this.labelZoom.TabIndex = 3;
this.labelZoom.Text = "Zoom"; this.labelZoom.Text = "Zoom";
// //
// groupUpdates // groupUpdates
@ -244,5 +261,6 @@ private void InitializeComponent() {
private System.Windows.Forms.Label labelZoomValue; private System.Windows.Forms.Label labelZoomValue;
private System.Windows.Forms.TrackBar trackBarZoom; private System.Windows.Forms.TrackBar trackBarZoom;
private System.Windows.Forms.Timer zoomUpdateTimer; private System.Windows.Forms.Timer zoomUpdateTimer;
private System.Windows.Forms.CheckBox checkSwitchAccountSelectors;
} }
} }

View File

@ -28,6 +28,7 @@ public TabSettingsGeneral(UpdateHandler updates){
labelZoomValue.Text = trackBarZoom.Value+"%"; labelZoomValue.Text = trackBarZoom.Value+"%";
checkExpandLinks.Checked = Config.ExpandLinksOnHover; checkExpandLinks.Checked = Config.ExpandLinksOnHover;
checkSwitchAccountSelectors.Checked = Config.SwitchAccountSelectors;
checkSpellCheck.Checked = Config.EnableSpellCheck; checkSpellCheck.Checked = Config.EnableSpellCheck;
checkTrayHighlight.Checked = Config.EnableTrayHighlight; checkTrayHighlight.Checked = Config.EnableTrayHighlight;
@ -36,6 +37,7 @@ public TabSettingsGeneral(UpdateHandler updates){
public override void OnReady(){ public override void OnReady(){
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged; checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
checkSwitchAccountSelectors.CheckedChanged += checkSwitchAccountSelectors_CheckedChanged;
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged; checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
trackBarZoom.ValueChanged += trackBarZoom_ValueChanged; trackBarZoom.ValueChanged += trackBarZoom_ValueChanged;
@ -54,6 +56,10 @@ private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){
Config.ExpandLinksOnHover = checkExpandLinks.Checked; Config.ExpandLinksOnHover = checkExpandLinks.Checked;
} }
private void checkSwitchAccountSelectors_CheckedChanged(object sender, EventArgs e){
Config.SwitchAccountSelectors = checkSwitchAccountSelectors.Checked;
}
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){ private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
Config.EnableSpellCheck = checkSpellCheck.Checked; Config.EnableSpellCheck = checkSpellCheck.Checked;
PromptRestart(); PromptRestart();

View File

@ -513,17 +513,18 @@
// Block: Swap shift key functionality for selecting accounts. // Block: Swap shift key functionality for selecting accounts.
// //
onAppReady.push(function(){ onAppReady.push(function(){
$(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", function(e){ var toggleEventShiftKey = function(e){
e.shiftKey = !e.shiftKey; if ($TDX.switchAccountSelectors){
}); e.shiftKey = !e.shiftKey;
}
};
$(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", toggleEventShiftKey);
TD.components.AccountSelector.prototype.refreshPostingAccounts = appendToFunction(TD.components.AccountSelector.prototype.refreshPostingAccounts, function(){ TD.components.AccountSelector.prototype.refreshPostingAccounts = appendToFunction(TD.components.AccountSelector.prototype.refreshPostingAccounts, function(){
if (!this.$node.attr("td-account-selector-hook")){ if (!this.$node.attr("td-account-selector-hook")){
this.$node.attr("td-account-selector-hook", "1"); this.$node.attr("td-account-selector-hook", "1");
this.$node.delegate(".js-account-item", "click", toggleEventShiftKey);
this.$node.delegate(".js-account-item", "click", function(e){
e.shiftKey = !e.shiftKey;
});
} }
}); });
}); });