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

Michał Świtakowski swistakers-guest at alioth.debian.org
Wed Aug 19 11:42:51 UTC 2009


Author: swistakers-guest
Date: 2009-08-19 11:42:51 +0000 (Wed, 19 Aug 2009)
New Revision: 1455

Modified:
   tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.h
   tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.ui
   tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.h
Log:
student tab uses SelectStudentWidget, Computer column hiden on Windows

Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.cpp	2009-08-17 13:42:58 UTC (rev 1454)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.cpp	2009-08-19 11:42:51 UTC (rev 1455)
@@ -5,8 +5,10 @@
 #include "schoolData.h"
 #include "studentDir.h"
 #include "studentTableDelegate.h"
+#include "selectStudentWidget.h"
 
 #include <QDebug>
+#include <QTableView>
 
 ManageStudentsWidget::ManageStudentsWidget(MainController *mainController, QWidget *parent) :
 		QWidget(parent),
@@ -14,19 +16,32 @@
 		m_addStudentDialog(0)
 {
 	m_ui->setupUi(this);
+	m_mainController = mainController;
 
-	m_ui->studentsTable->setEditTriggers(QAbstractItemView::AllEditTriggers);
-	m_ui->studentsTable->setItemDelegateForColumn(StudentTableModel::StudentComputer,
+	m_selectStudentWidget = new SelectStudentWidget(this);
+	m_ui->verticalLayout->insertWidget(0, m_selectStudentWidget);
+	m_selectStudentWidget->studentTable()->
+			setEditTriggers(QAbstractItemView::AllEditTriggers);
+
+	m_selectStudentWidget->studentTable()
+			->setItemDelegateForColumn(StudentTableModel::StudentComputer,
 						      new StudentTableDelegate(this));
-	m_studentTableProxyModel.setSourceModel(mainController->studentTableModel());
-	m_ui->studentsTable->setModel(&m_studentTableProxyModel);
 
-	m_mainController = mainController;
-	connect(m_ui->addStudentButton, SIGNAL(clicked()), this, SLOT(addStudentClicked()));
-	connect(m_ui->editStudentButton, SIGNAL(clicked()), this, SLOT(editStudentClicked()));
-	connect(m_ui->deleteStudentButton, SIGNAL(clicked()), this, SLOT(deleteStudentClicked()));
-	connect(m_ui->studentsTable->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(setEditButtons()));
+	m_selectStudentWidget->setStudentTableModel(m_mainController->studentTableModel());
 
+	m_selectStudentWidget->studentTable()
+			->hideColumn(StudentTableModel::StudentSelected);
+
+	connect(m_ui->addStudentButton, SIGNAL(clicked()),
+		this, SLOT(addStudentClicked()));
+	connect(m_ui->editStudentButton, SIGNAL(clicked()),
+		this, SLOT(editStudentClicked()));
+	connect(m_ui->deleteStudentButton, SIGNAL(clicked()),
+		this, SLOT(deleteStudentClicked()));
+	connect(m_selectStudentWidget->studentTable()->selectionModel(),
+		SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+		this, SLOT(setEditButtons()));
+
 	setEditButtons();
 }
 
@@ -65,12 +80,13 @@
 		qDebug() << profileType;
 		studentDir->addProfileDir(profileType);
 	}
-	qDebug() << "po";
 }
 
 void ManageStudentsWidget::setEditButtons()
 {
-	if (m_ui->studentsTable->selectionModel()->selectedIndexes().isEmpty()) {
+	if (m_selectStudentWidget->studentTable()
+		->selectionModel()->selectedIndexes().isEmpty()) {
+
 		setEditButtonsEnabled(false);
 	} else {
 		setEditButtonsEnabled(true);

Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.h	2009-08-17 13:42:58 UTC (rev 1454)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.h	2009-08-19 11:42:51 UTC (rev 1455)
@@ -9,6 +9,7 @@
 
 class AddStudentDialog;
 class MainController;
+class SelectStudentWidget;
 
 namespace Ui {
 	class ManageStudentsWidget;
@@ -25,7 +26,7 @@
 	Ui::ManageStudentsWidget *m_ui;
 	QPointer<AddStudentDialog> m_addStudentDialog;
 	QPointer<MainController> m_mainController;
-	StudentTableProxyModel m_studentTableProxyModel;
+	QPointer<SelectStudentWidget> m_selectStudentWidget;
 
 	void setEditButtonsEnabled(bool enable);
 

Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.ui
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.ui	2009-08-17 13:42:58 UTC (rev 1454)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageStudentsWidget.ui	2009-08-19 11:42:51 UTC (rev 1455)
@@ -13,65 +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="studentsTable">
-     <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="gridStyle">
-      <enum>Qt::DashLine</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="deleteStudentButton">
-       <property name="text">
-        <string>Delete</string>
-       </property>
-      </widget>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QPushButton" name="deleteStudentButton">
+         <property name="text">
+          <string>Delete</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer">
+         <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="addStudentButton">
+         <property name="text">
+          <string>Add</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="editStudentButton">
+         <property name="text">
+          <string>Edit</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
      </item>
-     <item>
-      <spacer name="horizontalSpacer">
-       <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="addStudentButton">
-       <property name="text">
-        <string>Add</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="editStudentButton">
-       <property name="text">
-        <string>Edit</string>
-       </property>
-      </widget>
-     </item>
     </layout>
    </item>
   </layout>

Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.cpp	2009-08-17 13:42:58 UTC (rev 1454)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.cpp	2009-08-19 11:42:51 UTC (rev 1455)
@@ -8,6 +8,11 @@
 	m_ui->setupUi(this);
 
 	m_studentTableProxyModel.setSourceModel(&m_studentTableModel);
+
+#if defined(Q_WS_WIN)
+	m_ui->studentTable->hideColumn(StudentTableModel::StudentComputer);
+#endif
+
 	m_ui->studentTable->setModel(&m_studentTableProxyModel);
 
 	m_ui->filterKeyCombo->addItem(tr("Everything"),
@@ -50,3 +55,8 @@
 	m_studentTableProxyModel.setFilterKeyColumn(m_ui->filterKeyCombo->itemData(index).toInt());
 }
 
+QTableView *SelectStudentWidget::studentTable()
+{
+	return m_ui->studentTable;
+}
+

Modified: tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.h	2009-08-17 13:42:58 UTC (rev 1454)
+++ tux4kids-admin/trunk/tux4kids-admin/src/selectStudentWidget.h	2009-08-19 11:42:51 UTC (rev 1455)
@@ -7,6 +7,8 @@
 #include "studentTableModel.h"
 #include "studentTableProxyModel.h"
 
+class QTableView;
+
 namespace Ui {
 	class SelectStudentWidget;
 }
@@ -19,6 +21,7 @@
 	~SelectStudentWidget();
 
 	void setStudentTableModel(StudentTableModel *studentTableModel);
+	QTableView *studentTable();
 
 private:
 	Ui::SelectStudentWidget *m_ui;




More information about the Tux4kids-commits mailing list