diff --git a/src/app/app.component.html b/src/app/app.component.html
index 1b13e68..2d7836a 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -11,6 +11,7 @@
Slides
Alerts
Search
+ Themes
Main View
Stage View
@@ -55,7 +56,8 @@
-
+
+
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 821625c..37c3825 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -75,5 +75,4 @@ export class AppComponent implements OnInit {
sliderChanged(event: MatSlideToggleChange) {
this.fastSwitching = event.checked;
}
-
}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 37b4842..2713cd7 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -11,7 +11,7 @@ import { MatToolbarModule } from '@angular/material/toolbar';
import { MatGridListModule } from '@angular/material/grid-list';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
-import { MatButtonModule } from '@angular/material/button';
+import { MatButtonModule, MatButtonToggleModule } from '@angular/material';
import { MatInputModule } from '@angular/material';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
@@ -32,6 +32,7 @@ import { StageViewComponent } from './components/stage-view/stage-view.component
import { MainViewComponent } from './components/main-view/main-view.component';
import { ChordProPipe } from './components/chord-view/chordpro.pipe';
import { LoginComponent } from './components/login/login.component';
+import { ThemesComponent } from './components/themes/themes.component';
@NgModule({
@@ -45,13 +46,15 @@ import { LoginComponent } from './components/login/login.component';
ServiceComponent,
AlertComponent,
SearchComponent,
- SlidesComponent
+ SlidesComponent,
+ ThemesComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AppRoutingModule,
+ MatButtonToggleModule,
MatListModule,
MatSidenavModule,
MatIconModule,
diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts
index a7d482f..da721d6 100644
--- a/src/app/app.routing.ts
+++ b/src/app/app.routing.ts
@@ -8,6 +8,7 @@ import { SlidesComponent } from './components/slides/slides.component';
import { ChordViewComponent } from './components/chord-view/chord-view.component';
import { MainViewComponent } from './components/main-view/main-view.component';
import { StageViewComponent } from './components/stage-view/stage-view.component';
+import { ThemesComponent } from './components/themes/themes.component';
const routes: Routes = [
{ path: '', redirectTo: '/service', pathMatch: 'full' },
@@ -17,7 +18,8 @@ const routes: Routes = [
{ path: 'search', component: SearchComponent },
{ path: 'chords', component: ChordViewComponent },
{ path: 'main', component: MainViewComponent },
- { path: 'stage', component: StageViewComponent }
+ { path: 'stage', component: StageViewComponent },
+ { path: 'themes', component: ThemesComponent}
];
@NgModule({
imports: [RouterModule.forRoot(routes, {useHash: true})],
diff --git a/src/app/components/themes/themes.component.html b/src/app/components/themes/themes.component.html
new file mode 100644
index 0000000..02d74f1
--- /dev/null
+++ b/src/app/components/themes/themes.component.html
@@ -0,0 +1,18 @@
+
+ Theme level:
+
+ Global
+ Service
+
+
+
+
+ {{ theme.name }}
+
+
+Change Theme Level
+
+ Song level theme changing not yet supported.
+ To continue, change your theme level.
+
+
\ No newline at end of file
diff --git a/src/app/components/themes/themes.component.scss b/src/app/components/themes/themes.component.scss
new file mode 100644
index 0000000..3545081
--- /dev/null
+++ b/src/app/components/themes/themes.component.scss
@@ -0,0 +1,19 @@
+mat-card {
+ cursor: pointer;
+}
+mat-divider {
+ border-color: #afafaf;
+}
+mat-button-toggle-group {
+ margin-left: 10px;
+}
+
+.selected {
+ background-color: rgb(235, 235, 235);
+ font-weight: 700;
+}
+
+.theme-title {
+ margin-left: 2.5rem;
+ white-space: pre-wrap;
+}
\ No newline at end of file
diff --git a/src/app/components/themes/themes.component.ts b/src/app/components/themes/themes.component.ts
new file mode 100644
index 0000000..3cf9f91
--- /dev/null
+++ b/src/app/components/themes/themes.component.ts
@@ -0,0 +1,64 @@
+import { Component, OnInit } from '@angular/core';
+import { MatSlideToggleChange } from '@angular/material';
+
+import { OpenLPService } from '../../openlp.service';
+import { PageTitleService } from '../../page-title.service';
+
+@Component({
+ selector: 'openlp-themes',
+ templateUrl: './themes.component.html',
+ styleUrls: ['./themes.component.scss'],
+ providers: [OpenLPService]
+})
+
+export class ThemesComponent implements OnInit {
+ theme_list = null;
+ theme_level = null;
+
+ themeLevelSwitching = false;
+ unsupportedLevel = false;
+
+
+ constructor(private pageTitleService: PageTitleService, private openlpService: OpenLPService) {
+ pageTitleService.changePageTitle('Themes');
+ }
+
+ ngOnInit() {
+ this.getThemeLevel();
+ this.getThemes();
+ }
+
+ getThemeLevel() {
+ this.openlpService.getThemeLevel().subscribe(theme_level => {
+ this.theme_level = theme_level;
+ this.unsupportedLevelCheck(this.theme_level);
+ });
+ }
+
+ getThemes() {
+ this.openlpService.getThemes().subscribe(theme_list => this.theme_list = theme_list);
+ }
+
+ onThemeLevelSelected(level: string) {
+ this.openlpService.setThemeLevel(level).subscribe(res => this.getThemes());
+ }
+
+ onThemeSelected(theme: string) {
+ this.openlpService.setTheme(theme).subscribe(res => this.getThemes());
+ }
+
+ levelSliderChanged(event: MatSlideToggleChange) {
+ this.themeLevelSwitching = event.checked;
+ }
+
+ unsupportedLevelCheck(level) {
+ this.getThemeLevel();
+ if (level === 'song') {
+ this.unsupportedLevel = true;
+ this.themeLevelSwitching = true;
+ }
+ else {
+ this.unsupportedLevel = false;
+ }
+ }
+}
diff --git a/src/app/openlp.service.ts b/src/app/openlp.service.ts
index 15852ae..fe03945 100644
--- a/src/app/openlp.service.ts
+++ b/src/app/openlp.service.ts
@@ -7,6 +7,7 @@ import {
State,
Slide,
ServiceItem,
+ Theme,
MainView,
SystemInformation,
Credentials,
@@ -81,6 +82,14 @@ export class OpenLPService {
return this.http.get(`${this.apiURL}/service/items`, httpOptions);
}
+ getThemeLevel(): Observable {
+ return this.http.get(`${this.apiURL}/controller/get_theme_level`, httpOptions);
+ }
+
+ getThemes(): Observable {
+ return this.http.get(`${this.apiURL}/controller/themes`, httpOptions);
+ }
+
getSearchablePlugins(): Observable {
return this.http.get(`${this.apiURL}/core/plugins`, httpOptions);
}
@@ -97,6 +106,14 @@ export class OpenLPService {
return this.http.post(`${this.apiURL}/controller/show`, {'id': id}, httpOptions);
}
+ setThemeLevel(level): Observable {
+ return this.http.post(`${this.apiURL}/controller/set_theme_level`, {'level': level}, httpOptions);
+ }
+
+ setTheme(theme: string): Observable {
+ return this.http.post(`${this.apiURL}/controller/theme_change`, {'theme': theme}, httpOptions);
+ }
+
nextItem(): Observable {
return this.http.post(`${this.apiURL}/service/progress`, {'action': 'next'}, httpOptions);
}
diff --git a/src/app/responses.ts b/src/app/responses.ts
index 4f74b6d..e8cb5ee 100644
--- a/src/app/responses.ts
+++ b/src/app/responses.ts
@@ -34,6 +34,11 @@ export interface ServiceItem {
title: string;
}
+export interface Theme {
+ selected: boolean;
+ name: string;
+}
+
export interface MainView {
binary_image: string;
}