Changeset View
Changeset View
Standalone View
Standalone View
src/systeminformation.cpp
Show First 20 Lines • Show All 128 Lines • ▼ Show 20 Line(s) | 113 | { | |||
---|---|---|---|---|---|
129 | m_complete = true; | 129 | m_complete = true; | ||
130 | } | 130 | } | ||
131 | 131 | | |||
132 | //this function maps the distribution information to an "Hardware Platform" . | 132 | //this function maps the distribution information to an "Hardware Platform" . | ||
133 | //value that is accepted by bugs.kde.org. If the values change on the server . | 133 | //value that is accepted by bugs.kde.org. If the values change on the server . | ||
134 | //side, they need to be updated here as well . | 134 | //side, they need to be updated here as well . | ||
135 | QString SystemInformation::guessBugzillaPlatform(const QString& distroInfo) const | 135 | QString SystemInformation::guessBugzillaPlatform(const QString& distroInfo) const | ||
136 | { | 136 | { | ||
137 | if ( distroInfo.contains(QStringLiteral("suse"),Qt::CaseInsensitive) ) { | 137 | static QHash<QString, QString> platforms { | ||
138 | return (QLatin1String("openSUSE RPMs")); | 138 | { QStringLiteral("suse"), QStringLiteral("openSUSE RPMs") }, | ||
139 | } else if ( distroInfo.contains(QStringLiteral("mint"),Qt::CaseInsensitive) ) { | 139 | { QStringLiteral("mint"), QStringLiteral("Mint (Ubuntu Based)") }, | ||
140 | return (QLatin1String("Mint (Ubuntu Based)")); | 140 | { QStringLiteral("lmde"), QStringLiteral("Mint (Debian Based)") }, | ||
141 | } else if ( distroInfo.contains(QStringLiteral("lmde"),Qt::CaseInsensitive) ) { | 141 | { QStringLiteral("ubuntu"), QStringLiteral("Ubuntu Packages") }, | ||
142 | return (QLatin1String("Mint (Debian Based)")); | 142 | { QStringLiteral("fedora"), QStringLiteral("Fedora RPMs") }, | ||
143 | } else if ( distroInfo.contains(QStringLiteral("ubuntu"),Qt::CaseInsensitive) ) { | 143 | { QStringLiteral("redhat"), QStringLiteral("RedHat RPMs") }, | ||
144 | return (QLatin1String("Ubuntu Packages")); | 144 | { QStringLiteral("gentoo"), QStringLiteral("Gentoo Packages") }, | ||
145 | } else if ( distroInfo.contains(QStringLiteral("fedora"),Qt::CaseInsensitive) ) { | 145 | { QStringLiteral("mandriva"), QStringLiteral("Mandriva RPMs") }, | ||
146 | return (QLatin1String("Fedora RPMs")); | 146 | { QStringLiteral("mageia"), QStringLiteral("Mageia RPMs") }, | ||
147 | } else if ( distroInfo.contains(QStringLiteral("redhat"),Qt::CaseInsensitive) ) { | 147 | { QStringLiteral("slack"), QStringLiteral("Slackware Packages") }, | ||
148 | return (QLatin1String("RedHat RPMs")); | 148 | { QStringLiteral("pclinuxos"), QStringLiteral("PCLinuxOS") }, | ||
149 | } else if ( distroInfo.contains(QStringLiteral("gentoo"),Qt::CaseInsensitive) ) { | 149 | { QStringLiteral("pardus"), QStringLiteral("Pardus Packages") }, | ||
150 | return (QLatin1String("Gentoo Packages")); | 150 | { QStringLiteral("freebsd"), QStringLiteral("FreeBSD Ports") }, | ||
151 | } else if ( distroInfo.contains(QStringLiteral("mandriva"),Qt::CaseInsensitive) ) { | 151 | { QStringLiteral("netbsd"), QStringLiteral("NetBSD pkgsrc") }, | ||
152 | return (QLatin1String("Mandriva RPMs")); | 152 | { QStringLiteral("openbsd"), QStringLiteral("OpenBSD Packages") }, | ||
153 | } else if ( distroInfo.contains(QStringLiteral("mageia"),Qt::CaseInsensitive) ) { | 153 | { QStringLiteral("solaris"), QStringLiteral("Solaris Packages") }, | ||
154 | return (QLatin1String("Mageia RPMs")); | 154 | { QStringLiteral("chakra"), QStringLiteral("Chakra") }, | ||
155 | } else if ( distroInfo.contains(QStringLiteral("slack"),Qt::CaseInsensitive) ) { | 155 | { QStringLiteral("ms windows"), QStringLiteral("MS Windows") }, | ||
156 | return (QLatin1String("Slackware Packages")); | 156 | { QStringLiteral("arch"), QStringLiteral("Archlinux Packages") } | ||
157 | } else if ( distroInfo.contains(QStringLiteral("pclinuxos"),Qt::CaseInsensitive) ) { | 157 | }; | ||
158 | return (QLatin1String("PCLinuxOS")); | 158 | for (auto it = platforms.constBegin(); it != platforms.constEnd(); ++it) { | ||
159 | } else if ( distroInfo.contains(QStringLiteral("pardus"),Qt::CaseInsensitive) ) { | 159 | if (distroInfo.contains(it.key(), Qt::CaseInsensitive)) { | ||
160 | return (QLatin1String("Pardus Packages")); | 160 | return it.value(); | ||
161 | } else if ( distroInfo.contains(QStringLiteral("freebsd"),Qt::CaseInsensitive) ) { | 161 | } | ||
162 | return (QLatin1String("FreeBSD Ports")); | 162 | } | ||
163 | } else if ( distroInfo.contains(QStringLiteral("netbsd"),Qt::CaseInsensitive) ) { | 163 | | ||
164 | return (QLatin1String("NetBSD pkgsrc")); | 164 | // Debian has multiple platforms. | ||
165 | } else if ( distroInfo.contains(QStringLiteral("openbsd"),Qt::CaseInsensitive) ) { | 165 | if (distroInfo.contains(QStringLiteral("debian"), Qt::CaseInsensitive)) { | ||
166 | return (QLatin1String("OpenBSD Packages")); | | |||
167 | } else if ( distroInfo.contains(QStringLiteral("solaris"),Qt::CaseInsensitive) ) { | | |||
168 | return (QLatin1String("Solaris Packages")); | | |||
169 | } else if ( distroInfo.contains(QStringLiteral("chakra"),Qt::CaseInsensitive) ) { | | |||
170 | return (QLatin1String("Chakra")); | | |||
171 | } else if ( distroInfo.contains(QStringLiteral("ms windows"),Qt::CaseInsensitive) ) { | | |||
172 | return (QLatin1String("MS Windows")); | | |||
173 | } else if ( distroInfo.contains(QStringLiteral("arch"),Qt::CaseInsensitive) ) { | | |||
174 | return (QLatin1String("Archlinux Packages")); | | |||
175 | } else if ( distroInfo.contains(QStringLiteral("debian"),Qt::CaseInsensitive) ) { | | |||
176 | if ( distroInfo.contains(QStringLiteral("unstable"),Qt::CaseInsensitive) ) { | 166 | if (distroInfo.contains(QStringLiteral("unstable"), Qt::CaseInsensitive)) { | ||
177 | return (QLatin1String("Debian unstable")); | 167 | return QStringLiteral("Debian unstable"); | ||
178 | } else if ( distroInfo.contains(QStringLiteral("testing"),Qt::CaseInsensitive) ) { | 168 | } else if (distroInfo.contains(QStringLiteral("testing"), Qt::CaseInsensitive)) { | ||
179 | return (QLatin1String("Debian testing")); | 169 | return QStringLiteral("Debian testing"); | ||
180 | } else { | 170 | } else { | ||
181 | return (QLatin1String("Debian stable")); | 171 | return QStringLiteral("Debian stable"); | ||
182 | } | 172 | } | ||
183 | } else { | | |||
184 | return PLATFORM_UNSPECIFIED; | | |||
185 | } | 173 | } | ||
174 | | ||||
175 | return PLATFORM_UNSPECIFIED; | ||||
186 | } | 176 | } | ||
187 | 177 | | |||
188 | //this function maps the operating system to an OS value that is accepted by bugs.kde.org. | 178 | //this function maps the operating system to an OS value that is accepted by bugs.kde.org. | ||
189 | //if the values change on the server side, they need to be updated here as well. | 179 | //if the values change on the server side, they need to be updated here as well. | ||
190 | QString SystemInformation::fetchOSBasicInformation() const | 180 | QString SystemInformation::fetchOSBasicInformation() const | ||
191 | { | 181 | { | ||
192 | //krazy:excludeall=cpp | 182 | //krazy:excludeall=cpp | ||
193 | //Get the base OS string (bugzillaOS) | 183 | //Get the base OS string (bugzillaOS) | ||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |