-
Notifications
You must be signed in to change notification settings - Fork 0
/
FunctionsGroup.cpp
67 lines (59 loc) · 1005 Bytes
/
FunctionsGroup.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "FunctionsGroup.h"
FunctionsGroup::FunctionsGroup(void)
{
personal_id=0;
}
FunctionsGroup::~FunctionsGroup(void)
{
}
void FunctionsGroup::addGroup(QString temp)
{
Groups tmp;
tmp.id=0;
personal_id++;
tmp.name=temp;
groups.append(tmp);
}
bool FunctionsGroup::SaveGroupFile(QString filename)
{
QFile file(filename);
if(file.open(QIODevice::WriteOnly))
{
QDataStream tmp(&file);
if(groups.size())tmp<<groups.size();
for(int i=0; i<groups.size();i++)
{
tmp<<groups[i].name;
}
return true;
}
return false;
}
bool FunctionsGroup::LoadGroupFile(QString filename)
{
QFile file(filename);
Groups temp;
if(file.open(QIODevice::ReadOnly))
{
QDataStream tmp(&file);
int j=0;
tmp>>j;
if(j){
for(int i=0; i<j;i++)
{
tmp>>temp.name;
groups.append(temp);
int k=0;
}
}
return true;
}
return false;
}
void FunctionsGroup::editGroup(int index, QString add_group)
{
Groups temp;
temp.name=add_group;
groups.replace(index, temp);
int v=0;
}