diff options
Diffstat (limited to 'krecipes/src/dialogs/dietwizarddialog.cpp')
-rw-r--r-- | krecipes/src/dialogs/dietwizarddialog.cpp | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/krecipes/src/dialogs/dietwizarddialog.cpp b/krecipes/src/dialogs/dietwizarddialog.cpp index 50a4435..c07f25c 100644 --- a/krecipes/src/dialogs/dietwizarddialog.cpp +++ b/krecipes/src/dialogs/dietwizarddialog.cpp @@ -14,11 +14,11 @@ #include "backends/recipedb.h" #include "dietviewdialog.h" -#include <qbitmap.h> -#include <qheader.h> -#include <qlayout.h> -#include <qpainter.h> -#include <qwmatrix.h> +#include <ntqbitmap.h> +#include <ntqheader.h> +#include <ntqlayout.h> +#include <ntqpainter.h> +#include <ntqwmatrix.h> #include <kapplication.h> #include <kcursor.h> @@ -35,7 +35,7 @@ #include "profiling.h" -DietWizardDialog::DietWizardDialog( QWidget *parent, RecipeDB *db ) : QVBox( parent ) +DietWizardDialog::DietWizardDialog( TQWidget *parent, RecipeDB *db ) : TQVBox( parent ) { // Initialize internal variables database = db; @@ -46,47 +46,47 @@ DietWizardDialog::DietWizardDialog( QWidget *parent, RecipeDB *db ) : QVBox( par //Design the dialog setSpacing( 5 ); // Options Box - optionsBox = new QHBox( this ); + optionsBox = new TQHBox( this ); - daysSliderBox = new QVGroupBox( i18n( "Number of Days" ), optionsBox ); - dayNumberLabel = new QLabel( daysSliderBox ); + daysSliderBox = new TQVGroupBox( i18n( "Number of Days" ), optionsBox ); + dayNumberLabel = new TQLabel( daysSliderBox ); dayNumberLabel->setText( "- 1 -" ); - dayNumberLabel->setAlignment( Qt::AlignHCenter ); - dayNumberSelector = new QSlider( daysSliderBox ); + dayNumberLabel->setAlignment( TQt::AlignHCenter ); + dayNumberSelector = new TQSlider( daysSliderBox ); - dayNumberSelector->setOrientation( Qt::Horizontal ); + dayNumberSelector->setOrientation( TQt::Horizontal ); dayNumberSelector->setRange( 1, 10 ); dayNumberSelector->setSteps( 1, 1 ); - dayNumberSelector->setTickmarks( QSlider::Below ); + dayNumberSelector->setTickmarks( TQSlider::Below ); dayNumberSelector->setFixedWidth( 100 ); - mealsSliderBox = new QVGroupBox( i18n( "Meals per Day" ), optionsBox ); - mealNumberLabel = new QLabel( mealsSliderBox ); + mealsSliderBox = new TQVGroupBox( i18n( "Meals per Day" ), optionsBox ); + mealNumberLabel = new TQLabel( mealsSliderBox ); mealNumberLabel->setText( "- 1 -" ); - mealNumberLabel->setAlignment( Qt::AlignHCenter ); - mealNumberSelector = new QSlider( mealsSliderBox ); + mealNumberLabel->setAlignment( TQt::AlignHCenter ); + mealNumberSelector = new TQSlider( mealsSliderBox ); - mealNumberSelector->setOrientation( Qt::Horizontal ); + mealNumberSelector->setOrientation( TQt::Horizontal ); mealNumberSelector->setRange( 1, 10 ); mealNumberSelector->setSteps( 1, 1 ); - mealNumberSelector->setTickmarks( QSlider::Below ); + mealNumberSelector->setTickmarks( TQSlider::Below ); mealNumberSelector->setFixedWidth( 100 ); // Tabs - mealTabs = new QTabWidget( this ); + mealTabs = new TQTabWidget( this ); mealTabs->setMargin( 5 ); // Button bar KIconLoader il; - QHBox *bottom_layout = new QHBox( this ); - //bottom_layout->layout()->addItem( new QSpacerItem( 10,10, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) ); + TQHBox *bottom_layout = new TQHBox( this ); + //bottom_layout->layout()->addItem( new TQSpacerItem( 10,10, TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ) ); - okButton = new QPushButton( bottom_layout ); + okButton = new TQPushButton( bottom_layout ); okButton->setIconSet( il.loadIconSet( "button_ok", KIcon::Small ) ); okButton->setText( i18n( "Create the diet" ) ); - QPushButton *clearButton = new QPushButton( bottom_layout ); + TQPushButton *clearButton = new TQPushButton( bottom_layout ); clearButton->setIconSet( il.loadIconSet( "editclear", KIcon::Small ) ); clearButton->setText( i18n( "Clear" ) ); @@ -132,7 +132,7 @@ void DietWizardDialog::reload( ReloadFlags flag ) } } -void DietWizardDialog::newTab( const QString &name ) +void DietWizardDialog::newTab( const TQString &name ) { mealTab = new MealInput( mealTabs, database ); mealTab->reload(); @@ -142,7 +142,7 @@ void DietWizardDialog::newTab( const QString &name ) void DietWizardDialog::changeMealNumber( int mn ) { - mealNumberLabel->setText( QString( i18n( "- %1 -" ) ).arg( mn ) ); + mealNumberLabel->setText( TQString( i18n( "- %1 -" ) ).arg( mn ) ); if ( mn > mealNumber ) { while ( mealNumber != mn ) { @@ -165,15 +165,15 @@ void DietWizardDialog::changeDayNumber( int dn ) if ( dn < 7 ) { dayNumber = dn; - dayNumberLabel->setText( QString( i18n( "- %1 -" ) ).arg( dn ) ); + dayNumberLabel->setText( TQString( i18n( "- %1 -" ) ).arg( dn ) ); } else if ( dn == 7 ) { dayNumber = 7; - dayNumberLabel->setText( QString( i18n( "- 1 week -" ) ) ); + dayNumberLabel->setText( TQString( i18n( "- 1 week -" ) ) ); } else { dayNumber = ( dn - 6 ) * 7; - dayNumberLabel->setText( QString( i18n( "- %1 weeks -" ) ).arg( dn - 6 ) ); + dayNumberLabel->setText( TQString( i18n( "- %1 weeks -" ) ).arg( dn - 6 ) ); } } @@ -192,7 +192,7 @@ void DietWizardDialog::createDiet( void ) // temporal iterator list so elements can be removed without reloading them again from the DB // this list prevents the same meal from showing up in the same day twice - QValueList <RecipeList::Iterator> tempRList; + TQValueList <RecipeList::Iterator> tempRList; bool alert = false; @@ -205,10 +205,10 @@ void DietWizardDialog::createDiet( void ) for ( int dish = 0;dish < dishNo;dish++ ) { bool found = false; - QValueList <RecipeList::Iterator> tempDishRList = tempRList; + TQValueList <RecipeList::Iterator> tempDishRList = tempRList; while ( ( !found ) && !tempDishRList.empty() ) { int random_index = ( int ) ( ( float ) ( kapp->random() ) / ( float ) RAND_MAX * tempDishRList.count() ); - QValueList<RecipeList::Iterator>::Iterator iit = tempDishRList.at( random_index ); // note that at() retrieves an iterator to the iterator list, so we need to use * in order to get the RecipeList::Iterator + TQValueList<RecipeList::Iterator>::Iterator iit = tempDishRList.at( random_index ); // note that at() retrieves an iterator to the iterator list, so we need to use * in order to get the RecipeList::Iterator RecipeList::Iterator rit = *iit; if ( found = ( ( ( !categoryFiltering( meal, dish ) ) || checkCategories( *rit, meal, dish ) ) && checkConstraints( *rit, meal, dish ) ) ) // Check that the recipe is inside the constraint limits and in the categories specified @@ -235,7 +235,7 @@ void DietWizardDialog::createDiet( void ) { // make a list of dishnumbers - QValueList<int> dishNumbers; + TQValueList<int> dishNumbers; for ( int meal = 0;meal < mealNumber;meal++ ) { int dishNo = ( ( MealInput* ) ( mealTabs->page( meal ) ) ) ->dishNo(); @@ -254,7 +254,7 @@ void DietWizardDialog::createDiet( void ) } -void DietWizardDialog::populateIteratorList( RecipeList &rl, QValueList <RecipeList::Iterator> *il ) +void DietWizardDialog::populateIteratorList( RecipeList &rl, TQValueList <RecipeList::Iterator> *il ) { il->clear(); RecipeList::Iterator it; @@ -306,52 +306,52 @@ int DietWizardDialog::getNecessaryFlags() const } -MealInput::MealInput( QWidget *parent, RecipeDB *db ) : QWidget( parent ), +MealInput::MealInput( TQWidget *parent, RecipeDB *db ) : TQWidget( parent ), database( db ) { // Design the dialog - QVBoxLayout *layout = new QVBoxLayout( this ); + TQVBoxLayout *layout = new TQVBoxLayout( this ); layout->setSpacing( 10 ); // Options box - mealOptions = new QHBox( this ); + mealOptions = new TQHBox( this ); mealOptions->setSpacing( 10 ); layout->addWidget( mealOptions ); // Number of dishes input - dishNumberBox = new QHBox( mealOptions ); + dishNumberBox = new TQHBox( mealOptions ); dishNumberBox->setSpacing( 10 ); - dishNumberLabel = new QLabel( i18n( "No. of dishes: " ), dishNumberBox ); - dishNumberInput = new QSpinBox( dishNumberBox ); + dishNumberLabel = new TQLabel( i18n( "No. of dishes: " ), dishNumberBox ); + dishNumberInput = new TQSpinBox( dishNumberBox ); dishNumberInput->setMinValue( 1 ); dishNumberInput->setMaxValue( 10 ); - dishNumberBox->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); + dishNumberBox->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum ) ); // Toolbar - toolBar = new QHGroupBox( mealOptions ); - toolBar->setFrameStyle ( QFrame::Panel | QFrame::Sunken ); - toolBar->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ) ); + toolBar = new TQHGroupBox( mealOptions ); + toolBar->setFrameStyle ( TQFrame::Panel | TQFrame::Sunken ); + toolBar->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ) ); // Next dish/ Previous dish buttons KIconLoader il; - buttonPrev = new QToolButton( toolBar ); + buttonPrev = new TQToolButton( toolBar ); buttonPrev->setUsesTextLabel( true ); buttonPrev->setTextLabel( i18n( "Previous Dish" ) ); buttonPrev->setIconSet( il.loadIconSet( "back", KIcon::Small ) ); - buttonPrev->setTextPosition( QToolButton::Under ); - buttonNext = new QToolButton( toolBar ); + buttonPrev->setTextPosition( TQToolButton::Under ); + buttonNext = new TQToolButton( toolBar ); buttonNext->setUsesTextLabel( true ); buttonNext->setTextLabel( i18n( "Next Dish" ) ); buttonNext->setIconSet( il.loadIconSet( "forward", KIcon::Small ) ); - buttonNext->setTextPosition( QToolButton::Under ); + buttonNext->setTextPosition( TQToolButton::Under ); // Dish widgets - dishStack = new QWidgetStack( this ); + dishStack = new TQWidgetStack( this ); layout->addWidget( dishStack ); - dishStack->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + dishStack->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); // Add default dishes DishInput *newDish = new DishInput( this, database, i18n( "1st Course" ) ); dishStack->addWidget( newDish ); @@ -377,7 +377,7 @@ MealInput::~MealInput() void MealInput::reload( ReloadFlags flag ) { - QValueList<DishInput*>::iterator it; + TQValueList<DishInput*>::iterator it; for ( it = dishInputList.begin(); it != dishInputList.end(); ++it ) { DishInput *di = ( *it ); di->reload(flag); @@ -393,7 +393,7 @@ void MealInput::changeDishNumber( int dn ) { if ( dn > dishNumber ) { while ( dishNumber != dn ) { - DishInput * newDish = new DishInput( this, database, QString( i18n( "Dish %1" ) ).arg( dishNumber + 1 ) ); + DishInput * newDish = new DishInput( this, database, TQString( i18n( "Dish %1" ) ).arg( dishNumber + 1 ) ); newDish->reload(); dishStack->addWidget( newDish ); dishInputList.append( newDish ); @@ -402,7 +402,7 @@ void MealInput::changeDishNumber( int dn ) } } else if ( dn < dishNumber ) { - QValueList <DishInput*>::Iterator it; + TQValueList <DishInput*>::Iterator it; while ( dishNumber != dn ) { it = dishInputList.fromLast(); DishInput *lastDish = ( *it ); @@ -422,7 +422,7 @@ void MealInput::changeDishNumber( int dn ) void MealInput::nextDish( void ) { // First get the place of the current dish input in the list - QValueList <DishInput*>::iterator it = dishInputList.find( ( DishInput* ) ( dishStack->visibleWidget() ) ); + TQValueList <DishInput*>::iterator it = dishInputList.find( ( DishInput* ) ( dishStack->visibleWidget() ) ); //Show the next dish if it exists it++; @@ -435,7 +435,7 @@ void MealInput::nextDish( void ) void MealInput::prevDish( void ) { // First get the place of the current dish input in the list - QValueList <DishInput*>::iterator it = dishInputList.find( ( DishInput* ) ( dishStack->visibleWidget() ) ); + TQValueList <DishInput*>::iterator it = dishInputList.find( ( DishInput* ) ( dishStack->visibleWidget() ) ); //Show the previous dish if it exists it--; @@ -446,12 +446,12 @@ void MealInput::prevDish( void ) void MealInput::showDish( int dn ) { - QValueList <DishInput*>::iterator it = dishInputList.at( dn ); + TQValueList <DishInput*>::iterator it = dishInputList.at( dn ); if ( it != dishInputList.end() ) dishStack->raiseWidget( *it ); } -DishInput::DishInput( QWidget* parent, RecipeDB *db, const QString &title ) : QWidget( parent ), +DishInput::DishInput( TQWidget* parent, RecipeDB *db, const TQString &title ) : TQWidget( parent ), database(db) { @@ -460,28 +460,28 @@ DishInput::DishInput( QWidget* parent, RecipeDB *db, const QString &title ) : QW // Design the widget - QVBoxLayout *layout = new QVBoxLayout( this ); + TQVBoxLayout *layout = new TQVBoxLayout( this ); layout->setSpacing( 10 ); //Horizontal Box to hold the KListView's - listBox = new QHGroupBox( i18n( "Dish Characteristics" ), this ); + listBox = new TQHGroupBox( i18n( "Dish Characteristics" ), this ); layout->addWidget( listBox ); // Dish id dishTitle = new DishTitle( listBox, title ); //Categories list - categoriesBox = new QVBox( listBox ); - categoriesEnabledBox = new QCheckBox( categoriesBox ); + categoriesBox = new TQVBox( listBox ); + categoriesEnabledBox = new TQCheckBox( categoriesBox ); categoriesEnabledBox->setText( i18n( "Enable Category Filtering" ) ); categoriesView = new CategoryCheckListView( categoriesBox, database, false ); - categoriesView->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ); + categoriesView->setSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ); categoriesView->setEnabled( false ); // Disable it by default //Constraints list constraintsView = new PropertyConstraintListView( listBox, database ); - constraintsView->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ); + constraintsView->setSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ); constraintsView->reload(); // KDoubleInput based edit boxes @@ -494,7 +494,7 @@ DishInput::DishInput( QWidget* parent, RecipeDB *db, const QString &title ) : QW // Connect Signals & Slots - connect( constraintsView, SIGNAL( executed( QListViewItem* ) ), this, SLOT( insertConstraintsEditBoxes( QListViewItem* ) ) ); + connect( constraintsView, SIGNAL( executed( TQListViewItem* ) ), this, SLOT( insertConstraintsEditBoxes( TQListViewItem* ) ) ); connect( constraintsView, SIGNAL( selectionChanged() ), this, SLOT( hideConstraintInputs() ) ); connect( constraintsEditBox1, SIGNAL( valueChanged( double ) ), this, SLOT( setMinValue( double ) ) ); connect( constraintsEditBox2, SIGNAL( valueChanged( double ) ), this, SLOT( setMaxValue( double ) ) ); @@ -506,9 +506,9 @@ DishInput::~DishInput() void DishInput::clear() { - QListViewItemIterator it( categoriesView ); + TQListViewItemIterator it( categoriesView ); while ( it.current() ) { - QCheckListItem * item = ( QCheckListItem* ) it.current(); + TQCheckListItem * item = ( TQCheckListItem* ) it.current(); item->setOn( false ); ++it; } @@ -534,9 +534,9 @@ void DishInput::reload( ReloadFlags flag ) categoriesView->reload(flag); } -void DishInput::insertConstraintsEditBoxes( QListViewItem* it ) +void DishInput::insertConstraintsEditBoxes( TQListViewItem* it ) { - QRect r; + TQRect r; // Constraints Box1 r = constraintsView->header() ->sectionRect( 2 ); //start at the section 2 header @@ -612,7 +612,7 @@ void DishInput::setMaxValue( double maxValue ) it->setMax( maxValue ); } -DishTitle::DishTitle( QWidget *parent, const QString &title ) : QWidget( parent ) +DishTitle::DishTitle( TQWidget *parent, const TQString &title ) : TQWidget( parent ) { titleText = title; } @@ -621,73 +621,73 @@ DishTitle::DishTitle( QWidget *parent, const QString &title ) : QWidget( parent DishTitle::~DishTitle() {} -void DishTitle::paintEvent( QPaintEvent * ) +void DishTitle::paintEvent( TQPaintEvent * ) { // Now draw the text - if ( QT_VERSION >= 0x030200 ) { - // Case 1: Qt 3.2+ + if ( TQT_VERSION >= 0x030200 ) { + // Case 1: TQt 3.2+ - QPainter painter( this ); + TQPainter painter( this ); // First draw the decoration painter.setPen( KGlobalSettings::activeTitleColor() ); - painter.setBrush( QBrush( KGlobalSettings::activeTitleColor() ) ); + painter.setBrush( TQBrush( KGlobalSettings::activeTitleColor() ) ); painter.drawRoundRect( 0, 20, 30, height() - 40, 50, ( int ) ( 50.0 / ( height() - 40 ) * 35.0 ) ); // Now draw the text - QFont titleFont = KGlobalSettings::windowTitleFont (); + TQFont titleFont = KGlobalSettings::windowTitleFont (); titleFont.setPointSize( 15 ); painter.setFont( titleFont ); painter.rotate( -90 ); - painter.setPen( QColor( 0x00, 0x00, 0x00 ) ); + painter.setPen( TQColor( 0x00, 0x00, 0x00 ) ); painter.drawText( 0, 0, -height(), 30, AlignCenter, titleText ); - painter.setPen( QColor( 0xFF, 0xFF, 0xFF ) ); + painter.setPen( TQColor( 0xFF, 0xFF, 0xFF ) ); painter.drawText( -1, -1, -height() - 1, 29, AlignCenter, titleText ); painter.end(); } else { - // Case 2: Qt 3.1 + // Case 2: TQt 3.1 // Use a pixmap - QSize pmSize( height(), width() ); //inverted size so we can rotate later - QPixmap pm( pmSize ); - pm.fill( QColor( 0xFF, 0xFF, 0xFF ) ); - QPainter painter( &pm ); + TQSize pmSize( height(), width() ); //inverted size so we can rotate later + TQPixmap pm( pmSize ); + pm.fill( TQColor( 0xFF, 0xFF, 0xFF ) ); + TQPainter painter( &pm ); // First draw the decoration painter.setPen( KGlobalSettings::activeTitleColor() ); - painter.setBrush( QBrush( KGlobalSettings::activeTitleColor() ) ); + painter.setBrush( TQBrush( KGlobalSettings::activeTitleColor() ) ); painter.drawRoundRect( 20, 0, height() - 40, 30, ( int ) ( 50.0 / ( height() - 40 ) * 35.0 ), 50 ); // Now draw the text - QFont titleFont = KGlobalSettings::windowTitleFont (); + TQFont titleFont = KGlobalSettings::windowTitleFont (); titleFont.setPointSize( 15 ); painter.setFont( titleFont ); - painter.setPen( QColor( 0x00, 0x00, 0x00 ) ); + painter.setPen( TQColor( 0x00, 0x00, 0x00 ) ); painter.drawText( 0, 0, height(), 30, AlignCenter, titleText ); - painter.setPen( QColor( 0xFF, 0xFF, 0xFF ) ); + painter.setPen( TQColor( 0xFF, 0xFF, 0xFF ) ); painter.drawText( -1, -1, height() - 1, 29, AlignCenter, titleText ); painter.end(); //Set the border transparent using a mask - QBitmap mask( pm.size() ); - mask.fill( Qt::color0 ); + TQBitmap mask( pm.size() ); + mask.fill( TQt::color0 ); painter.begin( &mask ); - painter.setPen( Qt::color1 ); - painter.setBrush( Qt::color1 ); + painter.setPen( TQt::color1 ); + painter.setBrush( TQt::color1 ); painter.drawRoundRect( 20, 0, height() - 40, 30, ( int ) ( 50.0 / ( height() - 40 ) * 35.0 ), 50 ); painter.end(); pm.setMask( mask ); //And Rotate - QWMatrix m ; + TQWMatrix m ; m.rotate( -90 ); pm = pm.xForm( m ); @@ -695,14 +695,14 @@ void DishTitle::paintEvent( QPaintEvent * ) } } -QSize DishTitle::sizeHint () const +TQSize DishTitle::sizeHint () const { - return ( QSize( 40, 200 ) ); + return ( TQSize( 40, 200 ) ); } -QSize DishTitle::minimumSizeHint() const +TQSize DishTitle::minimumSizeHint() const { - return ( QSize( 40, 200 ) ); + return ( TQSize( 40, 200 ) ); } bool DietWizardDialog::checkCategories( Recipe &rec, int meal, int dish ) |