2019-10-08 05:43:49 +00:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2019-11-07 18:02:26 +00:00
|
|
|
import { MatSlideToggleChange, MatDialog } from '@angular/material';
|
|
|
|
|
2018-08-22 20:04:41 +00:00
|
|
|
import { State } from './responses';
|
2018-08-19 20:37:53 +00:00
|
|
|
import { OpenLPService } from './openlp.service';
|
2019-11-07 18:02:26 +00:00
|
|
|
import { PageTitleService } from './page-title.service';
|
2019-10-08 05:43:49 +00:00
|
|
|
import { LoginComponent } from './components/login/login.component';
|
2018-08-07 11:51:51 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: './app.component.html',
|
2018-08-19 20:37:53 +00:00
|
|
|
styleUrls: ['./app.component.scss']
|
2018-08-07 11:51:51 +00:00
|
|
|
})
|
2019-10-08 05:43:49 +00:00
|
|
|
export class AppComponent implements OnInit {
|
2019-10-06 00:28:36 +00:00
|
|
|
fastSwitching = false;
|
2019-10-08 05:43:49 +00:00
|
|
|
state = new State();
|
|
|
|
showLogin = false;
|
2019-11-07 18:02:26 +00:00
|
|
|
pageTitle = 'OpenLP Remote';
|
2018-08-19 20:37:53 +00:00
|
|
|
|
2019-11-07 18:02:26 +00:00
|
|
|
constructor(private pageTitleService: PageTitleService, private openlpService: OpenLPService,
|
|
|
|
private dialog: MatDialog) {
|
|
|
|
pageTitleService.pageTitleChanged$.subscribe(pageTitle => this.pageTitle = pageTitle);
|
2018-08-19 20:37:53 +00:00
|
|
|
openlpService.stateChanged$.subscribe(item => this.state = item);
|
|
|
|
}
|
2019-10-06 00:28:36 +00:00
|
|
|
|
2019-10-08 05:43:49 +00:00
|
|
|
ngOnInit(): void {
|
|
|
|
this.openlpService.retrieveSystemInformation().subscribe(res => this.showLogin = res.login_required);
|
|
|
|
}
|
|
|
|
|
|
|
|
login() {
|
|
|
|
const dialogRef = this.dialog.open(LoginComponent, {
|
|
|
|
width: '250px'
|
|
|
|
});
|
|
|
|
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
if (result) {
|
|
|
|
this.showLogin = false;
|
|
|
|
this.openlpService.setAuthToken(result.token);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-08-19 20:37:53 +00:00
|
|
|
nextItem() {
|
2019-10-06 00:28:36 +00:00
|
|
|
this.openlpService.nextItem().subscribe();
|
2018-08-19 20:37:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
previousItem() {
|
2019-10-06 00:28:36 +00:00
|
|
|
this.openlpService.previousItem().subscribe();
|
2018-08-19 20:37:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nextSlide() {
|
2019-10-06 00:28:36 +00:00
|
|
|
this.openlpService.nextSlide().subscribe();
|
2018-08-19 20:37:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
previousSlide() {
|
2019-10-06 00:28:36 +00:00
|
|
|
this.openlpService.previousSlide().subscribe();
|
2018-08-19 20:37:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
blankDisplay() {
|
2019-10-06 00:28:36 +00:00
|
|
|
this.openlpService.blankDisplay().subscribe();
|
2018-08-19 20:37:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
themeDisplay() {
|
2019-10-06 00:28:36 +00:00
|
|
|
this.openlpService.themeDisplay().subscribe();
|
2018-08-19 20:37:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
desktopDisplay() {
|
2019-10-06 00:28:36 +00:00
|
|
|
this.openlpService.desktopDisplay().subscribe();
|
2018-08-19 20:37:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
showDisplay() {
|
2019-10-06 00:28:36 +00:00
|
|
|
this.openlpService.showDisplay().subscribe();
|
2018-08-19 20:37:53 +00:00
|
|
|
}
|
|
|
|
|
2018-08-27 18:21:35 +00:00
|
|
|
sliderChanged(event: MatSlideToggleChange) {
|
|
|
|
this.fastSwitching = event.checked;
|
|
|
|
}
|
2018-08-07 11:51:51 +00:00
|
|
|
}
|