| 1 |
unit ProgramInfoTabDlg; |
| 2 |
|
| 3 |
interface |
| 4 |
|
| 5 |
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, |
| 6 |
Buttons, ComCtrls, ExtCtrls, |
| 7 |
ShellAPI, |
| 8 |
RegularExpressions,Dialogs; |
| 9 |
|
| 10 |
type |
| 11 |
TProgramInfoDlg = class(TForm) |
| 12 |
Panel1: TPanel; |
| 13 |
Panel2: TPanel; |
| 14 |
PageControl1: TPageControl; |
| 15 |
LiveTabSheet: TTabSheet; |
| 16 |
CommunityTabSheet: TTabSheet; |
| 17 |
UserTabSheet: TTabSheet; |
| 18 |
OKBtn: TButton; |
| 19 |
LiveOwnerLabel: TLabel; |
| 20 |
LiveGBox: TGroupBox; |
| 21 |
Memo1: TMemo; |
| 22 |
InfoLabel: TLabel; |
| 23 |
LiveAudienceLabel: TLabel; |
| 24 |
LiveCommentLabel: TLabel; |
| 25 |
LiveStartTimeLabel: TLabel; |
| 26 |
LiveOpenTimeLabel: TLabel; |
| 27 |
UserNameLabel: TLabel; |
| 28 |
UserIDLabel: TLabel; |
| 29 |
UserSexLabel: TLabel; |
| 30 |
UserBirthdayLabel: TLabel; |
| 31 |
CommunityAudienceLabel: TLabel; |
| 32 |
CommunityStatusLabel: TLabel; |
| 33 |
IsCommunityMemberLabel: TLabel; |
| 34 |
CommunityNameLabel: TLabel; |
| 35 |
CommunityLevelLabel: TLabel; |
| 36 |
CommunityOpenDayLabel: TLabel; |
| 37 |
CommunityOwnerNameLabel: TLabel; |
| 38 |
CommunityGBox: TGroupBox; |
| 39 |
UserLocationLabel: TLabel; |
| 40 |
LiveURLLabel: TLinkLabel; |
| 41 |
UserGBox: TGroupBox; |
| 42 |
UserStampLabel: TLabel; |
| 43 |
UserNicorareLabel: TLabel; |
| 44 |
UserFavLabel: TLabel; |
| 45 |
CommunityMemberLabel: TLabel; |
| 46 |
CommunityMemo: TMemo; |
| 47 |
UserMemo: TMemo; |
| 48 |
LiveTitleLE: TLabeledEdit; |
| 49 |
LiveTagsLE: TLabeledEdit; |
| 50 |
CommunityTagsLE: TLabeledEdit; |
| 51 |
REGButton: TButton; |
| 52 |
CommunityIDLabel: TLinkLabel; |
| 53 |
UserIsDeadLabel: TLabel; |
| 54 |
procedure LiveURLLabelLinkClick(Sender: TObject; const Link: string; |
| 55 |
LinkType: TSysLinkType); |
| 56 |
procedure OKBtnClick(Sender: TObject); |
| 57 |
procedure FormCreate(Sender: TObject); |
| 58 |
procedure FormActivate(Sender: TObject); |
| 59 |
procedure REGButtonClick(Sender: TObject); |
| 60 |
procedure ReSetting(Sender: TObject); |
| 61 |
procedure SettingChannelTab(Sender: TObject); |
| 62 |
procedure SetLiveURL(URL: string); |
| 63 |
function SetCommunityIdURL(coNum: string): string; |
| 64 |
procedure CommunityIDLabelLinkClick(Sender: TObject; |
| 65 |
const Link: string; LinkType: TSysLinkType); |
| 66 |
procedure FormKeyUp(Sender: TObject; var Key: Word; |
| 67 |
Shift: TShiftState); |
| 68 |
|
| 69 |
private |
| 70 |
{ Private 宣言 } |
| 71 |
public |
| 72 |
{ Public 宣言 } |
| 73 |
end; |
| 74 |
|
| 75 |
var |
| 76 |
ProgramInfoDlg: TProgramInfoDlg; |
| 77 |
|
| 78 |
implementation |
| 79 |
|
| 80 |
uses NicoVitanD_pas; |
| 81 |
|
| 82 |
{$R *.dfm} |
| 83 |
|
| 84 |
procedure TProgramInfoDlg.CommunityIDLabelLinkClick(Sender: TObject; |
| 85 |
const Link: string; LinkType: TSysLinkType); |
| 86 |
begin |
| 87 |
ShellExecute(Self.Handle,PChar('Open'),PChar(Link),nil,nil,SW_SHOWNORMAL); |
| 88 |
end; |
| 89 |
|
| 90 |
procedure TProgramInfoDlg.FormActivate(Sender: TObject); |
| 91 |
begin |
| 92 |
PageControl1.ActivePageIndex := 0; // 必ずProgramInfoDlgが表示されたときには 番組情報タブ が表示されるようにする |
| 93 |
end; |
| 94 |
|
| 95 |
procedure TProgramInfoDlg.FormCreate(Sender: TObject); |
| 96 |
begin |
| 97 |
ReSetting(Sender); |
| 98 |
KeyPreview := True; |
| 99 |
end; |
| 100 |
|
| 101 |
procedure TProgramInfoDlg.FormKeyUp(Sender: TObject; var Key: Word; |
| 102 |
Shift: TShiftState); |
| 103 |
begin |
| 104 |
if key=VK_ESCAPE then ProgramInfoDlg.Close; |
| 105 |
end; |
| 106 |
|
| 107 |
procedure TProgramInfoDlg.OKBtnClick(Sender: TObject); |
| 108 |
begin |
| 109 |
Close; |
| 110 |
end; |
| 111 |
|
| 112 |
procedure TProgramInfoDlg.REGButtonClick(Sender: TObject); |
| 113 |
//var |
| 114 |
// StartTime:string; |
| 115 |
// tempStr : string; |
| 116 |
begin |
| 117 |
{$IFDEF DEBUG} |
| 118 |
SetLiveURL('lv601217'); |
| 119 |
SetCommunityIdURL('co601217'); |
| 120 |
{$ENDIF} |
| 121 |
end; |
| 122 |
|
| 123 |
procedure TProgramInfoDlg.ReSetting(Sender: TObject); |
| 124 |
begin |
| 125 |
InfoLabel.Visible := False; |
| 126 |
|
| 127 |
// 番組情報 タブ リセット |
| 128 |
LiveTitleLE.Text := ''; |
| 129 |
LiveOwnerLabel.Caption := '放送主名: '; |
| 130 |
LiveAudienceLabel.Caption := '総来場者数: '; |
| 131 |
LiveCommentLabel.Caption := '総コメント数: '; |
| 132 |
LiveOpenTimeLabel.Caption := '放送開場日時: '; |
| 133 |
LiveStartTimeLabel.Caption:= '放送開始日時: '; |
| 134 |
SetLiveURL(''); |
| 135 |
LiveTagsLE.Text := ''; |
| 136 |
Memo1.Clear; |
| 137 |
|
| 138 |
// コミュニティ タブ リセット |
| 139 |
CommunityTabSheet.Caption := 'コミュニティ'; |
| 140 |
CommunityNameLabel.Caption := 'コミュニティ名: '; |
| 141 |
CommunityStatusLabel.Caption := 'コミュニティステータス: '; // クローズ or オープン or 削除 |
| 142 |
CommunityLevelLabel.Caption := 'コミュニティレベル: '; // xxxx () |
| 143 |
CommunityMemberLabel.Caption := 'コミュニティ人数: '; // 00000000 |
| 144 |
CommunityIDLabel.Caption := SetCommunityIdURL(''); |
| 145 |
CommunityOpenDayLabel.Caption := '開設日: '; // YYYY/MM/DD |
| 146 |
CommunityAudienceLabel.Caption := '累計来場者数: '; // 0000000000000000 |
| 147 |
CommunityOwnerNameLabel.Caption := 'オーナー名: '; |
| 148 |
IsCommunityMemberLabel.Caption := 'コミュニティ加入: '; // 参加中 or 未参加 |
| 149 |
CommunityTagsLE.Text := ''; |
| 150 |
CommunityMemo.Clear; |
| 151 |
if CommunityStatusLabel.Enabled = False then |
| 152 |
begin |
| 153 |
CommunityStatusLabel.Enabled := True; |
| 154 |
CommunityLevelLabel.Enabled := True; |
| 155 |
CommunityMemberLabel.Enabled := True; |
| 156 |
CommunityOpenDayLabel.Enabled := True; |
| 157 |
CommunityAudienceLabel.Enabled := True; |
| 158 |
CommunityOwnerNameLabel.Enabled:= True; |
| 159 |
IsCommunityMemberLabel.Enabled := True; |
| 160 |
CommunityGBox.Caption := 'コミュニティプロフィール'; |
| 161 |
|
| 162 |
UserTabSheet.TabVisible := True; |
| 163 |
end; |
| 164 |
|
| 165 |
|
| 166 |
// 放送主タブ リセット |
| 167 |
UserNameLabel.Caption := '放送主名: '; // 名前 or 非公開 |
| 168 |
UserIDLabel.Caption := 'ID番号: '; // 数字 or 非公開 |
| 169 |
UserLocationLabel.Caption := 'お住まいの地域: '; // 基本的に「お住まいの地域: 非公開」 |
| 170 |
UserSexLabel.Caption := '性別: '; // 性別: 非公開 |
| 171 |
UserBirthdayLabel.Caption := '生年月日: '; // 生年月日: YYYY/MM/DD |
| 172 |
UserFavLabel.Caption := 'お気に入り登録された数: '; |
| 173 |
UserStampLabel.Caption := 'スタンプ経験値: '; |
| 174 |
UserNicorareLabel.Caption := 'ニコられた数: '; |
| 175 |
UserIsDeadLabel.Visible := False; // 削除もしくは非公開ユーザー |
| 176 |
UserMemo.Clear; |
| 177 |
|
| 178 |
end; |
| 179 |
|
| 180 |
function TProgramInfoDlg.SetCommunityIdURL(coNum: string): string; |
| 181 |
var |
| 182 |
temp:string; |
| 183 |
begin |
| 184 |
// コミュニティ用 |
| 185 |
if (TRegEx.IsMatch(coNum, 'co\d+')) then |
| 186 |
begin |
| 187 |
temp := 'href="http://com.nicovideo.jp/community/' + coNum + '"'; |
| 188 |
Result := 'コミュニティID: <a ' + temp + ' title="視聴中のコミュニティをブラウザで開く">'+ coNum +'</a>'; |
| 189 |
Exit; |
| 190 |
end; |
| 191 |
|
| 192 |
// チャンネル用 |
| 193 |
if (TRegEx.IsMatch(coNum, 'ch\d+')) then |
| 194 |
begin |
| 195 |
SettingChannelTab(Self); |
| 196 |
temp := 'href="http://ch.nicovideo.jp/channel/' + coNum + '"'; |
| 197 |
Result := 'チャンネルID: <a ' + temp + ' title="視聴中のチャンネルをブラウザで開く">'+ coNum +'</a>'; |
| 198 |
Exit; |
| 199 |
end; |
| 200 |
|
| 201 |
// リセット用の処理 |
| 202 |
if coNum = '' then |
| 203 |
begin |
| 204 |
Result := 'コミュニティID: <a href="http://com.nicovideo.jp/" title="ニコニコミュニティのトップページを開く" target="_blank">ニコニコミュニティのトップを開く</a>' |
| 205 |
end |
| 206 |
else |
| 207 |
begin // co/ch番号以外の処理 |
| 208 |
Result := 'コミュニティID: <a href="http://com.nicovideo.jp/" title="ニコニコミュニティのトップページを開く" target="_blank">ニコニコミュニティのトップを開く</a>' |
| 209 |
end; |
| 210 |
|
| 211 |
end; |
| 212 |
|
| 213 |
|
| 214 |
procedure TProgramInfoDlg.SetLiveURL(URL: string); |
| 215 |
var |
| 216 |
temp:string; |
| 217 |
begin |
| 218 |
if TRegEx.IsMatch(URL, 'lv\d+|co\d+') then // 加減演算(or)を使わずにIsMatch 1回だけに出来た。 |
| 219 |
begin |
| 220 |
temp := 'href="http://live.nicovideo.jp/watch/' + URL + '"'; |
| 221 |
LiveURLLabel.Caption := '放送アドレス: <a ' + temp + ' title="視聴中の放送をブラウザで開く">'+ URL +'</a>' |
| 222 |
end |
| 223 |
else |
| 224 |
begin // リセット用の処理 |
| 225 |
LiveURLLabel.Caption := '放送アドレス: <a href="http://live.nicovideo.jp/" title="ニコニコ生放送のトップページを開く">ニコニコ生放送のトップページを開く</a>' |
| 226 |
end; |
| 227 |
end; |
| 228 |
|
| 229 |
procedure TProgramInfoDlg.SettingChannelTab(Sender: TObject); // チャンネル タブ セット |
| 230 |
begin |
| 231 |
CommunityTabSheet.Caption := 'チャンネル'; |
| 232 |
CommunityNameLabel.Caption := 'チャンネル名: '; |
| 233 |
CommunityStatusLabel.Enabled := False; |
| 234 |
CommunityLevelLabel.Enabled := False; // xxxx () |
| 235 |
CommunityMemberLabel.Enabled := False; // 00000000 |
| 236 |
CommunityOpenDayLabel.Enabled := False; // YYYY/MM/DD |
| 237 |
CommunityAudienceLabel.Enabled := False; // 0000000000000000 |
| 238 |
CommunityOwnerNameLabel.Enabled := False; |
| 239 |
IsCommunityMemberLabel.Enabled := False; // 参加中 or 未参加 |
| 240 |
CommunityGBox.Caption := 'チャンネルプロフィール'; |
| 241 |
CommunityTagsLE.Text := ''; |
| 242 |
CommunityMemo.Clear; |
| 243 |
|
| 244 |
UserTabSheet.TabVisible := False; |
| 245 |
end; |
| 246 |
|
| 247 |
procedure TProgramInfoDlg.LiveURLLabelLinkClick(Sender: TObject; |
| 248 |
const Link: string; LinkType: TSysLinkType); |
| 249 |
begin |
| 250 |
ShellExecute(Self.Handle,PChar('Open'),PChar(Link),nil,nil,SW_SHOWNORMAL); |
| 251 |
end; |
| 252 |
|
| 253 |
end. |