[Tux4kids-commits] r1414 - in tux4kids-admin/trunk: libtux4kidsadmin tux4kids-admin/plugins tux4kids-admin/plugins/dummy tux4kids-admin/plugins/tuxmathPlugin tux4kids-admin/plugins/tuxtypePlugin tux4kids-admin/src
Michał Świtakowski
swistakers-guest at alioth.debian.org
Tue Aug 11 19:40:43 UTC 2009
Author: swistakers-guest
Date: 2009-08-11 19:40:43 +0000 (Tue, 11 Aug 2009)
New Revision: 1414
Added:
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.cpp
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.h
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.ui
Modified:
tux4kids-admin/trunk/libtux4kidsadmin/profileDir.cpp
tux4kids-admin/trunk/tux4kids-admin/plugins/dummy/dummy.cpp
tux4kids-admin/trunk/tux4kids-admin/plugins/dummy/dummy.h
tux4kids-admin/trunk/tux4kids-admin/plugins/pluginInterface.h
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/CMakeLists.txt
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.cpp
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.h
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.ui
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.cpp
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.h
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.pro
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.cpp
tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.h
tux4kids-admin/trunk/tux4kids-admin/src/mainController.cpp
tux4kids-admin/trunk/tux4kids-admin/src/mainWindow.cpp
tux4kids-admin/trunk/tux4kids-admin/src/pluginManager.cpp
tux4kids-admin/trunk/tux4kids-admin/src/pluginManager.h
Log:
tuxmath widget is visible
Modified: tux4kids-admin/trunk/libtux4kidsadmin/profileDir.cpp
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/profileDir.cpp 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/libtux4kidsadmin/profileDir.cpp 2009-08-11 19:40:43 UTC (rev 1414)
@@ -9,10 +9,8 @@
ProfileDirPrivate::ProfileDirPrivate(QString path)
: status(ProfileDir::NoError)
{
- qDebug() << "PD" << path;
mainDir.setPath(path);
if (!mainDir.exists()) {
- qDebug() << "nie istnieje";
if (!QDir::root().mkpath(path)) {
status = ProfileDir::InitializationError;
return;
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/dummy/dummy.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/dummy/dummy.cpp 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/dummy/dummy.cpp 2009-08-11 19:40:43 UTC (rev 1414)
@@ -20,7 +20,12 @@
QWidget *DummyPlugin::mainWidget()
{
- return m_mainWidget;
+ return 0;
}
+void DummyPlugin::setSchoolData(SchoolData *schoolData)
+{
+ m_schoolData = schoolData;
+}
+
Q_EXPORT_PLUGIN2(DummyPlugin, DummyPlugin);
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/dummy/dummy.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/dummy/dummy.h 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/dummy/dummy.h 2009-08-11 19:40:43 UTC (rev 1414)
@@ -17,7 +17,9 @@
QString name() const;
QString version() const;
QWidget *mainWidget();
+ void setSchoolData(SchoolData *schoolData);
+
};
#endif
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/pluginInterface.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/pluginInterface.h 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/pluginInterface.h 2009-08-11 19:40:43 UTC (rev 1414)
@@ -4,7 +4,8 @@
#include <QString>
#include <QtPlugin>
-class ProfileDir;
+//class ProfileDir;
+class SchoolData;
class PluginInterface
{
@@ -15,12 +16,14 @@
virtual QString version() const = 0;
// virtual ProfileDir *newProfileDir(QString path) const = 0;
+ virtual void setSchoolData(SchoolData *schoolData) = 0;
virtual QWidget *mainWidget() = 0;
protected:
- QWidget *m_mainWidget;
+ SchoolData *m_schoolData;
+
};
Q_DECLARE_INTERFACE(PluginInterface, "org.Tux4Kids.Tux4KidsPluginInterface/0.0.2");
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/CMakeLists.txt
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/CMakeLists.txt 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/CMakeLists.txt 2009-08-11 19:40:43 UTC (rev 1414)
@@ -21,7 +21,7 @@
FIND_PACKAGE( Qt4 REQUIRED )
INCLUDE( ${QT_USE_FILE} )
-INCLUDE_DIRECTORIES( ../ ../../../libtux4kidsadmin_tuxmath ../../../libtux4kidsadmin ${CMAKE_CURRENT_BINARY_DIR} )
+INCLUDE_DIRECTORIES( ../ ../../src ../../../libtux4kidsadmin_tuxmath ../../../libtux4kidsadmin ${CMAKE_CURRENT_BINARY_DIR} )
QT4_WRAP_UI( TUXMATH_PLUGIN_UI_HEADERS ${TUXMATH_PLUGIN_UIS} )
QT4_WRAP_CPP( TUXMATH_PLUGIN_MOC_SOURCES ${TUXMATH_PLUGIN_MOC_HEADERS} )
Added: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.cpp (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.cpp 2009-08-11 19:40:43 UTC (rev 1414)
@@ -0,0 +1,14 @@
+#include "editTuxmathOptions.h"
+#include "ui_editTuxmathOptions.h"
+
+EditTuxmathOptions::EditTuxmathOptions(QWidget *parent) :
+ QDialog(parent),
+ m_ui(new Ui::EditTuxmathOptions)
+{
+ m_ui->setupUi(this);
+}
+
+EditTuxmathOptions::~EditTuxmathOptions()
+{
+ delete m_ui;
+}
Added: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.h (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.h 2009-08-11 19:40:43 UTC (rev 1414)
@@ -0,0 +1,20 @@
+#ifndef EDITTUXMATHOPTIONS_H
+a#define EDITTUXMATHOPTIONS_H
+
+#include <QtGui/QDialog>
+
+ namespace Ui {
+ class EditTuxmathOptions;
+}
+
+class EditTuxmathOptions : public QDialog {
+ Q_OBJECT
+public:
+ EditTuxmathOptions(QWidget *parent = 0);
+ ~EditTuxmathOptions();
+
+private:
+ Ui::EditTuxmathOptions *m_ui;
+};
+
+#endif // EDITTUXMATHOPTIONS_H
Added: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.ui
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.ui (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/editTuxmathOptions.ui 2009-08-11 19:40:43 UTC (rev 1414)
@@ -0,0 +1,18 @@
+<ui version="4.0" >
+ <class>EditTuxmathOptions</class>
+ <widget class="QDialog" name="EditTuxmathOptions" >
+ <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>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.cpp 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.cpp 2009-08-11 19:40:43 UTC (rev 1414)
@@ -1,11 +1,20 @@
#include "tuxmathMainWidget.h"
#include "ui_tuxmathMainWidget.h"
-TuxmathMainWidget::TuxmathMainWidget(QWidget *parent) :
+#include "schoolData.h"
+#include "selectStudentWidget.h"
+
+TuxmathMainWidget::TuxmathMainWidget(SchoolData *schoolData, QWidget *parent) :
QWidget(parent),
m_ui(new Ui::TuxmathMainWidget)
{
m_ui->setupUi(this);
+
+
+ m_studentTableModel.setSchoolData(schoolData);
+ m_selectStudentWidget = new SelectStudentWidget(this);
+ m_ui->verticalLayout->insertWidget(0, m_selectStudentWidget);
+ m_selectStudentWidget->setStudentTableModel(&m_studentTableModel);
}
TuxmathMainWidget::~TuxmathMainWidget()
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.h 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.h 2009-08-11 19:40:43 UTC (rev 1414)
@@ -2,21 +2,29 @@
#define TUXMATHMAINWIDGET_H
#include <QtGui/QWidget>
+#include <QPointer>
+#include "studentTableModel.h"
+
namespace Ui {
class TuxmathMainWidget;
}
+class SchoolData;
+class SelectStudentWidget;
+
class TuxmathMainWidget : public QWidget {
Q_OBJECT
Q_DISABLE_COPY(TuxmathMainWidget)
public:
- explicit TuxmathMainWidget(QWidget *parent = 0);
+ explicit TuxmathMainWidget(SchoolData *schoolData, QWidget *parent = 0);
virtual ~TuxmathMainWidget();
private:
+ Ui::TuxmathMainWidget *m_ui;
+ StudentTableModel m_studentTableModel;
+ QPointer<SelectStudentWidget> m_selectStudentWidget;
- Ui::TuxmathMainWidget *m_ui;
};
#endif // TUXMATHMAINWIDGET_H
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.ui
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.ui 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathMainWidget.ui 2009-08-11 19:40:43 UTC (rev 1414)
@@ -13,19 +13,36 @@
<property name="windowTitle">
<string>Form</string>
</property>
- <widget class="QLabel" name="label">
- <property name="geometry">
- <rect>
- <x>70</x>
- <y>50</y>
- <width>57</width>
- <height>16</height>
- </rect>
- </property>
- <property name="text">
- <string>tuxmath</string>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <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="setOptionsButton">
+ <property name="text">
+ <string>Set options</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
<resources/>
<connections/>
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.cpp 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.cpp 2009-08-11 19:40:43 UTC (rev 1414)
@@ -3,12 +3,13 @@
#include "tuxmathPlugin.h"
#include "tuxmathOptions.h"
+#include "schoolData.h"
+#include "tuxmathMainWidget.h"
+
TuxmathPlugin::TuxmathPlugin(QObject *parent) : QObject(parent)
{
qDebug() << "tux math plugin constructed";
- TuxmathOptions *tmp = new TuxmathOptions("/home/swistak/options");
-
}
TuxmathPlugin::~TuxmathPlugin()
@@ -28,7 +29,12 @@
QWidget *TuxmathPlugin::mainWidget()
{
- return m_mainWidget;
+ return (new TuxmathMainWidget(m_schoolData));
}
+void TuxmathPlugin::setSchoolData(SchoolData *schoolData)
+{
+ m_schoolData = schoolData;
+}
+
Q_EXPORT_PLUGIN2(TuxmathPlugin, TuxmathPlugin);
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.h 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.h 2009-08-11 19:40:43 UTC (rev 1414)
@@ -5,6 +5,8 @@
#include "pluginInterface.h"
+class SchoolData;
+
class TuxmathPlugin : public QObject, PluginInterface
{
Q_OBJECT
@@ -17,7 +19,7 @@
QString name() const;
QString version() const;
QWidget *mainWidget();
-
+ void setSchoolData(SchoolData *schoolData);
};
#endif
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.pro
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.pro 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxmathPlugin/tuxmathPlugin.pro 2009-08-11 19:40:43 UTC (rev 1414)
@@ -1,15 +1,20 @@
TEMPLATE = lib
CONFIG += plugin
INCLUDEPATH += ../ \
- ../../../libtux4kidsadmin \
- ../../../libtux4kidsadmin_tuxmath
+ ../../../libtux4kidsadmin \
+ ../../../libtux4kidsadmin_tuxmath \
+ ../../src
HEADERS = tuxmathPlugin.h \
- tuxmathMainWidget.h
+ tuxmathMainWidget.h \
+ editTuxmathOptions.h
SOURCES = tuxmathPlugin.cpp \
- tuxmathMainWidget.cpp
+ tuxmathMainWidget.cpp \
+ editTuxmathOptions.cpp
TARGET = $$qtLibraryTarget(TuxmathPlugin)
DESTDIR = ../
-FORMS += tuxmathMainWidget.ui
-LIBS += -ltux4kidsadmin -L../../../libtux4kidsadmin
-LIBS += -ltux4kidsadmintuxmath -L../../../libtux4kidsadmin_tuxmath
-
+FORMS += tuxmathMainWidget.ui \
+ editTuxmathOptions.ui
+LIBS += -ltux4kidsadmin \
+ -L../../../libtux4kidsadmin
+LIBS += -ltux4kidsadmintuxmath \
+ -L../../../libtux4kidsadmin_tuxmath
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.cpp 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.cpp 2009-08-11 19:40:43 UTC (rev 1414)
@@ -24,7 +24,12 @@
QWidget *TuxtypePlugin::mainWidget()
{
- return m_mainWidget;
+ return 0;
}
+void TuxtypePlugin::setSchoolData(SchoolData *schoolData)
+{
+ m_schoolData = schoolData;
+}
+
Q_EXPORT_PLUGIN2(TuxtypePlugin, TuxtypePlugin);
Modified: tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.h 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/plugins/tuxtypePlugin/tuxtypePlugin.h 2009-08-11 19:40:43 UTC (rev 1414)
@@ -17,7 +17,9 @@
QString name() const;
QString version() const;
QWidget *mainWidget();
+ void setSchoolData(SchoolData *schoolData);
+
};
#endif
Modified: tux4kids-admin/trunk/tux4kids-admin/src/mainController.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/mainController.cpp 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/src/mainController.cpp 2009-08-11 19:40:43 UTC (rev 1414)
@@ -20,6 +20,13 @@
m_studentTableModel.setSchoolData(m_schoolData);
m_classTableModel.setSchoolDatabase(m_schoolData->schoolDatabase());
m_teacherTableModel.setSchoolDatabase(m_schoolData->schoolDatabase());
+
+ foreach (QPluginLoader *pluginLoader, m_pluginManager.plugins()) {
+ PluginInterface *plugin = qobject_cast<PluginInterface *>(pluginLoader->instance());
+ if (plugin != 0) {
+ plugin->setSchoolData(m_schoolData);
+ }
+ }
}
MainController::~MainController()
Modified: tux4kids-admin/trunk/tux4kids-admin/src/mainWindow.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/mainWindow.cpp 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/src/mainWindow.cpp 2009-08-11 19:40:43 UTC (rev 1414)
@@ -6,6 +6,8 @@
#include "manageClassesWidget.h"
#include "manageTeachersWidget.h"
+#include <QDebug>
+
MainWindow::MainWindow(MainController *mainController, QWidget *parent) : QMainWindow(parent), m_ui(new Ui::MainWindow)
{
m_ui->setupUi(this);
@@ -16,6 +18,16 @@
m_ui->tabWidget->insertTab(0, new ManageStudentsWidget(m_mainController, this), tr("Students"));
m_ui->tabWidget->insertTab(1, new ManageClassesWidget(m_mainController, this), tr("Classes"));
m_ui->tabWidget->insertTab(2, (new ManageTeachersWidget(m_mainController, this)), tr("Teachers"));
+ foreach (QPluginLoader *pluginLoader, m_mainController->pluginManager()->plugins()) {
+ PluginInterface *plugin = qobject_cast<PluginInterface *>(pluginLoader->instance());
+ if (plugin != 0) {
+ qDebug() << "AAA" << plugin->name();
+ QWidget *widget = plugin->mainWidget();
+ if (widget != 0) {
+ m_ui->tabWidget->insertTab(3, widget, plugin->name());
+ }
+ }
+ }
connect(m_ui->actionPlugins, SIGNAL(triggered()), this, SLOT(pluginsManagerClicked()));
}
Modified: tux4kids-admin/trunk/tux4kids-admin/src/pluginManager.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/pluginManager.cpp 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/src/pluginManager.cpp 2009-08-11 19:40:43 UTC (rev 1414)
@@ -100,3 +100,8 @@
return result;
}
+QList<QPluginLoader *> PluginManager::plugins()
+{
+ return m_plugins;
+}
+
Modified: tux4kids-admin/trunk/tux4kids-admin/src/pluginManager.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/pluginManager.h 2009-08-11 18:16:32 UTC (rev 1413)
+++ tux4kids-admin/trunk/tux4kids-admin/src/pluginManager.h 2009-08-11 19:40:43 UTC (rev 1414)
@@ -24,6 +24,7 @@
bool unload(int pluginIndex);
QPluginLoader &operator[](int i);
QStringList loadedPluginNames() const;
+ QList<QPluginLoader *> plugins();
private:
QString m_pluginsPath;
More information about the Tux4kids-commits
mailing list