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

Michał Świtakowski swistakers-guest at alioth.debian.org
Wed Aug 5 22:21:45 UTC 2009


Author: swistakers-guest
Date: 2009-08-05 22:21:45 +0000 (Wed, 05 Aug 2009)
New Revision: 1381

Modified:
   tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.ui
   tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.ui
Log:
adding classes works

Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp	2009-08-05 22:06:54 UTC (rev 1380)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp	2009-08-05 22:21:45 UTC (rev 1381)
@@ -258,8 +258,8 @@
 		lastError = insertClass.lastError().text();
 		return;
 	} else {
-		db.transaction();
 
+
 		QSqlQuery getClassId;
 		getClassId.prepare("SELECT MAX(id) FROM classes;");
 		getClassId.exec();
@@ -279,18 +279,17 @@
 			Q_Q(SchoolDatabase);
 			emit q->classAdded(newClass);
 		}
-
-		if (addClassStudents(newClass)) {
-			addClassTeachers(newClass);
+		//db.transaction();
+		if (addClassTeachers(newClass)) {
+			addClassStudents(newClass);
 		}
-		db.commit();
+		//db.commit();
 	}
 }
 
 bool SchoolDatabasePrivate::addClassTeachers(const Class &newClass)
 {
 	foreach (Teacher teacher, newClass.teachers()) {
-
 		QSqlQuery addTeacher;
 		addTeacher.prepare("INSERT INTO class_teachers(id_class, id_teacher) VALUES(:id_class, :id_teacher);");
 		addTeacher.bindValue(":id_class", newClass.id());
@@ -542,7 +541,7 @@
 
 	error = false;
 
-	teacherList.prepare("SELECT first_name, last_name FROM teachers;");
+	teacherList.prepare("SELECT id, first_name, last_name FROM teachers;");
 	teacherList.exec();
 
 	if (!teacherList.isActive()) {

Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.ui
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.ui	2009-08-05 22:06:54 UTC (rev 1380)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.ui	2009-08-05 22:21:45 UTC (rev 1381)
@@ -31,7 +31,26 @@
       </layout>
      </item>
      <item>
-      <widget class="QTableView" name="studentTable"/>
+      <widget class="QTableView" name="studentTable">
+       <property name="alternatingRowColors">
+        <bool>true</bool>
+       </property>
+       <property name="selectionMode">
+        <enum>QAbstractItemView::SingleSelection</enum>
+       </property>
+       <property name="selectionBehavior">
+        <enum>QAbstractItemView::SelectRows</enum>
+       </property>
+       <property name="verticalScrollMode">
+        <enum>QAbstractItemView::ScrollPerPixel</enum>
+       </property>
+       <property name="horizontalScrollMode">
+        <enum>QAbstractItemView::ScrollPerPixel</enum>
+       </property>
+       <property name="sortingEnabled">
+        <bool>true</bool>
+       </property>
+      </widget>
      </item>
     </layout>
    </item>

Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.ui
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.ui	2009-08-05 22:06:54 UTC (rev 1380)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.ui	2009-08-05 22:21:45 UTC (rev 1381)
@@ -31,7 +31,26 @@
       </layout>
      </item>
      <item>
-      <widget class="QTableView" name="teacherTable"/>
+      <widget class="QTableView" name="teacherTable">
+       <property name="alternatingRowColors">
+        <bool>true</bool>
+       </property>
+       <property name="selectionMode">
+        <enum>QAbstractItemView::SingleSelection</enum>
+       </property>
+       <property name="selectionBehavior">
+        <enum>QAbstractItemView::SelectRows</enum>
+       </property>
+       <property name="verticalScrollMode">
+        <enum>QAbstractItemView::ScrollPerPixel</enum>
+       </property>
+       <property name="horizontalScrollMode">
+        <enum>QAbstractItemView::ScrollPerPixel</enum>
+       </property>
+       <property name="sortingEnabled">
+        <bool>true</bool>
+       </property>
+      </widget>
      </item>
     </layout>
    </item>




More information about the Tux4kids-commits mailing list