Skip to content

Commit

Permalink
some minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chinonso098 committed Oct 20, 2023
1 parent 041e8ae commit 87fb0a1
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 103 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<cos-desktop>
<cos-filemanager> </cos-filemanager>
<!-- <cos-jsdos> </cos-jsdos> -->
<!-- <cos-jsdos> </cos-jsdos> -->
<ng-container #processContainerRef> </ng-container>

<cos-taskbar>
Expand Down
12 changes: 6 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RunningProcessService } from './shared/system-service/running.process.s
import { Process } from './system-files/process';
import { ComponentReferenceService } from './shared/system-service/component.reference.service';
import { Subscription } from 'rxjs';
import { StartProcessService } from './shared/system-service/start.process.service';
import { TriggerProcessService } from './shared/system-service/trigger.process.service';
import { BaseComponent } from './system-base/base/base.component';
import { TitleComponent } from './user-apps/title/title.component';
import { GreetingComponent } from './user-apps/greeting/greeting.component';
Expand All @@ -32,7 +32,7 @@ export class AppComponent implements OnDestroy, AfterViewInit {
private _processIdService:ProcessIDService;
private _runningProcessService:RunningProcessService;
private _componentReferenceService:ComponentReferenceService;
private _startProcessService:StartProcessService;
private _triggerProcessService:TriggerProcessService;
private _sessionMangamentServices:SessionManagmentService;
private _componentRefView!:ViewRef;
private _appDirectory:AppDirectory;
Expand Down Expand Up @@ -63,18 +63,18 @@ export class AppComponent implements OnDestroy, AfterViewInit {
];


constructor( processIdService:ProcessIDService, runningProcessService:RunningProcessService,componentReferenceService:ComponentReferenceService, startProcessService:StartProcessService,
constructor( processIdService:ProcessIDService, runningProcessService:RunningProcessService,componentReferenceService:ComponentReferenceService, triggerProcessService:TriggerProcessService,
sessionMangamentServices:SessionManagmentService){
this._processIdService = processIdService
this.processId = this._processIdService.getNewProcessId()

this._componentReferenceService = componentReferenceService;
this._runningProcessService = runningProcessService;
this._startProcessService = startProcessService;
this._triggerProcessService = triggerProcessService;
this._sessionMangamentServices = sessionMangamentServices;

this._startProcessSub = this._startProcessService.startProcessNotify.subscribe((appName) =>{this.loadApps(appName)})
this._startProcessSub = this._startProcessService.appNotFoundNotify.subscribe((appName) =>{this.loadApps(appName)})
this._startProcessSub = this._triggerProcessService.startProcessNotify.subscribe((appName) =>{this.loadApps(appName)})
this._startProcessSub = this._triggerProcessService.appNotFoundNotify.subscribe((appName) =>{this.loadApps(appName)})
this._runningProcessService.closeProcessNotify.subscribe((p) =>{this.onCloseBtnClicked(p)})
this._runningProcessService.addProcess(this.getComponentDetail());

Expand Down
40 changes: 0 additions & 40 deletions src/app/shared/system-service/start.process.service.ts

This file was deleted.

55 changes: 55 additions & 0 deletions src/app/shared/system-service/trigger.process.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Injectable } from "@angular/core";
import { Subject } from "rxjs";
import { RunningProcessService } from "./running.process.service";
import { AppDirectory } from "src/app/system-files/app.directory";
import { FileInfo } from "src/app/system-files/fileinfo";

@Injectable({
providedIn: 'root'
})

export class TriggerProcessService{

private _runningProcessService:RunningProcessService;
private _appDirectory:AppDirectory;
private _TriggerList:FileInfo[];

startProcessNotify: Subject<string> = new Subject<string>();
appNotFoundNotify: Subject<string> = new Subject<string>();
appIsRunningNotify: Subject<string> = new Subject<string>();

constructor(runningProcessService:RunningProcessService){
this._runningProcessService = runningProcessService;
this._appDirectory = new AppDirectory();
this._TriggerList = [];
}

startApplication(file:FileInfo):void{

if(this._appDirectory.appExist(file.getOpensWith)){

if(!this._runningProcessService.isProcessRunning(file.getOpensWith)){
this.startProcessNotify.next(file.getOpensWith);
this._TriggerList.push(file);
return
}
this.appNotFoundNotify.next(file.getOpensWith);
return;
}
this.appNotFoundNotify.next(file.getOpensWith);
return;
}

/**
* Getting the last process from the Trigger, will remove it the TriggerList.
*/
getLastProcessTrigger():FileInfo{

if(this._TriggerList.length > 0){
return this._TriggerList.pop() || new FileInfo;
}

return new FileInfo;
}

}
10 changes: 5 additions & 5 deletions src/app/system-apps/filemanager/filemanager.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Process } from 'src/app/system-files/process';
import { FileEntry } from 'src/app/system-files/fileentry';
import { FileInfo } from 'src/app/system-files/fileinfo';
import { Subscription } from 'rxjs';
import { StartProcessService } from 'src/app/shared/system-service/start.process.service';
import { TriggerProcessService } from 'src/app/shared/system-service/trigger.process.service';

@Component({
selector: 'cos-filemanager',
Expand All @@ -24,7 +24,7 @@ export class FilemanagerComponent implements OnInit, AfterViewInit, OnDestroy {
private _fileService:FileService
private _directoryFilesEntires!:FileEntry[];
private _dirFilesUpdatedSub!: Subscription;
private _startProcessService:StartProcessService;
private _triggerProcessService:TriggerProcessService;

hasWindow = false;
icon = '';
Expand All @@ -36,11 +36,11 @@ export class FilemanagerComponent implements OnInit, AfterViewInit, OnDestroy {
files:FileInfo[] = [];


constructor( processIdService:ProcessIDService, runningProcessService:RunningProcessService, fileInfoService:FileService, startProcessService:StartProcessService) {
constructor( processIdService:ProcessIDService, runningProcessService:RunningProcessService, fileInfoService:FileService, triggerProcessService:TriggerProcessService) {
this._processIdService = processIdService;
this._runningProcessService = runningProcessService;
this._fileService = fileInfoService;
this._startProcessService = startProcessService;
this._triggerProcessService = triggerProcessService;

this.processId = this._processIdService.getNewProcessId();
this._runningProcessService.addProcess(this.getComponentDetail());
Expand Down Expand Up @@ -115,7 +115,7 @@ export class FilemanagerComponent implements OnInit, AfterViewInit, OnDestroy {

await this.loadFilesInfoAsync();
}else{
this._startProcessService.startApplication(file.getOpensWith);
this._triggerProcessService.startApplication(file);
}
}

Expand Down
40 changes: 20 additions & 20 deletions src/app/system-apps/window/window.component.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

.section{
.section{
font-size: 100px;
text-align: center;
background-color: #808080;
Expand All @@ -13,9 +13,9 @@
margin-left: -100px;
outline: 1px hsl(0deg 0% 20%/70%);
overflow:hidden
}
}

.window-dd-box {
.window-dd-box {
cursor:none;
justify-content: center;
align-items: center;
Expand Down Expand Up @@ -87,23 +87,23 @@
/* width: 10px; */
}

nav{
display: flex;
position: absolute;
right: 0;
height: 30px;
}
nav{
display: flex;
position: absolute;
right: 0;
height: 30px;
}

/* change cursor style to normal*/
.ng-draggable {
cursor: auto;
}
/* change cursor style to normal*/
.ng-draggable {
cursor: auto;
}

.ng-dragging {
cursor: auto;
}
.ng-dragging {
cursor: auto;
}

/* Hide draggable corner*/
.ng-resizable-diagonal{
border-bottom: 12px solid transparent;
}
/* Hide draggable corner*/
.ng-resizable-diagonal{
border-bottom: 12px solid transparent;
}
9 changes: 4 additions & 5 deletions src/app/system-apps/window/window.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,25 @@ <h1>
</figure>
</h1>
<nav>
<button appHighlight id="hideBtn" (click)="onHideBtnClick()">
<button appHighlight id="hideBtn" (click)="onHideBtnClick()" title="Hide">
<svg width="10" viewBox="0 0 10 1">
<path d="M0 0h10v1H0z"/>
</svg>
</button>
<button *ngIf="!windowMaximize, else elseBlock" id="minMaxBtn" appHighlight (click)="onMaximizeBtnClick()" >
<button *ngIf="!windowMaximize, else elseBlock" id="minMaxBtn" appHighlight (click)="onMaximizeBtnClick()" title="Maximize">
<svg width="10" viewBox="0 0 10 10">
<path d="M0 0v10h10V0H0zm1 1h8v8H1V1z"/>
</svg>
</button>
<ng-template #elseBlock>
<button appHighlight (click)="onUnMaximizeBtnClick()" >
<button appHighlight (click)="onUnMaximizeBtnClick()" title="Minimize">
<svg width="15" viewBox="0 0 24 24">
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M7 6V3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-3v3c0 .552-.45 1-1.007 1H4.007A1.001 1.001 0 0 1 3 21l.003-14c0-.552.45-1 1.007-1H7zM5.003 8L5 20h10V8H5.003zM9 6h8v10h2V4H9v2z"/>
</svg>
</button>
</ng-template>

<button [ngStyle]="closeBtnStyles" id="closeBtn" appHighlight (click)="onCloseBtnClick()" >
<button [ngStyle]="closeBtnStyles" id="closeBtn" appHighlight (click)="onCloseBtnClick()" title="Close" >
<svg width="10" viewBox="0 0 10 10">
<path d="M10.2.7L9.5 0 5.1 4.4.7 0 0 .7l4.4 4.4L0 9.5l.7.7 4.4-4.4 4.4 4.4.7-.7-4.4-4.4z"/>
</svg>
Expand Down
4 changes: 3 additions & 1 deletion src/app/system-apps/window/window.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,10 @@ import { WindowState } from 'src/app/system-files/state/windows.state';
for (let i=0; i < processWithWindows.length; i++){
const process = processWithWindows[i];
const window = this._stateManagmentService.getState(process.getProcessId) as WindowState;

console.log("setNextWindowToFocus:", window);

if(window.getIsVisible){
if(window != undefined && window.getIsVisible){
//console.log('process:',process.getProcessId +'----'+process.getProcessName); //TBD
this.setWindowToFocusById(process.getProcessId);
break;
Expand Down
29 changes: 18 additions & 11 deletions src/app/system-files/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,41 @@ export class Process{
private _processId:number;
private _processName:string;
private _icon:string;
private _hasWindow:boolean
private _type:string
private _hasWindow:boolean;
private _type:string;
private _processTrigger:unknown;

constructor(processId:number, processName:string, icon:string, hasWindow:boolean, type:string){
constructor(processId:number, processName:string, icon:string, hasWindow:boolean, type:string, processTrigger?:unknown){
this._processId = processId;
this._processName = processName
this._processName = processName;
this._icon = icon;
this._hasWindow = hasWindow
this._type = type
this._hasWindow = hasWindow;
this._type = type;
this._processTrigger = processTrigger || null;
}

public get getProcessId(){
return this._processId
return this._processId;
}

public get getProcessName(){
return this._processName
return this._processName;
}

get getIcon(){
return this._icon
return this._icon;
}

public get getHasWindow(){
return this._hasWindow
return this._hasWindow;
}

public get getType(){
return this._type
return this._type;
}

public get getProcessTrigger(){
return this._processTrigger;
}

}
Loading

0 comments on commit 87fb0a1

Please sign in to comment.