[Tux4kids-commits] r1392 - in tux4kids-admin/trunk: libtux4kidsadmin tux4kids-admin/src
Michał Świtakowski
swistakers-guest at alioth.debian.org
Fri Aug 7 21:17:17 UTC 2009
Author: swistakers-guest
Date: 2009-08-07 21:17:17 +0000 (Fri, 07 Aug 2009)
New Revision: 1392
Modified:
tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp
tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp
tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.cpp
tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.h
tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.ui
tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.cpp
tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.h
Log:
teacher tab makes use of SelectTeacherWidget + fixes in database
Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp 2009-08-07 20:29:14 UTC (rev 1391)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp 2009-08-07 21:17:17 UTC (rev 1392)
@@ -535,7 +535,7 @@
if (error) {
return QList<Class>();
}
-
+qDebug() << "aaaa";
QSqlQuery classTeachers;
classTeachers.prepare("SELECT id_class, id_teacher FROM class_teachers ORDER BY id_class ASC;");
classTeachers.exec();
@@ -544,7 +544,7 @@
lastError = classTeachers.lastError().text();
return QList<Class>();
}
-
+qDebug() << "bbb";
QSqlRecord classTeachersRecord = classTeachers.record();
int oldClassId = -1;
int classIndex = 0;
@@ -570,16 +570,16 @@
}
}
}
-
+qDebug() << "cccc";
QSqlQuery students;
- students.prepare("SELECT id, profile_name;");
+ students.prepare("SELECT id, profile_name FROM students;");
students.exec();
if (!students.isActive()) {
error = true;
lastError = students.lastError().text();
return QList<Class>();
}
-
+qDebug() << "dddd";
QSqlQuery classStudents;
classStudents.prepare("SELECT id_class, id_student FROM class_students ORDER BY id_class ASC;");
classStudents.exec();
@@ -588,7 +588,7 @@
lastError = classStudents.lastError().text();
return QList<Class>();
}
-
+qDebug() << "eeee";
QSqlRecord classStudentsRecord = classStudents.record();
QSqlRecord studentsRecord = students.record();
oldClassId = -1;
@@ -665,16 +665,16 @@
if (error) {
return QList<Teacher>();
}
-
+qDebug() << "AAA";
QSqlQuery classTeachers;
- classTeachers.prepare("SELECT id_class, id_teacher FROM class_teachers ORDER BY id_teachers ASC;");
+ classTeachers.prepare("SELECT id_class, id_teacher FROM class_teachers ORDER BY id_teacher ASC;");
classTeachers.exec();
if (!classTeachers.isActive()) {
error = true;
lastError = classTeachers.lastError().text();
return QList<Teacher>();
}
-
+qDebug() << "BBBB";
QSqlRecord classTeachersRecord = classTeachers.record();
int oldTeacherId = -1;
Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp 2009-08-07 20:29:14 UTC (rev 1391)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp 2009-08-07 21:17:17 UTC (rev 1392)
@@ -20,6 +20,7 @@
m_selectClassWidget = new SelectClassWidget(this);
m_ui->verticalLayout->insertWidget(0, m_selectClassWidget);
m_selectClassWidget->setClassTableModel(m_mainController->classTableModel());
+ m_selectClassWidget->classTable()->hideColumn(ClassTableModel::ClassSelected);
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/manageTeachersWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.cpp 2009-08-07 20:29:14 UTC (rev 1391)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.cpp 2009-08-07 21:17:17 UTC (rev 1392)
@@ -2,8 +2,10 @@
#include "ui_manageTeachersWidget.h"
#include "mainController.h"
#include "editTeacherDialog.h"
+#include "selectTeacherWidget.h"
#include <QDebug>
+#include <QTableView>
ManageTeachersWidget::ManageTeachersWidget(MainController *mainController, QWidget *parent) :
QWidget(parent),
@@ -13,13 +15,16 @@
{
m_ui->setupUi(this);
- m_teacherTableProxyModel.setSourceModel(m_mainController->teacherTableModel());
- m_ui->teachersTable->setModel(&m_teacherTableProxyModel);
+ m_selectTeacherWidget = new SelectTeacherWidget(this);
+ m_ui->verticalLayout->insertWidget(0, m_selectTeacherWidget);
+ m_selectTeacherWidget->setTeacherTableModel(m_mainController->teacherTableModel());
+ m_selectTeacherWidget->teacherTable()->
+ hideColumn(TeacherTableModel::TeacherSelected);
connect(m_ui->addTeacherButton, SIGNAL(clicked()), this, SLOT(addClicked()));
connect(m_ui->editTeacherButton, SIGNAL(clicked()), this, SLOT(editClicked()));
connect(m_ui->deleteTeacherButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
- connect(m_ui->teachersTable->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(setEditButtons()));
+ connect(m_selectTeacherWidget->teacherTable()->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(setEditButtons()));
setEditButtons();
}
@@ -76,7 +81,7 @@
void ManageTeachersWidget::setEditButtons()
{
- if (m_ui->teachersTable->selectionModel()->selectedIndexes().isEmpty()) {
+ if (m_selectTeacherWidget->teacherTable()->selectionModel()->selectedIndexes().isEmpty()) {
setEditButtonsEnabled(false);
} else {
setEditButtonsEnabled(true);
Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.h 2009-08-07 20:29:14 UTC (rev 1391)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.h 2009-08-07 21:17:17 UTC (rev 1392)
@@ -12,6 +12,7 @@
class MainController;
class EditTeacherDialog;
+class SelectTeacherWidget;
class ManageTeachersWidget : public QWidget
{
@@ -23,9 +24,10 @@
private:
Ui::ManageTeachersWidget *m_ui;
QPointer<MainController> m_mainController;
- TeacherTableProxyModel m_teacherTableProxyModel;
QPointer<EditTeacherDialog> m_addTeacherDialog;
QPointer<EditTeacherDialog> m_editTeacherDialog;
+ QPointer<SelectTeacherWidget> m_selectTeacherWidget;
+
void setEditButtonsEnabled(bool enable);
private slots:
Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.ui
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.ui 2009-08-07 20:29:14 UTC (rev 1391)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.ui 2009-08-07 21:17:17 UTC (rev 1392)
@@ -13,62 +13,47 @@
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QTableView" name="teachersTable">
- <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>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QPushButton" name="deleteTeacherButton">
- <property name="text">
- <string>Delete</string>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QPushButton" name="deleteTeacherButton">
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="addTeacherButton">
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="editTeacherButton">
+ <property name="text">
+ <string>Edit</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item>
- <spacer name="spacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="addTeacherButton">
- <property name="text">
- <string>Add</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="editTeacherButton">
- <property name="text">
- <string>Edit</string>
- </property>
- </widget>
- </item>
</layout>
</item>
</layout>
Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.cpp 2009-08-07 20:29:14 UTC (rev 1391)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.cpp 2009-08-07 21:17:17 UTC (rev 1392)
@@ -23,6 +23,11 @@
m_teacherTableProxyModel.setSourceModel(teacherTableModel);
}
+QTableView *SelectTeacherWidget::teacherTable()
+{
+ return m_ui->teacherTable;
+}
+
void SelectTeacherWidget::searchEdited()
{
m_searchTimer.start(250);
Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.h 2009-08-07 20:29:14 UTC (rev 1391)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectTeacherWidget.h 2009-08-07 21:17:17 UTC (rev 1392)
@@ -11,6 +11,8 @@
class SelectTeacherWidget;
}
+class QTableView;
+
class SelectTeacherWidget : public QWidget
{
Q_OBJECT
@@ -18,6 +20,7 @@
SelectTeacherWidget(QWidget *parent = 0);
~SelectTeacherWidget();
void setTeacherTableModel(TeacherTableModel *teacherTableModel);
+ QTableView *teacherTable();
private:
Ui::SelectTeacherWidget *m_ui;
More information about the Tux4kids-commits
mailing list