[Tux4kids-commits] r1391 - tux4kids-admin/trunk/tux4kids-admin/src

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


Author: swistakers-guest
Date: 2009-08-07 20:29:14 +0000 (Fri, 07 Aug 2009)
New Revision: 1391

Modified:
   tux4kids-admin/trunk/tux4kids-admin/src/classTableModel.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/classTableModel.h
   tux4kids-admin/trunk/tux4kids-admin/src/editClassDialog.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/editClassDialog.h
   tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/selectClassWidget.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/selectClassWidget.h
   tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.h
   tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.h
   tux4kids-admin/trunk/tux4kids-admin/src/studentTableModel.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/teacherTableModel.cpp
Log:
class tab makes use of SelectClassWidget

Modified: tux4kids-admin/trunk/tux4kids-admin/src/classTableModel.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/classTableModel.cpp	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/classTableModel.cpp	2009-08-07 20:29:14 UTC (rev 1391)
@@ -95,14 +95,14 @@
 	void classUpdated(const Class &updatedClass);
 	void classDeleted(const Class &deletedClass);
 
-	connect(m_schoolDatabase, SIGNAL(classAdded(const Class &)), this, SLOT(addClass(const Class &)));
-	connect(m_schoolDatabase, SIGNAL(classUpdated(const Class &)), this, SLOT(updateClass(const Class &)));
-	connect(m_schoolDatabase, SIGNAL(classDeleted(const Class &)), this, SLOT(deleteClass(const Class &)));
+	connect(m_schoolDatabase, SIGNAL(classAdded(Class &)), this, SLOT(addClass(Class &)));
+	connect(m_schoolDatabase, SIGNAL(classUpdated(Class &)), this, SLOT(updateClass(Class &)));
+	connect(m_schoolDatabase, SIGNAL(classDeleted(Class &)), this, SLOT(deleteClass(Class &)));
 
 	reset();
 }
 
-void ClassTableModel::addClass(const Class & newClass)
+void ClassTableModel::addClass(Class & newClass)
 {
 	beginInsertRows(QModelIndex(), m_classes.size(), m_classes.size());
 	m_classes.append(newClass);
@@ -110,7 +110,7 @@
 	endInsertRows();
 }
 
-void ClassTableModel::updateClass(const Class &updatedClass)
+void ClassTableModel::updateClass(Class &updatedClass)
 {
 	int pos = m_classes.indexOf(updatedClass);
 	if (pos != -1) {
@@ -119,7 +119,7 @@
 	}
 }
 
-void ClassTableModel::deleteClass(const Class &deletedClass)
+void ClassTableModel::deleteClass(Class &deletedClass)
 {
 	int pos = m_classes.indexOf(deletedClass);
 	if (pos != -1) {

Modified: tux4kids-admin/trunk/tux4kids-admin/src/classTableModel.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/classTableModel.h	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/classTableModel.h	2009-08-07 20:29:14 UTC (rev 1391)
@@ -36,9 +36,9 @@
 	QList<bool> m_classesSelection;
 
 private slots:
-	void addClass(const Class & newClass);
-	void updateClass(const Class &updatedClass);
-	void deleteClass(const Class &deletedClass);
+	void addClass(Class & newClass);
+	void updateClass(Class &updatedClass);
+	void deleteClass(Class &deletedClass);
 };
 
 #endif // CLASSTABLEMODEL_H

Modified: tux4kids-admin/trunk/tux4kids-admin/src/editClassDialog.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/editClassDialog.cpp	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/editClassDialog.cpp	2009-08-07 20:29:14 UTC (rev 1391)
@@ -9,18 +9,20 @@
 
 EditClassDialog::EditClassDialog(SchoolData *schoolData, QWidget *parent) :
 		QDialog(parent),
-		m_ui(new Ui::EditClassDialog)
+		m_ui(new Ui::EditClassDialog),
+		m_schoolData(schoolData)
 {
 	m_ui->setupUi(this);
 
-	m_schoolData = schoolData;
+	m_studentTableModel.setSchoolData(m_schoolData);
+	m_teacherTableModel.setSchoolDatabase(m_schoolData->schoolDatabase());
 
 	m_selectStudentWidget = new SelectStudentWidget(this);
-	m_selectStudentWidget->studentTableModel()->setSchoolData(m_schoolData);
+	m_selectStudentWidget->setStudentTableModel(&m_studentTableModel);
 	m_ui->verticalLayout->insertWidget(1, m_selectStudentWidget);
 
 	m_selectTeacherWidget = new SelectTeacherWidget(this);
-	m_selectTeacherWidget->teacherTableModel()->setSchoolDatabase(m_schoolData->schoolDatabase());
+	m_selectTeacherWidget->setTeacherTableModel(&m_teacherTableModel);
 	m_ui->verticalLayout->insertWidget(2, m_selectTeacherWidget);
 
 	connect(m_ui->nameEdit, SIGNAL(textEdited(QString)), this, SLOT(validate()));
@@ -54,8 +56,8 @@
 	Class result;
 
 	result.setName(m_ui->nameEdit->text());
-	*result.students() = m_selectStudentWidget->studentTableModel()->selectedStudentsDirNames();
-	*result.teachers() = m_selectTeacherWidget->teacherTableModel()->selectedTeachers();
+	*result.students() = m_studentTableModel.selectedStudentsDirNames();
+	*result.teachers() = m_teacherTableModel.selectedTeachers();
 
 	return result;
 }
@@ -63,7 +65,7 @@
 void EditClassDialog::setClass(Class & newClass)
 {
 	m_ui->nameEdit->setText(newClass.name());
-	m_selectTeacherWidget->teacherTableModel()->setSelectedTeachers(*newClass.teachers());
-	m_selectStudentWidget->studentTableModel()->setSelectedStudents(*newClass.students());
+	m_teacherTableModel.setSelectedTeachers(*newClass.teachers());
+	m_studentTableModel.setSelectedStudents(*newClass.students());
 }
 

Modified: tux4kids-admin/trunk/tux4kids-admin/src/editClassDialog.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/editClassDialog.h	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/editClassDialog.h	2009-08-07 20:29:14 UTC (rev 1391)
@@ -4,6 +4,7 @@
 #include <QtGui/QDialog>
 
 #include "studentTableModel.h"
+#include "teacherTableModel.h"
 
 
 namespace Ui {
@@ -30,6 +31,8 @@
 	SelectStudentWidget *m_selectStudentWidget;
 	SelectTeacherWidget *m_selectTeacherWidget;
 	SchoolData *m_schoolData;
+	TeacherTableModel m_teacherTableModel;
+	StudentTableModel m_studentTableModel;
 
 	bool isValid() const;
 

Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp	2009-08-07 20:29:14 UTC (rev 1391)
@@ -19,7 +19,7 @@
 
 	m_selectClassWidget = new SelectClassWidget(this);
 	m_ui->verticalLayout->insertWidget(0, m_selectClassWidget);
-	m_selectClassWidget->classTableModel()->setSchoolDatabase(m_schoolDatabase);
+	m_selectClassWidget->setClassTableModel(m_mainController->classTableModel());
 
 	connect(m_ui->addClassButton, SIGNAL(clicked()), this, SLOT(addClicked()));
 	connect(m_ui->editClassButton, SIGNAL(clicked()), this, SLOT(editClicked()));

Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectClassWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectClassWidget.cpp	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectClassWidget.cpp	2009-08-07 20:29:14 UTC (rev 1391)
@@ -7,7 +7,6 @@
 {
 	m_ui->setupUi(this);
 
-	m_classTableProxyModel.setSourceModel(&m_classTableModel);
 	m_ui->classTable->setModel(&m_classTableProxyModel);
 	connect(m_ui->clearButton, SIGNAL(clicked()), m_ui->searchEdit, SLOT(clear()));
 	connect(m_ui->searchEdit, SIGNAL(textEdited(QString)), this, SLOT(searchEdited()));
@@ -19,9 +18,9 @@
 	delete m_ui;
 }
 
-ClassTableModel *SelectClassWidget::classTableModel()
+void SelectClassWidget::setClassTableModel(ClassTableModel *classTableModel)
 {
-	return &m_classTableModel;
+	m_classTableProxyModel.setSourceModel(classTableModel);
 }
 
 QTableView *SelectClassWidget::classTable()

Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectClassWidget.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectClassWidget.h	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectClassWidget.h	2009-08-07 20:29:14 UTC (rev 1391)
@@ -20,13 +20,12 @@
 	SelectClassWidget(QWidget *parent = 0);
 	~SelectClassWidget();
 
-	ClassTableModel *classTableModel();
+	void setClassTableModel(ClassTableModel *classTableModel);
 	QTableView *classTable();
 
 private:
 	Ui::SelectClassWidget *m_ui;
 
-	ClassTableModel m_classTableModel;
 	ClassTableProxyModel m_classTableProxyModel;
 	QTimer m_searchTimer;
 

Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.cpp	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.cpp	2009-08-07 20:29:14 UTC (rev 1391)
@@ -19,9 +19,9 @@
 	delete m_ui;
 }
 
-StudentTableModel *SelectStudentWidget::studentTableModel()
+void SelectStudentWidget::setStudentTableModel(StudentTableModel *studentTableModel)
 {
-	return &m_studentTableModel;
+	m_studentTableProxyModel.setSourceModel(studentTableModel);
 }
 
 void SelectStudentWidget::searchEdited()

Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.h	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.h	2009-08-07 20:29:14 UTC (rev 1391)
@@ -18,7 +18,7 @@
 	SelectStudentWidget(QWidget *parent = 0);
 	~SelectStudentWidget();
 
-	StudentTableModel *studentTableModel();
+	void setStudentTableModel(StudentTableModel *studentTableModel);
 
 private:
 	Ui::SelectStudentWidget *m_ui;

Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.cpp	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.cpp	2009-08-07 20:29:14 UTC (rev 1391)
@@ -7,7 +7,6 @@
 {
 	m_ui->setupUi(this);
 
-	m_teacherTableProxyModel.setSourceModel(&m_teacherTableModel);
 	m_ui->teacherTable->setModel(&m_teacherTableProxyModel);
 	connect(m_ui->clearButton, SIGNAL(clicked()), m_ui->searchEdit, SLOT(clear()));
 	connect(m_ui->searchEdit, SIGNAL(textEdited(QString)), this, SLOT(searchEdited()));
@@ -19,9 +18,9 @@
 	delete m_ui;
 }
 
-TeacherTableModel *SelectTeacherWidget::teacherTableModel()
+void SelectTeacherWidget::setTeacherTableModel(TeacherTableModel *teacherTableModel)
 {
-	return &m_teacherTableModel;
+	m_teacherTableProxyModel.setSourceModel(teacherTableModel);
 }
 
 void SelectTeacherWidget::searchEdited()

Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.h	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.h	2009-08-07 20:29:14 UTC (rev 1391)
@@ -17,12 +17,11 @@
 public:
 	SelectTeacherWidget(QWidget *parent = 0);
 	~SelectTeacherWidget();
-	TeacherTableModel *teacherTableModel();
+	void setTeacherTableModel(TeacherTableModel *teacherTableModel);
 
 private:
 	Ui::SelectTeacherWidget *m_ui;
 
-	TeacherTableModel m_teacherTableModel;
 	TeacherTableProxyModel m_teacherTableProxyModel;
 	QTimer m_searchTimer;
 

Modified: tux4kids-admin/trunk/tux4kids-admin/src/studentTableModel.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/studentTableModel.cpp	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/studentTableModel.cpp	2009-08-07 20:29:14 UTC (rev 1391)
@@ -106,9 +106,9 @@
 	}
 	connect(schoolData, SIGNAL(studentAdded(StudentDir*)), this,
 		SLOT(addStudent(StudentDir*)));
-	connect(schoolData->schoolDatabase(), SIGNAL(classAdded()), this, SLOT(addClass(const Class &)));
-	connect(schoolData->schoolDatabase(), SIGNAL(classUpdated(const Class &)), this, SLOT(updateClass(const Class &)));
-	connect(schoolData->schoolDatabase(), SIGNAL(classDeleted(const Class &)), this, SLOT(deleteClass(const Class &)));
+	connect(schoolData->schoolDatabase(), SIGNAL(classAdded(Class &)), this, SLOT(addClass(Class &)));
+	connect(schoolData->schoolDatabase(), SIGNAL(classUpdated(Class &)), this, SLOT(updateClass(Class &)));
+	connect(schoolData->schoolDatabase(), SIGNAL(classDeleted(Class &)), this, SLOT(deleteClass(Class &)));
 
 	reset();
 }

Modified: tux4kids-admin/trunk/tux4kids-admin/src/teacherTableModel.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/teacherTableModel.cpp	2009-08-07 19:33:38 UTC (rev 1390)
+++ tux4kids-admin/trunk/tux4kids-admin/src/teacherTableModel.cpp	2009-08-07 20:29:14 UTC (rev 1391)
@@ -98,18 +98,18 @@
 	for (int i = 0; i < m_teachers.size(); ++i) {
 		m_teachersSelection.append(false);
 	}
-	connect(m_schoolDatabase, SIGNAL(teacherAdded(const Teacher &)),
-		this, SLOT(addTeacher(const Teacher &)));
-	connect(m_schoolDatabase, SIGNAL(teacherUpdated(const Teacher &)),
-		this, SLOT(updateTeacher(const Teacher &)));
-	connect(m_schoolDatabase, SIGNAL(teacherDeleted(const Teacher &)),
-		this, SLOT(deleteTeacher(const Teacher &)));
-	connect(schoolDatabase, SIGNAL(classAdded()),
-		this, SLOT(addClass(const Class &)));
-	connect(schoolDatabase, SIGNAL(classUpdated(const Class &)),
-		this, SLOT(updateClass(const Class &)));
-	connect(schoolDatabase, SIGNAL(classDeleted(const Class &)),
-		this, SLOT(deleteClass(const Class &)));
+	connect(m_schoolDatabase, SIGNAL(teacherAdded(Teacher &)),
+		this, SLOT(addTeacher(Teacher &)));
+	connect(m_schoolDatabase, SIGNAL(teacherUpdated(Teacher &)),
+		this, SLOT(updateTeacher(Teacher &)));
+	connect(m_schoolDatabase, SIGNAL(teacherDeleted(Teacher &)),
+		this, SLOT(deleteTeacher(Teacher &)));
+	connect(schoolDatabase, SIGNAL(classAdded(Class &)),
+		this, SLOT(addClass(Class &)));
+	connect(schoolDatabase, SIGNAL(classUpdated(Class &)),
+		this, SLOT(updateClass(Class &)));
+	connect(schoolDatabase, SIGNAL(classDeleted(Class &)),
+		this, SLOT(deleteClass(Class &)));
 	reset();
 
 }




More information about the Tux4kids-commits mailing list