summaryrefslogtreecommitdiff
path: root/src/gui/serverdialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-19 15:49:45 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-19 15:49:45 +0300
commitb30a5d2289a0b68410dee5343e148aba88ea4839 (patch)
tree9d756785b9166ced76675ad3ebe398c09b494a3c /src/gui/serverdialog.cpp
parent9a3a196dbf633a699c26d0227802a42f025c8bfd (diff)
parent164e4ed5a153ce06badb52f3a5a4dff16c58d7e6 (diff)
downloadplus-b30a5d2289a0b68410dee5343e148aba88ea4839.tar.gz
plus-b30a5d2289a0b68410dee5343e148aba88ea4839.tar.bz2
plus-b30a5d2289a0b68410dee5343e148aba88ea4839.tar.xz
plus-b30a5d2289a0b68410dee5343e148aba88ea4839.zip
Merge branch 'master' into stripped
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;
+}