1 | /* |
2 | * Copyright (C) 2012 Cutehacks AS. All rights reserved. |
3 | * info@cutehacks.com |
4 | * http://cutehacks.com |
5 | * |
6 | * This file is part of Fly. |
7 | * |
8 | * Fly is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
12 | * |
13 | * Fly is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with Fly. If not, see <http://www.gnu.org/licenses/>. |
20 | */ |
21 | |
22 | #include "settings.h" |
23 | #include <QApplication> |
24 | #include <QDebug> |
25 | |
26 | Settings::Settings(QObject *parent) |
27 | : QSettings(QApplication::organizationName(), |
28 | QApplication::applicationName(), |
29 | parent) |
30 | { |
31 | } |
32 | |
33 | Settings::~Settings() |
34 | { |
35 | } |
36 | |
37 | QString Settings::airportCode() const |
38 | { |
39 | return value("AirportCode" , "OSL" ).toString(); |
40 | } |
41 | |
42 | void Settings::setAirportCode(const QString &code) |
43 | { |
44 | setValue("AirportCode" , code); |
45 | emit airportCodeChanged(); |
46 | } |
47 | |
48 | int Settings::hoursBefore() const |
49 | { |
50 | return value("HoursBefore" , 1).toInt(); |
51 | } |
52 | |
53 | void Settings::setHoursBefore(int hours) |
54 | { |
55 | setValue("HoursBefore" , hours); |
56 | emit hoursBeforeChanged(); |
57 | } |
58 | |
59 | int Settings::hoursAfter() const |
60 | { |
61 | return value("HoursAfter" , 7).toInt(); |
62 | } |
63 | |
64 | void Settings::setHoursAfter(int hours) |
65 | { |
66 | setValue("HoursAfter" , hours); |
67 | emit hoursAfterChanged(); |
68 | } |
69 | |