aboutsummaryrefslogtreecommitdiff
path: root/common/updates.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2016-04-03 11:38:06 +0200
committerEugene Sandulenko2016-04-03 11:38:06 +0200
commitd643036c206fff904232d3d7678cf0f3d57e55b4 (patch)
tree263507834121849fc91b0f30bccc43b8f40be929 /common/updates.cpp
parentc8bb597e6754783660efa8011af60e0c2d8490eb (diff)
parent5baa657f2586ec9596768920861f1645dd5a4856 (diff)
downloadscummvm-rg350-d643036c206fff904232d3d7678cf0f3d57e55b4.tar.gz
scummvm-rg350-d643036c206fff904232d3d7678cf0f3d57e55b4.tar.bz2
scummvm-rg350-d643036c206fff904232d3d7678cf0f3d57e55b4.zip
Merge pull request #735 from sev-/updates-gui
UPDATES: Add GUI. Opt-in dialog and Options
Diffstat (limited to 'common/updates.cpp')
-rw-r--r--common/updates.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/common/updates.cpp b/common/updates.cpp
new file mode 100644
index 0000000000..552324ef5a
--- /dev/null
+++ b/common/updates.cpp
@@ -0,0 +1,66 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/system.h"
+#include "common/updates.h"
+#include "common/translation.h"
+
+namespace Common {
+
+static const int updateIntervals[] = {
+ UpdateManager::kUpdateIntervalNotSupported,
+ UpdateManager::kUpdateIntervalOneDay,
+ UpdateManager::kUpdateIntervalOneWeek,
+ UpdateManager::kUpdateIntervalOneMonth,
+ -1
+};
+
+const int *UpdateManager::getUpdateIntervals() {
+ return updateIntervals;
+}
+
+int UpdateManager::normalizeInterval(int interval) {
+ const int *val = updateIntervals;
+
+ while (*val != -1)
+ if (*val > interval)
+ return *val;
+
+ return val[-1]; // Return maximal acceptable value
+}
+
+const char *UpdateManager::updateIntervalToString(int interval) {
+ switch (interval) {
+ case kUpdateIntervalNotSupported:
+ return _("Never");
+ case kUpdateIntervalOneDay:
+ return _("Daily");
+ case kUpdateIntervalOneWeek:
+ return _("Weekly");
+ case kUpdateIntervalOneMonth:
+ return _("Monthly");
+ default:
+ return _("<Bad value>");
+ }
+}
+
+} // End of namespace Common