OSDN Git Service

CooperatePanelに対する設定値の設定・取得を LoadConfing/SaveConfig メソッドに移動
authorKimura Youichi <kim.upsilon@bucyou.net>
Tue, 29 Jul 2014 14:25:51 +0000 (23:25 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Thu, 31 Jul 2014 16:17:09 +0000 (01:17 +0900)
OpenTween/AppendSettingDialog.cs
OpenTween/Setting/Panel/CooperatePanel.cs
OpenTween/Thumbnail/MapThumb.cs
OpenTween/Thumbnail/MapThumbGoogle.cs
OpenTween/Thumbnail/MapThumbOSM.cs
OpenTween/Tween.cs

index dd80975..b85e37c 100644 (file)
@@ -51,14 +51,7 @@ namespace OpenTween
         private bool _ValidationError = false;
         private MyCommon.EVENTTYPE _MyEventNotifyFlag;
         private MyCommon.EVENTTYPE _isMyEventNotifyFlag;
-        private string _MyTranslateLanguage;
-
-        public bool EnableImgAzyobuziNet { get; set; }
-        public bool ImgAzyobuziNetDisabledInDM { get; set; }
-        public MapProvider MapThumbnailProvider;
-        public int MapThumbnailHeight;
-        public int MapThumbnailWidth;
-        public int MapThumbnailZoom;
+
         public List<UserAccount> UserAccounts;
         private long? InitialUserId;
         public bool IsRemoveSameEvent;
@@ -82,6 +75,7 @@ namespace OpenTween
             this.GetCountPanel.LoadConfig(settingCommon);
             this.ShortUrlPanel.LoadConfig(settingCommon);
             this.ProxyPanel.LoadConfig(settingLocal);
+            this.CooperatePanel.LoadConfig(settingCommon);
         }
 
         public void SaveConfig(SettingCommon settingCommon, SettingLocal settingLocal)
@@ -97,6 +91,7 @@ namespace OpenTween
             this.GetCountPanel.SaveConfig(settingCommon);
             this.ShortUrlPanel.SaveConfig(settingCommon);
             this.ProxyPanel.SaveConfig(settingLocal);
+            this.CooperatePanel.SaveConfig(settingCommon);
         }
 
         private void TreeViewSetting_BeforeSelect(object sender, TreeViewCancelEventArgs e)
@@ -222,22 +217,13 @@ namespace OpenTween
 #endif
             try
             {
-                Nicoms = this.CooperatePanel.CheckNicoms.Checked;
                 DefaultTimeOut = int.Parse(this.ConnectionPanel.ConnectionTimeOut.Text);
                 EventNotifyEnabled = this.NotifyPanel.CheckEventNotify.Checked;
                 GetEventNotifyFlag(ref _MyEventNotifyFlag, ref _isMyEventNotifyFlag);
                 ForceEventNotify = this.NotifyPanel.CheckForceEventNotify.Checked;
                 FavEventUnread = this.NotifyPanel.CheckFavEventUnread.Checked;
-                TranslateLanguage = Bing.GetLanguageEnumFromIndex(this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex);
                 EventSoundFile = (string)this.NotifyPanel.ComboBoxEventNotifySound.SelectedItem;
                 TwitterApiUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
-                UserAppointUrl = this.CooperatePanel.UserAppointUrlText.Text;
-                this.EnableImgAzyobuziNet = this.CooperatePanel.EnableImgAzyobuziNetCheckBox.Checked;
-                this.ImgAzyobuziNetDisabledInDM = this.CooperatePanel.ImgAzyobuziNetDisabledInDMCheckBox.Checked;
-                this.MapThumbnailProvider = (MapProvider)this.CooperatePanel.MapThumbnailProviderComboBox.SelectedIndex;
-                this.MapThumbnailHeight = int.Parse(this.CooperatePanel.MapThumbnailHeightTextBox.Text);
-                this.MapThumbnailWidth = int.Parse(this.CooperatePanel.MapThumbnailWidthTextBox.Text);
-                this.MapThumbnailZoom = int.Parse(this.CooperatePanel.MapThumbnailZoomTextBox.Text);
                 this.IsRemoveSameEvent = this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked;
             }
             catch(Exception)
@@ -345,23 +331,14 @@ namespace OpenTween
                 }
             }
 
-            this.CooperatePanel.CheckNicoms.Checked = Nicoms;
             this.ConnectionPanel.ConnectionTimeOut.Text = DefaultTimeOut.ToString();
 
             ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
             this.NotifyPanel.CheckForceEventNotify.Checked = ForceEventNotify;
             this.NotifyPanel.CheckFavEventUnread.Checked = FavEventUnread;
-            this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex = Bing.GetIndexFromLanguageEnum(TranslateLanguage);
             SoundFileListup();
             this.ConnectionPanel.TwitterAPIText.Text = TwitterApiUrl;
 
-            this.CooperatePanel.UserAppointUrlText.Text = UserAppointUrl;
-            this.CooperatePanel.EnableImgAzyobuziNetCheckBox.Checked = this.EnableImgAzyobuziNet;
-            this.CooperatePanel.ImgAzyobuziNetDisabledInDMCheckBox.Checked = this.ImgAzyobuziNetDisabledInDM;
-            this.CooperatePanel.MapThumbnailProviderComboBox.SelectedIndex = (int)this.MapThumbnailProvider;
-            this.CooperatePanel.MapThumbnailHeightTextBox.Text = this.MapThumbnailHeight.ToString();
-            this.CooperatePanel.MapThumbnailWidthTextBox.Text = this.MapThumbnailWidth.ToString();
-            this.CooperatePanel.MapThumbnailZoomTextBox.Text = this.MapThumbnailZoom.ToString();
             this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked = this.IsRemoveSameEvent;
 
             this.TreeViewSetting.Nodes["BasedNode"].Tag = BasedPanel;
@@ -573,7 +550,6 @@ namespace OpenTween
 
         public string RecommendStatusText { get; set; }
 
-        public bool Nicoms { get; set; }
         public int DefaultTimeOut { get; set; }
         public string TwitterApiUrl { get; set; }
 
@@ -606,21 +582,7 @@ namespace OpenTween
         public bool ForceEventNotify { get; set; }
         public bool FavEventUnread { get; set; }
 
-        public string TranslateLanguage
-        {
-            get
-            {
-                return _MyTranslateLanguage;
-            }
-            set
-            {
-                _MyTranslateLanguage = value;
-                this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex = Bing.GetIndexFromLanguageEnum(value);
-            }
-        }
-
         public string EventSoundFile { get; set; }
-        public string UserAppointUrl { get; set; }
 
         private bool StartAuth()
         {
index 3760bd4..f5bc558 100644 (file)
@@ -32,6 +32,7 @@ using System.Data;
 using System.Linq;
 using System.Text;
 using System.Windows.Forms;
+using OpenTween.Thumbnail;
 
 namespace OpenTween.Setting.Panel
 {
@@ -42,6 +43,32 @@ namespace OpenTween.Setting.Panel
             InitializeComponent();
         }
 
+        public void LoadConfig(SettingCommon settingCommon)
+        {
+            this.CheckNicoms.Checked = settingCommon.Nicoms;
+            this.ComboBoxTranslateLanguage.SelectedIndex = Bing.GetIndexFromLanguageEnum(settingCommon.TranslateLanguage);
+            this.UserAppointUrlText.Text = settingCommon.UserAppointUrl;
+            this.EnableImgAzyobuziNetCheckBox.Checked = settingCommon.EnableImgAzyobuziNet;
+            this.ImgAzyobuziNetDisabledInDMCheckBox.Checked = settingCommon.ImgAzyobuziNetDisabledInDM;
+            this.MapThumbnailProviderComboBox.SelectedIndex = (int)settingCommon.MapThumbnailProvider;
+            this.MapThumbnailHeightTextBox.Text = settingCommon.MapThumbnailHeight.ToString();
+            this.MapThumbnailWidthTextBox.Text = settingCommon.MapThumbnailWidth.ToString();
+            this.MapThumbnailZoomTextBox.Text = settingCommon.MapThumbnailZoom.ToString();
+        }
+
+        public void SaveConfig(SettingCommon settingCommon)
+        {
+            settingCommon.Nicoms = this.CheckNicoms.Checked;
+            settingCommon.TranslateLanguage = Bing.GetLanguageEnumFromIndex(this.ComboBoxTranslateLanguage.SelectedIndex);
+            settingCommon.UserAppointUrl = this.UserAppointUrlText.Text;
+            settingCommon.EnableImgAzyobuziNet = this.EnableImgAzyobuziNetCheckBox.Checked;
+            settingCommon.ImgAzyobuziNetDisabledInDM = this.ImgAzyobuziNetDisabledInDMCheckBox.Checked;
+            settingCommon.MapThumbnailProvider = (MapProvider)this.MapThumbnailProviderComboBox.SelectedIndex;
+            settingCommon.MapThumbnailHeight = int.Parse(this.MapThumbnailHeightTextBox.Text);
+            settingCommon.MapThumbnailWidth = int.Parse(this.MapThumbnailWidthTextBox.Text);
+            settingCommon.MapThumbnailZoom = int.Parse(this.MapThumbnailZoomTextBox.Text);
+        }
+
         private void UserAppointUrlText_Validating(object sender, CancelEventArgs e)
         {
             if (!UserAppointUrlText.Text.StartsWith("http") && !string.IsNullOrEmpty(UserAppointUrlText.Text))
index a5d23d0..e8c869b 100644 (file)
@@ -61,7 +61,7 @@ namespace OpenTween.Thumbnail
         {
             Type classType;
 
-            MapProvider confValue = AppendSettingDialog.Instance.MapThumbnailProvider;
+            MapProvider confValue = SettingCommon.Instance.MapThumbnailProvider;
             switch (confValue)
             {
                 case MapProvider.OpenStreetMap:
index 78d24e8..cf84c20 100644 (file)
@@ -30,9 +30,9 @@ namespace OpenTween.Thumbnail
     {
         public override string CreateStaticMapUrl(double latitude, double longitude)
         {
-            var width = AppendSettingDialog.Instance.MapThumbnailWidth; // この辺なんとかならんかなあ
-            var height = AppendSettingDialog.Instance.MapThumbnailHeight;
-            var zoom = AppendSettingDialog.Instance.MapThumbnailZoom;
+            var width = SettingCommon.Instance.MapThumbnailWidth; // この辺なんとかならんかなあ
+            var height = SettingCommon.Instance.MapThumbnailHeight;
+            var zoom = SettingCommon.Instance.MapThumbnailZoom;
             var location = latitude.ToString() + "," + longitude.ToString();
 
             var baseUrl = "https://maps.googleapis.com/maps/api/staticmap";
@@ -42,7 +42,7 @@ namespace OpenTween.Thumbnail
 
         public override string CreateMapLinkUrl(double latitude, double longitude)
         {
-            var zoom = AppendSettingDialog.Instance.MapThumbnailZoom;
+            var zoom = SettingCommon.Instance.MapThumbnailZoom;
             var location = latitude.ToString() + "," + longitude.ToString();
 
             var baseUrl = "https://maps.google.co.jp/maps";
index 762d7c6..3803fe4 100644 (file)
@@ -30,9 +30,9 @@ namespace OpenTween.Thumbnail
     {
         public override string CreateStaticMapUrl(double latitude, double longitude)
         {
-            var width = AppendSettingDialog.Instance.MapThumbnailWidth;
-            var height = AppendSettingDialog.Instance.MapThumbnailHeight;
-            var zoom = AppendSettingDialog.Instance.MapThumbnailZoom;
+            var width = SettingCommon.Instance.MapThumbnailWidth;
+            var height = SettingCommon.Instance.MapThumbnailHeight;
+            var zoom = SettingCommon.Instance.MapThumbnailZoom;
             var location = latitude.ToString() + "," + longitude.ToString();
 
             return "http://ojw.dev.openstreetmap.org/StaticMap/?show=1&att=none&center=" + location + "&size=" + width + "x" + height + "&zoom=" + zoom + "&mlat0=" + latitude.ToString() + "&mlon0=" + longitude.ToString() + "&mico0=18479";
@@ -40,7 +40,7 @@ namespace OpenTween.Thumbnail
 
         public override string CreateMapLinkUrl(double latitude, double longitude)
         {
-            var zoom = AppendSettingDialog.Instance.MapThumbnailZoom;
+            var zoom = SettingCommon.Instance.MapThumbnailZoom;
 
             return "http://www.openstreetmap.org/index.html?lat=" + latitude.ToString() + "&lon=" + longitude.ToString() + "&zoom=" + zoom + "&mlat=" + latitude.ToString() + "&mlon=" + longitude.ToString();
         }
index 65b82e5..e544f56 100644 (file)
@@ -781,7 +781,6 @@ namespace OpenTween
             SettingDialog.IsMyEventNotifyFlag = _cfgCommon.IsMyEventNotifyFlag;
             SettingDialog.ForceEventNotify = _cfgCommon.ForceEventNotify;
             SettingDialog.FavEventUnread = _cfgCommon.FavEventUnread;
-            SettingDialog.TranslateLanguage = _cfgCommon.TranslateLanguage;
             SettingDialog.EventSoundFile = _cfgCommon.EventSoundFile;
 
             //廃止サービスが選択されていた場合bit.lyへ読み替え
@@ -796,16 +795,6 @@ namespace OpenTween
             //Regex statregex = new Regex("^0*");
             SettingDialog.RecommendStatusText = " [TWNv" + Regex.Replace(MyCommon.FileVersion.Replace(".", ""), "^0*", "") + "]";
 
-            SettingDialog.Nicoms = _cfgCommon.Nicoms;
-
-            SettingDialog.UserAppointUrl = _cfgCommon.UserAppointUrl;
-
-            SettingDialog.EnableImgAzyobuziNet = _cfgCommon.EnableImgAzyobuziNet;
-            SettingDialog.ImgAzyobuziNetDisabledInDM = _cfgCommon.ImgAzyobuziNetDisabledInDM;
-            SettingDialog.MapThumbnailProvider = _cfgCommon.MapThumbnailProvider;
-            SettingDialog.MapThumbnailHeight = _cfgCommon.MapThumbnailHeight;
-            SettingDialog.MapThumbnailWidth = _cfgCommon.MapThumbnailWidth;
-            SettingDialog.MapThumbnailZoom = _cfgCommon.MapThumbnailZoom;
             SettingDialog.IsRemoveSameEvent = _cfgCommon.IsRemoveSameEvent;
 
             //ハッシュタグ関連
@@ -2043,7 +2032,7 @@ namespace OpenTween
 
             _history[_history.Count - 1] = new PostingStatus(StatusText.Text, _reply_to_id, _reply_to_name);
 
-            if (SettingDialog.Nicoms)
+            if (this._cfgCommon.Nicoms)
             {
                 StatusText.SelectionStart = StatusText.Text.Length;
                 await UrlConvertAsync(MyCommon.UrlConverter.Nicoms);
@@ -3880,8 +3869,8 @@ namespace OpenTween
                     SplitContainer1.IsPanelInverted = !this._cfgCommon.StatusAreaAtBottom;
 
                     var imgazyobizinet = ThumbnailGenerator.ImgAzyobuziNetInstance;
-                    imgazyobizinet.Enabled = this.SettingDialog.EnableImgAzyobuziNet;
-                    imgazyobizinet.DisabledInDM = this.SettingDialog.ImgAzyobuziNetDisabledInDM;
+                    imgazyobizinet.Enabled = this._cfgCommon.EnableImgAzyobuziNet;
+                    imgazyobizinet.DisabledInDM = this._cfgCommon.ImgAzyobuziNetDisabledInDM;
 
                     this.PlaySoundMenuItem.Checked = this._cfgCommon.PlaySound;
                     this.PlaySoundFileMenuItem.Checked = this._cfgCommon.PlaySound;
@@ -7660,7 +7649,6 @@ namespace OpenTween
                 _cfgCommon.IsMyEventNotifyFlag = SettingDialog.IsMyEventNotifyFlag;
                 _cfgCommon.ForceEventNotify = SettingDialog.ForceEventNotify;
                 _cfgCommon.FavEventUnread = SettingDialog.FavEventUnread;
-                _cfgCommon.TranslateLanguage = SettingDialog.TranslateLanguage;
                 _cfgCommon.EventSoundFile = SettingDialog.EventSoundFile;
                 if (IdeographicSpaceToSpaceToolStripMenuItem != null &&
                    IdeographicSpaceToSpaceToolStripMenuItem.IsDisposed == false)
@@ -7688,7 +7676,6 @@ namespace OpenTween
                         break;
                 }
 
-                _cfgCommon.Nicoms = SettingDialog.Nicoms;
                 _cfgCommon.HashTags = HashMgr.HashHistories;
                 if (HashMgr.IsPermanent)
                 {
@@ -7711,13 +7698,6 @@ namespace OpenTween
                 _cfgCommon.AllAtReply = tw.AllAtReply;
                 _cfgCommon.UseImageService = ImageSelector.ServiceIndex;
                 _cfgCommon.UseImageServiceName = ImageSelector.ServiceName;
-                _cfgCommon.UserAppointUrl = SettingDialog.UserAppointUrl;
-                _cfgCommon.EnableImgAzyobuziNet = SettingDialog.EnableImgAzyobuziNet;
-                _cfgCommon.ImgAzyobuziNetDisabledInDM = SettingDialog.ImgAzyobuziNetDisabledInDM;
-                _cfgCommon.MapThumbnailProvider = SettingDialog.MapThumbnailProvider;
-                _cfgCommon.MapThumbnailHeight = SettingDialog.MapThumbnailHeight;
-                _cfgCommon.MapThumbnailWidth = SettingDialog.MapThumbnailWidth;
-                _cfgCommon.MapThumbnailZoom = SettingDialog.MapThumbnailZoom;
                 _cfgCommon.IsRemoveSameEvent = SettingDialog.IsRemoveSameEvent;
 
                 _cfgCommon.Save();
@@ -9728,7 +9708,7 @@ namespace OpenTween
                     // 文字列が選択されている場合はその文字列について処理
 
                     //nico.ms使用、nicovideoにマッチしたら変換
-                    if (SettingDialog.Nicoms && Regex.IsMatch(tmp, nico))
+                    if (this._cfgCommon.Nicoms && Regex.IsMatch(tmp, nico))
                     {
                         result = nicoms.Shorten(tmp);
                     }
@@ -9797,7 +9777,7 @@ namespace OpenTween
                     StatusText.Select(StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal), mt.Result("${url}").Length);
 
                     //nico.ms使用、nicovideoにマッチしたら変換
-                    if (SettingDialog.Nicoms && Regex.IsMatch(tmp, nico))
+                    if (this._cfgCommon.Nicoms && Regex.IsMatch(tmp, nico))
                     {
                         result = nicoms.Shorten(tmp);
                     }
@@ -12793,7 +12773,7 @@ namespace OpenTween
             {
                 var translatedText = await bing.TranslateAsync(str,
                     langFrom: null,
-                    langTo: this.SettingDialog.TranslateLanguage);
+                    langTo: this._cfgCommon.TranslateLanguage);
 
                 this.PostBrowser.DocumentText = this.createDetailHtml(translatedText);
             }
@@ -12905,13 +12885,13 @@ namespace OpenTween
 
         private void OpenUserAppointUrl()
         {
-            if (SettingDialog.UserAppointUrl != null)
+            if (this._cfgCommon.UserAppointUrl != null)
             {
-                if (SettingDialog.UserAppointUrl.Contains("{ID}") || SettingDialog.UserAppointUrl.Contains("{STATUS}"))
+                if (this._cfgCommon.UserAppointUrl.Contains("{ID}") || this._cfgCommon.UserAppointUrl.Contains("{STATUS}"))
                 {
                     if (_curPost != null)
                     {
-                        string xUrl = SettingDialog.UserAppointUrl;
+                        string xUrl = this._cfgCommon.UserAppointUrl;
                         xUrl = xUrl.Replace("{ID}", _curPost.ScreenName);
                         if (_curPost.RetweetedId != null)
                         {
@@ -12926,7 +12906,7 @@ namespace OpenTween
                 }
                 else
                 {
-                    OpenUriAsync(SettingDialog.UserAppointUrl);
+                    OpenUriAsync(this._cfgCommon.UserAppointUrl);
                 }
             }
         }