115
* Returns the instance of this class containing default values of all options
116
* \return Instance of PsiOptions
118
const PsiOptions* PsiOptions::defaults()
121
defaults_ = new PsiOptions();
126
* Reset the singleton instance of this class
127
* this delete the old instance so be sure no references are there anymore
129
void PsiOptions::reset() {
136
* initizialises the default options for a new profile
138
bool PsiOptions::newProfile()
141
if (!load(":/options/newprofile.xml")) {
144
StatusPreset(tr("Away from desk"),
145
tr("I am away from my desk. Leave a message."),
148
StatusPreset(tr("Showering"),
149
tr("I'm in the shower. You'll have to wait for me to get out."),
152
StatusPreset(tr("Eating"),
153
tr("Out eating. Mmmm.. food."),
156
StatusPreset(tr("Sleep"),
157
tr("Sleep is good. Zzzzz"),
160
StatusPreset(tr("Work"),
161
tr("Can't chat. Gotta work."),
164
StatusPreset(tr("Air"),
165
tr("Stepping out to get some fresh air."),
168
StatusPreset(tr("Movie"),
169
tr("Out to a movie. Is that OK with you?"),
172
StatusPreset(tr("Secret"),
173
tr("I'm not available right now and that's all you need to know."),
176
StatusPreset(tr("Out for the night"),
177
tr("Out for the night."),
180
StatusPreset(tr("Greece"),
181
tr("I have gone to a far away place. I will be back someday!"),
186
ToolbarPrefs buttons;
187
buttons.name = tr("Buttons");
191
buttons.keys << "button_options" << "button_status";
192
buttons.dock = Qt::DockBottom;
194
ToolbarPrefs showContacts;
195
showContacts.name = tr("Show contacts");
196
showContacts.keys << "show_offline" << "show_hidden" << "show_agents" << "show_self" << "show_statusmsg";
198
ToolbarPrefs eventNotifier;
199
eventNotifier.name = tr("Event notifier");
200
eventNotifier.keys << "event_notifier";
201
eventNotifier.dock = Qt::DockBottom;
203
QList<ToolbarPrefs> toolbars;
207
foreach(ToolbarPrefs tb, toolbars) {
209
PsiToolBar::structToOptions(this, tb);
213
setOption("options.status.auto-away.message", tr("Auto Status (idle)"));
110
220
* Loads the options present in the xml config file named.
111
221
* \param file Name of the xml config file to load
112
222
* \return Success
139
249
return saveOptions(file, "options", ApplicationInfo::optionsNS(), ApplicationInfo::version());
143
* Default (private) constructor
145
252
PsiOptions::PsiOptions()
256
autoSaveTimer_ = new QTimer(this);
257
autoSaveTimer_->setSingleShot(true);
258
autoSaveTimer_->setInterval(1000);
259
connect(autoSaveTimer_, SIGNAL(timeout()), SLOT(saveToAutoFile()));
148
261
setParent(QCoreApplication::instance());
150
264
if (!load(":/options/default.xml"))
151
265
qWarning("ERROR: Failed to load default options");
176
292
void PsiOptions::autoSave(bool autoSave, QString autoFile)
179
connect(this, SIGNAL(optionChanged(const QString&)), SLOT(saveToAutoFile()));
295
connect(this, SIGNAL(optionChanged(const QString&)), autoSaveTimer_, SLOT(start()));
296
autoFile_ = autoFile;
183
disconnect(this, SLOT(saveToAutoFile()));
299
disconnect(this, SIGNAL(optionChanged(const QString&)), autoSaveTimer_, SLOT(start()));