Kstars

culturelist.cpp
1/*
2 SPDX-FileCopyrightText: 2008 Jerome SONRIER <jsid@emor3j.fr.eu.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "culturelist.h"
8#include "ksfilereader.h"
9#include "Options.h"
10
12{
14 if (!fileReader.open("cnames.dat"))
15 return;
16
17 while (fileReader.hasMoreLines())
18 {
19 QString line = fileReader.readLine();
20 if (line.size() < 1)
21 continue;
22
23 QChar mode = line.at(0);
24 if (mode == 'C')
25 m_CultureList << line.mid(2).trimmed();
26 }
27
28 m_CurrentCulture = m_CultureList.at(0);
29 m_CultureList.sort();
30 for (int i = 0; i < m_CultureList.size(); ++i)
31 {
32 if (m_CultureList.at(i) == Options::skyCulture())
33 {
34 m_CurrentCulture = m_CultureList.at(i);
35 }
36 }
37}
38
40{
41 m_CurrentCulture = newName;
42}
43
45{
46 return m_CultureList.value(index);
47}
void setCurrent(QString newName)
Set the current culture name.
QString getName(int index) const
Return the name of the culture at index.
CultureList()
Create culture list and load its content from file.
I totally rewrote this because the earlier scheme of reading all the lines of a file into a buffer be...
const_reference at(qsizetype i) const const
qsizetype size() const const
T value(qsizetype i) const const
const QChar at(qsizetype position) const const
QString mid(qsizetype position, qsizetype n) const const
qsizetype size() const const
QString trimmed() const const
void sort(Qt::CaseSensitivity cs)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:04 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.