OSDN Git Service

ShortUrlPanelに対する設定値の設定・取得を LoadConfing/SaveConfig メソッドに移動
authorKimura Youichi <kim.upsilon@bucyou.net>
Sun, 27 Jul 2014 16:33:06 +0000 (01:33 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Thu, 31 Jul 2014 16:17:02 +0000 (01:17 +0900)
OpenTween/AppendSettingDialog.cs
OpenTween/Setting/Panel/ShortUrlPanel.cs
OpenTween/Tween.cs

index b19a539..f549c7a 100644 (file)
@@ -81,6 +81,7 @@ namespace OpenTween
             this.FontPanel2.LoadConfig(settingLocal);
             this.PreviewPanel.LoadConfig(settingCommon);
             this.GetCountPanel.LoadConfig(settingCommon);
+            this.ShortUrlPanel.LoadConfig(settingCommon);
         }
 
         public void SaveConfig(SettingCommon settingCommon, SettingLocal settingLocal)
@@ -94,6 +95,7 @@ namespace OpenTween
             this.FontPanel2.SaveConfig(settingLocal);
             this.PreviewPanel.SaveConfig(settingCommon);
             this.GetCountPanel.SaveConfig(settingCommon);
+            this.ShortUrlPanel.SaveConfig(settingCommon);
         }
 
         private void TreeViewSetting_BeforeSelect(object sender, TreeViewCancelEventArgs e)
@@ -219,8 +221,6 @@ namespace OpenTween
 #endif
             try
             {
-                TinyUrlResolve = this.ShortUrlPanel.CheckTinyURL.Checked;
-                ShortUrl.Instance.DisableExpanding = !TinyUrlResolve;
                 if (this.ProxyPanel.RadioProxyNone.Checked)
                 {
                     _MyProxyType = ProxyType.None;
@@ -237,8 +237,6 @@ namespace OpenTween
                 ProxyPort = int.Parse(this.ProxyPanel.TextProxyPort.Text.Trim());
                 ProxyUser = this.ProxyPanel.TextProxyUser.Text.Trim();
                 ProxyPassword = this.ProxyPanel.TextProxyPassword.Text.Trim();
-                UrlConvertAuto = this.ShortUrlPanel.CheckAutoConvertUrl.Checked;
-                ShortenTco = this.ShortUrlPanel.ShortenTcoCheck.Checked;
 
                 Nicoms = this.CooperatePanel.CheckNicoms.Checked;
                 DefaultTimeOut = int.Parse(this.ConnectionPanel.ConnectionTimeOut.Text);
@@ -248,9 +246,6 @@ namespace OpenTween
                 FavEventUnread = this.NotifyPanel.CheckFavEventUnread.Checked;
                 TranslateLanguage = Bing.GetLanguageEnumFromIndex(this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex);
                 EventSoundFile = (string)this.NotifyPanel.ComboBoxEventNotifySound.SelectedItem;
-                AutoShortUrlFirst = (MyCommon.UrlConverter)this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex;
-                BitlyUser = this.ShortUrlPanel.TextBitlyId.Text;
-                BitlyPwd = this.ShortUrlPanel.TextBitlyPw.Text;
                 TwitterApiUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
                 UserAppointUrl = this.CooperatePanel.UserAppointUrlText.Text;
                 this.EnableImgAzyobuziNet = this.CooperatePanel.EnableImgAzyobuziNetCheckBox.Checked;
@@ -366,7 +361,6 @@ namespace OpenTween
                 }
             }
 
-            this.ShortUrlPanel.CheckTinyURL.Checked = TinyUrlResolve;
             switch (_MyProxyType)
             {
                 case ProxyType.None:
@@ -394,10 +388,6 @@ namespace OpenTween
             this.ProxyPanel.TextProxyUser.Text = ProxyUser;
             this.ProxyPanel.TextProxyPassword.Text = ProxyPassword;
 
-            this.ShortUrlPanel.CheckAutoConvertUrl.Checked = UrlConvertAuto;
-            this.ShortUrlPanel.ShortenTcoCheck.Checked = ShortenTco;
-            this.ShortUrlPanel.ShortenTcoCheck.Enabled = this.ShortUrlPanel.CheckAutoConvertUrl.Checked;
-
             this.CooperatePanel.CheckNicoms.Checked = Nicoms;
             this.ConnectionPanel.ConnectionTimeOut.Text = DefaultTimeOut.ToString();
 
@@ -406,11 +396,6 @@ namespace OpenTween
             this.NotifyPanel.CheckFavEventUnread.Checked = FavEventUnread;
             this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex = Bing.GetIndexFromLanguageEnum(TranslateLanguage);
             SoundFileListup();
-            this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex = (int)AutoShortUrlFirst;
-            this.ShortUrlPanel.TextBitlyId.Text = BitlyUser;
-            this.ShortUrlPanel.TextBitlyPw.Text = BitlyPwd;
-            this.ShortUrlPanel.TextBitlyId.Modified = false;
-            this.ShortUrlPanel.TextBitlyPw.Modified = false;
             this.ConnectionPanel.TwitterAPIText.Text = TwitterApiUrl;
 
             this.CooperatePanel.UserAppointUrlText.Text = UserAppointUrl;
@@ -630,7 +615,6 @@ namespace OpenTween
         }
 
         public string RecommendStatusText { get; set; }
-        public bool TinyUrlResolve { get; set; }
 
         public ProxyType SelectedProxyType
         {
@@ -646,13 +630,8 @@ namespace OpenTween
         public int ProxyPort { get; set; }
         public string ProxyUser { get; set; }
         public string ProxyPassword { get; set; }
-        public bool UrlConvertAuto { get; set; }
-        public bool ShortenTco { get; set; }
         public bool Nicoms { get; set; }
-        public MyCommon.UrlConverter AutoShortUrlFirst { get; set; }
         public int DefaultTimeOut { get; set; }
-        public string BitlyUser { get; set; }
-        public string BitlyPwd { get; set; }
         public string TwitterApiUrl { get; set; }
 
         public bool EventNotifyEnabled { get; set; }
index a3502ec..564bdfd 100644 (file)
@@ -42,6 +42,33 @@ namespace OpenTween.Setting.Panel
             InitializeComponent();
         }
 
+        public void LoadConfig(SettingCommon settingCommon)
+        {
+            this.CheckTinyURL.Checked = settingCommon.TinyUrlResolve;
+
+            // 使われていない設定項目 (Tween v1.0.5.0)
+            this.CheckAutoConvertUrl.Checked = false;
+            //this.CheckAutoConvertUrl.Checked = settingCommon.UrlConvertAuto;
+            //this.ShortenTcoCheck.Checked = settingCommon.ShortenTco;
+            this.ShortenTcoCheck.Enabled = this.CheckAutoConvertUrl.Checked;
+
+            this.ComboBoxAutoShortUrlFirst.SelectedIndex = (int)settingCommon.AutoShortUrlFirst;
+            this.TextBitlyId.Text = settingCommon.BilyUser;
+            this.TextBitlyPw.Text = settingCommon.BitlyPwd;
+            this.TextBitlyId.Modified = false;
+            this.TextBitlyPw.Modified = false;
+        }
+
+        public void SaveConfig(SettingCommon settingCommon)
+        {
+            settingCommon.TinyUrlResolve = this.CheckTinyURL.Checked;
+            settingCommon.UrlConvertAuto = this.CheckAutoConvertUrl.Checked;
+            //settingCommon.ShortenTco = this.ShortenTcoCheck.Checked;
+            settingCommon.AutoShortUrlFirst = (MyCommon.UrlConverter)this.ComboBoxAutoShortUrlFirst.SelectedIndex;
+            settingCommon.BilyUser = this.TextBitlyId.Text;
+            settingCommon.BitlyPwd = this.TextBitlyPw.Text;
+        }
+
         private void ComboBoxAutoShortUrlFirst_SelectedIndexChanged(object sender, EventArgs e)
         {
             if (ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Bitly ||
index dd94862..92e39a5 100644 (file)
@@ -775,17 +775,12 @@ namespace OpenTween
             this.PlaySoundMenuItem.Checked = this._cfgCommon.PlaySound;
             this.PlaySoundFileMenuItem.Checked = this._cfgCommon.PlaySound;
 
-            SettingDialog.TinyUrlResolve = _cfgCommon.TinyUrlResolve;
-
             SettingDialog.SelectedProxyType = _cfgLocal.ProxyType;
             SettingDialog.ProxyAddress = _cfgLocal.ProxyAddress;
             SettingDialog.ProxyPort = _cfgLocal.ProxyPort;
             SettingDialog.ProxyUser = _cfgLocal.ProxyUser;
             SettingDialog.ProxyPassword = _cfgLocal.ProxyPassword;
 
-            SettingDialog.UrlConvertAuto = false;
-            //SettingDialog.UrlConvertAuto = _cfgCommon.UrlConvertAuto;
-
             SettingDialog.DefaultTimeOut = _cfgCommon.DefaultTimeOut;
             SettingDialog.EventNotifyEnabled = _cfgCommon.EventNotifyEnabled;
             SettingDialog.EventNotifyFlag = _cfgCommon.EventNotifyFlag;
@@ -799,9 +794,6 @@ namespace OpenTween
             if (_cfgCommon.AutoShortUrlFirst < 0)
                 _cfgCommon.AutoShortUrlFirst = MyCommon.UrlConverter.Uxnu;
 
-            SettingDialog.AutoShortUrlFirst = _cfgCommon.AutoShortUrlFirst;
-            SettingDialog.BitlyUser = _cfgCommon.BilyUser;
-            SettingDialog.BitlyPwd = _cfgCommon.BitlyPwd;
             AtIdSupl = new AtIdSupplement(SettingAtIdList.Load().AtIdList, "@");
 
             this.IdeographicSpaceToSpaceToolStripMenuItem.Checked = _cfgCommon.WideSpaceConvert;
@@ -925,9 +917,9 @@ namespace OpenTween
 
             tw.RestrictFavCheck = this._cfgCommon.RestrictFavCheck;
             tw.ReadOwnPost = this._cfgCommon.ReadOwnPost;
-            ShortUrl.Instance.DisableExpanding = !SettingDialog.TinyUrlResolve;
-            ShortUrl.Instance.BitlyId = SettingDialog.BitlyUser;
-            ShortUrl.Instance.BitlyKey = SettingDialog.BitlyPwd;
+            ShortUrl.Instance.DisableExpanding = !this._cfgCommon.TinyUrlResolve;
+            ShortUrl.Instance.BitlyId = this._cfgCommon.BilyUser;
+            ShortUrl.Instance.BitlyKey = this._cfgCommon.BitlyPwd;
             HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;
             tw.TrackWord = _cfgCommon.TrackWord;
             TrackToolStripMenuItem.Checked = !String.IsNullOrEmpty(tw.TrackWord);
@@ -3826,9 +3818,9 @@ namespace OpenTween
 
                     tw.RestrictFavCheck = this._cfgCommon.RestrictFavCheck;
                     tw.ReadOwnPost = this._cfgCommon.ReadOwnPost;
-                    ShortUrl.Instance.DisableExpanding = !SettingDialog.TinyUrlResolve;
-                    ShortUrl.Instance.BitlyId = SettingDialog.BitlyUser;
-                    ShortUrl.Instance.BitlyKey = SettingDialog.BitlyPwd;
+                    ShortUrl.Instance.DisableExpanding = !this._cfgCommon.TinyUrlResolve;
+                    ShortUrl.Instance.BitlyId = this._cfgCommon.BilyUser;
+                    ShortUrl.Instance.BitlyKey = this._cfgCommon.BitlyPwd;
                     HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;
 
                     Networking.DefaultTimeout = TimeSpan.FromSeconds(this.SettingDialog.DefaultTimeOut);
@@ -7668,8 +7660,6 @@ namespace OpenTween
                 _cfgCommon.TokenSecret = tw.AccessTokenSecret;
                 _cfgCommon.UserAccounts = SettingDialog.UserAccounts;
 
-                _cfgCommon.TinyUrlResolve = SettingDialog.TinyUrlResolve;
-                _cfgCommon.UrlConvertAuto = SettingDialog.UrlConvertAuto;
                 _cfgCommon.DefaultTimeOut = SettingDialog.DefaultTimeOut;
                 _cfgCommon.EventNotifyEnabled = SettingDialog.EventNotifyEnabled;
                 _cfgCommon.EventNotifyFlag = SettingDialog.EventNotifyFlag;
@@ -7678,14 +7668,11 @@ namespace OpenTween
                 _cfgCommon.FavEventUnread = SettingDialog.FavEventUnread;
                 _cfgCommon.TranslateLanguage = SettingDialog.TranslateLanguage;
                 _cfgCommon.EventSoundFile = SettingDialog.EventSoundFile;
-                _cfgCommon.AutoShortUrlFirst = SettingDialog.AutoShortUrlFirst;
                 if (IdeographicSpaceToSpaceToolStripMenuItem != null &&
                    IdeographicSpaceToSpaceToolStripMenuItem.IsDisposed == false)
                 {
                     _cfgCommon.WideSpaceConvert = this.IdeographicSpaceToSpaceToolStripMenuItem.Checked;
                 }
-                _cfgCommon.BilyUser = SettingDialog.BitlyUser;
-                _cfgCommon.BitlyPwd = SettingDialog.BitlyPwd;
 
                 _cfgCommon.SortOrder = (int)_statuses.SortOrder;
                 switch (_statuses.SortMode)
@@ -9920,16 +9907,16 @@ namespace OpenTween
 
         private async void UrlConvertAutoToolStripMenuItem_Click(object sender, EventArgs e)
         {
-            if (!await UrlConvertAsync(SettingDialog.AutoShortUrlFirst))
+            if (!await UrlConvertAsync(this._cfgCommon.AutoShortUrlFirst))
             {
-                MyCommon.UrlConverter svc = SettingDialog.AutoShortUrlFirst;
+                MyCommon.UrlConverter svc = this._cfgCommon.AutoShortUrlFirst;
                 Random rnd = new Random();
                 // 前回使用した短縮URLサービス以外を選択する
                 do
                 {
                     svc = (MyCommon.UrlConverter)rnd.Next(System.Enum.GetNames(typeof(MyCommon.UrlConverter)).Length);
                 }
-                while (svc == SettingDialog.AutoShortUrlFirst || svc == MyCommon.UrlConverter.Nicoms || svc == MyCommon.UrlConverter.Unu);
+                while (svc == this._cfgCommon.AutoShortUrlFirst || svc == MyCommon.UrlConverter.Nicoms || svc == MyCommon.UrlConverter.Unu);
                 await UrlConvertAsync(svc);
             }
         }
@@ -10941,12 +10928,12 @@ namespace OpenTween
 
         private void ToolStripMenuItemUrlAutoShorten_CheckedChanged(object sender, EventArgs e)
         {
-            SettingDialog.UrlConvertAuto = ToolStripMenuItemUrlAutoShorten.Checked;
+            this._cfgCommon.UrlConvertAuto = ToolStripMenuItemUrlAutoShorten.Checked;
         }
 
         private void ContextMenuPostMode_Opening(object sender, CancelEventArgs e)
         {
-            ToolStripMenuItemUrlAutoShorten.Checked = SettingDialog.UrlConvertAuto;
+            ToolStripMenuItemUrlAutoShorten.Checked = this._cfgCommon.UrlConvertAuto;
         }
 
         private void TraceOutToolStripMenuItem_Click(object sender, EventArgs e)