[Tux4kids-commits] r1435 - in tux4kids-admin/trunk: libtux4kidsadmin tux4kids-admin/src

Michał Świtakowski swistakers-guest at alioth.debian.org
Fri Aug 14 22:47:29 UTC 2009


Author: swistakers-guest
Date: 2009-08-14 22:47:29 +0000 (Fri, 14 Aug 2009)
New Revision: 1435

Modified:
   tux4kids-admin/trunk/libtux4kidsadmin/computerDir.cpp
   tux4kids-admin/trunk/libtux4kidsadmin/schoolData.cpp
   tux4kids-admin/trunk/libtux4kidsadmin/schoolData.h
   tux4kids-admin/trunk/libtux4kidsadmin/schoolData_p.h
   tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp
   tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.h
   tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase_p.h
   tux4kids-admin/trunk/tux4kids-admin/src/studentTableModel.h
Log:
part of ComputerDir logic

Modified: tux4kids-admin/trunk/libtux4kidsadmin/computerDir.cpp
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/computerDir.cpp	2009-08-14 22:25:09 UTC (rev 1434)
+++ tux4kids-admin/trunk/libtux4kidsadmin/computerDir.cpp	2009-08-14 22:47:29 UTC (rev 1435)
@@ -6,7 +6,7 @@
 ComputerDirPrivate::ComputerDirPrivate(QString path, int num)
 {
 	QDir parentDir(path);
-	QString dirName = QString("computer_%1").arg(number);
+	QString dirName = QString("computer%1").arg(number);
 	if (!parentDir.exists(dirName)) {
 		if (!parentDir.mkdir(dirName)) {
 			//report error

Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolData.cpp
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolData.cpp	2009-08-14 22:25:09 UTC (rev 1434)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolData.cpp	2009-08-14 22:47:29 UTC (rev 1435)
@@ -2,6 +2,7 @@
 #include "schoolData_p.h"
 #include "studentDir.h"
 #include "studentDir_p.h"
+#include "computerDir.h"
 
 #include <QString>
 #include <QDebug>
@@ -35,6 +36,7 @@
 	if (attributes->status() != QSettings::NoError) {
 		status = SchoolData::InitializationError;
 	}
+	createComputerDirs();
 }
 
 
@@ -68,7 +70,17 @@
 	}
 }
 
+void SchoolDataPrivate::createComputerDirs()
+{
+	int computerCount = attributes->value("computer_count", 0).toInt();
+	for (int i = 0; i <= computerCount; ++i) {
+		ComputerDir *computerDir = new ComputerDir(mainDir.absolutePath(), i);
+		computers.append(computerDir);
+		studentComputers[computerDir] = 0;
+	}
+}
 
+
 /****************** SchoolData *******************/
 
 SchoolData::SchoolData(QString path, QObject *parent)
@@ -115,7 +127,7 @@
 }
 */
 
-QList< QPointer<StudentDir> > SchoolData::students() const
+QList<StudentDir *> SchoolData::students() const
 {
 	Q_D(const SchoolData);
 	return d->students;
@@ -130,7 +142,7 @@
 int SchoolData::computerCount() const
 {
 	Q_D(const SchoolData);
-	return d->attributes->value("computer_count", 20).toInt();
+	return d->attributes->value("computer_count", 0).toInt();
 }
 
 int SchoolData::setComputerCount(int computerCount)

Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolData.h
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolData.h	2009-08-14 22:25:09 UTC (rev 1434)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolData.h	2009-08-14 22:47:29 UTC (rev 1435)
@@ -26,7 +26,7 @@
 	Status status() const;
 	StudentDir *addStudent();
 	//const StudentDir & studentDirAt(int index);
-	QList< QPointer<StudentDir> > students() const;
+	QList<StudentDir *> students() const;
 	SchoolDatabase *schoolDatabase();
 	int computerCount() const;
 	int setComputerCount(int computerCount);

Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolData_p.h
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolData_p.h	2009-08-14 22:25:09 UTC (rev 1434)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolData_p.h	2009-08-14 22:47:29 UTC (rev 1435)
@@ -5,6 +5,7 @@
 #include <QDir>
 #include <QList>
 #include <QPointer>
+#include <QHash>
 
 #include "schoolData.h"
 #include "schoolDatabase.h"
@@ -13,6 +14,7 @@
 class ProfileDir;
 class StudentDir;
 class QSettings;
+class ComputerDir;
 
 class SchoolDataPrivate
 {
@@ -24,13 +26,16 @@
 
 	QString nextStudentDir() const;
 	void loadStudentDirs();
+	void createComputerDirs();
 
 	SchoolData *q_ptr;
 
 	QDir mainDir;
 	SchoolData::Status status;
-	QList< QPointer<StudentDir> > students;
-	QList< QPointer<ProfileDir> > profiles;
+	QList<StudentDir *> students;
+	QList<ProfileDir *> profiles;
+	QList<ComputerDir *> computers;
+	QHash<ComputerDir *, StudentDir *> studentComputers;
 	QSettings *attributes;
 
 	SchoolDatabase database;

Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp	2009-08-14 22:25:09 UTC (rev 1434)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp	2009-08-14 22:47:29 UTC (rev 1435)
@@ -838,7 +838,7 @@
 	return result;
 }
 
-void SchoolDatabasePrivate::synchronizeStudents(const QList< QPointer<StudentDir> > &studentsList)
+void SchoolDatabasePrivate::synchronizeStudents(const QList<StudentDir *> &studentsList)
 {
 	QStringList existingStudents;
 
@@ -1040,7 +1040,7 @@
 	return d->teacherList();
 }
 
-void SchoolDatabase::synchronizeStudents(const QList< QPointer<StudentDir> > &studentList)
+void SchoolDatabase::synchronizeStudents(const QList<StudentDir *> &studentList)
 {
 	Q_D(SchoolDatabase);
 	d->synchronizeStudents(studentList);

Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.h
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.h	2009-08-14 22:25:09 UTC (rev 1434)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.h	2009-08-14 22:47:29 UTC (rev 1435)
@@ -32,7 +32,7 @@
 
 	QList<Class> classList() const;
 	QList<Teacher> teacherList() const;
-	void synchronizeStudents(const QList< QPointer<StudentDir> > &studentList);
+	void synchronizeStudents(const QList<StudentDir *> &studentList);
 
 protected:
 	SchoolDatabasePrivate * const d_ptr;

Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase_p.h
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase_p.h	2009-08-14 22:25:09 UTC (rev 1434)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase_p.h	2009-08-14 22:47:29 UTC (rev 1435)
@@ -37,7 +37,7 @@
 	QList<Class> classListNoJoin() const;
 	QList<Teacher> teacherList() const;
 	QList<Teacher> teacherListNoJoin() const;
-	void synchronizeStudents(const QList< QPointer<StudentDir> > &studentList);
+	void synchronizeStudents(const QList<StudentDir *> &studentList);
 	QStringList studentList() const;
 	QStringList studentListNoJoin() const;
 	void joinStudentsToClass(QList<Class> &classes) const;

Modified: tux4kids-admin/trunk/tux4kids-admin/src/studentTableModel.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/studentTableModel.h	2009-08-14 22:25:09 UTC (rev 1434)
+++ tux4kids-admin/trunk/tux4kids-admin/src/studentTableModel.h	2009-08-14 22:47:29 UTC (rev 1435)
@@ -40,7 +40,7 @@
 
 protected:
 
-	QList< QPointer<StudentDir> > m_students;
+	QList<StudentDir *> m_students;
 	QList<bool> m_studentsSelection;
 	QPointer<SchoolData> m_schoolData;
 




More information about the Tux4kids-commits mailing list