[Tux4kids-commits] r1437 - in tux4kids-admin/trunk: libtux4kidsadmin tux4kids-admin/src
Michał Świtakowski
swistakers-guest at alioth.debian.org
Sat Aug 15 10:58:42 UTC 2009
Author: swistakers-guest
Date: 2009-08-15 10:58:42 +0000 (Sat, 15 Aug 2009)
New Revision: 1437
Modified:
tux4kids-admin/trunk/libtux4kidsadmin/schoolData.cpp
tux4kids-admin/trunk/libtux4kidsadmin/schoolData_p.h
tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.cpp
Log:
seperated students and computers
Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolData.cpp
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolData.cpp 2009-08-14 22:58:00 UTC (rev 1436)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolData.cpp 2009-08-15 10:58:42 UTC (rev 1437)
@@ -22,7 +22,22 @@
}
}
mainDir.setPath(path);
+ if (!mainDir.exists("students")) {
+ if (!mainDir.mkdir("students")) {
+ status = SchoolData::InitializationError;
+ return;
+ }
+ }
+ studentsDir.setPath(mainDir.absoluteFilePath("students"));
+ if (!mainDir.exists("computers")) {
+ if (!mainDir.mkdir("computers")) {
+ status = SchoolData::InitializationError;
+ return;
+ }
+ }
+ computersDir.setPath(mainDir.absoluteFilePath("computers"));
+
loadStudentDirs();
if (!database.open(path + "/school_database.db")) {
@@ -59,9 +74,9 @@
void SchoolDataPrivate::loadStudentDirs()
{
foreach(QString dirName,
- mainDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)) {
+ studentsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)) {
- StudentDir *studentDir = new StudentDir(mainDir.absoluteFilePath(dirName));
+ StudentDir *studentDir = new StudentDir(studentsDir.absoluteFilePath(dirName));
if (studentDir->status() == StudentDir::NoError) {
students.append(studentDir);
} else {
@@ -74,7 +89,7 @@
{
int computerCount = attributes->value("computer_count", 0).toInt();
for (int i = 1; i <= computerCount; ++i) {
- ComputerDir *computerDir = new ComputerDir(mainDir.absolutePath(), i);
+ ComputerDir *computerDir = new ComputerDir(computersDir.absolutePath(), i);
computers.append(computerDir);
studentComputers[computerDir] = 0;
}
@@ -113,7 +128,7 @@
{
Q_D(SchoolData);
- StudentDir *studentDir = new StudentDir(d->mainDir.absoluteFilePath(d->nextStudentDir()));
+ StudentDir *studentDir = new StudentDir(d->studentsDir.absoluteFilePath(d->nextStudentDir()));
d->students.append(studentDir);
emit studentAdded(studentDir);
Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolData_p.h
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolData_p.h 2009-08-14 22:58:00 UTC (rev 1436)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolData_p.h 2009-08-15 10:58:42 UTC (rev 1437)
@@ -31,6 +31,8 @@
SchoolData *q_ptr;
QDir mainDir;
+ QDir studentsDir;
+ QDir computersDir;
SchoolData::Status status;
QList<StudentDir *> students;
QList<ProfileDir *> profiles;
Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.cpp 2009-08-14 22:58:00 UTC (rev 1436)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.cpp 2009-08-15 10:58:42 UTC (rev 1437)
@@ -15,9 +15,7 @@
{
m_ui->setupUi(this);
- m_ui->studentsTable->setEditTriggers(QAbstractItemView::SelectedClicked
- | QAbstractItemView::EditKeyPressed
- | QAbstractItemView::DoubleClicked);
+ m_ui->studentsTable->setEditTriggers(QAbstractItemView::AllEditTriggers);
m_ui->studentsTable->setItemDelegateForColumn(StudentTableModel::StudentComputer,
new StudentTableDelegate(this));
m_studentTableProxyModel.setSourceModel(mainController->studentTableModel());
More information about the Tux4kids-commits
mailing list