diff --git a/keduvocdocument/keduvoccontainermimedata.h b/keduvocdocument/keduvoccontainermimedata.h index 1bfea68..4ccbd66 100644 --- a/keduvocdocument/keduvoccontainermimedata.h +++ b/keduvocdocument/keduvoccontainermimedata.h @@ -1,43 +1,43 @@ /*************************************************************************** Copyright 2007 Frederik Gladhorn ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KEDUVOCCONTAINERMIMEDATA_H #define KEDUVOCCONTAINERMIMEDATA_H #include "keduvoccontainer.h" #include class KEduVocContainer; -class KEduVocContainerMimeData : public QMimeData +class KEDUVOCDOCUMENT_EXPORT KEduVocContainerMimeData : public QMimeData { Q_OBJECT public: void addContainer(KEduVocContainer* container); QList containerList() const; KEduVocContainerMimeData(); ~KEduVocContainerMimeData(); private: class Private; Private * const d; }; #endif diff --git a/keduvocdocument/keduvoccontainermodel.h b/keduvocdocument/keduvoccontainermodel.h index 53523c6..043e814 100644 --- a/keduvocdocument/keduvoccontainermodel.h +++ b/keduvocdocument/keduvoccontainermodel.h @@ -1,87 +1,87 @@ /*************************************************************************** Copyright 2007-2008 Frederik Gladhorn ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KEDUVOCCONTAINERMODEL_H #define KEDUVOCCONTAINERMODEL_H #include "keduvocreadonlycontainermodel.h" #include #include #include #include #include /** * Model for the tree of containers (lessons, word types). */ -class KEduVocContainerModel : public KEduVocReadonlyContainerModel +class KEDUVOCDOCUMENT_EXPORT KEduVocContainerModel : public KEduVocReadonlyContainerModel { Q_OBJECT public: enum ColumnType { ContainerNameColumn = 0, TotalCountColumn, FirstDataColumn }; explicit KEduVocContainerModel(KEduVocContainer::EnumContainerType type, QObject *parent = 0); ~KEduVocContainerModel(); virtual QVariant data(const QModelIndex &index, int role) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; virtual Qt::DropActions supportedDropActions() const; virtual QStringList mimeTypes() const; virtual QMimeData * mimeData(const QModelIndexList &indexes) const; virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); /** Change the name or checkbox of a lesson. * @param index which lesson * @param value new name * @param role * @return bool @c true it worked */ virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); QModelIndex appendContainer(const QModelIndex& parent, const QString & containerName = QString()); void deleteContainer(const QModelIndex& containerIndex); /** Indicate supported drag actions @return enum of actions supported **/ virtual Qt::DropActions supportedDragActions() const ; signals: /** * emitted when the inPractice state or name of a lesson changed. */ void documentModified(); private: class Private; Private * const d; }; #endif diff --git a/keduvocdocument/keduvoclessonmodel.h b/keduvocdocument/keduvoclessonmodel.h index e854e44..b316e4e 100644 --- a/keduvocdocument/keduvoclessonmodel.h +++ b/keduvocdocument/keduvoclessonmodel.h @@ -1,60 +1,60 @@ /*************************************************************************** Copyright 2008-2009 Frederik Gladhorn ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KEDUVOCLESSONMODEL_H #define KEDUVOCLESSONMODEL_H #include "keduvoccontainermodel.h" /** * Model for the tree of lessons. */ -class KEduVocLessonModel : public KEduVocContainerModel +class KEDUVOCDOCUMENT_EXPORT KEduVocLessonModel : public KEduVocContainerModel { Q_OBJECT public: /** When splitting a lesson into smaller ones - how to sort the entries into lessons.*/ enum SplitLessonOrder { Sorted, /**< The order of the entries in the document */ Random /**< Randomized */ }; explicit KEduVocLessonModel(QObject *parent = 0); ~KEduVocLessonModel(); virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual QVariant data(const QModelIndex &index, int role) const; virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); /** * Divide a lesson into smaller ones. * Tip: If you create a lesson that is >= the original one and use random order, you get your lesson reshuffled. Maybe that is sometimes useful. For now the lessons are appended at the end. * @param lessonIndex lesson to split * @param entriesPerLesson number of entries in each new lesson * @param order one of SplitLessonOrder */ void splitLesson(const QModelIndex& containerIndex, int entriesPerLesson, SplitLessonOrder order); protected: KEduVocContainer * rootContainer() const; private: class Private; Private * const d; }; #endif diff --git a/keduvocdocument/keduvocreadonlycontainermodel.h b/keduvocdocument/keduvocreadonlycontainermodel.h index 728198f..7aa94c4 100644 --- a/keduvocdocument/keduvocreadonlycontainermodel.h +++ b/keduvocdocument/keduvocreadonlycontainermodel.h @@ -1,74 +1,74 @@ /*************************************************************************** Copyright 2007-2008 Frederik Gladhorn ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KEDUVOCREADONLYCONTAINERMODEL_H #define KEDUVOCREADONLYCONTAINERMODEL_H #include #include #include #include #include /** * Model for the tree of containers (lessons, word types). * ReadonlyContainerModel is a read only tree model. * @see ContainerModel for its subclass that includes more options. */ -class KEduVocReadonlyContainerModel : public QAbstractItemModel +class KEDUVOCDOCUMENT_EXPORT KEduVocReadonlyContainerModel : public QAbstractItemModel { Q_OBJECT public: explicit KEduVocReadonlyContainerModel(KEduVocContainer::EnumContainerType & type, QObject *parent = 0); ~KEduVocReadonlyContainerModel(); virtual QVariant data(const QModelIndex &index, int role) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex index(KEduVocContainer* container) const; virtual QModelIndex parent(const QModelIndex &index) const; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; KEduVocContainer::EnumContainerType containerType(); // getter methods KEduVocContainer::EnumContainerType getType() const; KEduVocDocument* getDoc() const; public slots: /** Set the new source kvtml file * @param doc the new file */ virtual void setDocument(KEduVocDocument *doc); protected: virtual KEduVocContainer *rootContainer() const = 0; private: class Private; Private * const d; }; #endif diff --git a/keduvocdocument/keduvocvocabularymimedata.h b/keduvocdocument/keduvocvocabularymimedata.h index 0cee076..8026ac3 100644 --- a/keduvocdocument/keduvocvocabularymimedata.h +++ b/keduvocdocument/keduvocvocabularymimedata.h @@ -1,59 +1,59 @@ /*************************************************************************** Copyright 2007 Frederik Gladhorn ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KEDUVOCVOCABULARYMIMEDATA_H #define KEDUVOCVOCABULARYMIMEDATA_H #include #include #include class KEduVocTranslation; -class KEduVocVocabularyMimeData : public QMimeData +class KEDUVOCDOCUMENT_EXPORT KEduVocVocabularyMimeData : public QMimeData { Q_OBJECT public: struct MimeExpression { struct WordTypeStrings { QStringList wordType; // better have this hierarchical KEduVocWordFlags grammarType; }; // all data as deep copy KEduVocExpression expression; // the word types cannot be copied, thus per translation (int) save parent types and the type QMap wordTypes; }; KEduVocVocabularyMimeData(); ~KEduVocVocabularyMimeData(); void setTranslations(QList translation); QList translationList() const; QList expressionList() const; QVariant retrieveData(const QString & mimeType, QVariant::Type type) const; QStringList formats() const; private: class Private; Private * const d; }; #endif diff --git a/keduvocdocument/keduvocvocabularymodel.h b/keduvocdocument/keduvocvocabularymodel.h index 46ea2be..bf3c837 100644 --- a/keduvocdocument/keduvocvocabularymodel.h +++ b/keduvocdocument/keduvocvocabularymodel.h @@ -1,130 +1,130 @@ /*************************************************************************** Copyright 2007 Frederik Gladhorn ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KEDUVOCVOCABULARYMODEL_H #define KEDUVOCVOCABULARYMODEL_H #include #include #include #include class KEduVocDocument; class KEduVocLesson; /** @author Frederik Gladhorn */ -class KEduVocVocabularyModel : public QAbstractTableModel +class KEDUVOCDOCUMENT_EXPORT KEduVocVocabularyModel : public QAbstractTableModel { Q_OBJECT public: enum entryColumns { Translation = 0, Pronunciation, WordClass, Synonym, Antonym, Example, Comment, Paraphrase, EntryColumnsMAX }; enum roles { TranslationRole = Qt::UserRole, EntryRole, LocaleRole, AudioRole, ImageRole }; KEduVocVocabularyModel(bool show, QObject *parent = 0); ~KEduVocVocabularyModel(); int rowCount(const QModelIndex&) const; int columnCount(const QModelIndex&) const; QVariant data(const QModelIndex&, int) const; bool setData(const QModelIndex &index, const QVariant &value, int role); Qt::ItemFlags flags(const QModelIndex &index) const; QFont font(int translation) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; /** * Returns the name of the entryColumns column */ static QString columnTitle(KEduVocDocument *document, int translation, int column); /** * Returns which translation this column matches. It starts from 0 and increases every * EntryColumnMax columns */ static int translation(int column); /** * Returns the type of the column specified. Translation types are multiples of * EntryColumnsMAX */ static int columnType(int column); QModelIndex appendEntry(KEduVocExpression *expression = 0); bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex()); QStringList mimeTypes() const; QMimeData * mimeData(const QModelIndexList &indexes) const; void resetLanguages(); public slots: void setDocument(KEduVocDocument *doc); /** * Whatever the contents, the model will now display it. * @param container */ void showContainer(KEduVocContainer *container); /** * * @param lessonContainer */ void setLesson(KEduVocLesson *lessonContainer); KEduVocLesson * lesson(); void setFont(QFont & font, int translation); KEduVocContainer::EnumEntriesRecursive recursive(); /** * Show the entries of child lessons in selected lessons * @param show */ void setRecursive(bool show); private: class Private; Private * const d; }; Q_DECLARE_METATYPE(KEduVocExpression*) #endif diff --git a/keduvocdocument/keduvocwordclassmodel.h b/keduvocdocument/keduvocwordclassmodel.h index b92246b..f5f11cd 100644 --- a/keduvocdocument/keduvocwordclassmodel.h +++ b/keduvocdocument/keduvocwordclassmodel.h @@ -1,47 +1,47 @@ /*************************************************************************** Copyright 2008 Frederik Gladhorn ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KEDUVOCWORDCLASSMODEL_H #define KEDUVOCWORDCLASSMODEL_H #include "keduvoccontainermodel.h" /** * Model for the tree of word types. */ -class KEduVocWordClassModel : public KEduVocContainerModel +class KEDUVOCDOCUMENT_EXPORT KEduVocWordClassModel : public KEduVocContainerModel { Q_OBJECT public: explicit KEduVocWordClassModel(QObject *parent = 0); ~KEduVocWordClassModel(); // TODO implement this function QModelIndex appendWordClass(const QModelIndex& parent, const QString & wordTypeName = QString()); // TODO implement this function void deleteWordClass(const QModelIndex& wordTypeIndex); protected: KEduVocContainer * rootContainer() const; private: class Private; Private * const d; }; #endif