-
Notifications
You must be signed in to change notification settings - Fork 0
/
projectitem.cpp
115 lines (99 loc) · 2.68 KB
/
projectitem.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include "projectitem.h"
ProjectItem::ProjectItem()
{
m_ProjectName.clear();
m_Customer.clear();
m_ProjectFolder.clear();
}
ProjectItem::~ProjectItem()
{
int listSize;
listSize = m_FileInfoList.size();
for(int i = listSize-1; i >= 0 ; i--)
{
deleteFileInfoListItem(i);
qDebug() << "<ProjectItem> destructor: deleted item in the m_FileInfoList:" << i;
}
}
void ProjectItem::setProjectName(QString projectName)
{
m_ProjectName = projectName;
}
void ProjectItem::setCustomer(QString customer)
{
m_Customer = customer;
}
void ProjectItem::setProjectFolder(QString projectFolder)
{
m_ProjectFolder = projectFolder;
}
void ProjectItem::setFileInfoListItem(QString data, FileInfo::Option dataType, int itemNumber)
{
if(itemNumber <= m_FileInfoList.size())
{
switch(dataType)
{
case FileInfo::File:
m_FileInfoList.at(itemNumber)->setFileName(data);
break;
case FileInfo::Comment:
m_FileInfoList.at(itemNumber)->setComment(data);
break;
case FileInfo::Date:
QDate date;
m_FileInfoList.at(itemNumber)->setDate(date.fromString(data));
};
}else
qDebug()<< "Function <setFileInfoListItem> :itemNumber excceds m_FileInfoList size.";
}
QString ProjectItem::projectName()
{
return m_ProjectName;
}
QString ProjectItem::customer()
{
return m_Customer;
}
QString ProjectItem::projectFolder()
{
return m_ProjectFolder;
}
QString ProjectItem::fileInfoListItem(FileInfo::Option dataType, int itemNumber)
{
if(itemNumber <= m_FileInfoList.size())
{
switch(dataType)
{
case FileInfo::File:
return m_FileInfoList.at(itemNumber)->fileName();
case FileInfo::Comment:
return m_FileInfoList.at(itemNumber)->comment();
case FileInfo::Date:
return m_FileInfoList.at(itemNumber)->date().toString();
};
}
qDebug() << "Function <fileInfoListItem>: ItemNumber excceds m_FileInfoList size.";
return QString();
}
int ProjectItem::fileInfoListSize()
{
return m_FileInfoList.size();
}
void ProjectItem::appendFileInfoListItem()
{
FileInfoItem *fileInfoItem = new FileInfoItem;
m_FileInfoList.append(fileInfoItem);
}
void ProjectItem::appendFileInfoListItem(FileInfoItem *fileInfoItem)
{
m_FileInfoList.append(fileInfoItem);
}
void ProjectItem::deleteFileInfoListItem(int itemNumber)
{
if(itemNumber <= m_FileInfoList.size())
{
delete m_FileInfoList.at(itemNumber);
m_FileInfoList.removeAt(itemNumber);
}else
qDebug() << "Function <deleteFileInfoListItem>: ItemNumber excceds m_FileInfoList size.";
}