diff --git a/api/net/sf/briar/api/crypto/Password.java b/api/net/sf/briar/api/crypto/Password.java index be576f32819d61775fed5481405e9e8cf3f5523b..f26b68ef34174490f4fcd24b4c5d563be5b021cc 100644 --- a/api/net/sf/briar/api/crypto/Password.java +++ b/api/net/sf/briar/api/crypto/Password.java @@ -1,6 +1,14 @@ package net.sf.briar.api.crypto; +/** + * Encapsulates a password. Implementations may keep the password encrypted in + * memory to reduce the chances of writing it to the swapfile in plaintext. + */ public interface Password { + /** + * Returns the password as a character array, which should be filled with + * zeroes as soon as it has been used. + */ char[] getPassword(); } diff --git a/api/net/sf/briar/api/db/DatabaseComponent.java b/api/net/sf/briar/api/db/DatabaseComponent.java index 8f5cd228e82cb612b93de40015cb8187ba365149..8be61c5cd0d83c18204995770e471e3397827d22 100644 --- a/api/net/sf/briar/api/db/DatabaseComponent.java +++ b/api/net/sf/briar/api/db/DatabaseComponent.java @@ -7,11 +7,16 @@ import net.sf.briar.api.protocol.Bundle; import net.sf.briar.api.protocol.GroupId; import net.sf.briar.api.protocol.Message; +/** + * Encapsulates the database implementation and exposes high-level operations + * to other components. + */ public interface DatabaseComponent { static final long MEGABYTES = 1024L * 1024L; static final long GIGABYTES = 1024L * MEGABYTES; + // FIXME: Some of these should be configurable static final long MAX_DB_SIZE = 2L * GIGABYTES; static final long MIN_FREE_SPACE = 300L * MEGABYTES; static final long CRITICAL_FREE_SPACE = 100L * MEGABYTES; @@ -21,23 +26,42 @@ public interface DatabaseComponent { static final int CLEANER_SLEEP_MS = 1000; // 1 sec static final int RETRANSMIT_THRESHOLD = 3; + /** Waits for any open transactions to finish and closes the database. */ void close() throws DbException; + /** Adds a locally generated message to the database. */ void addLocallyGeneratedMessage(Message m) throws DbException; + /** Adds a new neighbour to the database. */ void addNeighbour(NeighbourId n) throws DbException; + /** Generates a bundle of messages for the given neighbour. */ void generateBundle(NeighbourId n, Bundle b) throws DbException; + /** + * Returns the rating assigned to the given author, which may be + * Rating.UNRATED if no rating has been assigned. + */ Rating getRating(AuthorId a) throws DbException; + /** Returns the set of groups to which we subscribe. */ Set<GroupId> getSubscriptions() throws DbException; + /** + * Processes a bundle of messages received from the given neighbour. Some + * or all of the messages in the bundle may be stored. + */ void receiveBundle(NeighbourId n, Bundle b) throws DbException; + /** Stores a rating for the given author. */ void setRating(AuthorId a, Rating r) throws DbException; + /** Subscribes to the given group. */ void subscribe(GroupId g) throws DbException; + /** + * Unsubscribes from the given group. Any messages belonging to the group + * will be deleted from the database. + */ void unsubscribe(GroupId g) throws DbException; } diff --git a/api/net/sf/briar/api/db/DatabasePassword.java b/api/net/sf/briar/api/db/DatabasePassword.java index 06f5e4fb264d505a4b70ea75cc19bbb430997115..d24a4a30c9e784d0298fed9269f8607fb1fdc89c 100644 --- a/api/net/sf/briar/api/db/DatabasePassword.java +++ b/api/net/sf/briar/api/db/DatabasePassword.java @@ -8,6 +8,10 @@ import java.lang.annotation.Target; import com.google.inject.BindingAnnotation; +/** + * Annotation for injecting the password from which the database encryption + * key is derived. + */ @BindingAnnotation @Target({ PARAMETER }) @Retention(RUNTIME) diff --git a/api/net/sf/briar/api/db/NeighbourId.java b/api/net/sf/briar/api/db/NeighbourId.java index b35a92680daaff0b68828d2dcb5d69b42cec0ace..943db44f1a8e5cb5ef72fbde85e5ea35bf44aa93 100644 --- a/api/net/sf/briar/api/db/NeighbourId.java +++ b/api/net/sf/briar/api/db/NeighbourId.java @@ -1,5 +1,6 @@ package net.sf.briar.api.db; +/** Uniquely identifies a neighbour. */ public class NeighbourId { private final int id; diff --git a/api/net/sf/briar/api/db/Rating.java b/api/net/sf/briar/api/db/Rating.java index b8b4a07f81828872e1d14c178bcf26b900cadd1a..2a61dbfde26d10ecf3143b69ea2253978c6dfd4d 100644 --- a/api/net/sf/briar/api/db/Rating.java +++ b/api/net/sf/briar/api/db/Rating.java @@ -1,5 +1,6 @@ package net.sf.briar.api.db; +/** The ratings that may be applied to an author in peer moderation. */ public enum Rating { BAD, UNRATED, GOOD } diff --git a/api/net/sf/briar/api/db/Status.java b/api/net/sf/briar/api/db/Status.java index ed5bba15ff438704c31dbb455ec17038239af70b..0f80ba176b38b99e81a41ee0923b9a18b896fe60 100644 --- a/api/net/sf/briar/api/db/Status.java +++ b/api/net/sf/briar/api/db/Status.java @@ -1,5 +1,17 @@ package net.sf.briar.api.db; +/** The status of a message with respect to a neighbour. */ public enum Status { - NEW, SENT, SEEN + /** + * The message has not been sent to, received from, or acked by the + * neighbour. + */ + NEW, + /** + * The message has been sent to, but not received from or acked by, the + * neighbour. + */ + SENT, + /** The message has been received from or acked by the neighbour. */ + SEEN } diff --git a/api/net/sf/briar/api/i18n/FontManager.java b/api/net/sf/briar/api/i18n/FontManager.java index 87053fa5b026eeeb68ff1711a8cc9093b375beba..df6be33d5b27817411545002416c53f62337ade6 100644 --- a/api/net/sf/briar/api/i18n/FontManager.java +++ b/api/net/sf/briar/api/i18n/FontManager.java @@ -6,13 +6,15 @@ import java.util.Locale; public interface FontManager { + /** Initializes the FontManager for the given locale. */ void initialize(Locale locale) throws IOException; - String[] getBundledFontFilenames(); - + /** Returns the appropriate font for the given language. */ Font getFontForLanguage(String language); + /** Returns the current user interface font. */ Font getUiFont(); + /** Sets the user interface font appropriately for the given language. */ void setUiFontForLanguage(String language); } \ No newline at end of file diff --git a/api/net/sf/briar/api/i18n/I18n.java b/api/net/sf/briar/api/i18n/I18n.java index 2e93804ef85081e5a160766cbdf93ee709b154bc..c1930e5678d31c299c16eb9d02315d2e9d3c29c6 100644 --- a/api/net/sf/briar/api/i18n/I18n.java +++ b/api/net/sf/briar/api/i18n/I18n.java @@ -8,26 +8,43 @@ import java.util.Locale; public interface I18n { + /** Returns the named string, translated for the current i18n locale. */ String tr(String name); + /** Returns the i18n locale. This may not match the system locale. */ Locale getLocale(); + /** Sets the i18n locale. */ void setLocale(Locale locale); + /** Loads the i18n locale from Briar/Data/locale.cfg. */ void loadLocale() throws IOException; + /** Saves the i18n locale to Briar/Data/locale.cfg. */ void saveLocale() throws IOException; + /** Saves the i18n locale to the given file. */ void saveLocale(File dir) throws IOException; + /** Returns the ComponentOrientation of the current i18n locale. */ ComponentOrientation getComponentOrientation(); + /** Registers a listener for changes to the i18n locale. */ void addListener(Listener l); + /** Unregisters a listener for changes to the i18n locale. */ void removeListener(Listener l); + /** + * Implemented by classes that wish to be informed of changes to the i18n + * locale. + */ public interface Listener { + /** + * Called whenever the i18n locale changes. + * @param uiFont The user interface font for the new locale. + */ void localeChanged(Font uiFont); } } \ No newline at end of file diff --git a/api/net/sf/briar/api/i18n/Stri18ng.java b/api/net/sf/briar/api/i18n/Stri18ng.java index 250752b0e194a097a43174ddceae7610ed30f7e1..a15305b3175d1fdd131a18dc1501d1730b8ad6de 100644 --- a/api/net/sf/briar/api/i18n/Stri18ng.java +++ b/api/net/sf/briar/api/i18n/Stri18ng.java @@ -1,5 +1,6 @@ package net.sf.briar.api.i18n; +/** A named translatable string. */ public class Stri18ng { private static final String HTML_OPEN_LEFT = "<html><body align='left'>"; @@ -15,16 +16,23 @@ public class Stri18ng { this.i18n = i18n; } + /** Returns the string translated for the current i18n locale. */ public String tr() { return i18n.tr(name); } + /** Returns the string, translated for the current i18n locale, as HTML. */ public String html() { if(i18n.getComponentOrientation().isLeftToRight()) return HTML_OPEN_LEFT + i18n.tr(name) + HTML_CLOSE; else return HTML_OPEN_RIGHT + i18n.tr(name) + HTML_CLOSE; } + /** + * Returns the string, translated for the current locale, as HTML. + * @param paras Additional (pre-translated) paragraphs that should be + * appended to the HTML. + */ public String html(String... paras) { StringBuilder s = new StringBuilder(); if(i18n.getComponentOrientation().isLeftToRight()) diff --git a/api/net/sf/briar/api/invitation/InvitationCallback.java b/api/net/sf/briar/api/invitation/InvitationCallback.java index 01d9fc3a6dfc59c96bd2ee18ef7abacefc257d97..793cb79939167ba94f7d890b6393240b0407c80b 100644 --- a/api/net/sf/briar/api/invitation/InvitationCallback.java +++ b/api/net/sf/briar/api/invitation/InvitationCallback.java @@ -3,8 +3,10 @@ package net.sf.briar.api.invitation; import java.io.File; import java.util.List; +/** A progress callback for creating an invitation. */ public interface InvitationCallback { + /** Returns true if the process has been cancelled by the user. */ boolean isCancelled(); void copyingFile(File f); diff --git a/api/net/sf/briar/api/invitation/InvitationParameters.java b/api/net/sf/briar/api/invitation/InvitationParameters.java index 550e78fda8b8b980b7d16d6609c79ec802dcdd59..ff53a21bba5233abfd5bb70d2149ca65e1a7a3f9 100644 --- a/api/net/sf/briar/api/invitation/InvitationParameters.java +++ b/api/net/sf/briar/api/invitation/InvitationParameters.java @@ -2,6 +2,7 @@ package net.sf.briar.api.invitation; import java.io.File; +/** Provides the parameters for creating an invitation. */ public interface InvitationParameters { boolean shouldCreateExe(); @@ -12,5 +13,5 @@ public interface InvitationParameters { File getChosenLocation(); - String[] getBundledFontFilenames(); + File getSetupDat(); } diff --git a/api/net/sf/briar/api/protocol/AuthorId.java b/api/net/sf/briar/api/protocol/AuthorId.java index 08b9f697664865766a850e12d188bfd62e3e2c80..5f5ab3b1334cfff7c09d310a3fda022d35cbc9d5 100644 --- a/api/net/sf/briar/api/protocol/AuthorId.java +++ b/api/net/sf/briar/api/protocol/AuthorId.java @@ -2,10 +2,13 @@ package net.sf.briar.api.protocol; import java.util.Arrays; +/** Uniquely identifies a pseudonymous author. */ public class AuthorId { public static final int LENGTH = 32; + // FIXME: Replace this with an isSelf() method that compares an AuthorId + // to any and all local AuthorIds. public static final AuthorId SELF = new AuthorId(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 diff --git a/api/net/sf/briar/api/protocol/Batch.java b/api/net/sf/briar/api/protocol/Batch.java index b7503e772066ccfb1f4c2e5f089dcd1e35f8e8ea..82c86222cc5870c16afd9369b9b9a59548512680 100644 --- a/api/net/sf/briar/api/protocol/Batch.java +++ b/api/net/sf/briar/api/protocol/Batch.java @@ -1,13 +1,24 @@ package net.sf.briar.api.protocol; - +/** A batch of messages up to CAPACITY bytes in total size. */ public interface Batch { public static final long CAPACITY = 1024L * 1024L; + /** Prepares the batch for transmission and generates its identifier. */ public void seal(); + + /** + * Returns the batch's unique identifier. Cannot be called before seal(). + */ BatchId getId(); + + /** Returns the size of the batch in bytes. */ long getSize(); + + /** Returns the messages contained in the batch. */ Iterable<Message> getMessages(); + + /** Adds a message to the batch. Cannot be called after seal(). */ void addMessage(Message m); } \ No newline at end of file diff --git a/api/net/sf/briar/api/protocol/BatchId.java b/api/net/sf/briar/api/protocol/BatchId.java index 1125c47aff44f2840558eda9a9bdc2fd68d3a7ef..9aad9c0e2db61e025e3779d66b57aec354ac3d3b 100644 --- a/api/net/sf/briar/api/protocol/BatchId.java +++ b/api/net/sf/briar/api/protocol/BatchId.java @@ -2,6 +2,7 @@ package net.sf.briar.api.protocol; import java.util.Arrays; +/** Uniquely identifies a batch of messages. */ public class BatchId { public static final int LENGTH = 32; diff --git a/api/net/sf/briar/api/protocol/Bundle.java b/api/net/sf/briar/api/protocol/Bundle.java index 5bb55e455ea73048e759ec2c574246a5022c7295..e027825fbab3698e26552ffecd2cc3f9a10f5041 100644 --- a/api/net/sf/briar/api/protocol/Bundle.java +++ b/api/net/sf/briar/api/protocol/Bundle.java @@ -1,16 +1,39 @@ package net.sf.briar.api.protocol; - +/** A bundle of acknowledgements, subscriptions, and batches of messages. */ public interface Bundle { + /** Prepares the bundle for transmission and generates its identifier. */ public void seal(); + + /** + * Returns the bundle's unique identifier. Cannot be called before seal(). + */ BundleId getId(); + + /** Returns the bundle's capacity in bytes. */ long getCapacity(); + + /** Returns the bundle's size in bytes. */ long getSize(); + + /** Returns the acknowledgements contained in the bundle. */ Iterable<BatchId> getAcks(); + + /** Adds an acknowledgement to the bundle. Cannot be called after seal(). */ void addAck(BatchId b); + + /** Returns the subscriptions contained in the bundle. */ Iterable<GroupId> getSubscriptions(); + + /** Adds a subscription to the bundle. Cannot be called after seal(). */ void addSubscription(GroupId g); + + /** Returns the batches of messages contained in the bundle. */ Iterable<Batch> getBatches(); + + /** + * Adds a batch of messages to the bundle. Cannot be called after seal(). + */ void addBatch(Batch b); } diff --git a/api/net/sf/briar/api/protocol/GroupId.java b/api/net/sf/briar/api/protocol/GroupId.java index 1ac038bbfbfe96e43481f9bb4d414d7cd8d7b332..75a12c8a3f6222142647fda4db8d3854a40d6e6f 100644 --- a/api/net/sf/briar/api/protocol/GroupId.java +++ b/api/net/sf/briar/api/protocol/GroupId.java @@ -2,6 +2,7 @@ package net.sf.briar.api.protocol; import java.util.Arrays; +/** Uniquely identifies a group to which a user may subscribe. */ public class GroupId { public static final int LENGTH = 32; diff --git a/api/net/sf/briar/api/protocol/Message.java b/api/net/sf/briar/api/protocol/Message.java index 31458e492861e6eac32f8bcce32f339d0415d42d..8ed42d12d22aa3579e63d86ab89dfad5472648b2 100644 --- a/api/net/sf/briar/api/protocol/Message.java +++ b/api/net/sf/briar/api/protocol/Message.java @@ -1,13 +1,28 @@ package net.sf.briar.api.protocol; - public interface Message { + /** Returns the message's unique identifier. */ MessageId getId(); + + /** + * Returns the message's parent, or MessageId.NONE if this is the first + * message in a thread. + */ MessageId getParent(); + + /** Returns the group to which the message belongs. */ GroupId getGroup(); + + /** Returns the message's author. */ AuthorId getAuthor(); + + /** Returns the timestamp created by the message's author. */ long getTimestamp(); + + /** Returns the size of the message in bytes. */ int getSize(); + + /** Returns the message in wire format. */ byte[] getBody(); } \ No newline at end of file diff --git a/api/net/sf/briar/api/protocol/MessageId.java b/api/net/sf/briar/api/protocol/MessageId.java index 7fb042a298beffd63ba31547ac6b3cd78f387419..ad25c171d6920ebda3238cfe9e62c01305564ca1 100644 --- a/api/net/sf/briar/api/protocol/MessageId.java +++ b/api/net/sf/briar/api/protocol/MessageId.java @@ -2,8 +2,10 @@ package net.sf.briar.api.protocol; import java.util.Arrays; +/** Uniquely identifies a message. */ public class MessageId { + /** Used to indicate that the first message in a thread has no parent. */ public static final MessageId NONE = new MessageId(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 diff --git a/api/net/sf/briar/api/setup/SetupCallback.java b/api/net/sf/briar/api/setup/SetupCallback.java index 1c3767c00dd996657c5ea90a861327b61b5d0725..490612ecfa656c24a4118d52524fbed471ebcc30 100644 --- a/api/net/sf/briar/api/setup/SetupCallback.java +++ b/api/net/sf/briar/api/setup/SetupCallback.java @@ -2,8 +2,10 @@ package net.sf.briar.api.setup; import java.io.File; +/** A progress callback for the installation process. */ public interface SetupCallback { + /** Returns true if the process has been cancelled by the user. */ boolean isCancelled(); void extractingFile(File f); diff --git a/api/net/sf/briar/api/setup/SetupParameters.java b/api/net/sf/briar/api/setup/SetupParameters.java index be90063496b962ddada6c2181fff438009d20417..f9876305b99ac418f029e4c86efe7d5d31c7bcb7 100644 --- a/api/net/sf/briar/api/setup/SetupParameters.java +++ b/api/net/sf/briar/api/setup/SetupParameters.java @@ -2,11 +2,10 @@ package net.sf.briar.api.setup; import java.io.File; +/** Provides the parameters for the installation process. */ public interface SetupParameters { File getChosenLocation(); - String[] getBundledFontFilenames(); - long getExeHeaderSize(); } diff --git a/components/net/sf/briar/i18n/FontManagerImpl.java b/components/net/sf/briar/i18n/FontManagerImpl.java index 8b5f9623feaa422e1f59093af9270a6f694c2987..378cd354c26a7da87648671f0c957581ee28029c 100644 --- a/components/net/sf/briar/i18n/FontManagerImpl.java +++ b/components/net/sf/briar/i18n/FontManagerImpl.java @@ -58,13 +58,6 @@ public class FontManagerImpl implements FontManager { return Font.getFont(attr); } - public String[] getBundledFontFilenames() { - String[] names = new String[BUNDLED_FONTS.length]; - for(int i = 0; i < BUNDLED_FONTS.length; i++) - names[i] = BUNDLED_FONTS[i].filename; - return names; - } - public Font getFontForLanguage(String language) { assert defaultFont != null; Font font = fonts.get(language); diff --git a/components/net/sf/briar/invitation/InvitationWorker.java b/components/net/sf/briar/invitation/InvitationWorker.java index 4c8f94e55fcf5777fb2758985a14a395e8f8d7b8..ce3c5751cc7f153397049bd3345e336b97951a7a 100644 --- a/components/net/sf/briar/invitation/InvitationWorker.java +++ b/components/net/sf/briar/invitation/InvitationWorker.java @@ -94,8 +94,7 @@ class InvitationWorker implements Runnable { } private void copyInstaller(File dest) throws IOException { - File root = FileUtils.getBriarDirectory(); - File src = new File(root, "Data/setup.dat"); + File src = parameters.getSetupDat(); if(!src.exists() || !src.isFile()) throw new IOException("File not found: " + src.getPath()); callback.copyingFile(dest); diff --git a/installer/net/sf/briar/ui/setup/SetupMain.java b/installer/net/sf/briar/ui/setup/SetupMain.java index db25a705b74bfab978931a3bc1525663651ba6cd..5529703e577156593126050170126813d2f84dec 100644 --- a/installer/net/sf/briar/ui/setup/SetupMain.java +++ b/installer/net/sf/briar/ui/setup/SetupMain.java @@ -27,8 +27,7 @@ public class SetupMain { new AlreadyInstalledPanel(wizard, i18n); new InstructionsPanel(wizard, i18n); LocationPanel locationPanel = new LocationPanel(wizard, i18n); - SetupParameters parameters = - new SetupParametersImpl(locationPanel, fontManager); + SetupParameters parameters = new SetupParametersImpl(locationPanel); new SetupWorkerPanel(wizard, workerFactory, parameters, i18n); fontManager.initialize(Locale.getDefault()); diff --git a/test/net/sf/briar/TestUtils.java b/test/net/sf/briar/TestUtils.java index 8e3e8daf30e270f1e9b1162bea1eef317f655d33..86fb377099a0efa52e278be1beaf74b491c3b795 100644 --- a/test/net/sf/briar/TestUtils.java +++ b/test/net/sf/briar/TestUtils.java @@ -4,9 +4,13 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; +import java.util.concurrent.atomic.AtomicInteger; public class TestUtils { + private static final AtomicInteger nextTestDir = + new AtomicInteger((int) (Math.random() * 1000 * 1000)); + public static void delete(File f) throws IOException { if(f.isDirectory()) for(File child : f.listFiles()) delete(child); f.delete(); @@ -19,4 +23,10 @@ public class TestUtils { out.flush(); out.close(); } + + public static File getTestDirectory() { + int name = nextTestDir.getAndIncrement(); + File testDir = new File("test.tmp/" + name); + return testDir; + } } diff --git a/test/net/sf/briar/setup/SetupWorkerTest.java b/test/net/sf/briar/setup/SetupWorkerTest.java index bcaeb2ba12aa5f662a8136f7f37cc6463001cd5d..cf164a9591e8233c1e3983f5dc36ea7fff76bf7e 100644 --- a/test/net/sf/briar/setup/SetupWorkerTest.java +++ b/test/net/sf/briar/setup/SetupWorkerTest.java @@ -22,7 +22,7 @@ public class SetupWorkerTest extends TestCase { private static final int HEADER_SIZE = 1234; - private final File testDir = new File("test.tmp"); + private final File testDir = TestUtils.getTestDirectory(); private final File jar = new File(testDir, "test.jar"); @Before diff --git a/test/net/sf/briar/util/FileUtilsTest.java b/test/net/sf/briar/util/FileUtilsTest.java index 0f303d56c1114608bdfd2d3577ed45c6db771a97..8dbbe0f367883712d498482f30daa5332baa86f9 100644 --- a/test/net/sf/briar/util/FileUtilsTest.java +++ b/test/net/sf/briar/util/FileUtilsTest.java @@ -18,7 +18,7 @@ import org.junit.Test; public class FileUtilsTest extends TestCase { - private final File testDir = new File("test.tmp"); + private final File testDir = TestUtils.getTestDirectory(); @Before public void setUp() { diff --git a/test/net/sf/briar/util/ZipUtilsTest.java b/test/net/sf/briar/util/ZipUtilsTest.java index 4e95a437fac193b6ae16aff4e4034196c1befb8c..c2ad772aef9687654b3f2e6439f8fd8d8f43a0a4 100644 --- a/test/net/sf/briar/util/ZipUtilsTest.java +++ b/test/net/sf/briar/util/ZipUtilsTest.java @@ -24,7 +24,7 @@ import org.junit.Test; public class ZipUtilsTest extends TestCase { - private final File testDir = new File("test.tmp"); + private final File testDir = TestUtils.getTestDirectory(); private final File f1 = new File(testDir, "abc/def/1"); private final File f2 = new File(testDir, "abc/def/2"); diff --git a/ui/net/sf/briar/ui/invitation/InvitationParametersImpl.java b/ui/net/sf/briar/ui/invitation/InvitationParametersImpl.java index d6933ce5669a4691fc128c3b21d2cc11f2c71edc..b2eae75adb84b98b4bcbb1435b997468ce3c6735 100644 --- a/ui/net/sf/briar/ui/invitation/InvitationParametersImpl.java +++ b/ui/net/sf/briar/ui/invitation/InvitationParametersImpl.java @@ -2,10 +2,8 @@ package net.sf.briar.ui.invitation; import java.io.File; -import net.sf.briar.api.i18n.FontManager; import net.sf.briar.api.invitation.InvitationParameters; - -import com.google.inject.Inject; +import net.sf.briar.util.FileUtils; class InvitationParametersImpl implements InvitationParameters { @@ -13,17 +11,14 @@ class InvitationParametersImpl implements InvitationParameters { private final OperatingSystemPanel osPanel; private final PasswordPanel passwordPanel; private final LocationPanel locationPanel; - private final FontManager fontManager; - @Inject InvitationParametersImpl(ExistingUserPanel existingUserPanel, OperatingSystemPanel osPanel, PasswordPanel passwordPanel, - LocationPanel locationPanel, FontManager fontManager) { + LocationPanel locationPanel) { this.existingUserPanel = existingUserPanel; this.osPanel = osPanel; this.passwordPanel = passwordPanel; this.locationPanel = locationPanel; - this.fontManager = fontManager; } public boolean shouldCreateExe() { @@ -44,7 +39,7 @@ class InvitationParametersImpl implements InvitationParameters { return locationPanel.getChosenDirectory(); } - public String[] getBundledFontFilenames() { - return fontManager.getBundledFontFilenames(); + public File getSetupDat() { + return FileUtils.getBriarDirectory(); } } diff --git a/ui/net/sf/briar/ui/invitation/LocationPanel.java b/ui/net/sf/briar/ui/invitation/LocationPanel.java index b3f52b3df1b86740e8529e5bab4b69fe3d100321..a949113d5618814bbccdf16e85783bbe2648bcff 100644 --- a/ui/net/sf/briar/ui/invitation/LocationPanel.java +++ b/ui/net/sf/briar/ui/invitation/LocationPanel.java @@ -5,13 +5,10 @@ import net.sf.briar.api.i18n.Stri18ng; import net.sf.briar.ui.wizard.DirectoryChooserPanel; import net.sf.briar.ui.wizard.Wizard; -import com.google.inject.Inject; - class LocationPanel extends DirectoryChooserPanel { private static final long serialVersionUID = 3788640725729516888L; - @Inject LocationPanel(Wizard wizard, I18n i18n) { super(wizard, "Location", "Password", "InvitationWorker", new Stri18ng("INVITATION_LOCATION_TITLE", i18n), diff --git a/ui/net/sf/briar/ui/invitation/OperatingSystemPanel.java b/ui/net/sf/briar/ui/invitation/OperatingSystemPanel.java index 777bc5b571b9385dfc42f889fdfa5d1a963e223f..80f0116a9bf9d3ef96e4e68a880f28152ead24ac 100644 --- a/ui/net/sf/briar/ui/invitation/OperatingSystemPanel.java +++ b/ui/net/sf/briar/ui/invitation/OperatingSystemPanel.java @@ -15,8 +15,6 @@ import net.sf.briar.api.i18n.Stri18ng; import net.sf.briar.ui.wizard.Wizard; import net.sf.briar.ui.wizard.WizardPanel; -import com.google.inject.Inject; - class OperatingSystemPanel extends WizardPanel { private static final long serialVersionUID = -8370132633634629466L; @@ -26,7 +24,6 @@ class OperatingSystemPanel extends WizardPanel { private final JRadioButton windowsButton, macButton, linuxButton; private final JRadioButton unknownButton; - @Inject OperatingSystemPanel(Wizard wizard, I18n i18n) { super(wizard, "OperatingSystem"); question = new Stri18ng("INVITATION_OPERATING_SYSTEM", i18n); diff --git a/ui/net/sf/briar/ui/invitation/PasswordPanel.java b/ui/net/sf/briar/ui/invitation/PasswordPanel.java index 343ee0a96ea5f292ee86382d39b9567130434ee2..273768c0978b87db1042a10b7c1f3c325818c777 100644 --- a/ui/net/sf/briar/ui/invitation/PasswordPanel.java +++ b/ui/net/sf/briar/ui/invitation/PasswordPanel.java @@ -17,8 +17,6 @@ import net.sf.briar.api.i18n.Stri18ng; import net.sf.briar.ui.wizard.Wizard; import net.sf.briar.ui.wizard.WizardPanel; -import com.google.inject.Inject; - public class PasswordPanel extends WizardPanel { private static final long serialVersionUID = -1012132977732308293L; @@ -28,7 +26,6 @@ public class PasswordPanel extends WizardPanel { private final JLabel introLabel, enterPasswordLabel, confirmPasswordLabel; private final JPasswordField password1, password2; - @Inject PasswordPanel(Wizard wizard, ExistingUserPanel existingUserPanel, I18n i18n) { super(wizard, "Password"); diff --git a/ui/net/sf/briar/ui/invitation/UiInvitationModule.java b/ui/net/sf/briar/ui/invitation/UiInvitationModule.java index 742efd4fd3afec9ba1250b35e90b2b28ddef608c..82b78640f0ac96aef2e56e00fa3c0874741424ac 100644 --- a/ui/net/sf/briar/ui/invitation/UiInvitationModule.java +++ b/ui/net/sf/briar/ui/invitation/UiInvitationModule.java @@ -1,6 +1,5 @@ package net.sf.briar.ui.invitation; -import net.sf.briar.api.i18n.FontManager; import net.sf.briar.api.i18n.I18n; import net.sf.briar.api.invitation.InvitationParameters; import net.sf.briar.api.invitation.InvitationWorkerFactory; @@ -15,7 +14,7 @@ public class UiInvitationModule extends AbstractModule { protected void configure() {} @Provides @Singleton - InvitationWizard getInvitationWizard(I18n i18n, FontManager fontManager, + InvitationWizard getInvitationWizard(I18n i18n, InvitationWorkerFactory workerFactory) { InvitationWizard wizard = new InvitationWizard(i18n); new IntroPanel(wizard, i18n); @@ -25,7 +24,7 @@ public class UiInvitationModule extends AbstractModule { new PasswordPanel(wizard, userPanel, i18n); LocationPanel locationPanel = new LocationPanel(wizard, i18n); InvitationParameters parameters = new InvitationParametersImpl( - userPanel, osPanel, passwordPanel, locationPanel, fontManager); + userPanel, osPanel, passwordPanel, locationPanel); new InvitationWorkerPanel(wizard, workerFactory, parameters, i18n); return wizard; } diff --git a/ui/net/sf/briar/ui/setup/SetupParametersImpl.java b/ui/net/sf/briar/ui/setup/SetupParametersImpl.java index 0fb1b72a483afd3759da7f59d371cd914beca892..1545ad085fbf9e32f97a6c684c2b964aa8356ccf 100644 --- a/ui/net/sf/briar/ui/setup/SetupParametersImpl.java +++ b/ui/net/sf/briar/ui/setup/SetupParametersImpl.java @@ -2,7 +2,6 @@ package net.sf.briar.ui.setup; import java.io.File; -import net.sf.briar.api.i18n.FontManager; import net.sf.briar.api.setup.SetupParameters; class SetupParametersImpl implements SetupParameters { @@ -10,21 +9,15 @@ class SetupParametersImpl implements SetupParameters { private static final int EXE_HEADER_SIZE = 62976; private final LocationPanel locationPanel; - private final FontManager fontManager; - SetupParametersImpl(LocationPanel locationPanel, FontManager fontManager) { + SetupParametersImpl(LocationPanel locationPanel) { this.locationPanel = locationPanel; - this.fontManager = fontManager; } public File getChosenLocation() { return locationPanel.getChosenDirectory(); } - public String[] getBundledFontFilenames() { - return fontManager.getBundledFontFilenames(); - } - public long getExeHeaderSize() { return EXE_HEADER_SIZE; } diff --git a/ui/net/sf/briar/ui/setup/UiSetupModule.java b/ui/net/sf/briar/ui/setup/UiSetupModule.java index 26b8df46d8ba5aefe7c6e4a5d55291a1538ab19a..3a6a96452c8d977fa089f89716ae95a4561e594b 100644 --- a/ui/net/sf/briar/ui/setup/UiSetupModule.java +++ b/ui/net/sf/briar/ui/setup/UiSetupModule.java @@ -22,8 +22,7 @@ public class UiSetupModule extends AbstractModule { new AlreadyInstalledPanel(wizard, i18n); new InstructionsPanel(wizard, i18n); LocationPanel locationPanel = new LocationPanel(wizard, i18n); - SetupParameters parameters = - new SetupParametersImpl(locationPanel, fontManager); + SetupParameters parameters = new SetupParametersImpl(locationPanel); new SetupWorkerPanel(wizard, workerFactory, parameters, i18n); return wizard; }