Add global and per-book settings for the streaming PDF reader
This commit is contained in:
@@ -208,6 +208,7 @@ public class BookLoreUser {
|
||||
private GlobalOrIndividual pdf;
|
||||
private GlobalOrIndividual epub;
|
||||
private GlobalOrIndividual cbx;
|
||||
private GlobalOrIndividual newPdf;
|
||||
|
||||
public enum GlobalOrIndividual {
|
||||
Global, Individual
|
||||
|
||||
+1
@@ -54,6 +54,7 @@ public class DefaultUserSettingsProvider {
|
||||
.epub(BookLoreUser.UserSettings.PerBookSetting.GlobalOrIndividual.Individual)
|
||||
.pdf(BookLoreUser.UserSettings.PerBookSetting.GlobalOrIndividual.Individual)
|
||||
.cbx(BookLoreUser.UserSettings.PerBookSetting.GlobalOrIndividual.Individual)
|
||||
.newPdf(BookLoreUser.UserSettings.PerBookSetting.GlobalOrIndividual.Individual)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
+1
-82
@@ -10,88 +10,7 @@
|
||||
</div>
|
||||
|
||||
<div class="settings-content">
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-cog"></i>
|
||||
Settings Application Mode
|
||||
</h3>
|
||||
<p class="section-description">
|
||||
Control how default settings are applied. Select "Default Override" to apply your configured defaults to all books of the same format, overriding individual book preferences. Choose "Book-Specific" to let each book retain its own custom reading settings.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="settings-card">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">PDF Reader Settings</label>
|
||||
<div class="button-group">
|
||||
@for (item of scopeOptions; track item) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedPdfScope === item.key"
|
||||
(click)="selectedPdfScope = item.key; onPdfScopeChange()">
|
||||
<i [class]="item.icon"></i>
|
||||
<span class="option-text">{{ item.key === 'Global' ? 'Default Override' : 'Book-Specific' }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Choose whether default zoom, layout, and navigation settings override individual PDF preferences or if each document maintains its own settings.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">eBook Reader Settings</label>
|
||||
<div class="button-group">
|
||||
@for (item of scopeOptions; track item) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedEpubScope === item.key"
|
||||
(click)="selectedEpubScope = item.key; onEpubScopeChange()">
|
||||
<i [class]="item.icon"></i>
|
||||
<span class="option-text">{{ item.key === 'Global' ? 'Default Override' : 'Book-Specific' }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Choose whether default font, theme, and layout settings override individual eBook preferences (EPUB, FB2, MOBI, AZW3) or if each book maintains its own settings.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">CBX Reader Settings</label>
|
||||
<div class="button-group">
|
||||
@for (item of scopeOptions; track item) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedCbxScope === item.key"
|
||||
(click)="selectedCbxScope = item.key; onCbxScopeChange()">
|
||||
<i [class]="item.icon"></i>
|
||||
<span class="option-text">{{ item.key === 'Global' ? 'Default Override' : 'Book-Specific' }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Choose whether default layout, direction, and scaling settings override individual comic book preferences (CBZ, CBR, CB7) or if each file maintains its own settings.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<app-settings-application-mode [userSettings]="userSettings"></app-settings-application-mode>
|
||||
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
|
||||
-51
@@ -106,57 +106,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 2rem;
|
||||
padding: 0.25rem 0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
.setting-label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: var(--p-text-color);
|
||||
font-size: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.setting-label-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.setting-label {
|
||||
margin-bottom: 0;
|
||||
flex-shrink: 0;
|
||||
min-width: 150px;
|
||||
}
|
||||
}
|
||||
|
||||
.setting-description {
|
||||
color: var(--p-text-muted-color);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.setting-control {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
|
||||
+2
-30
@@ -11,26 +11,17 @@ import {PdfReaderPreferencesComponent} from './pdf-reader-preferences/pdf-reader
|
||||
import {CbxReaderPreferencesComponent} from './cbx-reader-preferences/cbx-reader-preferences-component';
|
||||
import {CustomFontsComponent} from '../custom-fonts/custom-fonts.component';
|
||||
import {NewPdfReaderPreferencesComponent} from './new-pdf-reader-preferences/new-pdf-reader-preferences-component';
|
||||
import {SettingsApplicationModeComponent} from './settings-application-mode/settings-application-mode.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-reader-preferences',
|
||||
templateUrl: './reader-preferences.component.html',
|
||||
standalone: true,
|
||||
styleUrls: ['./reader-preferences.component.scss'],
|
||||
imports: [FormsModule, TooltipModule, EpubReaderPreferencesComponent, PdfReaderPreferencesComponent, CbxReaderPreferencesComponent, CustomFontsComponent, NewPdfReaderPreferencesComponent]
|
||||
imports: [FormsModule, TooltipModule, EpubReaderPreferencesComponent, PdfReaderPreferencesComponent, CbxReaderPreferencesComponent, CustomFontsComponent, NewPdfReaderPreferencesComponent, SettingsApplicationModeComponent]
|
||||
})
|
||||
export class ReaderPreferences implements OnInit, OnDestroy {
|
||||
readonly scopeOptions = [
|
||||
{name: 'Global', key: 'Global', icon: 'pi pi-globe'},
|
||||
{name: 'Individual', key: 'Individual', icon: 'pi pi-user'}
|
||||
];
|
||||
|
||||
selectedPdfScope!: string;
|
||||
selectedEpubScope!: string;
|
||||
selectedCbxScope!: string;
|
||||
|
||||
private readonly userService = inject(UserService);
|
||||
private readonly readerPreferencesService = inject(ReaderPreferencesService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
userData$: Observable<UserState> = this.userService.userState$;
|
||||
@@ -46,7 +37,6 @@ export class ReaderPreferences implements OnInit, OnDestroy {
|
||||
this.userSettings = userState.user!.userSettings;
|
||||
const perms = userState.user!.permissions;
|
||||
this.hasFontManagementPermission = (perms.admin || perms.canManageFonts);
|
||||
this.loadPreferences(userState.user!.userSettings);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -54,22 +44,4 @@ export class ReaderPreferences implements OnInit, OnDestroy {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
|
||||
private loadPreferences(settings: UserSettings): void {
|
||||
this.selectedPdfScope = settings.perBookSetting.pdf;
|
||||
this.selectedEpubScope = settings.perBookSetting.epub;
|
||||
this.selectedCbxScope = settings.perBookSetting.cbx;
|
||||
}
|
||||
|
||||
onPdfScopeChange() {
|
||||
this.readerPreferencesService.updatePreference(['perBookSetting', 'pdf'], this.selectedPdfScope);
|
||||
}
|
||||
|
||||
onEpubScopeChange() {
|
||||
this.readerPreferencesService.updatePreference(['perBookSetting', 'epub'], this.selectedEpubScope);
|
||||
}
|
||||
|
||||
onCbxScopeChange() {
|
||||
this.readerPreferencesService.updatePreference(['perBookSetting', 'cbx'], this.selectedCbxScope);
|
||||
}
|
||||
}
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-cog"></i>
|
||||
Settings Application Mode
|
||||
</h3>
|
||||
<p class="section-description">
|
||||
Configure how default reader settings are applied across your library. Choose "Default Override" to enforce your preferred defaults across all books of the same format, or select "Book-Specific" to preserve individual reading preferences for each book.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="settings-card">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">PDF Reader Settings</label>
|
||||
<div class="button-group">
|
||||
@for (item of scopeOptions; track item) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedPdfScope === item.key"
|
||||
(click)="selectedPdfScope = item.key; onPdfScopeChange()">
|
||||
<i [class]="item.icon"></i>
|
||||
<span class="option-text">{{ item.key === 'Global' ? 'Default Override' : 'Book-Specific' }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Control whether your default zoom level, page layout, and navigation preferences apply to all PDFs or if each document retains its own settings.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">eBook Reader Settings</label>
|
||||
<div class="button-group">
|
||||
@for (item of scopeOptions; track item) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedEpubScope === item.key"
|
||||
(click)="selectedEpubScope = item.key; onEpubScopeChange()">
|
||||
<i [class]="item.icon"></i>
|
||||
<span class="option-text">{{ item.key === 'Global' ? 'Default Override' : 'Book-Specific' }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Determine whether your default font, theme, and layout preferences apply to all eBooks (EPUB, FB2, MOBI, AZW3) or if each book maintains its own settings.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">Comic Book Reader Settings</label>
|
||||
<div class="button-group">
|
||||
@for (item of scopeOptions; track item) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedCbxScope === item.key"
|
||||
(click)="selectedCbxScope = item.key; onCbxScopeChange()">
|
||||
<i [class]="item.icon"></i>
|
||||
<span class="option-text">{{ item.key === 'Global' ? 'Default Override' : 'Book-Specific' }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Set whether your default page layout, reading direction, and scaling preferences apply to all comics (CBZ, CBR, CB7) or if each file keeps its own settings.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">Streaming PDF Reader Settings</label>
|
||||
<div class="button-group">
|
||||
@for (item of scopeOptions; track item) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedNewPdfScope === item.key"
|
||||
(click)="selectedNewPdfScope = item.key; onNewPdfScopeChange()">
|
||||
<i [class]="item.icon"></i>
|
||||
<span class="option-text">{{ item.key === 'Global' ? 'Default Override' : 'Book-Specific' }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Choose whether your default view mode, fit mode, and scroll direction apply to all streaming PDFs or if each document maintains its own configuration.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
.preferences-section {
|
||||
@media (min-width: 768px) {
|
||||
padding: 0 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.section-header {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--p-text-color);
|
||||
margin: 0 0 0.5rem 0;
|
||||
|
||||
.pi {
|
||||
color: var(--p-primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
.section-description {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
color: var(--p-text-muted-color);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
|
||||
.pi {
|
||||
color: var(--p-primary-color);
|
||||
margin-top: 0.125rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.settings-card {
|
||||
border: 1px solid var(--p-content-border-color);
|
||||
border-radius: 8px;
|
||||
background: var(--p-content-background);
|
||||
padding: 1.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 2rem;
|
||||
padding: 0.25rem 0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
.setting-label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: var(--p-text-color);
|
||||
font-size: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
min-width: 220px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.setting-label-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.setting-label {
|
||||
margin-bottom: 0;
|
||||
min-width: 220px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.setting-description {
|
||||
color: var(--p-text-muted-color);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.button-group {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.option-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.375rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 0.375rem;
|
||||
border: 1.5px solid color-mix(in srgb, var(--text-color) 20%, transparent);
|
||||
background: color-mix(in srgb, var(--text-color) 5%, transparent);
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
min-width: 4.5rem;
|
||||
|
||||
i {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.option-text {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
|
||||
}
|
||||
|
||||
&.selected {
|
||||
border-color: var(--primary-color);
|
||||
background: color-mix(in srgb, var(--primary-color) 10%, transparent);
|
||||
color: var(--primary-color);
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 15%, transparent);
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
import {Component, inject, Input, OnInit} from '@angular/core';
|
||||
import {ReaderPreferencesService} from '../reader-preferences.service';
|
||||
import {UserSettings} from '../../user-management/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings-application-mode',
|
||||
templateUrl: './settings-application-mode.component.html',
|
||||
standalone: true,
|
||||
styleUrls: ['./settings-application-mode.component.scss']
|
||||
})
|
||||
export class SettingsApplicationModeComponent implements OnInit {
|
||||
@Input() userSettings!: UserSettings;
|
||||
|
||||
readonly scopeOptions = [
|
||||
{name: 'Global', key: 'Global', icon: 'pi pi-globe'},
|
||||
{name: 'Individual', key: 'Individual', icon: 'pi pi-user'}
|
||||
];
|
||||
|
||||
selectedPdfScope!: string;
|
||||
selectedNewPdfScope!: string;
|
||||
selectedEpubScope!: string;
|
||||
selectedCbxScope!: string;
|
||||
|
||||
private readonly readerPreferencesService = inject(ReaderPreferencesService);
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadPreferences();
|
||||
}
|
||||
|
||||
private loadPreferences(): void {
|
||||
this.selectedPdfScope = this.userSettings.perBookSetting.pdf;
|
||||
this.selectedNewPdfScope = this.userSettings.perBookSetting.newPdf || 'Global';
|
||||
this.selectedEpubScope = this.userSettings.perBookSetting.epub;
|
||||
this.selectedCbxScope = this.userSettings.perBookSetting.cbx;
|
||||
}
|
||||
|
||||
onPdfScopeChange() {
|
||||
this.readerPreferencesService.updatePreference(['perBookSetting', 'pdf'], this.selectedPdfScope);
|
||||
}
|
||||
|
||||
onNewPdfScopeChange() {
|
||||
this.readerPreferencesService.updatePreference(['perBookSetting', 'newPdf'], this.selectedNewPdfScope);
|
||||
}
|
||||
|
||||
onEpubScopeChange() {
|
||||
this.readerPreferencesService.updatePreference(['perBookSetting', 'epub'], this.selectedEpubScope);
|
||||
}
|
||||
|
||||
onCbxScopeChange() {
|
||||
this.readerPreferencesService.updatePreference(['perBookSetting', 'cbx'], this.selectedCbxScope);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ export interface PerBookSetting {
|
||||
pdf: string;
|
||||
epub: string;
|
||||
cbx: string;
|
||||
newPdf?: string;
|
||||
}
|
||||
|
||||
export type PageSpread = 'off' | 'even' | 'odd';
|
||||
|
||||
Reference in New Issue
Block a user