]> Git trees. - libqmvoc.git/commitdiff
a public inheritance on a ui4 generated file is a bad thing for a class in a public...
authorPino Toscano <pino@kde.org>
Fri, 12 May 2006 13:04:18 +0000 (13:04 +0000)
committerPino Toscano <pino@kde.org>
Fri, 12 May 2006 13:04:18 +0000 (13:04 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=540047

kdeeducore/prefleitner.cpp
kdeeducore/prefleitner.h

index 3473c1b6594e9c544c8c00b9a18a71b100c49b55..3be0378ee16ef595f93ef9a032393a7706396d73 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "leitnersystemview.h"
 #include "leitnersystem.h"
+#include "ui_prefleitnerbase.h"
 
 #include <QLayout>
 #include <QComboBox>
 
 PrefLeitner::PrefLeitner( QWidget* parent ) : QDialog( parent )
 {
-       setupUi( this );
-       
-       m_selectedSystem = 0;
-       m_selectedBox = 0;
-
-       QScrollArea *helperSV = new QScrollArea( this );
+       init( 0L );
+}
 
-       m_leitnerSystemView = new LeitnerSystemView( helperSV->viewport() );
-        m_leitnerSystemView->setObjectName( "LeitnerSystemView" );
-       
-        helperSV->setWidget( m_leitnerSystemView );
+PrefLeitner::PrefLeitner( QWidget* parent, LeitnerSystem* system ) : QDialog( parent )
+{
+       init( system );
+}
 
-       connect( m_leitnerSystemView, SIGNAL( boxClicked( int ) ), this, SLOT( slotBoxClicked( int ) ) );
+PrefLeitner::~PrefLeitner()
+{
+       delete m_base;
 }
 
-PrefLeitner::PrefLeitner( QWidget* parent, LeitnerSystem* system ) : QDialog( parent )
+void PrefLeitner::init( LeitnerSystem* system )
 {
-       setupUi( this );
+       m_base = new Ui::PrefLeitnerBase();
+       m_base->setupUi( this );
        
        m_selectedBox = 0;
 
@@ -61,14 +61,17 @@ PrefLeitner::PrefLeitner( QWidget* parent, LeitnerSystem* system ) : QDialog( pa
 
        connect( m_leitnerSystemView, SIGNAL( boxClicked( int ) ), this, SLOT( slotBoxClicked( int ) ) );
        
-       m_selectedSystem = system;
-       
-       //insert the list of box' names in the comboboxes
-       cmbWrong->addItems( m_selectedSystem->getBoxNameList() );
-       cmbCorrect->addItems( m_selectedSystem->getBoxNameList() );
+       m_selectedSystem = system;
 
-       //show leitnersystem
-       m_leitnerSystemView->setSystem( m_selectedSystem );
+       if ( m_selectedSystem )
+       {
+               //insert the list of box' names in the comboboxes
+               m_base->cmbWrong->addItems( m_selectedSystem->getBoxNameList() );
+               m_base->cmbCorrect->addItems( m_selectedSystem->getBoxNameList() );
+
+               //show leitnersystem
+               m_leitnerSystemView->setSystem( m_selectedSystem );
+       }
 }
 
 void PrefLeitner::slotCorrectWord( const QString& newBox )
@@ -102,8 +105,8 @@ void PrefLeitner::slotBoxName( const QString& newName )
 
 void PrefLeitner::newSystem()
 {
-       cmbCorrect->addItems( m_selectedSystem->getBoxNameList() );
-       cmbWrong->addItems( m_selectedSystem->getBoxNameList() );
+       m_base->cmbCorrect->addItems( m_selectedSystem->getBoxNameList() );
+       m_base->cmbWrong->addItems( m_selectedSystem->getBoxNameList() );
 
        refreshSystemView();
 }
@@ -117,9 +120,9 @@ void PrefLeitner::slotBoxClicked( int box )
 {
        m_selectedBox = m_selectedSystem->boxWithNumber( box );
 
-       cmbCorrect->setCurrentIndex( m_selectedSystem->correctBoxNumber( box ) );
-       cmbWrong->setCurrentIndex( m_selectedSystem->wrongBoxNumber( box ) );
-       lndBoxName->setText( m_selectedBox->boxName() );
+       m_base->cmbCorrect->setCurrentIndex( m_selectedSystem->correctBoxNumber( box ) );
+       m_base->cmbWrong->setCurrentIndex( m_selectedSystem->wrongBoxNumber( box ) );
+       m_base->lndBoxName->setText( m_selectedBox->boxName() );
 }
 
 void PrefLeitner::slotAddBox()
index 0a5b0785c6d0567d075af0c80d5cbff4e3473141..9f043781cdd8ec5e4e215f473d8503d312b7a221 100644 (file)
 
 #include <libkdeedu_core_export.h>
 
-#include "ui_prefleitnerbase.h"
+#include <QDialog>
 
 class LeitnerSystemView;
 class LeitnerSystem;
 class LeitnerBox;
+namespace Ui
+{
+       class PrefLeitnerBase;
+}
 
 /**
  * This class is a dialog for configuring a LeitnerSystem
  * @author Martin Pfeiffer <hubipete@gmx.net>
  */
-class EDUCORE_EXPORT PrefLeitner : public QDialog, public Ui::PrefLeitnerBase
+class EDUCORE_EXPORT PrefLeitner : public QDialog
 {
        Q_OBJECT
 
@@ -51,6 +55,11 @@ public:
         */
        PrefLeitner( QWidget* parent = 0 , LeitnerSystem* system = 0 );
 
+       /**
+        * The public destructor
+        */
+       ~PrefLeitner();
+
        /**
         * Sets the LeitnerSystem for the dialog
         * @param system a pointer to the LeitnerSystem to configure
@@ -82,6 +91,10 @@ private:
        LeitnerSystem* m_selectedSystem;        //the currently selected system to be changed
        LeitnerBox* m_selectedBox;              //the currently selected box
 
+       Ui::PrefLeitnerBase* m_base;
+
+       void init( LeitnerSystem* system );
+
        void refreshSystemView();               //refresh the LeitnerSystemView
        void newSystem();
 };