projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update year in copyright lines
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
core
/
Preferences.java
diff --git
a/src/main/java/net/pterodactylus/sone/core/Preferences.java
b/src/main/java/net/pterodactylus/sone/core/Preferences.java
index
f7ecdab
..
283f8e2
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/Preferences.java
+++ b/
src/main/java/net/pterodactylus/sone/core/Preferences.java
@@
-1,5
+1,5
@@
/*
/*
- * Sone - Preferences.java - Copyright © 2013 David Roden
+ * Sone - Preferences.java - Copyright © 2013
–2019
David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-39,36
+39,33
@@
import com.google.common.eventbus.EventBus;
/**
* Convenience interface for external classes that want to access the core’s
* configuration.
/**
* Convenience interface for external classes that want to access the core’s
* configuration.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class Preferences {
private final EventBus eventBus;
private final Option<Integer> insertionDelay =
*/
public class Preferences {
private final EventBus eventBus;
private final Option<Integer> insertionDelay =
- new DefaultOption<
Integer
>(60, range(0, MAX_VALUE));
+ new DefaultOption<>(60, range(0, MAX_VALUE));
private final Option<Integer> postsPerPage =
private final Option<Integer> postsPerPage =
- new DefaultOption<
Integer
>(10, range(1, MAX_VALUE));
+ new DefaultOption<>(10, range(1, MAX_VALUE));
private final Option<Integer> imagesPerPage =
private final Option<Integer> imagesPerPage =
- new DefaultOption<
Integer
>(9, range(1, MAX_VALUE));
+ new DefaultOption<>(9, range(1, MAX_VALUE));
private final Option<Integer> charactersPerPost =
private final Option<Integer> charactersPerPost =
- new DefaultOption<
Integer
>(400, Predicates.<Integer>or(
+ new DefaultOption<>(400, Predicates.<Integer>or(
range(50, MAX_VALUE), equalTo(-1)));
private final Option<Integer> postCutOffLength =
range(50, MAX_VALUE), equalTo(-1)));
private final Option<Integer> postCutOffLength =
- new DefaultOption<Integer>(200, Predicates.<Integer>or(
- range(50, MAX_VALUE), equalTo(-1)));
+ new DefaultOption<>(200, range(50, MAX_VALUE));
private final Option<Boolean> requireFullAccess =
private final Option<Boolean> requireFullAccess =
- new DefaultOption<
Boolean
>(false);
+ new DefaultOption<>(false);
private final Option<Integer> positiveTrust =
private final Option<Integer> positiveTrust =
- new DefaultOption<
Integer
>(75, range(0, 100));
+ new DefaultOption<>(75, range(0, 100));
private final Option<Integer> negativeTrust =
private final Option<Integer> negativeTrust =
- new DefaultOption<
Integer
>(-25, range(-100, 100));
+ new DefaultOption<>(-25, range(-100, 100));
private final Option<String> trustComment =
private final Option<String> trustComment =
- new DefaultOption<
String
>("Set from Sone Web Interface");
+ new DefaultOption<>("Set from Sone Web Interface");
private final Option<Boolean> activateFcpInterface =
private final Option<Boolean> activateFcpInterface =
- new DefaultOption<
Boolean
>(false);
+ new DefaultOption<>(false);
private final Option<FullAccessRequired> fcpFullAccessRequired =
private final Option<FullAccessRequired> fcpFullAccessRequired =
- new DefaultOption<
FullAccessRequired
>(ALWAYS);
+ new DefaultOption<>(ALWAYS);
public Preferences(EventBus eventBus) {
this.eventBus = eventBus;
public Preferences(EventBus eventBus) {
this.eventBus = eventBus;
@@
-106,6
+103,7
@@
public class Preferences {
public Preferences setInsertionDelay(Integer insertionDelay) {
this.insertionDelay.set(insertionDelay);
eventBus.post(new InsertionDelayChangedEvent(getInsertionDelay()));
public Preferences setInsertionDelay(Integer insertionDelay) {
this.insertionDelay.set(insertionDelay);
eventBus.post(new InsertionDelayChangedEvent(getInsertionDelay()));
+ eventBus.post(new PreferenceChangedEvent("InsertionDelay", getInsertionDelay()));
return this;
}
return this;
}
@@
-139,6
+137,7
@@
public class Preferences {
*/
public Preferences setPostsPerPage(Integer postsPerPage) {
this.postsPerPage.set(postsPerPage);
*/
public Preferences setPostsPerPage(Integer postsPerPage) {
this.postsPerPage.set(postsPerPage);
+ eventBus.post(new PreferenceChangedEvent("PostsPerPage", getPostsPerPage()));
return this;
}
return this;
}