summaryrefslogtreecommitdiff
path: root/src/gui/updatewindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/updatewindow.cpp')
-rw-r--r--src/gui/updatewindow.cpp21
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);
}