Skip to content

Commit

Permalink
small corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
wiegell committed Nov 21, 2022
1 parent 63e44fe commit 5c4bed4
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 29 deletions.
7 changes: 4 additions & 3 deletions AstroWall/ApplicationLayer/View/AppDelegate.Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void createStatusBar(string title)
statusBar = NSStatusBar.SystemStatusBar;
statusBarItem = statusBar.CreateStatusItem(NSStatusItemLength.Variable);
General.InitIcon(statusBarItem, this.StatusMenu);
MenuTitle.Title = title;
setTitle( title);
}

public void updateMenuCheckMarks(Preferences prefs)
Expand Down Expand Up @@ -82,12 +82,13 @@ public void setSubTitle(string str)
{
General.RunOnUIThread(() =>
{
MenuOutletState.Hidden = true;
MenuOutletState.Hidden = false;
MenuOutletState.Enabled = false;
MenuOutletState.Title = str;
});
}

public void hideSubTitle()
public void HideSubTitle()
{
General.RunOnUIThread(() =>
{
Expand Down
16 changes: 8 additions & 8 deletions AstroWall/BusinessLayer/ApplicationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ public class ApplicationHandler
public Preferences.Preferences Prefs { get; private set; }

// Misc
public Version CurrentVersion { private set; get; }
private string currentVersionString = General.currentVersion();
private string currentVersionStringWithCommit;


public ApplicationHandler(AppDelegate del)
{
AppDelegate = del;
MenuHandler = new MenuHandler(AppDelegate, this);
Updates = new Updates(this, currentVersionString);
currentVersionStringWithCommit = General.currentVersion();
Updates = new Updates(this, currentVersionStringWithCommit);
}

public async Task Init()
Expand All @@ -54,10 +54,10 @@ public void TerminationPreparations()
private bool primaryInitAndCheckIfPrefsAreAvail()
{
// Create status bar icon / menu
MenuHandler.createStatusBar("Astrowall v" + currentVersionString);
MenuHandler.createStatusBar("Astrowall v" + Updates.currentVersion);

// Init state
State = new State(this, currentVersionString);
State = new State(this, currentVersionStringWithCommit);

// Load prefs. If non-present halt further actions until
// preft are confirmed by user
Expand Down Expand Up @@ -127,17 +127,17 @@ public async Task checkForNewPics()
{

// Set state downloading
State.SetStateDownloading("Checking for new pics");
State.SetStateDownloading("Checking for new pics...");
// Update db from online site
bool successfullOnlinCheck = await db.LoadDataButNoImgFromOnlineStartingAtDate(10, DateTime.Now);
bool successfullOnlinCheck = await db.LoadDataButNoImgFromOnlineStartingAtDate(20, DateTime.Now);
if (successfullOnlinCheck)
{

// Register successfull check in prefs
Prefs.LastOnlineCheck = DateTime.Now;

db.Sort();
State.SetStateDownloading("Downloading pictures");
State.SetStateDownloading("Downloading pictures...");
await db.LoadImgs();

// Update submenu
Expand Down
14 changes: 7 additions & 7 deletions AstroWall/BusinessLayer/MenuHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public void DisableStatusIcon()
appDelegate.disableStatusIcon();
}

public void SetTitleInitialising()
public void SetSubTitleInitialising()
{
appDelegate.setSubTitle("Initializing...");
}
public void SetTitleDownloading(string msg)
public void SetSubTitle(string msg)
{
appDelegate.setSubTitle(msg);
}
Expand Down Expand Up @@ -129,11 +129,6 @@ public async Task SetIconToDefault()
}
}

public void HideState()
{

}

public void PopulateSubmenuLatestPictures(List<ImgWrap> imgWrapList, State stateRef)
{

Expand Down Expand Up @@ -234,6 +229,11 @@ public async void ClickedInMenuManualCheckForNewPic()
await this.appHandler.checkForNewPics();
}

public void HideSubtitle()
{
this.appHandler.AppDelegate.HideSubTitle();
}

private void renewCancellationSource()
{
this.taskCancellationSource = new CancellationTokenSource();
Expand Down
20 changes: 10 additions & 10 deletions AstroWall/BusinessLayer/State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void SetStateInitializing()
isInitializing = true;
applicationHandler.MenuHandler.EnableStatusIcon();
applicationHandler.MenuHandler.DisableAllItems();
applicationHandler.MenuHandler.SetTitleInitialising();
applicationHandler.MenuHandler.SetSubTitleInitialising();
applicationHandler.MenuHandler.RunSpinnerIconAnimation();
}
}
Expand Down Expand Up @@ -73,7 +73,7 @@ public void SetStateDownloading(string downloadingWhat, bool disableIcon = false
applicationHandler.MenuHandler.DisableStatusIcon();
}
applicationHandler.MenuHandler.DisableAllItems();
applicationHandler.MenuHandler.SetTitleDownloading(downloadingWhat);
applicationHandler.MenuHandler.SetSubTitle(downloadingWhat);
applicationHandler.MenuHandler.RunDownloadIconAnimation();
}
}
Expand Down Expand Up @@ -122,12 +122,12 @@ public void SetStatePostProcessing()
// No reason for multiple sets
if (!isPostProcessing)
{

Console.WriteLine("State: PostProcessing");
isPostProcessing = true;
isIdle = false;
// Check to see if animation already running
if (!isInitializing && !isDownloading) applicationHandler.MenuHandler.RunSpinnerIconAnimation();
applicationHandler.MenuHandler.SetSubTitle("Processing picture...");
Console.WriteLine("State: PostProcessing");
isPostProcessing = true;
isIdle = false;
// Check to see if animation already running
if (!isInitializing && !isDownloading) applicationHandler.MenuHandler.RunSpinnerIconAnimation();
}
}
}
Expand Down Expand Up @@ -189,8 +189,8 @@ private void trySetStateIdle()
Console.WriteLine("Setting state to idle:");
isIdle = true;
applicationHandler.MenuHandler.EnableStatusIcon();
Task t =applicationHandler.MenuHandler.SetIconToDefault();
applicationHandler.MenuHandler.HideState();
Task t = applicationHandler.MenuHandler.SetIconToDefault();
applicationHandler.MenuHandler.HideSubtitle();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion AstroWall/BusinessLayer/Updates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Updates

// Misc
public UpdateLibrary.Release pendingUpdate { private set; get; }
private Version currentVersion;
public Version currentVersion { get; private set; }
private string pendingUpdatePKGpath;

public Updates(ApplicationHandler applicationHandlerArg, string currentVersionString)
Expand Down
6 changes: 6 additions & 0 deletions AstroWall/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,9 @@
<items>
<menuItem title="{{title placeholder}}" enabled="NO" identifier="header" id="XzL-bp-nyZ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<segue destination="YBH-Bd-rg8" kind="show" id="CBT-gw-Kos"/>
</connections>
</menuItem>
<menuItem title="{{state placeholder}}" enabled="NO" identifier="state" id="gSP-HT-QMc">
<modifierMask key="keyEquivalentModifierMask"/>
Expand Down Expand Up @@ -944,6 +947,9 @@
<point key="canvasLocation" x="685" y="-1164"/>
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="sqK-k6-xIF"/>
</inferredMetricsTieBreakers>
<resources>
<image name="AppIconImage" width="256" height="256"/>
<image name="MainIcon_rot_400_trans" width="24" height="24"/>
Expand Down

0 comments on commit 5c4bed4

Please sign in to comment.