]> Git trees. - libqmvoc.git/commitdiff
Initial port of KWordQuiz to Qt4/KDE4. It compiles and runs, but a lot of work remains.
authorPeter Hedlund <peter@peterandlinda.com>
Sun, 16 Oct 2005 20:44:05 +0000 (20:44 +0000)
committerPeter Hedlund <peter@peterandlinda.com>
Sun, 16 Oct 2005 20:44:05 +0000 (20:44 +0000)
svn path=/branches/work/kwordquiz/src/prefleitner.h; revision=471217

17 files changed:
kwordquiz/keduvocdocument.cpp
kwordquiz/keduvocdocument.h
kwordquiz/keduvocexpression.h
kwordquiz/keduvocgrammar.cpp
kwordquiz/keduvocgrammar.h
kwordquiz/keduvockvtmlreader.cpp
kwordquiz/keduvockvtmlreader.h
kwordquiz/keduvockvtmlwriter.cpp
kwordquiz/keduvockvtmlwriter.h
kwordquiz/keduvocwqlwriter.h
kwordquiz/leitnersystem.cpp
kwordquiz/leitnersystem.h
kwordquiz/leitnersystemview.cpp
kwordquiz/leitnersystemview.h
kwordquiz/prefleitner.cpp
kwordquiz/prefleitner.h
kwordquiz/prefleitnerbase.ui

index f139bdec20b042692bf18041cc9511d800421393..618945318b71967415a8131fe5f44d2a6d95dec2 100644 (file)
 #include "keduvocdocument.h"
 
 #include <qfileinfo.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <QTextStream>
+#include <QtAlgorithms>
 
 #include <kapplication.h>
 #include <klocale.h>
@@ -100,7 +104,7 @@ bool KEduVocDocument::open(const KURL& url, bool /*append*/)
   if (KIO::NetAccess::download( url, tmpfile, 0 ))
   {
     QFile f(tmpfile);
-    if (!f.open(IO_ReadOnly))
+    if (!f.open(QIODevice::ReadOnly))
     {
       KMessageBox::error(0, i18n("<qt>Cannot open file<br><b>%1</b></qt>").arg(url.path()));
       return false;
@@ -111,7 +115,7 @@ bool KEduVocDocument::open(const KURL& url, bool /*append*/)
     bool read = false;
     while (!read) {
 
-      QApplication::setOverrideCursor( waitCursor );
+      QApplication::setOverrideCursor( Qt::WaitCursor );
       switch (ft) {
         case kvtml:
         {
@@ -213,13 +217,13 @@ bool KEduVocDocument::saveAs(QObject *parent, const KURL & url, FileType ft, con
 
     QFile f(tmp.path());
 
-    if (!f.open(IO_WriteOnly))
+    if (!f.open(QIODevice::WriteOnly))
     {
       KMessageBox::error(0, i18n("<qt>Cannot write to file<br><b>%1</b></qt>").arg(tmp.path()));
       return false;
     }
 
-    QApplication::setOverrideCursor( waitCursor );
+    QApplication::setOverrideCursor(Qt::WaitCursor);
     switch (ft) {
       case kvtml: {
         KEduVocKvtmlWriter kvtmlWriter(&f);
@@ -495,8 +499,8 @@ void KEduVocDocument::removeIdentifier(int index)
 {
   if (index < (int)m_identifiers.size() && index >= 1 )
   {
-    m_identifiers.erase(m_identifiers.at(index));
-    QValueList<KEduVocExpression>::iterator it;
+    m_identifiers.takeAt(index);
+    Q3ValueList<KEduVocExpression>::iterator it;
     for (it = m_vocabulary.begin(); it != m_vocabulary.end(); ++it)
       (*it).removeTranslation(index);
   }
@@ -661,7 +665,7 @@ bool KEduVocDocument::sort(int index)
 
     sortAscending = m_sortIdentifier[index];
     sortIndex = index;
-    qHeapSort(m_vocabulary);
+    ///@todo port qStableSort(m_vocabulary);
     m_sortIdentifier[index] = !m_sortIdentifier[index];
     result = m_sortIdentifier[index];
   }
@@ -838,7 +842,7 @@ public:
 
 void KEduVocDocument::resetEntry(int index, int lesson)
 {
-  QValueList<KEduVocExpression>::iterator it;
+  Q3ValueList<KEduVocExpression>::iterator it;
   if (index < 0)
   {
     for (it = m_vocabulary.begin(); it != m_vocabulary.end(); ++it)
@@ -893,9 +897,9 @@ QString KEduVocDocument::lessonDescription(int idx) const
 }
 
 
-QValueList<int> KEduVocDocument::lessonsInQuery() const
+Q3ValueList<int> KEduVocDocument::lessonsInQuery() const
 {
-  QValueList<int> iqvec;
+  Q3ValueList<int> iqvec;
   for (unsigned i = 0; i < m_lessonsInQuery.size(); i++)
     if (m_lessonsInQuery[i]) {
       iqvec.push_back(i+1);   // Offset <no lesson>
@@ -905,7 +909,7 @@ QValueList<int> KEduVocDocument::lessonsInQuery() const
 }
 
 
-void KEduVocDocument::setLessonsInQuery(QValueList<int> lesson_iq)
+void KEduVocDocument::setLessonsInQuery(Q3ValueList<int> lesson_iq)
 {
   m_lessonsInQuery.clear();
   for (unsigned i = 0; i < m_lessonDescriptions.size(); i++)
@@ -1025,7 +1029,7 @@ int KEduVocDocument::search(QString substr, int id, int first, int last, bool wo
 KEduVocDocument::FileType KEduVocDocument::detectFileType(const QString &filename)
 {
    QFile f( filename );
-   if (!f.open( IO_ReadOnly ))
+   if (!f.open( QIODevice::ReadOnly ))
      return csv;
 
    QDataStream is( &f );
@@ -1099,18 +1103,18 @@ public:
   KEduVocExpression *exp;
 };
 
-typedef QValueList<ExpRef> ExpRefList;
+typedef Q3ValueList<ExpRef> ExpRefList;
 
 int KEduVocDocument::cleanUp()
 {
   int count = 0;
   KEduVocExpression *kve1, *kve2;
   ExpRefList shadow;
-  QValueList<int> to_delete;
+  Q3ValueList<int> to_delete;
 
   for (int i = 0; i < (int) m_vocabulary.size(); i++)
     shadow.push_back (ExpRef (entry(i), i));
-  qHeapSort(shadow.begin(), shadow.end());
+  ///@todo port qStableSort(shadow.begin(), shadow.end());
 
 #ifdef CLEAN_BUG
   ofstream sso ("shadow.out");
@@ -1155,7 +1159,7 @@ int KEduVocDocument::cleanUp()
   f_ent_percent = to_delete.size () / 100.0;
   emit progressChanged(this, 0);
 
-  qHeapSort(to_delete.begin(), to_delete.end());
+  ///@todo port qStableSort(to_delete.begin(), to_delete.end());
   //std::sort (to_delete.begin(), to_delete.end() );
   for (int i = (int) to_delete.size()-1; i >= 0; i--) {
     ent_no++;
index 00ee84f03f415894defe64fe0dcaf9b2db209d1d..c41400a8786ac17be9019b67523f19ec27f7d16d 100644 (file)
 
 #include <qobject.h>
 #include <qfont.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <QTextStream>
 #include <kurl.h>
 
 #include "keduvocexpression.h"
@@ -544,10 +547,10 @@ class KEduVocDocument : public QObject
   QString lessonDescription(int index) const;
 
   /** returns lessons in current query  */
-  QValueList<int> lessonsInQuery() const;
+  Q3ValueList<int> lessonsInQuery() const;
 
   /** sets lessons in current query  */
-  void setLessonsInQuery(QValueList<int>);
+  void setLessonsInQuery(Q3ValueList<int>);
 
   inline QStringList lessonDescriptions() const { return m_lessonDescriptions; }
 
@@ -651,7 +654,7 @@ protected:
  private:
   bool                  m_dirty;
   KURL                  m_url;
-  QValueList<bool>      m_sortIdentifier;
+  Q3ValueList<bool>      m_sortIdentifier;
   bool                  m_sortLesson;
   bool                  m_unknownAttribute;
   bool                  m_unknownElement;
@@ -662,15 +665,15 @@ protected:
   int                   m_cols;
   int                   m_lines;
   int                   m_currentLesson;
-  QValueList<int>       m_extraSizeHints;
-  QValueList<int>       m_sizeHints;
+  Q3ValueList<int>       m_extraSizeHints;
+  Q3ValueList<int>       m_sizeHints;
   QFont*                m_font;
 
   QString               m_generator;
   QString               m_queryorg;
   QString               m_querytrans;
-  QValueList<KEduVocExpression>  m_vocabulary;
-  QValueList<bool>      m_lessonsInQuery;
+  Q3ValueList<KEduVocExpression>  m_vocabulary;
+  Q3ValueList<bool>      m_lessonsInQuery;
   QStringList           m_lessonDescriptions;
   QStringList           m_typeDescriptions;
   QStringList           m_tenseDescriptions;
@@ -681,8 +684,8 @@ protected:
   QString               m_remark;
   QString               m_version;
 
-  QValueList<KEduVocArticle>   m_articles;
-  QValueList<KEduVocConjugation> m_conjugations;
+  Q3ValueList<KEduVocArticle>   m_articles;
+  Q3ValueList<KEduVocConjugation> m_conjugations;
 
   LeitnerSystem*              m_leitnerSystem;
   bool                              m_activeLeitnerSystem;
index 0782dd35f0eb90f9824e72e771562edb0f9aca44..1a81a510542d725d2b50f387aa037c6546e4a010 100644 (file)
@@ -47,7 +47,7 @@
 #define KV_LEV7_GRADE      7
 #define KV_LEV7_TEXT       I18N_NOOP("Level 7")
 
-#include <qvaluelist.h>
+#include <q3valuelist.h>
 #include <qstringlist.h>
 #include <qdatetime.h>
 
@@ -446,17 +446,17 @@ class KEduVocExpression
   QStringList m_example;
   QStringList m_antonym;
   QStringList m_pronounciations;
-  QValueList<grade_t> m_grades;
-  QValueList<grade_t> m_reverseGrades;
-  QValueList<count_t> m_queryCounts;
-  QValueList<count_t> m_reverseQueryCounts;
-  QValueList<count_t> m_badCounts;
-  QValueList<count_t> m_reverseBadCounts;
-  QValueList<QDateTime> m_queryDates;
-  QValueList<QDateTime> m_reverseQueryDates;
-  QValueList<KEduVocConjugation> m_conjugations;
-  QValueList<KEduVocComparison> m_comparisons;
-  QValueList<KEduVocMultipleChoice> m_multipleChoices;
+  Q3ValueList<grade_t> m_grades;
+  Q3ValueList<grade_t> m_reverseGrades;
+  Q3ValueList<count_t> m_queryCounts;
+  Q3ValueList<count_t> m_reverseQueryCounts;
+  Q3ValueList<count_t> m_badCounts;
+  Q3ValueList<count_t> m_reverseBadCounts;
+  Q3ValueList<QDateTime> m_queryDates;
+  Q3ValueList<QDateTime> m_reverseQueryDates;
+  Q3ValueList<KEduVocConjugation> m_conjugations;
+  Q3ValueList<KEduVocComparison> m_comparisons;
+  Q3ValueList<KEduVocMultipleChoice> m_multipleChoices;
 
   QString m_leitnerBox;
   int m_lesson;
index 09ddce44dfcf950206d6281c4603227e377937f0..a55c6f05fb3f09b33e58628ee158ca71f9d2f4a3 100644 (file)
@@ -26,6 +26,8 @@
 #include "keduvocgrammar.h"
 
 #include <klocale.h>
+//Added by qt3to4:
+#include <Q3ValueList>
 
 KEduVocConjugation::conjug_name_t
 KEduVocConjugation::names [] =
@@ -142,9 +144,9 @@ int KEduVocConjugation::numEntries() const
 }
 
 
-QValueList<KEduVocTenseRelation> KEduVocConjugation::getRelation ()
+Q3ValueList<KEduVocTenseRelation> KEduVocConjugation::getRelation ()
 {
-  QValueList<KEduVocTenseRelation> vec;
+  Q3ValueList<KEduVocTenseRelation> vec;
 
   for (int i = 0; i < numInternalNames(); i++) {
     vec.append(KEduVocTenseRelation(names[i].abbrev, i18n(names[i].name)));
@@ -169,7 +171,7 @@ void KEduVocConjugation::setTenseNames (QStringList names)
 
 QString KEduVocConjugation::getName (const QString &abbrev)
 {
-  if (abbrev.length() >= 2 && abbrev[0] == QString(UL_USER_TENSE)) {
+  if (abbrev.length() >= 2 && QString(abbrev[0]) == QString(UL_USER_TENSE)) {
     QString s = abbrev;
     s.remove(0, 1);
     int i = s.toInt() - 1;
index 941c82fd0e992781bef5e3760abca855a3a54750..bd1400f720562e1176c20ee973813486ed5a80a5 100644 (file)
@@ -28,7 +28,7 @@
 #define grammarmanager_included
 
 #include <qstring.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
 #include <qstringlist.h>
 
 #define CONJ_SIMPLE_PRESENT    "PrSi" // I live at home  what you frequently do
@@ -127,7 +127,7 @@ public:
 
   int numEntries() const;
 
-  static QValueList<KEduVocTenseRelation> getRelation ();
+  static Q3ValueList<KEduVocTenseRelation> getRelation ();
   static void setTenseNames (QStringList names);
 
   static QString getName (const QString &abbrev);
@@ -199,7 +199,7 @@ struct conjug_t
 };
 
 protected:
-  typedef QValueList<conjug_t> conjug_tList;
+  typedef Q3ValueList<conjug_t> conjug_tList;
   conjug_tList conjugations;
 
   static conjug_name_t names [];
index 93d0686d45eecd0f2368e8854246c8c9278c28bf..4de1229e71223248525b36d9beaff121eff69ab1 100644 (file)
@@ -22,6 +22,8 @@
 #include <kmessagebox.h>
 
 #include <qtextstream.h>
+//Added by qt3to4:
+#include <Q3ValueList>
 
 #include "keduvockvtmlreader.h"
 #include "keduvocdocument.h"
@@ -227,7 +229,7 @@ bool KEduVocKvtmlReader::readArticle(QDomElement &domElementParent)
 }
 
 
-bool KEduVocKvtmlReader::readConjug(QDomElement &domElementParent, QValueList<KEduVocConjugation> &curr_conjug, const QString &entry_tag)
+bool KEduVocKvtmlReader::readConjug(QDomElement &domElementParent, Q3ValueList<KEduVocConjugation> &curr_conjug, const QString &entry_tag)
 /*
  <conjugation>        used in header for definiton of "prefix"
   <e l="de">          lang determines also lang order in entries !!
@@ -967,7 +969,7 @@ bool KEduVocKvtmlReader::readExpression(QDomElement &domElementParent)
   QString       antonym;
   QString       usage;
   QString       paraphrase;
-  QValueList<KEduVocConjugation> conjug;
+  Q3ValueList<KEduVocConjugation> conjug;
   KEduVocComparison     comparison;
   KEduVocMultipleChoice mc;
 
@@ -1664,7 +1666,7 @@ void KEduVocKvtmlReader::domErrorUnknownElement(const QString &elem)
       "read documents with unknown elements.\n"
      );
   QString msg = format.arg(elem);
-  QApplication::setOverrideCursor( arrowCursor, true );
+  QApplication::setOverrideCursor(Qt::ArrowCursor, true);
   QString s = kapp->makeStdCaption(i18n("Unknown element"));
   KMessageBox::sorry(0, ln+msg, s);
   QApplication::restoreOverrideCursor();
@@ -1672,7 +1674,7 @@ void KEduVocKvtmlReader::domErrorUnknownElement(const QString &elem)
 
 void KEduVocKvtmlReader::domError(const QString &text )
 {
-  QApplication::setOverrideCursor( arrowCursor, true );
+  QApplication::setOverrideCursor(Qt::ArrowCursor, true);
   QString s = kapp->makeStdCaption(i18n("Error"));
   QString ln = i18n("File:\t%1\n").arg(m_doc->URL().path());
   QString msg = text;
index d42bb833ffd589d3d3059068dbbe81f5ef0dff1b..a9c8c3ef5bc9f8605918325b57b2ec7b10a3e127 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <qfile.h>
 #include <qdom.h>
+//Added by qt3to4:
+#include <Q3ValueList>
 
 #include "keduvocdocument.h"
 #include "keduvocgrammar.h"
@@ -78,7 +80,7 @@ public:
 
        bool readLesson(QDomElement &domElementParent);
        bool readArticle(QDomElement &domElementParent);
-       bool readConjug(QDomElement &domElementParent, QValueList<KEduVocConjugation> &curr_conjug, const QString &entry_tag);
+       bool readConjug(QDomElement &domElementParent, Q3ValueList<KEduVocConjugation> &curr_conjug, const QString &entry_tag);
        bool readOptions(QDomElement &domElementParent);
        bool readType(QDomElement &domElementParent);
        bool readTense(QDomElement &domElementParent);
index 9d80bfe70ea7cb6294c2d83cc54ea7f6726fd511..6085ef254bb764f5b65c8acc097cff6a41a34348 100644 (file)
@@ -19,6 +19,8 @@
 #include <kdebug.h>
 #include <qdom.h>
 #include <qtextstream.h>
+//Added by qt3to4:
+#include <Q3ValueList>
 
 #include "keduvockvtmlwriter.h"
 #include "keduvocdocument.h"
@@ -243,7 +245,7 @@ bool KEduVocKvtmlWriter::saveConjug(QDomDocument &domDoc, QDomElement &domElemen
 }
 
 bool KEduVocKvtmlWriter::saveConjugHeader(QDomDocument &domDoc, QDomElement &domElementParent,
-                                          QValueList<KEduVocConjugation> &curr_conjug)
+                                          Q3ValueList<KEduVocConjugation> &curr_conjug)
 {
 /*
  <conjugation>    used in header for definiton of "prefix"
@@ -684,7 +686,7 @@ bool KEduVocKvtmlWriter::writeDoc(KEduVocDocument *doc, const QString &generator
     return false;
 
   QString q_org, q_trans;
-  QValueList<KEduVocExpression>::const_iterator first =  m_doc->m_vocabulary.begin ();
+  Q3ValueList<KEduVocExpression>::const_iterator first =  m_doc->m_vocabulary.begin ();
   m_doc->queryLang(q_org, q_trans);
 
   int ent_no = 0;
index 7748933b402d9abcd7c7a0997acf5c39196ce7fc..34959c93f4991aeb552deb610b906c924ee22b5a 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <qfile.h>
 #include <qdom.h>
+//Added by qt3to4:
+#include <Q3ValueList>
 
 //#include "keduvocdocument.h"
 #include "keduvocgrammar.h"
@@ -79,7 +81,7 @@ public:
   bool saveOptionsKvtMl  (QDomDocument &domDoc, QDomElement &domElementParent);
   bool saveArticleKvtMl  (QDomDocument &domDoc, QDomElement &domElementParent);
   bool saveConjugHeader  (QDomDocument &domDoc, QDomElement &domElementParent,
-                          QValueList<KEduVocConjugation> &curr_conjug);
+                          Q3ValueList<KEduVocConjugation> &curr_conjug);
   bool saveConjug        (QDomDocument &domDoc, QDomElement &domElementParent,
                           const KEduVocConjugation &curr_conjug, QString type);
   bool saveConjugEntry   (QDomDocument &domDoc, QDomElement &domElementParent,
index 98bc94f93648b6b7bd77be41b1c270a8b8756aa3..96d6cd3d173039b325592e0dc5ffe4e4546a8c3c 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <qfile.h>
 #include <qfont.h>
+//Added by qt3to4:
+#include <QTextStream>
 
 class KEduVocDocument;
 
index 65661dd28e7a0d6fb8a195d8918d295843c8c37c..10e94e73fc2875f363bebf38b6e307385837628f 100644 (file)
 //
 #include "leitnersystem.h"
 #include <kdebug.h>
+//Added by qt3to4:
+#include <Q3ValueList>
 
-LeitnerSystem::LeitnerSystem(QValueList<LeitnerBox>& boxes, QString name)
+LeitnerSystem::LeitnerSystem(Q3ValueList<LeitnerBox>& boxes, QString name)
 {
        if( !boxes.empty() )
                m_boxes = boxes;
@@ -32,7 +34,7 @@ LeitnerSystem::~LeitnerSystem()
 QStringList LeitnerSystem::getBoxNameList()
 {
        QStringList boxNameList;
-       QValueList<LeitnerBox>::iterator it;
+       Q3ValueList<LeitnerBox>::iterator it;
 
 
        for(it = m_boxes.begin(); it != m_boxes.end(); ++it)
@@ -55,7 +57,7 @@ LeitnerBox* LeitnerSystem::boxWithNumber( int number )
 
 LeitnerBox* LeitnerSystem::boxWithName( const QString& name )
 {
-       QValueList<LeitnerBox>::iterator it;
+       Q3ValueList<LeitnerBox>::iterator it;
 
        for(it = m_boxes.begin(); it != m_boxes.end(); ++it)
        {
index 6e9be523d5d4c4b8dec40fcfaac6909767000980..5122fdef86ddea1b6ed44c1fd15e871051925907 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <qstring.h>
 #include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
 #include "leitnerbox.h"
 
 #ifndef LEITNERSYSTEM_H
@@ -26,7 +26,7 @@ class LeitnerSystem
 {
 public:
        LeitnerSystem();
-       LeitnerSystem( QValueList<LeitnerBox>& boxes, QString name );
+       LeitnerSystem( Q3ValueList<LeitnerBox>& boxes, QString name );
 
        ~LeitnerSystem();
 
@@ -72,7 +72,7 @@ public:
 private:
        QString m_systemName;                           //the systems name
 
-       QValueList<LeitnerBox> m_boxes;
+       Q3ValueList<LeitnerBox> m_boxes;
 };
 
 #endif
index f802ba74ed30ed76587654c94281d56c6be39731..261200f316525608282994fa7a14bc4007a1ae52 100644 (file)
 #include <stdlib.h>
 #include <kiconloader.h>
 #include <qpainter.h>
+//Added by qt3to4:
+#include <QMouseEvent>
 
 #include <kdebug.h>
 
-LeitnerSystemView::LeitnerSystemView(QWidget * parent, const char* name, WFlags f)
- : QScrollView(parent, name, f)
+LeitnerSystemView::LeitnerSystemView(QWidget * parent, const char* name, Qt::WFlags f)
+ : Q3ScrollView(parent, name, f)
 {
        m_highlightedBox = -1;
 }
@@ -42,7 +44,7 @@ void LeitnerSystemView::drawSystem(QPainter* p)
                {
                        //p->drawPixmap(12 + i * 64 + i*10, m_imageY, KGlobal::iconLoader()->loadIcon("leitnerbox", KIcon::Panel));
                        p->drawRect(12 + i * 64 + i*10, m_imageY,64,64);
-                       p->fillRect(12 + i * 64 + i*10, m_imageY,64,64, QBrush(red));
+                       p->fillRect(12 + i * 64 + i*10, m_imageY,64,64, QBrush(Qt::red));
                }
                else
                {       //for each box 74 = 64(pixmap) + 10(distance between two boxes)
@@ -59,7 +61,7 @@ void LeitnerSystemView::drawConnections(QPainter* p)
        int dist, width = 0;
        int numberOfBoxes = m_leitnerSystem->getNumberOfBoxes();
 
-       p->setPen( QPen(green, 2) );
+       p->setPen( QPen(Qt::green, 2) );
 
        //paint the connections for the correct word boxes, above the boxes
        for(int i = 0; i < numberOfBoxes; i++)
@@ -86,7 +88,7 @@ void LeitnerSystemView::drawConnections(QPainter* p)
        }
 
        //paint the connections for the wrong word boxes, below the boxes
-       p->setPen(QPen(red, 2));
+       p->setPen(QPen(Qt::red, 2));
 
        for(int i = 0; i < numberOfBoxes; i++)
        {
index 86394630db965020a2cce0aa6df99940ebb8d8bf..5642b02f94216ab3cc3e13bae65919a9ddeb9be0 100644 (file)
 #ifndef LEITNERSYSTEMVIEW_H
 #define LEITNERSYSTEMVIEW_H
 
-#include <qscrollview.h>
+#include <q3scrollview.h>
 #include <qpixmap.h>
+//Added by qt3to4:
+#include <QMouseEvent>
 
 class LeitnerSystem;
 
@@ -22,12 +24,12 @@ class LeitnerSystem;
 @author Martin Pfeiffer
 */
 
-class LeitnerSystemView : public QScrollView
+class LeitnerSystemView : public Q3ScrollView
 {
        Q_OBJECT
                
 public:
-    LeitnerSystemView(QWidget* parent = 0, const char* name = 0, WFlags f = 0);
+    LeitnerSystemView(QWidget* parent = 0, const char* name = 0, Qt::WFlags f = 0);
 
     ~LeitnerSystemView();
 
index 79ddd163e6a988d2ed2de9d09bbfc83714784272..34961ba103202e907c9a7988f87561730c879754 100644 (file)
 
 #include <kdebug.h>
 
-PrefLeitner::PrefLeitner(QWidget * parent, const char* name, WFlags f, LeitnerSystem* system)
-       : PrefLeitnerBase( parent, name, f )
+PrefLeitner::PrefLeitner(QWidget * parent, LeitnerSystem* system) : QDialog(parent)
 {
-       m_selectedSystem = system;
+  setupUi(this);
+  m_selectedSystem = system;
        m_selectedBox = 0;
 
        //create new leitnersystemview, show and connect it
        m_leitnerSystemView = new LeitnerSystemView( this, 0 );
-       PrefLeitnerBaseLayout->addWidget( m_leitnerSystemView, 1, 0 );
-       PrefLeitnerBaseLayout->setOrigin( QGridLayout::BottomLeft );
+  ///@todo port PrefLeitnerBaseLayout->addWidget( m_leitnerSystemView, 1, 0 );
+       ///@todo port PrefLeitnerBaseLayout->setOrigin( Qt::BottomLeftCorner );
 
        connect( m_leitnerSystemView, SIGNAL( boxClicked( int ) ), this, SLOT( slotBoxClicked( int ) ) );
 
@@ -42,11 +42,6 @@ PrefLeitner::PrefLeitner(QWidget * parent, const char* name, WFlags f, LeitnerSy
        m_leitnerSystemView->setSystem( m_selectedSystem );
 }
 
-
-PrefLeitner::~PrefLeitner()
-{
-}
-
 void PrefLeitner::slotCorrectWord( const QString& newBox )
 {
        if( m_selectedBox == 0 )
index 09ecae14008b22bc3fb7265a62e6b31a3c2afc83..da97f4ec1d869c8f0d8d4201274fec5b6626c9ca 100644 (file)
@@ -21,15 +21,13 @@ class LeitnerBox;
 /**
 @author Martin Pfeiffer
 */
-class PrefLeitner : public PrefLeitnerBase
+class PrefLeitner : public QDialog, public Ui::PrefLeitnerBase
 {
        Q_OBJECT
        
 public:
-       PrefLeitner(QWidget * parent, const char* name, WFlags f, LeitnerSystem* system);
+       PrefLeitner(QWidget * parent, LeitnerSystem* system);
 
-       ~PrefLeitner();
-       
        LeitnerSystem* getSystem();
 
 public slots:
index 1a154c129c7bd5bb75654aeb9b4cbc17b87f2864..881381c779fc91400a9b3b2c335cbaf88b80525a 100644 (file)
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>PrefLeitnerBase</class>
-<widget class="QDialog">
-    <property name="name">
-        <cstring>PrefLeitnerBase</cstring>
-    </property>
-    <property name="geometry">
-        <rect>
-            <x>0</x>
-            <y>0</y>
-            <width>770</width>
-            <height>458</height>
-        </rect>
-    </property>
-    <property name="caption">
-        <string>Leitner System</string>
-    </property>
-    <grid>
-        <property name="name">
-            <cstring>unnamed</cstring>
-        </property>
-        <widget class="QLayoutWidget" row="0" column="0">
-            <property name="name">
-                <cstring>layout5</cstring>
-            </property>
-            <grid>
-                <property name="name">
-                    <cstring>unnamed</cstring>
-                </property>
-                <widget class="QPushButton" row="3" column="3">
-                    <property name="name">
-                        <cstring>btnApply</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Appl&amp;y Changes</string>
-                    </property>
-                    <property name="accel">
-                        <string>Alt+Y</string>
-                    </property>
-                </widget>
-                <spacer row="3" column="0" rowspan="1" colspan="2">
-                    <property name="name">
-                        <cstring>spacer2</cstring>
-                    </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
-                    </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
-                    </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>421</width>
-                            <height>20</height>
-                        </size>
-                    </property>
-                </spacer>
-                <widget class="QLayoutWidget" row="0" column="1" rowspan="3" colspan="1">
-                    <property name="name">
-                        <cstring>lytBoxName</cstring>
-                    </property>
-                    <grid>
-                        <property name="name">
-                            <cstring>unnamed</cstring>
-                        </property>
-                        <widget class="QLineEdit" row="1" column="0">
-                            <property name="name">
-                                <cstring>lndBoxName</cstring>
-                            </property>
-                        </widget>
-                        <widget class="QLabel" row="0" column="0">
-                            <property name="name">
-                                <cstring>lblBoxName</cstring>
-                            </property>
-                            <property name="text">
-                                <string>Edit box name:</string>
-                            </property>
-                        </widget>
-                    </grid>
-                </widget>
-                <widget class="QPushButton" row="3" column="2">
-                    <property name="name">
-                        <cstring>btnDiscard</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Disc&amp;ard Changes</string>
-                    </property>
-                    <property name="accel">
-                        <string>Alt+A</string>
-                    </property>
-                </widget>
-                <widget class="QPushButton" row="1" column="0">
-                    <property name="name">
-                        <cstring>btnAddBox</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Add a bo&amp;x</string>
-                    </property>
-                    <property name="accel">
-                        <string>Alt+X</string>
-                    </property>
-                </widget>
-                <widget class="QPushButton" row="2" column="0">
-                    <property name="name">
-                        <cstring>btnDeleteBox</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Delete selected &amp;box</string>
-                    </property>
-                    <property name="accel">
-                        <string>Alt+B</string>
-                    </property>
-                </widget>
-                <widget class="QLayoutWidget" row="0" column="2" rowspan="3" colspan="2">
-                    <property name="name">
-                        <cstring>lytWrongCorrect</cstring>
-                    </property>
-                    <grid>
-                        <property name="name">
-                            <cstring>unnamed</cstring>
-                        </property>
-                        <widget class="QLabel" row="0" column="0">
-                            <property name="name">
-                                <cstring>lblCorrect</cstring>
-                            </property>
-                            <property name="paletteBackgroundColor">
-                                <color>
-                                    <red>0</red>
-                                    <green>255</green>
-                                    <blue>0</blue>
-                                </color>
-                            </property>
-                            <property name="text">
-                                <string>Correct words to:</string>
-                            </property>
-                        </widget>
-                        <widget class="QComboBox" row="0" column="1">
-                            <property name="name">
-                                <cstring>cmbCorrect</cstring>
-                            </property>
-                        </widget>
-                        <widget class="QLabel" row="1" column="0">
-                            <property name="name">
-                                <cstring>lblWrong</cstring>
-                            </property>
-                            <property name="paletteBackgroundColor">
-                                <color>
-                                    <red>255</red>
-                                    <green>0</green>
-                                    <blue>0</blue>
-                                </color>
-                            </property>
-                            <property name="text">
-                                <string>Wrong words to:</string>
-                            </property>
-                        </widget>
-                        <widget class="QComboBox" row="1" column="1">
-                            <property name="name">
-                                <cstring>cmbWrong</cstring>
-                            </property>
-                            <property name="paletteBackgroundColor">
-                                <color>
-                                    <red>253</red>
-                                    <green>253</green>
-                                    <blue>253</blue>
-                                </color>
-                            </property>
-                        </widget>
-                    </grid>
-                </widget>
-                <spacer row="0" column="0">
-                    <property name="name">
-                        <cstring>spacer1</cstring>
-                    </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
-                    </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
-                    </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>252</width>
-                            <height>20</height>
-                        </size>
-                    </property>
-                </spacer>
-            </grid>
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>PrefLeitnerBase</class>
+ <widget class="QDialog" name="PrefLeitnerBase" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>770</width>
+    <height>458</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Leitner System</string>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>10</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="0" column="0" >
+    <layout class="QGridLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item row="3" column="3" >
+      <widget class="QPushButton" name="btnApply" >
+       <property name="text" >
+        <string>Appl&amp;y Changes</string>
+       </property>
+       <property name="shortcut" >
+        <string>Alt+Y</string>
+       </property>
+      </widget>
+     </item>
+     <item row="3" column="0" colspan="2" >
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>421</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item rowspan="3" row="0" column="1" >
+      <layout class="QGridLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item row="1" column="0" >
+        <widget class="QLineEdit" name="lndBoxName" />
+       </item>
+       <item row="0" column="0" >
+        <widget class="QLabel" name="lblBoxName" >
+         <property name="text" >
+          <string>Edit box name:</string>
+         </property>
         </widget>
-    </grid>
-</widget>
-<connections>
-    <connection>
-        <sender>cmbCorrect</sender>
-        <signal>activated(const QString&amp;)</signal>
-        <receiver>PrefLeitnerBase</receiver>
-        <slot>slotCorrectWord(const QString&amp;)</slot>
-    </connection>
-    <connection>
-        <sender>cmbWrong</sender>
-        <signal>activated(const QString&amp;)</signal>
-        <receiver>PrefLeitnerBase</receiver>
-        <slot>slotWrongWord(const QString&amp;)</slot>
-    </connection>
-    <connection>
-        <sender>lndBoxName</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>PrefLeitnerBase</receiver>
-        <slot>slotBoxName(const QString&amp;)</slot>
-    </connection>
-    <connection>
-        <sender>btnAddBox</sender>
-        <signal>clicked()</signal>
-        <receiver>PrefLeitnerBase</receiver>
-        <slot>slotAddBox()</slot>
-    </connection>
-    <connection>
-        <sender>btnDeleteBox</sender>
-        <signal>clicked()</signal>
-        <receiver>PrefLeitnerBase</receiver>
-        <slot>slotDeleteBox()</slot>
-    </connection>
-    <connection>
-        <sender>btnApply</sender>
-        <signal>clicked()</signal>
-        <receiver>PrefLeitnerBase</receiver>
-        <slot>slotDiscard()</slot>
-    </connection>
-    <connection>
-        <sender>btnDiscard</sender>
-        <signal>clicked()</signal>
-        <receiver>PrefLeitnerBase</receiver>
-        <slot>slotApply()</slot>
-    </connection>
-</connections>
-<slots>
-    <slot>slotBoxName(const QString&amp;)</slot>
-    <slot>slotSystem(const QString&amp;)</slot>
-    <slot>slotWrongWord(const QString&amp;)</slot>
-    <slot>slotCorrectWord(const QString&amp;)</slot>
-    <slot>slotAddBox()</slot>
-    <slot>slotDeleteBox()</slot>
-    <slot>slotDiscard()</slot>
-    <slot>slotApply()</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+       </item>
+      </layout>
+     </item>
+     <item row="3" column="2" >
+      <widget class="QPushButton" name="btnDiscard" >
+       <property name="text" >
+        <string>Disc&amp;ard Changes</string>
+       </property>
+       <property name="shortcut" >
+        <string>Alt+A</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="0" >
+      <widget class="QPushButton" name="btnAddBox" >
+       <property name="text" >
+        <string>Add a bo&amp;x</string>
+       </property>
+       <property name="shortcut" >
+        <string>Alt+X</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="0" >
+      <widget class="QPushButton" name="btnDeleteBox" >
+       <property name="text" >
+        <string>Delete selected &amp;box</string>
+       </property>
+       <property name="shortcut" >
+        <string>Alt+B</string>
+       </property>
+      </widget>
+     </item>
+     <item rowspan="3" row="0" column="2" colspan="2" >
+      <layout class="QGridLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item row="0" column="0" >
+        <widget class="QLabel" name="lblCorrect" >
+         <property name="text" >
+          <string>Correct words to:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1" >
+        <widget class="QComboBox" name="cmbCorrect" />
+       </item>
+       <item row="1" column="0" >
+        <widget class="QLabel" name="lblWrong" >
+         <property name="text" >
+          <string>Wrong words to:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1" >
+        <widget class="QComboBox" name="cmbWrong" />
+       </item>
+      </layout>
+     </item>
+     <item row="0" column="0" >
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>252</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>