15#include "Preference.h"
17#include "IException.h"
28 void Preference::Load(
const QString &file) {
38 QString(
"The preference file %1 was not found or does not exist").arg(file),
44 for(
int i = 0; i < pvl.groups(); i++) {
48 for(
int k = 0; k < inGroup.keywords(); k++) {
50 while(outGroup.hasKeyword(inKey.name())) {
51 outGroup.deleteKeyword(inKey.name());
64 PvlGroup &performance =
findGroup(
"Performance");
65 if (performance.hasKeyword(
"GlobalThreads")) {
66 IString threadsPreference = performance[
"GlobalThreads"][0];
68 if (threadsPreference.DownCase() !=
"optimized") {
70 int threads = threadsPreference.ToQt().toInt();
73 QThreadPool::globalInstance()->setMaxThreadCount(threads);
86 Preference &Preference::Preferences(
bool unitTest) {
94 if(!setup.fileExists()) {
96 QString dirName(IString(setup.expanded()).ToQt());
109 if(userPref.fileExists()) {
127 void Preference::Shutdown() {
File name manipulation and expansion.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Preference()
Constructs a Preference object.
static Preference * p_preference
Pointer to a Preference object.
static bool p_unitTest
Flag indicating whether the file is a unitTest or not.
QString name() const
Returns the container name.
Contains multiple PvlContainers.
Container for cube-like labels.
void read(const QString &file)
Loads PVL information from a stream.
A single keyword-value pair.
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
This is free and unencumbered software released into the public domain.
Namespace for the standard library.