diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-15 23:43:22 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-15 23:43:22 +0000 |
commit | 9cea91975451a7abb6f15e08f7fb6c20efed152c (patch) | |
tree | ddf2aaf22597d8fa63a33dd62a57cb50e083f7e3 /src/gui/updatewindow.cpp | |
parent | 97cac06ae12026f4be3765f68b0aea3caf02d8f0 (diff) | |
download | mana-9cea91975451a7abb6f15e08f7fb6c20efed152c.tar.gz mana-9cea91975451a7abb6f15e08f7fb6c20efed152c.tar.bz2 mana-9cea91975451a7abb6f15e08f7fb6c20efed152c.tar.xz mana-9cea91975451a7abb6f15e08f7fb6c20efed152c.zip |
Fixed compiler warnings and added plain text file loading to resource manager.
Diffstat (limited to 'src/gui/updatewindow.cpp')
-rw-r--r-- | src/gui/updatewindow.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 75f94b4b..473cc171 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -127,25 +127,16 @@ void UpdaterWindow::action(const std::string& eventId) void UpdaterWindow::loadNews() { - browserBox->clearRows(); ResourceManager *resman = ResourceManager::getInstance(); - int contentsLength; - std::ifstream newsFile(TMW_DATADIR "data/news.txt"); - if (!newsFile.is_open()) - { - logger->log("Couldn't load news.txt"); - browserBox->addRow("Error"); - return; - } + std::vector<std::string> lines = resman->loadTextFile("news.txt"); - // Tokenize and add each line separately - std::string line(""); - while (!newsFile.eof()) + browserBox->clearRows(); + + for (unsigned int i = 0; i < lines.size(); ++i) { - getline(newsFile, line); - browserBox->addRow(line); + browserBox->addRow(lines[i]); } - newsFile.close(); + scrollArea->setVerticalScrollAmount(0); setVisible(true); } |