Add marker interface to mark tabs, which contain followed models
This commit is contained in:
parent
b80fbd4c30
commit
0085ce7ab8
|
@ -1,5 +1,6 @@
|
|||
package ctbrec.sites.chaturbate;
|
||||
|
||||
import ctbrec.ui.FollowedTab;
|
||||
import ctbrec.ui.ThumbOverviewTab;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -11,7 +12,7 @@ import javafx.scene.input.KeyCode;
|
|||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
||||
public class ChaturbateFollowedTab extends ThumbOverviewTab {
|
||||
public class ChaturbateFollowedTab extends ThumbOverviewTab implements FollowedTab {
|
||||
private Label status;
|
||||
private String onlineUrl;
|
||||
private String offlineUrl;
|
||||
|
|
|
@ -3,6 +3,7 @@ import static ctbrec.sites.mfc.FriendsUpdateService.Mode.*;
|
|||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import ctbrec.ui.FollowedTab;
|
||||
import ctbrec.ui.ThumbOverviewTab;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Scene;
|
||||
|
@ -13,7 +14,7 @@ import javafx.scene.input.KeyEvent;
|
|||
import javafx.scene.layout.HBox;
|
||||
import javafx.util.Duration;
|
||||
|
||||
public class MyFreeCamsFriendsTab extends ThumbOverviewTab {
|
||||
public class MyFreeCamsFriendsTab extends ThumbOverviewTab implements FollowedTab {
|
||||
public MyFreeCamsFriendsTab(MyFreeCams mfc) {
|
||||
super("Friends", new FriendsUpdateService(mfc), mfc);
|
||||
updateService.setPeriod(new Duration(TimeUnit.SECONDS.toMillis(10)));
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package ctbrec.ui;
|
||||
|
||||
/**
|
||||
* Marker interface to mark tabs, which contain followed models
|
||||
*/
|
||||
public interface FollowedTab {
|
||||
|
||||
}
|
|
@ -21,6 +21,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -30,7 +31,6 @@ import ctbrec.Config;
|
|||
import ctbrec.Model;
|
||||
import ctbrec.recorder.Recorder;
|
||||
import ctbrec.sites.Site;
|
||||
import ctbrec.sites.chaturbate.ChaturbateFollowedTab;
|
||||
import ctbrec.sites.mfc.MyFreeCamsClient;
|
||||
import ctbrec.sites.mfc.MyFreeCamsModel;
|
||||
import javafx.collections.ObservableList;
|
||||
|
@ -391,10 +391,9 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
|||
contextMenu.setAutoHide(true);
|
||||
contextMenu.setHideOnEscape(true);
|
||||
contextMenu.setAutoFix(true);
|
||||
// TODO get rid of direct reference to Chaturbate
|
||||
MenuItem followOrUnFollow = this instanceof ChaturbateFollowedTab ? unfollow : follow;
|
||||
contextMenu.getItems().addAll(openInPlayer, startStop);
|
||||
if(site.supportsFollow()) {
|
||||
if(site.supportsFollow() && StringUtil.isNotBlank(Config.getInstance().getSettings().username)) {
|
||||
MenuItem followOrUnFollow = (this instanceof FollowedTab) ? unfollow : follow;
|
||||
contextMenu.getItems().add(followOrUnFollow);
|
||||
}
|
||||
if(site.supportsTips()) {
|
||||
|
|
Loading…
Reference in New Issue