CSS change, some fallbacks programs for Desktop
authorNiki Roo <niki@nikiroo.be>
Mon, 20 Feb 2017 14:45:31 +0000 (15:45 +0100)
committerNiki Roo <niki@nikiroo.be>
Mon, 20 Feb 2017 14:45:31 +0000 (15:45 +0100)
src/be/nikiroo/fanfix/output/epub.style.css
src/be/nikiroo/fanfix/output/html.style.css
src/be/nikiroo/fanfix/reader/LocalReaderFrame.java

index 3999b9ca1ca5ac362ec05628c10debc1ce4de25f..4bdab3928a69f89898996cb401d2247badc4cf0b 100644 (file)
@@ -40,7 +40,7 @@ h1 {
 }
 
 .book, .chapter_content {
-       text-indent: 40px;
+       NO_text-indent: 40px;
        padding-top: 40px;
        padding-left: 5%;
        padding-right: 5%;
@@ -83,19 +83,20 @@ h2 .chaptitle {
 }
 
 .normals {
-       /* padding-bottom: 20px; */
-       
 }
 
 .normal {
-       /* padding-bottom: 20px; */
-       
+       /* Can be removed if you want a more "compact" view */
+       display: block;
+}
+
+.blank {
+       /* Can be removed if you want a more "compact" view */
+       height: 24px;
+       width: 100%;
 }
 
 .dialogues {
-       /* padding-top: 10px;
-       padding-bottom: 10px; */
-       
 }
 
 .dialogue {
index fd7cdec65e1448c26086410530f7a4e6eeb641a4..2f88f0c5a938e398dd29ec60de5ae2d5c0d7b4c5 100644 (file)
@@ -42,7 +42,7 @@ h1 {
 }
 
 .book, .chapter_content {
-       text-indent: 40px;
+       NO_text-indent: 40px;
        padding-top: 40px;
        padding-left: 5%;
        padding-right: 5%;
@@ -85,19 +85,20 @@ h2 .chaptitle {
 }
 
 .normals {
-       /* padding-bottom: 20px; */
-       
 }
 
 .normal {
-       /* padding-bottom: 20px; */
-       
+       /* Can be removed if you want a more "compact" view */
+       display: block;
+}
+
+.blank {
+       /* Can be removed if you want a more "compact" view */
+       height: 24px;
+       width: 100%;
 }
 
 .dialogues {
-       /* padding-top: 10px;
-       padding-bottom: 10px; */
-       
 }
 
 .dialogue {
index 966869f502c8f9a65d9fe2ef6bd55ee78d698bad..9d39017de82ba212051807934c7951c76070a17a 100644 (file)
@@ -99,7 +99,34 @@ class LocalReaderFrame extends JFrame {
                                                        try {
                                                                File target = LocalReaderFrame.this.reader
                                                                                .getTarget(luid, pg);
-                                                               Desktop.getDesktop().browse(target.toURI());
+                                                               // TODO: allow custom programs, with
+                                                               // Desktop/xdg-open fallback
+                                                               try {
+                                                                       Desktop.getDesktop().browse(target.toURI());
+                                                               } catch (UnsupportedOperationException e) {
+                                                                       String browsers[] = new String[] {
+                                                                                       "xdg-open", "epiphany",
+                                                                                       "konqueror", "firefox", "chrome",
+                                                                                       "google-chrome", "mozilla" };
+
+                                                                       Runtime runtime = Runtime.getRuntime();
+                                                                       for (String browser : browsers) {
+                                                                               try {
+                                                                                       runtime.exec(new String[] {
+                                                                                                       browser,
+                                                                                                       target.getAbsolutePath() });
+                                                                                       runtime = null;
+                                                                                       break;
+                                                                               } catch (IOException ioe) {
+                                                                                       // continue, try next browser
+                                                                               }
+                                                                       }
+
+                                                                       if (runtime != null) {
+                                                                               throw new IOException(
+                                                                                               "Cannot find a working GUI browser...");
+                                                                       }
+                                                               }
                                                        } catch (IOException e) {
                                                                Instance.syserr(e);
                                                        }