Skip to content

Commit

Permalink
Fix issue where loading icons started to be visible - they appeard on…
Browse files Browse the repository at this point in the history
… screen very slowly

- Icons which were hit by that issue have been moved to loading during project build in project.xml - they have been moved to root Assets/images/common (reference #127)
  • Loading branch information
piotrzarzycki21 committed Dec 6, 2024
1 parent bd482ec commit df70908
Show file tree
Hide file tree
Showing 26 changed files with 103 additions and 51 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
3 changes: 0 additions & 3 deletions Genesis/Assets/images/common/start.png

This file was deleted.

55 changes: 32 additions & 23 deletions Genesis/Source/genesis/application/theme/GenesisApplicationTheme.hx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

package genesis.application.theme;

import openfl.display.Bitmap;
import feathers.skins.TriangleSkin;
import feathers.controls.Alert;
import feathers.controls.AssetLoader;
Expand Down Expand Up @@ -88,6 +89,15 @@ class GenesisApplicationTheme extends ClassVariantTheme {

}

public static function getCommonIcon(id:String, width:Float, height:Float):Bitmap
{
var icon = new Bitmap(Assets.getBitmapData(id));
icon.width = width;
icon.height = height;
icon.smoothing = true;
return icon;
}

public static final APPLICATION:String = "application";
public static final BUTTON_HIGHLIGHT:String = "button-hightlight";
public static final BUTTON_SELECT_FILE:String = "button-select-file";
Expand Down Expand Up @@ -119,35 +129,34 @@ class GenesisApplicationTheme extends ClassVariantTheme {
public static final LAYOUT_GROUP_PERCENTAGE_BAR:String = "layout-group-percentage-bar";
public static final TEXT_AREA_PRIVACY:String = "text-area-privacy";

public static final ICON_CHECKBOX_LARGE:String = "assets/images/common/checkbox_large.png";
public static final ICON_CHECKBOX_LARGE_DISABLED:String = "assets/images/common/checkbox_large_disabled.png";
public static final ICON_CHECKBOX_LARGE_SELECTED:String = "assets/images/common/checkbox_large_selected.png";
public static final ICON_CHECKBOX_LARGE:String = "ICON_CHECKBOX_LARGE";
public static final ICON_CHECKBOX_LARGE_SELECTED:String = "ICON_CHECKBOX_LARGE_SELECTED";
public static final ICON_CLEAR:String = "assets/images/common/clear.png";
public static final ICON_CLOSE:String = "assets/images/common/close.png";
public static final ICON_CONSOLE:String = "assets/images/common/console.png";
public static final ICON_CONSOLE:String = "ICON_CONSOLE";
public static final ICON_COPY:String = "assets/images/common/copy.png";
public static final ICON_DELETE:String = "assets/images/common/delete.png";
public static final ICON_DESTROY:String = "assets/images/common/destroy.png";
public static final ICON_DELETE:String = "ICON_DELETE";
public static final ICON_DESTROY:String = "ICON_DESTROY";
public static final ICON_DESTROY_SMALL:String = "assets/images/common/destroy_small.png";
public static final ICON_ERROR:String = "assets/images/common/error.png";
public static final ICON_FOLDER:String = "assets/images/common/folder.png";
public static final ICON_FILEZILLA:String = "ICON_FILEZILLA";
public static final ICON_FOLDER:String = "ICON_FOLDER";
public static final ICON_GITHUB:String = "assets/images/common/github.png";
public static final ICON_HELP:String = "assets/images/common/help.png";
public static final ICON_LOCATE_FILE:String = "assets/images/common/locatefile.png";
public static final ICON_OK:String = "assets/images/common/ok.png";
public static final ICON_OUTPUT:String = "assets/images/common/output.png";
public static final ICON_OUTPUT_ERROR:String = "assets/images/common/output_error.png";
public static final ICON_OUTPUT_NEW:String = "assets/images/common/output_new.png";
public static final ICON_REFRESH:String = "assets/images/common/refresh.png";
public static final ICON_SETTINGS:String = "assets/images/common/settings.png";
public static final ICON_SETTINGS_WARNING:String = "assets/images/common/settings_warning.png";
public static final ICON_START:String = "assets/images/common/start.png";
public static final ICON_STOP:String = "assets/images/common/stop.png";
public static final ICON_SUSPEND:String = "assets/images/common/suspend.png";
public static final ICON_UPLOAD:String = "assets/images/common/upload.png";
public static final ICON_FILEZILLA:String = "assets/images/common/filezilla.png";
public static final ICON_OUTPUT:String = "ICON_OUTPUT";
public static final ICON_OUTPUT_ERROR:String = "ICON_OUTPUT_ERROR";
public static final ICON_OUTPUT_NEW:String = "ICON_OUTPUT_NEW";
public static final ICON_REFRESH:String = "ICON_REFRESH";
public static final ICON_SETTINGS:String = "ICON_SETTINGS";
public static final ICON_SETTINGS_WARNING:String = "ICON_SETTINGS_WARNING";
public static final ICON_START:String = "ICON_START";
public static final ICON_STOP:String = "ICON_STOP";
public static final ICON_SUSPEND:String = "ICON_SUSPEND";
public static final ICON_UPLOAD:String = "ICON_UPLOAD";
public static final ICON_WARNING:String = "assets/images/common/warning.png";
public static final ICON_WEB:String = "assets/images/common/web.png";
public static final ICON_WEB:String = "ICON_WEB";

public static final IMAGE_GENESIS_DIRECTORY:String = "assets/images/genesisdirectory.png";
public static final IMAGE_HELP:String = "assets/images/help.png";
Expand Down Expand Up @@ -382,8 +391,8 @@ class GenesisApplicationTheme extends ClassVariantTheme {
function _setCheckMediumStyles( check:Check ) {

check.textFormat = _themeTypography.Medium;
check.icon = new AdvancedAssetLoader( ( _mode == ThemeMode.Dark ) ? getAssetPath( ICON_CHECKBOX_LARGE ) : getAssetPath( ICON_CHECKBOX_LARGE ) );
check.selectedIcon = new AdvancedAssetLoader( ( _mode == ThemeMode.Dark ) ? getAssetPath( ICON_CHECKBOX_LARGE_SELECTED ) : getAssetPath( ICON_CHECKBOX_LARGE_SELECTED ) );
check.icon = getCommonIcon( ICON_CHECKBOX_LARGE, 32, 18 );
check.selectedIcon = getCommonIcon( ICON_CHECKBOX_LARGE_SELECTED, 32, 18 );
check.horizontalAlign = HorizontalAlign.LEFT;

}
Expand Down Expand Up @@ -522,8 +531,8 @@ class GenesisApplicationTheme extends ClassVariantTheme {
function _setGenesisFormCheckBoxStyles( cb:GenesisFormCheckBox ) {

cb.textFormat = _themeTypography.Default;
cb.icon = new AdvancedAssetLoader( ( _mode == ThemeMode.Dark ) ? getAssetPath( ICON_CHECKBOX_LARGE ) : getAssetPath( ICON_CHECKBOX_LARGE ) );
cb.selectedIcon = new AdvancedAssetLoader( ( _mode == ThemeMode.Dark ) ? getAssetPath( ICON_CHECKBOX_LARGE_SELECTED ) : getAssetPath( ICON_CHECKBOX_LARGE_SELECTED ) );
cb.icon = getCommonIcon( ICON_CHECKBOX_LARGE, 32, 18 );
cb.selectedIcon = getCommonIcon( ICON_CHECKBOX_LARGE_SELECTED, 32, 18 );
cb.horizontalAlign = HorizontalAlign.LEFT;

}
Expand Down
6 changes: 3 additions & 3 deletions Source/superhuman/components/Console.hx
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ class Console extends LayoutGroup implements IConsole {
_topGroup.addChild( _titleLabel );

_clearButton = new Button( LanguageManager.getInstance().getString( 'console.buttonclear' ) );
_clearButton.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_CLEAR ) );
_clearButton.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_CLEAR, 20, 20 );
_clearButton.addEventListener( TriggerEvent.TRIGGER, _clearButtonTriggered );
_topGroup.addChild( _clearButton );

_copyButton = new Button( LanguageManager.getInstance().getString( 'console.buttoncopy' ) );
_copyButton.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_COPY ) );
_copyButton.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_COPY, 20, 20 );
_copyButton.addEventListener( TriggerEvent.TRIGGER, _copyButtonTriggered );
_topGroup.addChild( _copyButton );

_closeButton = new Button( LanguageManager.getInstance().getString( 'console.buttonclose' ) );
_closeButton.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_CLOSE ) );
_closeButton.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_CLOSE, 20, 20 );
_closeButton.addEventListener( TriggerEvent.TRIGGER, _closeButtonTriggered );
_topGroup.addChild( _closeButton );

Expand Down
68 changes: 47 additions & 21 deletions Source/superhuman/components/ServerList.hx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ class ServerList extends ListView {
@:styleContext
class ServerItem extends LayoutGroupItemRenderer {

private static final CONTROL_BUTTON_WIDTH:Float = 50;
private static final CONTROL_BUTTON_HEIGHT:Float = 30;

var _labelTitle:Label;
var _progressIndicator:ProgressIndicator;
var _labelRoles:Label;
Expand Down Expand Up @@ -233,85 +236,106 @@ class ServerItem extends LayoutGroupItemRenderer {
this.addChild( buttonGroup );

_buttonStart = new GenesisButton();
var iconStart = new Bitmap(Assets.getBitmapData("ICON_START"));
iconStart.smoothing = true;
_buttonStart.icon = iconStart; //new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_START ) );
_buttonStart.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_START, 20, 20 );
_buttonStart.width = CONTROL_BUTTON_WIDTH;
_buttonStart.height = CONTROL_BUTTON_HEIGHT;
_buttonStart.enabled = true;
_buttonStart.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.start' );
_buttonStart.addEventListener( TriggerEvent.TRIGGER, _buttonStartTriggered );
buttonGroup.addChild( _buttonStart );

_buttonStop = new GenesisButton();
_buttonStop.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_STOP ) );
_buttonStop.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_STOP, 20, 20 );
_buttonStop.width = CONTROL_BUTTON_WIDTH;
_buttonStop.height = CONTROL_BUTTON_HEIGHT;
_buttonStop.enabled = _buttonStop.visible = _buttonStop.includeInLayout = false;
_buttonStop.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.stop' );
_buttonStop.addEventListener( TriggerEvent.TRIGGER, _buttonStopTriggered );
buttonGroup.addChild( _buttonStop );

_buttonSuspend = new GenesisButton();
_buttonSuspend.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_SUSPEND ) );
_buttonSuspend.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_SUSPEND, 20, 20 );
_buttonSuspend.width = CONTROL_BUTTON_WIDTH;
_buttonSuspend.height = CONTROL_BUTTON_HEIGHT;
_buttonSuspend.enabled = _buttonSuspend.visible = _buttonSuspend.includeInLayout = false;
_buttonSuspend.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.suspend' );
_buttonSuspend.addEventListener( TriggerEvent.TRIGGER, _buttonSuspendTriggered );
buttonGroup.addChild( _buttonSuspend );

_buttonSync = new GenesisButton();
_buttonSync.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_UPLOAD ) );
_buttonSync.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_UPLOAD, 20, 20 );
_buttonSync.width = CONTROL_BUTTON_WIDTH;
_buttonSync.height = CONTROL_BUTTON_HEIGHT;
_buttonSync.enabled = false;
_buttonSync.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.resync' );
_buttonSync.addEventListener( TriggerEvent.TRIGGER, _buttonSyncTriggered );
buttonGroup.addChild( _buttonSync );

_buttonProvision = new GenesisButton();
_buttonProvision.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_REFRESH ) );
_buttonProvision.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_REFRESH, 20, 20 );
_buttonProvision.width = CONTROL_BUTTON_WIDTH;
_buttonProvision.height = CONTROL_BUTTON_HEIGHT;
_buttonProvision.enabled = false;
_buttonProvision.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.provision' );
_buttonProvision.addEventListener( TriggerEvent.TRIGGER, _buttonProvisionTriggered );
buttonGroup.addChild( _buttonProvision );

_buttonDestroy = new GenesisButton();
_buttonDestroy.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_DESTROY, 20, 20 );
_buttonDestroy.width = CONTROL_BUTTON_WIDTH;
_buttonDestroy.height = CONTROL_BUTTON_HEIGHT;
_buttonDestroy.enabled = false;
_buttonDestroy.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_DESTROY ) );
_buttonDestroy.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.destroy' );
_buttonDestroy.addEventListener( TriggerEvent.TRIGGER, _buttonDestroyTriggered );
buttonGroup.addChild( _buttonDestroy );

_buttonConsole = new GenesisButton();
_buttonConsole.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_OUTPUT ) );
_buttonConsole.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_OUTPUT, 20, 20 );
_buttonConsole.width = CONTROL_BUTTON_WIDTH;
_buttonConsole.height = CONTROL_BUTTON_HEIGHT;
_buttonConsole.addEventListener( TriggerEvent.TRIGGER, _buttonConsoleTriggered );
_buttonConsole.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.output' );
buttonGroup.addChild( _buttonConsole );

_buttonOpenBrowser = new GenesisButton();
_buttonOpenBrowser.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_WEB ) );
_buttonOpenBrowser.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_WEB, 20, 20 );
_buttonOpenBrowser.width = CONTROL_BUTTON_WIDTH;
_buttonOpenBrowser.height = CONTROL_BUTTON_HEIGHT;
_buttonOpenBrowser.enabled = false;
_buttonOpenBrowser.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.welcomepage' );
_buttonOpenBrowser.addEventListener( TriggerEvent.TRIGGER, _buttonOpenBrowserTriggered );
buttonGroup.addChild( _buttonOpenBrowser );

_buttonSSH = new GenesisButton();
_buttonSSH.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_CONSOLE, 20, 20 );
_buttonSSH.width = CONTROL_BUTTON_WIDTH;
_buttonSSH.height = CONTROL_BUTTON_HEIGHT;
_buttonSSH.enabled = false;
_buttonSSH.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_CONSOLE ) );
_buttonSSH.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.vagrantssh' );
_buttonSSH.addEventListener( TriggerEvent.TRIGGER, _buttonSSHTriggered );
buttonGroup.addChild( _buttonSSH );

_buttonOpenDir = new GenesisButton();
_buttonOpenDir.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_FOLDER ) );
_buttonOpenDir.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_FOLDER, 20, 20 );
_buttonOpenDir.width = CONTROL_BUTTON_WIDTH;
_buttonOpenDir.height = CONTROL_BUTTON_HEIGHT;
_buttonOpenDir.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.directory' );
_buttonOpenDir.addEventListener( TriggerEvent.TRIGGER, _buttonOpenDirTriggered );
buttonGroup.addChild( _buttonOpenDir );

_buttonDelete = new GenesisButton();
_buttonDelete.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_DELETE ) );
_buttonDelete.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_DELETE, 20, 20 );
_buttonDelete.width = CONTROL_BUTTON_WIDTH;
_buttonDelete.height = CONTROL_BUTTON_HEIGHT;
_buttonDelete.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.delete' );
_buttonDelete.addEventListener( TriggerEvent.TRIGGER, _buttonDeleteTriggered );
buttonGroup.addChild( _buttonDelete );

_buttonFtp = new GenesisButton();
_buttonFtp.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_FILEZILLA ) );
_buttonFtp.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_FILEZILLA, 20, 20 );
_buttonFtp.width = CONTROL_BUTTON_WIDTH;
_buttonFtp.height = CONTROL_BUTTON_HEIGHT;
_buttonFtp.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.ftp' );
_buttonFtp.height = 30;
_buttonFtp.addEventListener( TriggerEvent.TRIGGER, _buttonFtpTriggered );
buttonGroup.addChild( _buttonFtp );

Expand All @@ -320,7 +344,9 @@ class ServerItem extends LayoutGroupItemRenderer {
buttonGroup.addChild( spacer );

_buttonConfigure = new GenesisButton();
_buttonConfigure.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_SETTINGS ) );
_buttonConfigure.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_SETTINGS, 20, 20 );
_buttonConfigure.width = CONTROL_BUTTON_WIDTH;
_buttonConfigure.height = CONTROL_BUTTON_HEIGHT;
_buttonConfigure.addEventListener( TriggerEvent.TRIGGER, _buttonConfigureTriggered );
_buttonConfigure.toolTip = LanguageManager.getInstance().getString( 'serverpage.server.configure' );
buttonGroup.addChild( _buttonConfigure );
Expand Down Expand Up @@ -500,17 +526,17 @@ class ServerItem extends LayoutGroupItemRenderer {

if ( _console.hasError ) {

_buttonConsole.icon = new AdvancedAssetLoader( GenesisApplicationTheme.ICON_OUTPUT_ERROR );
_buttonConsole.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_OUTPUT_ERROR, 20, 20 );

} else {

_buttonConsole.icon = new AdvancedAssetLoader( GenesisApplicationTheme.ICON_OUTPUT_NEW );
_buttonConsole.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_OUTPUT_NEW, 20, 20 );

}

} else {

_buttonConsole.icon = new AdvancedAssetLoader( GenesisApplicationTheme.ICON_OUTPUT );
_buttonConsole.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_OUTPUT, 20, 20 );

}

Expand Down Expand Up @@ -546,7 +572,7 @@ class ServerItem extends LayoutGroupItemRenderer {
if ( _server.diskUsage.value != 0 ) _labelInfo.text += ' • Est. disk usage: ${ StrTools.autoFormatBytes( _server.diskUsage.value )}';

_buttonConfigure.enabled = _buttonConfigure.includeInLayout = _buttonConfigure.visible = false;
_buttonConfigure.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_SETTINGS ) );
_buttonConfigure.icon = GenesisApplicationTheme.getCommonIcon( GenesisApplicationTheme.ICON_SETTINGS, 20, 20 );
_buttonConsole.enabled = _buttonConsole.includeInLayout = _buttonConsole.visible = true;
_buttonDelete.enabled = _buttonDelete.includeInLayout = _buttonDelete.visible = false;
_buttonDestroy.enabled = _buttonDestroy.includeInLayout = _buttonDestroy.visible = false;
Expand Down Expand Up @@ -613,8 +639,8 @@ class ServerItem extends LayoutGroupItemRenderer {

case ServerStatus.Unconfigured:
_buttonConfigure.enabled = _buttonConfigure.includeInLayout = _buttonConfigure.visible = true;
_buttonConfigure.icon = new AdvancedAssetLoader( GenesisApplicationTheme.getAssetPath( GenesisApplicationTheme.ICON_SETTINGS_WARNING ) );
_buttonDelete.enabled = _buttonDelete.includeInLayout = _buttonDelete.visible = true;
_buttonStart.enabled = _buttonStart.includeInLayout = _buttonStart.visible = true;
_statusLabel.text = LanguageManager.getInstance().getString( 'serverpage.server.status.unconfigured' );

case ServerStatus.Ready:
Expand Down
Loading

0 comments on commit df70908

Please sign in to comment.