Skip to content

Commit

Permalink
Add label to OverviewItem with remaining booster duration.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoeppner committed Dec 23, 2022
1 parent c90c049 commit e52e7fd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/EVEMon/Controls/OverviewItem.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions src/EVEMon/Controls/OverviewItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ protected override void OnLoad(EventArgs e)
lblCompletionTime.Font = FontFactory.GetFont("Tahoma", m_regularFontSize);
lblSkillQueueTrainingTime.Font = FontFactory.GetFont("Tahoma", m_regularFontSize);
lblExtraInfo.Font = FontFactory.GetFont("Tahoma", m_regularFontSize);
lblBoosterDuration.Font = FontFactory.GetFont("Tahoma", m_regularFontSize);

// Initializes the portrait
pbCharacterPortrait.Hide();
Expand Down Expand Up @@ -318,6 +319,7 @@ private void UpdateContrastColor()
lblRemainingTime.ForeColor = m_settingsForeColor;
lblSkillInTraining.ForeColor = m_settingsForeColor;
lblCompletionTime.ForeColor = m_settingsForeColor;
lblBoosterDuration.ForeColor = m_settingsForeColor;
}

/// <summary>
Expand Down Expand Up @@ -380,6 +382,20 @@ private void UpdateContent()
m_hasRemainingTime = false;
m_hasSkillQueueTrainingTime = false;
}

var boosterDuration = ccpCharacter.SkillQueue.BoosterDuration;

if (boosterDuration > TimeSpan.Zero)
{
lblBoosterDuration.Visible = true;
lblBoosterDuration.Text = string.Format("Booster Duration: ~{0}:{1}", (int)boosterDuration.TotalHours, boosterDuration.ToString("mm"));
}
else
{
lblBoosterDuration.Visible = false;
lblBoosterDuration.Text = "No active booster";
}

UpdateExtraData();
// Adjusts all the controls layout
PerformCustomLayout(m_isTooltip);
Expand Down Expand Up @@ -800,6 +816,14 @@ private void PerformCustomLayout(bool tooltip)
else
top += smallLabelHeight;
}
if (lblBoosterDuration.Visible)
{
size = GetSizeForLabel(lblBoosterDuration, m_regularFontSize, left, top,
rightPad, labelWidth, smallLabelHeight);
labelWidth = size.Width;
smallLabelHeight = size.Height;
top += smallLabelHeight;
}
Width = m_preferredWidth = left + labelWidth + margin;
Height = m_preferredHeight = margin + (showPortrait ? Math.Max(top, lh + margin) :
top);
Expand Down

0 comments on commit e52e7fd

Please sign in to comment.