aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_wire/UpdateTime.cpp
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Library/ml_wire/UpdateTime.cpp
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Plugins/Library/ml_wire/UpdateTime.cpp')
-rw-r--r--Src/Plugins/Library/ml_wire/UpdateTime.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/Src/Plugins/Library/ml_wire/UpdateTime.cpp b/Src/Plugins/Library/ml_wire/UpdateTime.cpp
new file mode 100644
index 00000000..008a6118
--- /dev/null
+++ b/Src/Plugins/Library/ml_wire/UpdateTime.cpp
@@ -0,0 +1,62 @@
+#include "main.h"
+#include "api__ml_wire.h"
+#include "UpdateTime.h"
+
+__time64_t Update::times[] = {0, // TIME_MANUALLY
+60 /* 1 minute */ * 60 /* 1 hour */ * 24 /* 1 day */ * 7 /* 1 week */, // TIME_WEEKLY
+60 /* 1 minute */ * 60 /* 1 hour */ * 24 /* 1 day */, // TIME_DAILY
+60 /* 1 minute */ * 60 /* 1 hour */, // TIME_HOURLY
+};
+
+const wchar_t *Update::GetTitle( int position, wchar_t *buffer, int bufferMax )
+{
+ if ( NULL == buffer )
+ return NULL;
+
+ INT stringId = IDS_ERROR_FYEO;
+ switch ( position )
+ {
+ case TIME_MANUALLY:
+ stringId = IDS_UPD_MANUALLY;
+ break;
+ case TIME_WEEKLY:
+ stringId = IDS_UPD_WEEK;
+ break;
+ case TIME_DAILY:
+ stringId = IDS_UPD_DAY;
+ break;
+ case TIME_HOURLY:
+ stringId = IDS_UPD_HOUR;
+ break;
+ }
+ return WASABI_API_LNGSTRINGW_BUF( stringId, buffer, bufferMax );
+}
+
+bool Update::GetAutoUpdate(int selection)
+{
+ if (selection == TIME_MANUALLY)
+ return false;
+ else
+ return true;
+}
+
+__time64_t Update::GetTime(int selection)
+{
+ if (selection >= 0 && selection < TIME_NUMENTRIES)
+ return times[selection];
+ else
+ return 0;
+}
+
+int Update::GetSelection(__time64_t selTime, bool autoUpdate)
+{
+ if (!autoUpdate)
+ return TIME_MANUALLY;
+
+ for (int i = TIME_WEEKLY;i < TIME_NUMENTRIES;i++)
+ if (selTime >= times[i])
+ return i;
+
+ return TIME_DAILY;
+
+} \ No newline at end of file