• R/O
  • HTTP
  • SSH
  • HTTPS

TinyBannavi: Commit

タイニー番組ナビゲータ本体


Commit MetaInfo

Revisiónea256dbd43b81b2397a042fb55ce19b8c1955e28 (tree)
Tiempo2014-02-01 03:03:13
Autorpeeweedee <peeweedee@user...>
Commiterpeeweedee

Log Message

リスト形式の裏番組マークの問題修正(再コミット)

Cambiar Resumen

Diferencia incremental

--- a/TinyBannavi/src/tainavi/AbsListedView.java
+++ b/TinyBannavi/src/tainavi/AbsListedView.java
@@ -323,7 +323,6 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener
323323
324324 private class Marker {
325325 RsvMark rsvmark = null;
326- RsvMark uramark = null;
327326 RsvMark pickmark = null;
328327 String myself = null;
329328 String color = null;
@@ -335,7 +334,7 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener
335334 }
336335
337336 private static final String PICKUP_COLOR = CommonUtils.color2str(Color.BLACK);
338- private static final String URABAN_COLOR = CommonUtils.color2str(Color.BLACK);
337+ private static final String URABAN_COLOR = "#666666";
339338 private static final String DUPMARK_COLOR = "#FFB6C1";
340339
341340 private static final String TreeExpRegFile_Listed = "env"+File.separator+"tree_expand_listed.xml";
@@ -2423,108 +2422,155 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener
24232422 */
24242423 private Marker getReservedMarkChar(ListedItem data) {
24252424
2426- //
2427- HDDRecorder recorder = null; // その番組の予約がみつかった最初のレコーダ
2428- ReserveList reserve = null; // 見つかった予約情報
2429- String start = null; // 実行予定が複数あったら一番近いのを選ぶ
2430- String end = ""; // 同上
2431- long diff = 86400L*30L;
2432-
2433- String myself = getSelectedRecorderOnToolbar();
2434- HDDRecorderList recs = recorders.findInstance(myself);
2435-
24362425 // コンボボックスの指定はピックアップである
2426+ String myself = getSelectedRecorderOnToolbar();
24372427 boolean isPickupOnly = ( myself == HDDRecorder.SELECTED_PICKUP ) ;
2438-
2428+
2429+ Marker mark = new Marker("", "");
2430+ boolean marked = false;
2431+
24392432 if ( ! isPickupOnly ) {
2440-
24412433 // 「ピックアップ」が選択されていればここは通らない
2442-
2443- // 基準日時
2444- String critDateTime = CommonUtils.getCritDateTime(env.getDisplayPassedReserve());
2445-
2446- // 全予約をなめて、一番近い予約を探さなければならない
2447- for ( HDDRecorder rec : recs )
2448- {
2449- if (diff == 0) break;
2450-
2451- for ( ReserveList res : rec.getReserves() )
2452- {
2453- if (diff == 0) break;
2454-
2455- // Exec == ON ?
2456- if ( env.getDisplayOnlyExecOnEntry() && ! res.getExec()) {
2434+
2435+ // 表示対象のレコーダを絞る
2436+ HDDRecorderList s_recorders = recorders.findInstance(myself);
2437+
2438+ // 近傍の予約を探す
2439+ ArrayList<NeighborReserveList> n_reserves = findOverlapReserves(s_recorders, data);
2440+
2441+ for ( NeighborReserveList n_res : n_reserves ) {
2442+ if ( ! data.tvd.center.equals(n_res.getReserve().getCh_name()) ) {
2443+ // 他局はアウト
2444+ continue;
2445+ }
2446+
2447+ // 予約マーク
2448+ mark = new Marker(n_res.getRecorder().Myself(), n_res.getRecorder().getColor(n_res.getReserve().getTuner()));
2449+ marked = _getReservedMarkCharNormal(mark, data, n_res);
2450+ break;
2451+ }
2452+
2453+ // 裏番組予約マーク
2454+ if ( env.getShowRsvUra() && ! marked ) {
2455+ for ( NeighborReserveList n_res : n_reserves ) {
2456+ if ( data.tvd.center.equals(n_res.getReserve().getCh_name()) ) {
2457+ // 裏番組だから、同じ局はアウト
24572458 continue;
24582459 }
2459-
2460- if (res.getCh_name() == null) {
2461- // 警告したい!
2460+ if ( ! n_res.getReserve().getExec() ) {
2461+ // 実行不可なら裏番組にはならない
24622462 continue;
24632463 }
2464-
2465- // 局が一致して
2466- if ( ! data.tvd.center.equals(res.getCh_name())) {
2464+
2465+ // 予約マーク
2466+ marked = _getReservedMarkCharUra(mark, data) || marked;
2467+ break;
2468+ }
2469+
2470+ }
2471+ }
2472+
2473+ // ピックアップマーク
2474+ if ( env.getShowRsvPickup() ) {
2475+ marked = _getReservedMarkCharPickup(mark, data) || marked;
2476+ }
2477+
2478+ return(marked ? mark : null);
2479+ }
2480+
2481+ /**
2482+ * その番組の近傍の予約情報のリストを作成する
2483+ */
2484+ private ArrayList<NeighborReserveList> findOverlapReserves(HDDRecorderList s_recorders, ListedItem data) {
2485+
2486+ // 近傍予約のリスト
2487+ ArrayList<NeighborReserveList> n_reserves = new ArrayList<NeighborReserveList>();
2488+
2489+ // 基準日時
2490+ String critDateTime = CommonUtils.getCritDateTime(env.getDisplayPassedReserve());
2491+
2492+ // 全予約をなめて、一番近い予約を探さなければならない
2493+ for ( HDDRecorder rec : s_recorders ) {
2494+ for ( ReserveList res : rec.getReserves() ) {
2495+ if ( env.getDisplayOnlyExecOnEntry() && ! res.getExec() ) {
2496+ // 実行可能な予約しかいらない場合
2497+ continue;
2498+ }
2499+
2500+ if ( res.getCh_name() == null ) {
2501+ // TODO 警告したい!
2502+ continue;
2503+ }
2504+
2505+ // 開始終了日時リストを生成する
2506+ ArrayList<String> starts = new ArrayList<String>();
2507+ ArrayList<String> ends = new ArrayList<String>();
2508+ CommonUtils.getStartEndList(starts, ends, res);
2509+
2510+ for ( int j=0; j<starts.size(); j++ ) {
2511+ if ( critDateTime.compareTo(ends.get(j)) > 0 ) {
2512+ // 終了済みは対象外
24672513 continue;
24682514 }
2469-
2470- // 開始終了日時リストを生成する
2471- ArrayList<String> starts = new ArrayList<String>();
2472- ArrayList<String> ends = new ArrayList<String>();
2473- CommonUtils.getStartEndList(starts, ends, res);
2474-
2475- for (int j=0; j<starts.size(); j++) {
2476- if (critDateTime.compareTo(ends.get(j)) > 0) {
2477- // 終了済みは対象外
2478- continue;
2479- }
2480- if ( CommonUtils.isOverlap(data.tvd.startDateTime, data.tvd.endDateTime, starts.get(j), ends.get(j), true) ) {
2481- // より開始時刻が近いものを選ぶ
2482- if ( start == null ) {
2483- start = starts.get(j);
2484- }
2485- long df = CommonUtils.getDiffDateTime(starts.get(j), data.tvd.startDateTime);
2486- if ( diff > df ) {
2487- recorder = rec;
2488- reserve = res;
2489- start = starts.get(j);
2490- end = ends.get(j);
2491- diff = df;
2515+ if ( CommonUtils.isOverlap(data.tvd.startDateTime, data.tvd.endDateTime, starts.get(j), ends.get(j), true) ) {
2516+ // 重なってる(開始時間=終了時間は除外)
2517+ long df = CommonUtils.getDiffDateTime(starts.get(j), data.tvd.startDateTime);
2518+ NeighborReserveList n_res = new NeighborReserveList(rec, res, starts.get(j), ends.get(j), df);
2519+
2520+ // 距離昇順に並べる
2521+ int index = 0;
2522+ for ( ; index < n_reserves.size(); index++ ) {
2523+ if ( n_res.getDiff() < n_reserves.get(index).getDiff() ) {
2524+ break;
24922525 }
24932526 }
2527+ n_reserves.add(index, n_res);
2528+
2529+ break;
24942530 }
24952531 }
24962532 }
24972533 }
2498-
2499- // 予約されている
2500-
2501- Marker mark;
2502- boolean marked = false;
25032534
2504- // 予約マーク
2505- if (recorder != null) {
2506- mark = new Marker(recorder.Myself(), recorder.getColor(reserve.getTuner()));
2507- marked = marked || _getReservedMarkCharNormal(mark, data, recorder, reserve, start, end);
2508- }
2509- else {
2510- mark = new Marker("", "");
2511- }
2512- // 裏番組予約マーク
2513- if (env.getShowRsvUra() && mark.rsvmark == null) {
2514- marked = _getReservedMarkCharUra(mark, data) || marked;
2535+ return n_reserves;
2536+ }
2537+
2538+ private class NeighborReserveList {
2539+ public NeighborReserveList(HDDRecorder recorder, ReserveList reserve, String start, String end, long diff) {
2540+ this.recorder = recorder;
2541+ this.reserve = reserve;
2542+ this.start = start;
2543+ this.end = end;
2544+ this.diff = diff;
25152545 }
2516- // ピックアップマーク
2517- marked = _getReservedMarkCharPickup(mark, data) || marked;
25182546
2519- return(marked ? mark : null);
2547+ private HDDRecorder recorder;
2548+ public HDDRecorder getRecorder() { return recorder; }
2549+
2550+ private ReserveList reserve;
2551+ public ReserveList getReserve() { return reserve; }
2552+
2553+ private long diff;
2554+ public long getDiff() { return diff; }
2555+
2556+ private String start;
2557+ public String getStart() { return start; }
2558+
2559+ private String end;
2560+ public String getEnd() { return end; }
25202561 }
2562+
25212563 /**
25222564 * @see #getReservedMarkChar(ListedItem)
25232565 */
2524- private boolean _getReservedMarkCharNormal(Marker mark, ListedItem data, HDDRecorder recorder, ReserveList reserve, String start, String end) {
2566+ private boolean _getReservedMarkCharNormal(Marker mark, ListedItem data, NeighborReserveList n_reserve) {
25252567
25262568 // ここに入ってくる場合は時間の重なりが確認できているものだけである
2527-
2569+ HDDRecorder recorder = n_reserve.getRecorder();
2570+ ReserveList reserve = n_reserve.getReserve();
2571+ String start = n_reserve.getStart();
2572+ String end = n_reserve.getEnd();
2573+
25282574 RSVMARK_COND cond = getReservedMarkCond(data, start, end);
25292575
25302576 if (debug) System.err.println(DBGID+data.tvd.title+" "+data.tvd.startDateTime+" "+data.tvd.endDateTime+" "+start+" "+end+" "+cond);
@@ -2656,6 +2702,14 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener
26562702 }
26572703
26582704 private boolean _getReservedMarkCharUra(Marker mark, ListedItem data) {
2705+
2706+ mark.rsvmark = RsvMark.URABAN;
2707+ return true;
2708+ /*
2709+ if ( mark.rsvmark != null ) {
2710+ return false;
2711+ }
2712+
26592713 //
26602714 String myself = getSelectedRecorderOnToolbar();
26612715 HDDRecorderList recs = recorders.findInstance(myself);
@@ -2679,17 +2733,18 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener
26792733 CommonUtils.getStartEndList(starts, ends, res);
26802734 for (int j=0; j<starts.size(); j++) {
26812735 if ( CommonUtils.isOverlap(data.tvd.startDateTime, data.tvd.endDateTime, starts.get(j), ends.get(j), env.getAdjoiningNotRepetition()) ) {
2682- mark.uramark = RsvMark.URABAN;
2736+ mark.rsvmark = RsvMark.URABAN;
26832737 return true;
26842738 }
26852739 }
26862740 }
26872741 }
2742+
26882743 return false;
2744+ */
26892745 }
2690-
2691-
2692-
2746+
2747+
26932748
26942749
26952750 /*
@@ -4056,7 +4111,7 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener
40564111 {
40574112 // 予約が入っているか否か
40584113 if ( c.marker != null ) {
4059- if ( c.marker.rsvmark != null && c.marker.rsvmark != RsvMark.NOEXEC ) {
4114+ if ( c.marker.rsvmark != null && c.marker.rsvmark != RsvMark.NOEXEC && c.marker.rsvmark != RsvMark.URABAN ) {
40604115 prechkreserved = true;
40614116 }
40624117 else if ( c.marker.pickmark != null ) {
@@ -4143,7 +4198,7 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener
41434198 if ( c.size( ) > column ) {
41444199 // 特殊なカラム
41454200 if ( column == ListedColumn.RSVMARK.getColumn() ) {
4146- if ( c.marker != null && c.marker.rsvmark != null ) {
4201+ if ( c.marker != null && c.marker.rsvmark != null ) {
41474202 if ( c.marker.rsvmark != RsvMark.URABAN ) {
41484203 return c.marker.rsvmark.mark+"\0"+c.hide_rsvmarkcolor;
41494204 }
Show on old repository browser