svnno****@sourc*****
svnno****@sourc*****
2010年 12月 31日 (金) 08:13:42 JST
Revision: 1285 http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1285 Author: anis774 Date: 2010-12-31 08:13:42 +0900 (Fri, 31 Dec 2010) Log Message: ----------- ユーザータイムラインタブ、リストタブの上部にタブが表示している内容をラベルで表示するように変更 Todo:ユーザーTLタブで"前データを取得"が動作しない Modified Paths: -------------- trunk/Tween/StatusDictionary.vb trunk/Tween/Tween.vb trunk/Tween/Twitter.vb -------------- next part -------------- Modified: trunk/Tween/StatusDictionary.vb =================================================================== --- trunk/Tween/StatusDictionary.vb 2010-12-30 13:02:33 UTC (rev 1284) +++ trunk/Tween/StatusDictionary.vb 2010-12-30 23:13:42 UTC (rev 1285) @@ -1568,11 +1568,12 @@ Private ReadOnly _lockObj As New Object + Public Property User As String + #Region "検索" 'Search query Private _searchLang As String = "" Private _searchWords As String = "" - Private _UseSearch As Integer = 0 Public Property SearchLang() As String Get @@ -1592,14 +1593,6 @@ _searchWords = value.Trim End Set End Property - Public Property UseSearch As Integer - Get - Return _UseSearch - End Get - Set(ByVal value As Integer) - _UseSearch = value - End Set - End Property Public Function GetSearchPage(ByVal count As Integer) As Integer Return ((_ids.Count \ count) + 1) End Function @@ -1980,6 +1973,7 @@ If _tabType = TabUsageType.PublicSearch OrElse _tabType = TabUsageType.DirectMessage OrElse _tabType = TabUsageType.Lists OrElse + _tabType = TabUsageType.UserTimeline OrElse _tabType = TabUsageType.Related Then Return True Else Modified: trunk/Tween/Tween.vb =================================================================== --- trunk/Tween/Tween.vb 2010-12-30 13:02:33 UTC (rev 1284) +++ trunk/Tween/Tween.vb 2010-12-30 23:13:42 UTC (rev 1285) @@ -2052,7 +2052,7 @@ bw.ReportProgress(50, MakeStatusMessage(args, False)) If args.tName = "" Then For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.PublicSearch) - If tb.SearchWords <> "" AndAlso tb.UseSearch = 0 Then ret = tw.GetSearch(read, tb, False) + If tb.SearchWords <> "" Then ret = tw.GetSearch(read, tb, False) Next Else Dim tb As TabClass = _statuses.GetTabByName(args.tName) @@ -2070,16 +2070,13 @@ Dim count As Integer = 20 If SettingDialog.UseAdditionalCount Then count = SettingDialog.UserTimelineCountApi If args.tName = "" Then - For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.PublicSearch) - If tb.SearchWords <> "" AndAlso tb.UseSearch = 1 Then ret = tw.GetUserTimelineApi(read, count, tb.SearchWords, tb, False) + For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.UserTimeline) + If tb.User <> "" Then ret = tw.GetUserTimelineApi(read, count, tb.User, tb, False) Next Else Dim tb As TabClass = _statuses.GetTabByName(args.tName) If tb IsNot Nothing Then - ret = tw.GetUserTimelineApi(read, count, tb.SearchWords, tb, False) - If ret = "" AndAlso args.page = -1 Then - ret = tw.GetUserTimelineApi(read, count, tb.SearchWords, tb, True) - End If + ret = tw.GetUserTimelineApi(read, count, tb.User, tb, args.page = -1) End If End If '振り分け @@ -2938,11 +2935,9 @@ '' TODO Dim tb As TabClass = _statuses.Tabs(_curTab.Text) If tb.SearchWords = "" Then Exit Sub - If tb.UseSearch = 0 Then - GetTimeline(WORKERTYPE.PublicSearch, 1, 0, _curTab.Text) - ElseIf tb.UseSearch = 1 Then - GetTimeline(WORKERTYPE.UserTimeline, 1, 0, _curTab.Text) - End If + GetTimeline(WORKERTYPE.PublicSearch, 1, 0, _curTab.Text) + Case TabUsageType.UserTimeline + GetTimeline(WORKERTYPE.UserTimeline, 1, 0, _curTab.Text) Case TabUsageType.Lists '' TODO Dim tb As TabClass = _statuses.Tabs(_curTab.Text) @@ -2972,11 +2967,9 @@ ' TODO Dim tb As TabClass = _statuses.Tabs(_curTab.Text) If tb.SearchWords = "" Then Exit Sub - If tb.UseSearch = 0 Then - GetTimeline(WORKERTYPE.PublicSearch, -1, 0, _curTab.Text) - ElseIf tb.UseSearch = 1 Then - GetTimeline(WORKERTYPE.UserTimeline, -1, 0, _curTab.Text) - End If + GetTimeline(WORKERTYPE.PublicSearch, -1, 0, _curTab.Text) + Case TabUsageType.UserTimeline + GetTimeline(WORKERTYPE.UserTimeline, -1, 0, _curTab.Text) Case TabUsageType.Lists '' TODO Dim tb As TabClass = _statuses.Tabs(_curTab.Text) @@ -3287,10 +3280,10 @@ Me.SearchButton_Click(ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch"), Nothing) End Sub - Public Sub AddNewTabForUserTimeline(ByVal searchWord As String) + Public Sub AddNewTabForUserTimeline(ByVal user As String) '同一検索条件のタブが既に存在すれば、そのタブアクティブにして終了 - For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.PublicSearch) - If tb.SearchWords = searchWord AndAlso tb.SearchLang = "" Then + For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.UserTimeline) + If tb.User = user Then For Each tp As TabPage In ListTab.TabPages If tb.TabName = tp.Text Then ListTab.SelectedTab = tp @@ -3300,28 +3293,20 @@ End If Next 'ユニークなタブ名生成 - Dim tabName As String = "user:" + searchWord - For i As Integer = 0 To 100 - If _statuses.ContainsTab(tabName) Then - tabName += "_" - Else - Exit For - End If - Next + Dim tabName As String = "user:" + user + While _statuses.ContainsTab(tabName) + tabName += "_" + End While 'タブ追加 - AddNewTab(tabName, False, TabUsageType.PublicSearch) - _statuses.AddTab(tabName, TabUsageType.PublicSearch, Nothing) + _statuses.AddTab(tabName, TabUsageType.UserTimeline, Nothing) + _statuses.Tabs(tabName).User = user + AddNewTab(tabName, False, TabUsageType.UserTimeline) '追加したタブをアクティブに ListTab.SelectedIndex = ListTab.TabPages.Count - 1 - '検索条件の設定 - Dim cmb As ComboBox = DirectCast(ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch"), ComboBox) - cmb.Items.Add(searchWord) - cmb.Text = searchWord - Dim cmbus As ComboBox = DirectCast(ListTab.SelectedTab.Controls("panelSearch").Controls("comboUserLine"), ComboBox) - cmbus.Text = "User" SaveConfigsTabs() '検索実行 - Me.SearchButton_Click(ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch"), Nothing) + + GetTimeline(WORKERTYPE.UserTimeline, 1, 0, tabName) End Sub Public Function AddNewTab(ByVal tabName As String, ByVal startup As Boolean, ByVal tabType As TabUsageType) As Boolean @@ -3367,8 +3352,24 @@ _tabPage.SuspendLayout() + ''' UserTimeline関連 + Dim label As Label = Nothing + If tabType = TabUsageType.UserTimeline OrElse tabType = TabUsageType.Lists Then + label = New Label() + label.Dock = DockStyle.Top + label.Name = "labelUser" + If tabType = TabUsageType.Lists Then + label.Text = _statuses.Tabs(tabName).ListInfo.ToString() + Else + label.Text = _statuses.Tabs(tabName).User + "'s Timeline" + End If + label.TextAlign = ContentAlignment.MiddleLeft + Using tmpComboBox As New ComboBox() + label.Height = tmpComboBox.Height + End Using + _tabPage.Controls.Add(label) + End If - ''' 検索関連の準備 Dim pnl As Panel = Nothing If tabType = TabUsageType.PublicSearch Then @@ -3378,13 +3379,11 @@ Dim cmb As New ComboBox Dim btn As New Button Dim cmbLang As New ComboBox - Dim cmbushome As New ComboBox pnl.SuspendLayout() pnl.Controls.Add(cmb) pnl.Controls.Add(cmbLang) - pnl.Controls.Add(cmbushome) pnl.Controls.Add(btn) pnl.Controls.Add(lbl) pnl.Name = "panelSearch" @@ -3407,21 +3406,6 @@ cmb.Text = _statuses.Tabs(tabName).SearchWords End If - cmbushome.Text = "Search" - cmbushome.Anchor = AnchorStyles.Left Or AnchorStyles.Right - cmbushome.Dock = DockStyle.Right - cmbushome.Width = 50 - cmbushome.Name = "comboUserLine" - cmbushome.DropDownStyle = ComboBoxStyle.DropDownList - cmbushome.TabStop = False - cmbushome.Items.Add("Search") - cmbushome.Items.Add("User") - If _statuses.ContainsTab(tabName) Then - Dim SearchText As String = "Search" - If _statuses.Tabs(tabName).UseSearch = 1 Then SearchText = "User" - cmbushome.Text = SearchText - End If - cmbLang.Text = "" cmbLang.Anchor = AnchorStyles.Left Or AnchorStyles.Right cmbLang.Dock = DockStyle.Right @@ -3464,13 +3448,13 @@ btn.Dock = DockStyle.Right btn.TabStop = False AddHandler btn.Click, AddressOf SearchButton_Click - End If Me.ListTab.Controls.Add(_tabPage) _tabPage.Controls.Add(_listCustom) If tabType = TabUsageType.PublicSearch Then _tabPage.Controls.Add(pnl) + If tabType = TabUsageType.UserTimeline OrElse tabType = TabUsageType.Lists Then _tabPage.Controls.Add(label) _tabPage.Location = New Point(4, 4) _tabPage.Name = "CTab" + cnt.ToString() @@ -9185,11 +9169,6 @@ tb.SearchWords = cmb.Text tb.SearchLang = cmbLang.Text - If cmbusline.Text = "User" Then - tb.UseSearch = 1 - Else - tb.UseSearch = 0 - End If If cmb.Text = "" Then DirectCast(ListTab.SelectedTab.Tag, DetailsListView).Focus() SaveConfigsTabs() @@ -9208,11 +9187,7 @@ SaveConfigsTabs() '検索条件の保存 End If - If tb.UseSearch = 0 Then - GetTimeline(WORKERTYPE.PublicSearch, 1, 0, tbName) - ElseIf tb.UseSearch = 1 Then - GetTimeline(WORKERTYPE.UserTimeline, 1, 0, tbName) - End If + GetTimeline(WORKERTYPE.PublicSearch, 1, 0, tbName) DirectCast(ListTab.SelectedTab.Tag, DetailsListView).Focus() End Sub @@ -10315,4 +10290,8 @@ Return True End Get End Property + + Protected Overrides Sub Finalize() + MyBase.Finalize() + End Sub End Class Modified: trunk/Tween/Twitter.vb =================================================================== --- trunk/Tween/Twitter.vb 2010-12-30 13:02:33 UTC (rev 1284) +++ trunk/Tween/Twitter.vb 2010-12-30 23:13:42 UTC (rev 1285) @@ -1331,9 +1331,9 @@ If count = 0 Then count = 20 Try If String.IsNullOrEmpty(userName) Then - Dim target As PostClass = tab.RelationTargetPost + Dim target As String = tab.User If target Is Nothing Then Return "" - res = twCon.UserTimeline(target.Uid, "", count, 0, 0, content) + res = twCon.UserTimeline(0, target, count, 0, 0, content) Else If more Then res = twCon.UserTimeline(0, userName, count, tab.OldestId, 0, content)