[Tux4kids-commits] r1420 - tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin

Michał Świtakowski swistakers-guest at alioth.debian.org
Wed Aug 12 20:03:20 UTC 2009


Author: swistakers-guest
Date: 2009-08-12 20:03:19 +0000 (Wed, 12 Aug 2009)
New Revision: 1420

Added:
   tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.cpp
   tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.h
   tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.ui
Modified:
   tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/CMakeLists.txt
   tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypeMainWidget.cpp
   tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.pro
Log:
+EditWordListDialog

Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/CMakeLists.txt
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/CMakeLists.txt	2009-08-12 18:43:04 UTC (rev 1419)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/CMakeLists.txt	2009-08-12 20:03:19 UTC (rev 1420)
@@ -10,14 +10,17 @@
 
 SET(TUXTYPE_PLUGIN_MOC_HEADERS 
 	tuxtypePlugin.h
-	tuxtypeMainWidget.h )
+	tuxtypeMainWidget.h
+	editWordListDialog.h )
 
 SET(TUXTYPE_PLUGIN_SOURCES 
 	tuxtypePlugin.cpp 
-	tuxtypeMainWidget.cpp )
+	tuxtypeMainWidget.cpp
+	editWordListDialog.cpp )
 
 SET(TUXTYPE_PLUGIN_UIS 
-	tuxtypeMainWidget.ui )
+	tuxtypeMainWidget.ui
+	editWordListDialog.ui )
 
 FIND_PACKAGE( Qt4 REQUIRED )
 INCLUDE( ${QT_USE_FILE} )

Added: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.cpp	                        (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.cpp	2009-08-12 20:03:19 UTC (rev 1420)
@@ -0,0 +1,47 @@
+#include "editWordListDialog.h"
+#include "ui_editWordListDialog.h"
+
+#include <QPushButton>
+
+EditWordListDialog::EditWordListDialog(QWidget *parent)
+		: QDialog(parent),
+		m_ui(new Ui::EditWordListDialog)
+{
+	m_ui->setupUi(this);
+
+	validate();
+
+	connect(m_ui->nameEdit, SIGNAL(textEdited(QString)),
+		this, SLOT(validate()));
+	connect(m_ui->wordListEdit, SIGNAL(textChanged()),
+		this, SLOT(validate()));
+	connect(m_ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
+		this, SLOT(accept()));
+	connect(m_ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()),
+		this, SLOT(reject()));
+}
+
+EditWordListDialog::~EditWordListDialog()
+{
+	delete m_ui;
+}
+
+bool EditWordListDialog::isValid()
+{
+	if (m_ui->nameEdit->text().isEmpty()
+		|| m_ui->wordListEdit->toPlainText().isEmpty()) {
+		return false;
+	}
+
+	return true;
+}
+
+void EditWordListDialog::validate()
+{
+	if (isValid()) {
+		m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
+	} else {
+		m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
+	}
+}
+

Added: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.h	                        (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.h	2009-08-12 20:03:19 UTC (rev 1420)
@@ -0,0 +1,27 @@
+#ifndef EDITWORDLISTDIALOG_H
+#define EDITWORDLISTDIALOG_H
+
+#include <QtGui/QDialog>
+
+namespace Ui {
+	class EditWordListDialog;
+}
+
+class EditWordListDialog : public QDialog
+{
+	Q_OBJECT
+public:
+	EditWordListDialog(QWidget *parent = 0);
+	~EditWordListDialog();
+
+private:
+	Ui::EditWordListDialog *m_ui;
+
+	bool isValid();
+
+private slots:
+	void validate();
+
+};
+
+#endif // EDITWORDLISTDIALOG_H

Added: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.ui
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.ui	                        (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/editWordListDialog.ui	2009-08-12 20:03:19 UTC (rev 1420)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>EditWordListDialog</class>
+ <widget class="QDialog" name="EditWordListDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <layout class="QFormLayout" name="formLayout">
+       <item row="0" column="1">
+        <widget class="QLineEdit" name="nameEdit"/>
+       </item>
+       <item row="0" column="0">
+        <widget class="QLabel" name="label">
+         <property name="text">
+          <string>Name: </string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string>Words:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPlainTextEdit" name="wordListEdit"/>
+     </item>
+     <item>
+      <widget class="QDialogButtonBox" name="buttonBox">
+       <property name="standardButtons">
+        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypeMainWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypeMainWidget.cpp	2009-08-12 18:43:04 UTC (rev 1419)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypeMainWidget.cpp	2009-08-12 20:03:19 UTC (rev 1420)
@@ -2,6 +2,7 @@
 #include "ui_tuxtypeMainWidget.h"
 #include "studentTableModel.h"
 #include "selectStudentWidget.h"
+#include "editWordListDialog.h"
 
 TuxtypeMainWidget::TuxtypeMainWidget(SchoolData *schoolData, QWidget *parent) :
 		QWidget(parent),
@@ -24,5 +25,7 @@
 
 void TuxtypeMainWidget::setWordListClicked()
 {
+	EditWordListDialog editWordList;
+	editWordList.exec();
 }
 

Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.pro
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.pro	2009-08-12 18:43:04 UTC (rev 1419)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.pro	2009-08-12 20:03:19 UTC (rev 1420)
@@ -1,16 +1,20 @@
 TEMPLATE = lib
 CONFIG += plugin
 INCLUDEPATH += ../ \
-	       ../../../libtux4kidsadmin \
-	       ../../../libtux4kidsadmin_tuxtype \
-	       ../../src
+    ../../../libtux4kidsadmin \
+    ../../../libtux4kidsadmin_tuxtype \
+    ../../src
 HEADERS = tuxtypePlugin.h \
-    tuxtypeMainWidget.h
+    tuxtypeMainWidget.h \
+    editWordListDialog.h
 SOURCES = tuxtypePlugin.cpp \
-    tuxtypeMainWidget.cpp
+    tuxtypeMainWidget.cpp \
+    editWordListDialog.cpp
 TARGET = $$qtLibraryTarget(TuxtypePlugin)
 DESTDIR = ../
-FORMS += tuxtypeMainWidget.ui
-LIBS += -ltux4kidsadmin -L../../../libtux4kidsadmin
-LIBS += -ltux4kidsadmintuxtype -L../../../libtux4kidsadmin_tuxtype
-
+FORMS += tuxtypeMainWidget.ui \
+    editWordListDialog.ui
+LIBS += -ltux4kidsadmin \
+    -L../../../libtux4kidsadmin
+LIBS += -ltux4kidsadmintuxtype \
+    -L../../../libtux4kidsadmin_tuxtype




More information about the Tux4kids-commits mailing list