|
1 | 1 | #include "fileio.h"
|
2 |
| -#include "schedule.h" |
3 |
| -#include "schedulecollection.h" |
| 2 | +#include "schedulemodel.h" |
| 3 | +#include "schedules.h" |
4 | 4 | #include <QFile>
|
5 | 5 | #include <QDir>
|
6 | 6 | #include <QSettings>
|
@@ -29,71 +29,71 @@ bool FileIO::DelExtracted()
|
29 | 29 | return QFile::remove(QDir::tempPath()+"/QTalarm.ogg");
|
30 | 30 | }
|
31 | 31 |
|
32 |
| -QList<Schedule*> FileIO::LoadConfig() |
| 32 | +QList<ScheduleModel*> FileIO::LoadConfig() |
33 | 33 | {
|
34 |
| - QList<Schedule*> scheduleList; |
| 34 | + QList<ScheduleModel*> scheduleList; |
35 | 35 | QString indexStr;
|
36 | 36 |
|
37 | 37 | for(int index=0;index<this->_Settings.value("AlarmCount").toInt();index++)
|
38 | 38 | {
|
39 |
| - Schedule *sched=new Schedule(this); |
| 39 | + ScheduleModel *sched=new ScheduleModel(this); |
40 | 40 |
|
41 | 41 | indexStr.setNum(index);
|
42 | 42 |
|
43 |
| - sched->SetTime(this->_Settings.value(indexStr+"Time").toTime()); |
44 |
| - if(sched->GetTime().isNull()) |
| 43 | + sched->AlarmTime = this->_Settings.value(indexStr+"Time").toTime(); |
| 44 | + if(sched->AlarmTime.isNull()) |
45 | 45 | {
|
46 | 46 | QTime reset;
|
47 | 47 | reset.setHMS(0,0,0,0);
|
48 |
| - sched->SetTime(reset); |
| 48 | + sched->AlarmTime = reset; |
49 | 49 | }
|
50 | 50 |
|
51 |
| - sched->setIsMonEnabled(this->_Settings.value(indexStr+"MonEnabled").toBool()); |
52 |
| - sched->setIsTueEnabled(this->_Settings.value(indexStr+"TueEnabled").toBool()); |
53 |
| - sched->setIsWedEnabled(this->_Settings.value(indexStr+"WedEnabled").toBool()); |
54 |
| - sched->setIsThurEnabled(this->_Settings.value(indexStr+"ThurEnabled").toBool()); |
55 |
| - sched->setIsFriEnabled(this->_Settings.value(indexStr+"FriEnabled").toBool()); |
56 |
| - sched->setIsSatEnabled(this->_Settings.value(indexStr+"SatEnabled").toBool()); |
57 |
| - sched->setIsSunEnabled(this->_Settings.value(indexStr+"SunEnabled").toBool()); |
58 |
| - sched->SetIsBastard(this->_Settings.value(indexStr+"Bastard").toBool()); |
| 51 | + sched->isMonEnabled = this->_Settings.value(indexStr+"MonEnabled").toBool(); |
| 52 | + sched->isTueEnabled = this->_Settings.value(indexStr+"TueEnabled").toBool(); |
| 53 | + sched->isWedEnabled = this->_Settings.value(indexStr+"WedEnabled").toBool(); |
| 54 | + sched->isThurEnabled = this->_Settings.value(indexStr+"ThurEnabled").toBool(); |
| 55 | + sched->isFriEnabled = this->_Settings.value(indexStr+"FriEnabled").toBool(); |
| 56 | + sched->isSatEnabled = this->_Settings.value(indexStr+"SatEnabled").toBool(); |
| 57 | + sched->isSunEnabled = this->_Settings.value(indexStr+"SunEnabled").toBool(); |
| 58 | + sched->isBastard = this->_Settings.value(indexStr+"Bastard").toBool(); |
59 | 59 |
|
60 |
| - sched->SetCustEnabled(this->_Settings.value(indexStr+"CustEnabled").toBool()); |
61 |
| - sched->SetCust(this->_Settings.value(indexStr+"CustDate").toDate()); |
| 60 | + sched->isCustomAlarmEnabled = this->_Settings.value(indexStr+"CustEnabled").toBool(); |
| 61 | + sched->CustomAlarm = this->_Settings.value(indexStr+"CustDate").toDate(); |
62 | 62 |
|
63 |
| - sched->SetCustomSoundEnabled(this->_Settings.value(indexStr+"CustomSoundEnabled").toBool()); |
64 |
| - sched->SetCustomSound(this->_Settings.value(indexStr+"CustomSound").toString()); |
| 63 | + sched->isCustomSoundEnabled = this->_Settings.value(indexStr+"CustomSoundEnabled").toBool(); |
| 64 | + sched->CustomSoundPath = this->_Settings.value(indexStr+"CustomSound").toString(); |
65 | 65 |
|
66 | 66 | scheduleList.append(sched);
|
67 | 67 | }
|
68 | 68 | return scheduleList;
|
69 | 69 | }
|
70 | 70 |
|
71 |
| -bool FileIO::Save(ScheduleCollection *Collection) |
| 71 | +bool FileIO::Save(Schedules *Collection) |
72 | 72 | {
|
73 | 73 | try
|
74 | 74 | {
|
75 |
| - QList<Schedule*> SchedList=Collection->GetScheduleList(); |
76 |
| - Schedule *currentSche; |
| 75 | + QList<ScheduleModel*> SchedList=Collection->GetScheduleList(); |
| 76 | + ScheduleModel *currentSche; |
77 | 77 | int index=0;
|
78 | 78 |
|
79 | 79 | this->_Settings.setValue("AlarmCount",SchedList.count());
|
80 | 80 | foreach(currentSche,SchedList)
|
81 | 81 | {
|
82 | 82 | QString IndexStr;
|
83 | 83 | IndexStr.setNum(index);
|
84 |
| - this->_Settings.setValue(IndexStr+"MonEnabled",currentSche->isMonEnabled()); |
85 |
| - this->_Settings.setValue(IndexStr+"TueEnabled",currentSche->isTueEnabled()); |
86 |
| - this->_Settings.setValue(IndexStr+"WedEnabled",currentSche->isWedEnabled()); |
87 |
| - this->_Settings.setValue(IndexStr+"ThurEnabled",currentSche->isThurEnabled()); |
88 |
| - this->_Settings.setValue(IndexStr+"FriEnabled",currentSche->isFriEnabled()); |
89 |
| - this->_Settings.setValue(IndexStr+"SatEnabled",currentSche->isSatEnabled()); |
90 |
| - this->_Settings.setValue(IndexStr+"SunEnabled",currentSche->isSunEnabled()); |
91 |
| - this->_Settings.setValue(IndexStr+"Bastard",currentSche->isBastard()); |
92 |
| - this->_Settings.setValue(IndexStr+"Time",currentSche->GetTime()); |
93 |
| - this->_Settings.setValue(IndexStr+"CustEnabled",currentSche->GetCustomEnabled()); |
94 |
| - this->_Settings.setValue(IndexStr+"CustDate",currentSche->GetCustomDate()); |
95 |
| - this->_Settings.setValue(IndexStr+"CustomSoundEnabled",currentSche->GetCustomSoundEnabled()); |
96 |
| - this->_Settings.setValue(IndexStr+"CustomSound",currentSche->GetCustomSound()); |
| 84 | + this->_Settings.setValue(IndexStr+"MonEnabled",currentSche->isMonEnabled); |
| 85 | + this->_Settings.setValue(IndexStr+"TueEnabled",currentSche->isTueEnabled); |
| 86 | + this->_Settings.setValue(IndexStr+"WedEnabled",currentSche->isWedEnabled); |
| 87 | + this->_Settings.setValue(IndexStr+"ThurEnabled",currentSche->isThurEnabled); |
| 88 | + this->_Settings.setValue(IndexStr+"FriEnabled",currentSche->isFriEnabled); |
| 89 | + this->_Settings.setValue(IndexStr+"SatEnabled",currentSche->isSatEnabled); |
| 90 | + this->_Settings.setValue(IndexStr+"SunEnabled",currentSche->isSunEnabled); |
| 91 | + this->_Settings.setValue(IndexStr+"Bastard",currentSche->isBastard); |
| 92 | + this->_Settings.setValue(IndexStr+"Time",currentSche->AlarmTime); |
| 93 | + this->_Settings.setValue(IndexStr+"CustEnabled",currentSche->isCustomAlarmEnabled); |
| 94 | + this->_Settings.setValue(IndexStr+"CustDate",currentSche->CustomAlarm); |
| 95 | + this->_Settings.setValue(IndexStr+"CustomSoundEnabled",currentSche->isCustomSoundEnabled); |
| 96 | + this->_Settings.setValue(IndexStr+"CustomSound",currentSche->CustomSoundPath); |
97 | 97 | this->_Settings.sync();
|
98 | 98 | index++;
|
99 | 99 | }
|
|
0 commit comments