mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
cleanup
git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@835 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
parent
e30460a423
commit
75613761a2
130 changed files with 5225 additions and 5989 deletions
83
src/org/geometerplus/fbreader/formats/PluginCollection.java
Normal file
83
src/org/geometerplus/fbreader/formats/PluginCollection.java
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2008 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.geometerplus.fbreader.formats;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.geometerplus.zlibrary.core.options.*;
|
||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||
|
||||
import org.geometerplus.fbreader.formats.fb2.FB2Plugin;
|
||||
import org.geometerplus.fbreader.formats.html.HtmlPlugin;
|
||||
import org.geometerplus.fbreader.formats.oeb.OEBPlugin;
|
||||
import org.geometerplus.fbreader.formats.plucker.PluckerPlugin;
|
||||
|
||||
public class PluginCollection {
|
||||
private static PluginCollection ourInstance;
|
||||
private final ArrayList myPlugins = new ArrayList();
|
||||
public ZLStringOption DefaultLanguageOption;
|
||||
public ZLStringOption DefaultEncodingOption;
|
||||
public ZLBooleanOption LanguageAutoDetectOption;
|
||||
|
||||
public static PluginCollection instance() {
|
||||
if (ourInstance == null) {
|
||||
ourInstance = new PluginCollection();
|
||||
ourInstance.myPlugins.add(new FB2Plugin());
|
||||
ourInstance.myPlugins.add(new PluckerPlugin());
|
||||
//ourInstance->myPlugins.push_back(new DocBookPlugin());
|
||||
//ourInstance.myPlugins.add(new HtmlPlugin());
|
||||
/*ourInstance.myPlugins.add(new TxtPlugin());
|
||||
ourInstance.myPlugins.add(new PalmDocPlugin());
|
||||
ourInstance.myPlugins.add(new MobipocketPlugin());
|
||||
ourInstance.myPlugins.add(new ZTXTPlugin());
|
||||
ourInstance.myPlugins.add(new TcrPlugin());
|
||||
ourInstance.myPlugins.add(new CHMPlugin());
|
||||
*/
|
||||
ourInstance.myPlugins.add(new OEBPlugin());
|
||||
//ourInstance.myPlugins.add(new RtfPlugin());
|
||||
//ourInstance.myPlugins.add(new OpenReaderPlugin());
|
||||
}
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
public static void deleteInstance() {
|
||||
if (ourInstance != null) {
|
||||
ourInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
private PluginCollection() {
|
||||
LanguageAutoDetectOption = new ZLBooleanOption(ZLOption.CONFIG_CATEGORY, "Format", "AutoDetect", true);
|
||||
DefaultLanguageOption = new ZLStringOption(ZLOption.CONFIG_CATEGORY, "Format", "DefaultLanguage", "en");
|
||||
DefaultEncodingOption = new ZLStringOption(ZLOption.CONFIG_CATEGORY, "Format", "DefaultEncoding", "windows-1252");
|
||||
}
|
||||
|
||||
public FormatPlugin getPlugin(ZLFile file, boolean strong) {
|
||||
final ArrayList plugins = myPlugins;
|
||||
final int numberOfPlugins = plugins.size();
|
||||
for (int i = 0; i < numberOfPlugins; ++i) {
|
||||
FormatPlugin fp = (FormatPlugin)plugins.get(i);
|
||||
if ((!strong || fp.providesMetaInfo()) && fp.acceptsFile(file)) {
|
||||
return fp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue