2 * Copyright (C) 2010 Toni Gundogdu.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #define QSETTINGS_GROUP "Reminder"
28 #define QSETTINGS_REMINDER_SHOWREMINDER "showReminder"
29 #define QSETTINGS_REMINDER_FIRSTRUN "firstRun"
33 Reminder::Reminder (QWidget
*parent
, const QString
& group
)
34 : QDialog (parent
), showReminder (true), currTip (0), firstRun (true)
39 NomNom::restore_size (s
, this, QSETTINGS_GROUP
, QSize (400,200));
41 firstRunKey
= QString ("%1/%2")
43 .arg (QSETTINGS_REMINDER_FIRSTRUN
);
45 showReminderKey
= QString ("%1/%2")
47 .arg (QSETTINGS_REMINDER_SHOWREMINDER
);
49 if (s
.contains (firstRunKey
))
50 firstRun
= s
.value (firstRunKey
).toBool ();
52 if (s
.contains (showReminderKey
))
53 showReminder
= s
.value (showReminderKey
).toBool ();
55 textBrowser
->setHtml (NomNom::get_tip (currTip
, firstRun
));
63 textBrowser
->setHtml (NomNom::next_tip (currTip
));
66 // Conditional exec, or "until a more elegant way is found".
69 Reminder::conditionalExec ()
71 if (showReminder
) exec ();
75 // Done. QDialog and closeEvent design glitch workaround.
78 Reminder::done (int r
)
81 NomNom::save_size (s
, this, QSETTINGS_GROUP
);
83 showReminder
= showagainBox
->isChecked(); // Update.
85 s
.setValue (firstRunKey
, false);
86 s
.setValue (showReminderKey
, showReminder
);
95 Reminder::closeEvent (QCloseEvent
*e
)
97 QDialog::closeEvent(e
);
100 // vim: set ts=2 sw=2 tw=72 expandtab: