Repository navigation
Expand file tree
/
Copy pathOpenRouterItem.cpp
More file actions
64 lines (56 loc) · 1.58 KB
/
Copy pathOpenRouterItem.cpp
File metadata and controls
64 lines (56 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "pch.h"
#include "OpenRouterItem.h"
#include "DataManager.h"
#include <cstdio>
COpenRouterItem::COpenRouterItem(OpenRouterWindow window)
: m_window(window)
{
}
const wchar_t* COpenRouterItem::GetItemName() const
{
switch (m_window)
{
case OpenRouterWindow::Used:
m_name_cache = L"OpenRouter Used";
break;
case OpenRouterWindow::Remaining:
m_name_cache = L"OpenRouter Remaining";
break;
default:
m_name_cache = L"OpenRouter Total";
break;
}
return m_name_cache.c_str();
}
const wchar_t* COpenRouterItem::GetItemId() const
{
switch (m_window)
{
case OpenRouterWindow::Used: return L"or-used";
case OpenRouterWindow::Remaining: return L"or-remaining";
default: return L"or-total";
}
}
const wchar_t* COpenRouterItem::GetItemLableText() const
{
return CDataManager::Instance().GetOpenRouterDisplayLabel(m_window);
}
const wchar_t* COpenRouterItem::GetItemValueText() const
{
return CDataManager::Instance().GetOpenRouterDisplayValue(m_window);
}
const wchar_t* COpenRouterItem::GetItemValueSampleText() const
{
// Size the column to a typical dollar amount so there is no excess
// right-aligned gap.
return L"$99.99";
}
int COpenRouterItem::IsDrawResourceUsageGraph() const
{
return CDataManager::Instance().GetOpenRouterGraphValue(m_window) >= 0.0f ? 1 : 0;
}
float COpenRouterItem::GetResourceUsageGraphValue() const
{
float value = CDataManager::Instance().GetOpenRouterGraphValue(m_window);
return value >= 0.0f ? value : 0.0f;
}