123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- var buffInfoPanels = new Array();
- function infoMessage( infoPanelComponent, icon, textMessages, time_ms, color )
- {
- var sprite = infoPanelComponent.createObject( main.mainViewItem, {
- "text": textMessages,
- "__numScreen": buffInfoPanels.length,
- "icon": icon,
- "colorBorder": color
- } );
- buffInfoPanels.push( sprite );
- time_ms = time_ms || 3000
- sprite.showPanelTime( time_ms );
- if ( sprite == null ) {
- console.log("infoMessage(): error creating object");
- }
- }
- function removeInfoPanel( objPanel )
- {
- var remN = objPanel.__numScreen;
- for( var j = 0; j < buffInfoPanels.length; j++ )
- {
- var sprite = buffInfoPanels[ j ];
- var n = sprite.__numScreen;
- if( n > remN )
- {
- sprite.__numScreen = sprite.__numScreen - 1
- }
- }
- objPanel.destroy()
- buffInfoPanels.splice( remN, 1 );
- }
- function clearInfoStack()
- {
- buffInfoPanels.length = 0
- }
- function infoMessageN( icon, textMessages, time_ms, color )
- {
- var component = Qt.createComponent("TopInfoPanel.qml");
- var sprite = component.createObject( main.mainViewItem, {
- "text": textMessages,
- "__numScreen": buffInfoPanels.length,
- "icon": icon,
- "colorBorder": color
- } );
- buffInfoPanels.push( sprite );
- time_ms = time_ms || 3000
- sprite.showPanelTime( time_ms );
- if ( sprite == null ) {
- console.log("infoMessage(): error creating object");
- }
- }
- /****************************************************************/
- function baseName(path) {
- var filePath = path.toString();
- var pos1 = 0;
- var pos2 = 0;
- while( path != "" )
- {
- pos1 = filePath.indexOf("/", pos2);
- if( pos1 < 0 )
- {
- return filePath.substring( pos2 );
- }
- pos2 = pos1+1
- }
- return "";
- }
- function basePath(path) {
- var filePath = path.toString();
- var pos = 0;
- pos = filePath.lastIndexOf("/");
- //console.log( "pos1="+pos1 )
- //console.log( "filePath="+filePath )
- if( pos >= 0 )
- {
- //console.log( "filePath.length=" + filePath.length )
- return filePath.substring( 0, pos );
- }
- return "";
- }
- /****************************************************************/
- var bufColorName = new Array();
- var indexColorName = 0;
- function getColorByIndex( index )
- {
- var ret = "#000000"
- switch( index )
- {
- case 0: ret = "#020066"; break;
- case 1: ret = "#96003c"; break;
- case 2: ret = "#006a96"; break;
- case 3: ret = "#009691"; break;
- case 4: ret = "#00963c"; break;
- case 5: ret = "#57b100"; break;
- case 6: ret = "#b1a700"; break;
- case 7: ret = "#9b5168"; break;
- case 8: ret = "#ed8f88"; break;
- case 9: ret = "#875450"; break;
- case 10: ret = "#3e4a96"; break;
- }
- //console.log( "getColorByIndex("+index+") = " + ret )
- return ret;
- }
- function getNameColor( name )
- {
- var colorName = bufColorName[ name ];
- //console.log( "colorName="+colorName + " name="+name )
- if( colorName == undefined ) {
- colorName = getColorByIndex(indexColorName);
- bufColorName[ name ] = colorName;
- indexColorName = indexColorName + 1;
- }
- return colorName;
- }
- /****************************************************************/
- var componentFC;
- var spriteFC;
- function dlgFilesChoose( appWindow, presetDir, callbackFunc )
- {
- componentFC = Qt.createComponent("DialogFiles.qml");
- if (componentFC.status == Component.Ready)
- finishCreationFC( appWindow, presetDir, callbackFunc );
- else
- componentFC.statusChanged.connect( finishCreationFC(appWindow, presetDir, callbackFunc) );
- }
- function finishCreationFC( appWindow, presetDir, callbackFunc )
- {
- if (componentFC.status == Component.Ready)
- {
- spriteFC = componentFC.createObject(appWindow, {"presetPath": presetDir} );
- if (spriteFC == null) {
- console.log("Error creating DialogFiles.qml");
- }
- }
- else if (componentFC.status == Component.Error)
- {
- console.log( "Error loading component:", componentFC.errorString() );
- }
- spriteFC.fileSelected.connect( callbackFunc );
- spriteFC.dlgShowHide();
- }
- /****************************************************************/
|