summaryrefslogtreecommitdiff
path: root/src/gui/serverdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/serverdialog.cpp')
-rw-r--r--src/gui/serverdialog.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 59bdf9660..da61e105b 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -46,9 +46,9 @@
#include "net/net.h"
#include "utils/gettext.h"
+#include "utils/langs.h"
#include "utils/stringutils.h"
#include "utils/xml.h"
-#include "widgets/dropdown.h"
#include <guichan/font.hpp>
@@ -283,14 +283,10 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
// Do this manually instead of calling reflowLayout so we can enforce a
// minimum width.
- int width = 0, height = 0;
- getLayout().reflow(width, height);
- if (width < 400)
- {
- width = 400;
- getLayout().reflow(width, height);
- }
+ int width = 500;
+ int height = 350;
+ getLayout().reflow(width, height);
setContentSize(width, height);
setMinWidth(getWidth());
@@ -309,7 +305,7 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
loadServers(true);
- if (mServers.empty())
+ if (needUpdateServers())
downloadServerList();
}
@@ -488,13 +484,17 @@ void ServerDialog::downloadServerList()
}
mDownload = new Net::Download(this, listFile, &downloadUpdate);
- mDownload->setFile(mDir + "/serverlist.xml");
+ mDownload->setFile(mDir + "/" + branding.getStringValue(
+ "onlineServerFile"));
mDownload->start();
+
+ config.setValue("serverslistupdate", getDateString());
}
void ServerDialog::loadServers(bool addNew)
{
- XML::Document doc(mDir + "/serverlist.xml", false);
+ XML::Document doc(mDir + "/" + branding.getStringValue(
+ "onlineServerFile"), false);
XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "serverlist"))
@@ -744,3 +744,14 @@ void ServerDialog::updateServer(ServerInfo server, int index)
{
saveCustomServers(server, index);
}
+
+bool ServerDialog::needUpdateServers()
+{
+ if (mServers.empty() || config.getStringValue("serverslistupdate")
+ != getDateString())
+ {
+ return true;
+ }
+
+ return false;
+}