Author: coolo Date: Mon Dec 3 19:11:48 2007 New Revision: 42635 URL: http://svn.opensuse.org/viewcvs/yast?rev=42635&view=rev Log: getting rid of QT3_SUPPORT here too (added FIXMEs) Modified: branches/tmp/coolo/qt4-port/src/YQWizard.cc branches/tmp/coolo/qt4-port/src/YQWizard.h Modified: branches/tmp/coolo/qt4-port/src/YQWizard.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQWizard.cc?rev=42635&r1=42634&r2=42635&view=diff ============================================================================== --- branches/tmp/coolo/qt4-port/src/YQWizard.cc (original) +++ branches/tmp/coolo/qt4-port/src/YQWizard.cc Mon Dec 3 19:11:48 2007 @@ -18,8 +18,6 @@ /-*/ -#define QT3_SUPPORT - #include "YQWizard.h" #define y2log_component "qt-wizard" #include <ycp/y2log.h> @@ -34,8 +32,6 @@ #include <QPainter> #include <QStackedWidget> #include "ui_QHelpDialog.h" -#include <q3hbox.h> -#include <q3header.h> #include <qimage.h> #include <qlabel.h> #include <qlayout.h> @@ -43,21 +39,14 @@ #include <qmenudata.h> #include <qobject.h> #include <qpixmap.h> -#include <q3popupmenu.h> #include <qpushbutton.h> #include <qregexp.h> #include <qtabwidget.h> -#include <q3textbrowser.h> #include <qtoolbutton.h> -#include <q3widgetstack.h> #include "QY2ListView.h" -//Added by qt3to4: -#include <q3boxlayout.h> #include <QGridLayout> -#include <q3frame.h> #include <qevent.h> -#include <q3boxlayout.h> #include "utf8.h" #include "YQi18n.h" @@ -135,8 +124,8 @@ _sendButtonEvents = true; _contentsReplacePoint = 0; - _stepsList.setAutoDelete( true ); - _stepsIDs.setAutoDelete( false ); // Only for one of both! + //FIXME _stepsList.setAutoDelete( true ); + //FIXME _stepsIDs.setAutoDelete( false ); // Only for one of both! YQUI::setTextdomain( TEXTDOMAIN ); @@ -157,9 +146,10 @@ void YQWizard::layoutTitleBar( QWidget * parent ) { - Q3HBox * titleBar = new Q3HBox( parent ); + QFrame * titleBar = new QFrame( parent ); YUI_CHECK_NEW( titleBar ); + QHBoxLayout *layout = new QHBoxLayout( titleBar ); titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert // @@ -167,6 +157,7 @@ // QLabel * left = new QLabel( titleBar ); + layout->addWidget( left ); left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert QPixmap leftLogo( PIXMAP_DIR "title-bar-left.png" ); @@ -175,7 +166,6 @@ { left->setPixmap( leftLogo ); left->setFixedSize( leftLogo.size() ); - left->setBackgroundOrigin( QWidget::ParentOrigin ); } @@ -183,7 +173,7 @@ // Center stretch space // - addHStretch( titleBar ); + layout->addStretch( 10 ); // @@ -193,13 +183,14 @@ QLabel * right = new QLabel( titleBar ); YUI_CHECK_NEW( right ); + layout->addWidget( right ); + QPixmap rightLogo( PIXMAP_DIR "title-bar-right.png" ); if ( ! rightLogo.isNull() ) { right->setPixmap( rightLogo ); right->setFixedSize( rightLogo.size() ); - right->setBackgroundOrigin( QWidget::ParentOrigin ); } } @@ -265,7 +256,7 @@ y2error( "Step ID \"%s\" (\"%s\") already used for \"%s\"", id.c_str(), text.c_str(), - (const char *) _stepsIDs[ qId ]->name() ); + qPrintable( _stepsIDs[ qId ]->name() ) ); return; } @@ -323,10 +314,9 @@ // Create widgets for all steps and step headings in the internal list // - YQWizard::Step * step = _stepsList.first(); - - while ( step ) + for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i) { + YQWizard::Step * step = *i; if ( step->isHeading() ) { // @@ -339,9 +329,9 @@ label->setProperty( "class", "steps_heading" ); step->setNameLabel( label ); - _stepsGrid->addMultiCellWidget( label, - row, row, // from_row, to_row - statusCol, nameCol ); // from_col, to_col + _stepsGrid->addWidget( label, + row, statusCol, + 1, nameCol - statusCol ); } else // No heading - ordinary step { @@ -368,7 +358,6 @@ _stepsGrid->addWidget( nameLabel, row, nameCol ); } - step = _stepsList.next(); row++; } @@ -389,7 +378,7 @@ updateSteps(); YQWizard::Step * currentStep = findStep( _currentStepID ); - YQWizard::Step * step = _stepsList.first(); + QList<YQWizard::Step*>::iterator step = _stepsList.begin(); if ( currentStep ) { @@ -400,26 +389,26 @@ // Set all steps before the current to "done" // - while ( step && step != currentStep ) + while ( step != _stepsList.end() && *step != currentStep ) { - step->setStatus( Step::Done ); - step = _stepsList.next(); + ( *step )->setStatus( Step::Done ); + step++; } // Skip the current step - continue with the step after it - if ( step ) - step = _stepsList.next(); + if ( step != _stepsList.end() ) + step++; } // // Set all steps after the current to "to do" // - while ( step ) + while ( step != _stepsList.end() ) { - step->setStatus( Step::Todo ); - step = _stepsList.next(); + ( *step )->setStatus( Step::Todo ); + step++; } } @@ -513,36 +502,22 @@ } - -void YQWizard::layoutSideBarButtonBox( QWidget * parent, QPushButton * button ) -{ - QVBoxLayout * vbox = new QVBoxLayout( parent, 0, 0 ); // parent, margin, spacing - YUI_CHECK_NEW( vbox ); - - QHBoxLayout * hbox = new QHBoxLayout( vbox, 0 ); // parent, spacing - YUI_CHECK_NEW( hbox ); - - hbox->addStretch( 99 ); - hbox->addWidget( button ); - hbox->addStretch( 99 ); -} - - - void YQWizard::layoutTreePanel() { - _treePanel = new Q3HBox( _sideBar ); + _treePanel = new QFrame( _sideBar ); YUI_CHECK_NEW( _treePanel ); + QHBoxLayout *layout = new QHBoxLayout( _treePanel ); _sideBar->addWidget( _treePanel ); - Q3VBox * vbox = new Q3VBox( _treePanel ); + QVBoxLayout * vbox = new QVBoxLayout(); YUI_CHECK_NEW( vbox ); - + layout->addLayout( vbox ); // Selection tree - _tree = new QY2ListView( vbox ); + _tree = new QY2ListView( _treePanel ); YUI_CHECK_NEW( _tree ); + vbox->addWidget( _tree ); //FIXME // _tree->addColumn( "" ); @@ -560,33 +535,9 @@ connect( _tree, SIGNAL( doubleClicked ( QTreeWidgetItem * ) ), this, SLOT ( sendTreeEvent ( QTreeWidgetItem * ) ) ); - - // Bottom gradient - - QLabel * buttonBox = new QLabel( vbox ); - YUI_CHECK_NEW( buttonBox ); - - - // "Help" button - intentionally without keyboard shortcut - QPushButton * button = new QPushButton( _( "Help" ), buttonBox ); - YUI_CHECK_NEW( button ); - -#if USE_ICON_ON_HELP_BUTTON - QPixmap pixmap( PIXMAP_DIR "help-button.png" ); - - if ( ! pixmap.isNull() ) - button->setPixmap( pixmap ); -#endif - - layoutSideBarButtonBox( buttonBox, button ); - - connect( button, SIGNAL( clicked() ), - this, SLOT ( showHelp() ) ); - } - void YQWizard::addTreeItem( const string & parentID, const string & text, const string & id ) { QString qId = fromUTF8( id ); @@ -728,7 +679,8 @@ _dialogHeading = new QLabel( workArea ); YUI_CHECK_NEW( _dialogHeading ); headingHBox->addWidget( _dialogHeading ); - _dialogHeading->setAlignment( Qt::AlignLeft | Qt::WordBreak ); + _dialogHeading->setAlignment( Qt::AlignLeft ); + _dialogHeading->setWordWrap( true ); _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert _dialogHeading->setObjectName( "DialogHeading" ); @@ -753,8 +705,9 @@ void YQWizard::layoutClientArea( QWidget * parent ) { - _clientArea = new Q3VBox( parent ); + _clientArea = new QFrame( parent ); YUI_CHECK_NEW( _clientArea ); + QVBoxLayout *layout = new QVBoxLayout( _clientArea ); // _clientArea->layout()->setMargin( 4 ); // @@ -763,6 +716,7 @@ _contents = new YQAlignment( this, _clientArea, YAlignCenter, YAlignCenter ); YUI_CHECK_NEW( _contents ); + layout->addWidget( _contents ); _contents->QObject::setProperty( "class", "Contents" ); _contents->setStretchable( YD_HORIZ, true ); @@ -905,13 +859,13 @@ else { _dialogIcon->setPixmap( icon ); - topLevelWidget()->setIcon( icon ); + topLevelWidget()->setWindowIcon( icon ); } } else { _dialogIcon->clear(); - topLevelWidget()->setIcon( QPixmap() ); + topLevelWidget()->setWindowIcon( QIcon() ); } } } @@ -933,7 +887,7 @@ if ( _dialogHeading ) { QString label = _dialogHeading->text(); - label.simplifyWhiteSpace(); // Replace any embedded newline with a single blank + label = label.simplified(); // Replace any embedded newline with a single blank if ( ! label.isEmpty() ) { @@ -1031,11 +985,11 @@ { if ( _menuBar ) { - Q3PopupMenu * menu = new Q3PopupMenu( _menuBar ); + QMenu * menu = new QMenu( _menuBar ); YUI_CHECK_NEW( menu ); _menuIDs.insert( fromUTF8( id ), menu ); - _menuBar->insertItem( fromUTF8( text ), menu ); + //FIXME _menuBar->insertItem( fromUTF8( text ), menu ); connect( menu, SIGNAL( activated ( int ) ), this, SLOT ( sendMenuEvent( int ) ) ); @@ -1049,15 +1003,15 @@ const string & text, const string & id ) { - Q3PopupMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ]; + QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ]; if ( parentMenu ) { - Q3PopupMenu * menu = new Q3PopupMenu( _menuBar ); + QMenu * menu = new QMenu( _menuBar ); YUI_CHECK_NEW( menu ); _menuIDs.insert( fromUTF8( id ), menu ); - parentMenu->insertItem( fromUTF8( text ), menu ); + //FIXME parentMenu->insertItem( fromUTF8( text ), menu ); connect( menu, SIGNAL( activated ( int ) ), this, SLOT ( sendMenuEvent( int ) ) ); @@ -1073,13 +1027,13 @@ const string & text, const string & idString ) { - Q3PopupMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ]; + QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ]; if ( parentMenu ) { int id = _menuEntryIDs.size(); _menuEntryIDs.push_back( idString ); - parentMenu->insertItem( fromUTF8( text ), id ); + //FIXME parentMenu->insertItem( fromUTF8( text ), id ); } else { @@ -1090,11 +1044,11 @@ void YQWizard::addMenuSeparator( const string & parentMenuID ) { - Q3PopupMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ]; + QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ]; if ( parentMenu ) { - parentMenu->insertSeparator(); + parentMenu->addSeparator(); } else { Modified: branches/tmp/coolo/qt4-port/src/YQWizard.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQWizard.h?rev=42635&r1=42634&r2=42635&view=diff ============================================================================== --- branches/tmp/coolo/qt4-port/src/YQWizard.h (original) +++ branches/tmp/coolo/qt4-port/src/YQWizard.h Mon Dec 3 19:11:48 2007 @@ -21,13 +21,9 @@ #define YQWizard_h #include <string> -#include <q3vbox.h> #include <qpixmap.h> -#include <q3ptrlist.h> #include <qstringlist.h> -#include <q3dict.h> #include "QY2ListView.h" -//Added by qt3to4: #include <QGridLayout> #include <qlabel.h> #include <QMenu> @@ -42,10 +38,8 @@ class QFrame; class QLabel; class QMenuBar; -class Q3PopupMenu; class QPushButton; class QSpacerItem; -class Q3TextBrowser; class QToolButton; class QStackedWidget; class YReplacePoint; @@ -533,7 +527,7 @@ QPushButton * _helpButton; QPushButton * _stepsButton; QPushButton * _treeButton; - Q3HBox * _treePanel; + QFrame * _treePanel; QY2ListView * _tree; QWidget * _clientArea; @@ -546,10 +540,10 @@ YQWizardButton * _nextButton; YReplacePoint * _contentsReplacePoint; - Q3PtrList<YQWizard::Step> _stepsList; - Q3Dict<YQWizard::Step> _stepsIDs; - Q3Dict<YQWizard::TreeItem> _treeIDs; - Q3Dict<Q3PopupMenu> _menuIDs; + QList<YQWizard::Step*> _stepsList; + QHash<QString,YQWizard::Step*> _stepsIDs; + QHash<QString,YQWizard::TreeItem*> _treeIDs; + QHash<QString,QMenu*> _menuIDs; vector<string> _menuEntryIDs; @@ -605,6 +599,9 @@ bool _enabled; QStringList _idList; Status _status; + + private: + Q_DISABLE_COPY(Step); }; @@ -622,6 +619,9 @@ virtual ~StepHeading() {} virtual bool isHeading() const { return true; } virtual bool hasID( const QString & id ) { return false; } + + private: + Q_DISABLE_COPY(StepHeading); }; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org