From 9742f7f43aa70c5ddd9ea71019cf0b2ef893542d Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Mon, 28 Jul 2014 01:33:06 +0900 Subject: [PATCH] =?utf8?q?ShortUrlPanel=E3=81=AB=E5=AF=BE=E3=81=99?= =?utf8?q?=E3=82=8B=E8=A8=AD=E5=AE=9A=E5=80=A4=E3=81=AE=E8=A8=AD=E5=AE=9A?= =?utf8?q?=E3=83=BB=E5=8F=96=E5=BE=97=E3=82=92=20LoadConfing/SaveConfig=20?= =?utf8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=AB=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- OpenTween/AppendSettingDialog.cs | 25 ++--------------------- OpenTween/Setting/Panel/ShortUrlPanel.cs | 27 ++++++++++++++++++++++++ OpenTween/Tween.cs | 35 ++++++++++---------------------- 3 files changed, 40 insertions(+), 47 deletions(-) diff --git a/OpenTween/AppendSettingDialog.cs b/OpenTween/AppendSettingDialog.cs index b19a5393..f549c7a2 100644 --- a/OpenTween/AppendSettingDialog.cs +++ b/OpenTween/AppendSettingDialog.cs @@ -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; } diff --git a/OpenTween/Setting/Panel/ShortUrlPanel.cs b/OpenTween/Setting/Panel/ShortUrlPanel.cs index a3502ecc..564bdfd4 100644 --- a/OpenTween/Setting/Panel/ShortUrlPanel.cs +++ b/OpenTween/Setting/Panel/ShortUrlPanel.cs @@ -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 || diff --git a/OpenTween/Tween.cs b/OpenTween/Tween.cs index dd948629..92e39a5a 100644 --- a/OpenTween/Tween.cs +++ b/OpenTween/Tween.cs @@ -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) -- 2.11.0