Author: dmacvicar
Date: Sat Dec 8 02:02:48 2007
New Revision: 42840
URL: http://svn.opensuse.org/viewcvs/yast?rev=42840&view=rev
Log:
YQPkgSearchFilterView QT3_SUPPORT, damn this one was boring
Modified:
trunk/qt4/src/pkg/YQPkgSearchFilterView.cc
trunk/qt4/src/pkg/YQPkgSearchFilterView.h
Modified: trunk/qt4/src/pkg/YQPkgSearchFilterView.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgSearchFilterView.cc?rev=42840&r1=42839&r2=42840&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgSearchFilterView.cc (original)
+++ trunk/qt4/src/pkg/YQPkgSearchFilterView.cc Sat Dec 8 02:02:48 2007
@@ -18,19 +18,16 @@
/-*/
-#define QT3_SUPPORT 1
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-//Added by qt3to4:
-#include
+#include <QCheckBox>
+#include <QComboBox>
+#include <QLabel>
+#include <QLayout>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QGroupBox>
+#include <QProgressDialog>
+#include <QDateTime>
+#include <QKeyEvent>
#define y2log_component "qt-pkg"
#include
@@ -51,63 +48,74 @@
YQPkgSearchFilterView::YQPkgSearchFilterView( QWidget * parent )
- : Q3VBox( parent )
+ : QWidget( parent )
{
+ QVBoxLayout *layout = new QVBoxLayout;
+ setLayout(layout);
_matchCount = 0;
- setMargin( MARGIN );
- setSpacing( SPACING );
+ layout->setMargin( MARGIN );
+ layout->setSpacing( SPACING );
- addVStretch( this );
+ layout->addStretch();
// Headline
QLabel * label = new QLabel( _( "Searc&h:" ), this );
Q_CHECK_PTR( label );
+ layout->addWidget(label);
label->setFont( YQUI::yqApp()->headingFont() );
// Input field ( combo box ) for search text
_searchText = new QComboBox( this );
Q_CHECK_PTR( _searchText );
+ layout->addWidget(_searchText);
_searchText->setEditable( true );
label->setBuddy( _searchText );
// Box for search button
- Q3HBox * hbox = new Q3HBox( this );
+ QHBoxLayout * hbox = new QHBoxLayout( this );
Q_CHECK_PTR( hbox );
-
- addHStretch( hbox );
+ layout->addLayout(hbox);
+ hbox->addStretch();
// Search button
- _searchButton = new QPushButton( _( "&Search" ), hbox );
+ _searchButton = new QPushButton( _( "&Search" ), this );
Q_CHECK_PTR( _searchButton );
+ hbox->addWidget(_searchButton);
connect( _searchButton, SIGNAL( clicked() ),
this, SLOT ( filter() ) );
- addVStretch( this );
+ layout->addStretch();
//
// Where to search
//
-
- Q3VGroupBox * gbox = new Q3VGroupBox( _( "Search in" ), this );
+
+ QGroupBox * gbox = new QGroupBox( _( "Search in" ), this );
Q_CHECK_PTR( gbox );
-
+ QVBoxLayout *vlayout = new QVBoxLayout;
+ gbox->setLayout(vlayout);
_searchInName = new QCheckBox( _( "&Name" ), gbox ); Q_CHECK_PTR( _searchInName );
+ vlayout->addWidget(_searchInName);
_searchInSummary = new QCheckBox( _( "Su&mmary" ), gbox ); Q_CHECK_PTR( _searchInSummary );
+ vlayout->addWidget(_searchInSummary);
_searchInDescription = new QCheckBox( _( "Descr&iption" ), gbox ); Q_CHECK_PTR( _searchInDescription );
+ vlayout->addWidget(_searchInDescription);
- addVStretch( gbox );
+ vlayout->addStretch();
// Intentionally NOT marking RPM tags for translation
_searchInProvides = new QCheckBox( "RPM \"&Provides\"" , gbox ); Q_CHECK_PTR( _searchInProvides );
+ vlayout->addWidget(_searchInProvides);
_searchInRequires = new QCheckBox( "RPM \"Re&quires\"" , gbox ); Q_CHECK_PTR( _searchInRequires );
+ vlayout->addWidget(_searchInRequires);
_searchInName->setChecked( true );
_searchInSummary->setChecked( true );
- addVStretch( this );
+ layout->addStretch();
//
@@ -116,30 +124,34 @@
label = new QLabel( _( "Search &Mode:" ), this );
Q_CHECK_PTR( label );
+ layout->addWidget(label);
_searchMode = new QComboBox( this );
Q_CHECK_PTR( _searchMode );
+ layout->addWidget(_searchMode);
+
_searchMode->setEditable( false );
label->setBuddy( _searchMode );
// Caution: combo box items must be inserted in the same order as enum SearchMode!
- _searchMode->insertItem( _( "Contains" ) );
- _searchMode->insertItem( _( "Begins with" ) );
- _searchMode->insertItem( _( "Exact Match" ) );
- _searchMode->insertItem( _( "Use Wild Cards" ) );
- _searchMode->insertItem( _( "Use Regular Expression" ) );
+ _searchMode->addItem( _( "Contains" ) );
+ _searchMode->addItem( _( "Begins with" ) );
+ _searchMode->addItem( _( "Exact Match" ) );
+ _searchMode->addItem( _( "Use Wild Cards" ) );
+ _searchMode->addItem( _( "Use Regular Expression" ) );
- _searchMode->setCurrentItem( Contains );
+ _searchMode->setCurrentIndex( Contains );
- addVStretch( this );
+ layout->addStretch();
_caseSensitive = new QCheckBox( _( "Case Sensiti&ve" ), this );
Q_CHECK_PTR( _caseSensitive );
+ layout->addWidget(_caseSensitive);
for ( int i=0; i < 6; i++ )
- addVStretch( this );
+ layout->addStretch();
}
@@ -154,7 +166,7 @@
{
if ( event )
{
- if ( event->state() == 0 ) // No Ctrl / Alt / Shift etc. pressed
+ if ( event->modifiers() == Qt::NoModifier ) // No Ctrl / Alt / Shift etc. pressed
{
if ( event->key() == Qt::Key_Return ||
event->key() == Qt::Key_Enter )
@@ -166,7 +178,7 @@
}
- Q3VBox::keyPressEvent( event );
+ QWidget::keyPressEvent( event );
}
@@ -203,22 +215,19 @@
// Create a progress dialog that is only displayed if the search takes
// longer than a couple of seconds ( default: 4 ).
- Q3ProgressDialog progress( _( "Searching..." ), // text
+ QProgressDialog progress( _( "Searching..." ), // text
_( "&Cancel" ), // cancelButtonLabel
-#ifdef FIXME
- Y2PM::packageManager().size(), // totalSteps
-#else
+ 0,
1000,
-#endif
- this, 0, // parent, name
- true ); // modal
- progress.setCaption( "" );
+ this // parent
+ );
+ progress.setWindowTitle( "" );
progress.setMinimumDuration( 2000 ); // millisec
QTime timer;
QRegExp regexp( _searchText->currentText() );
- regexp.setCaseSensitive( _caseSensitive->isChecked() );
- regexp.setWildcard( _searchMode->currentItem() == UseWildcards );
+ regexp.setCaseSensitivity( _caseSensitive->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive );
+ regexp.setPatternSyntax( (_searchMode->currentIndex() == UseWildcards) ? QRegExp::Wildcard : QRegExp::RegExp);
timer.start();
@@ -226,7 +235,7 @@
int count = 0;
for ( ZyppPoolIterator it = zyppPkgBegin();
- it != zyppPkgEnd() && ! progress.wasCancelled();
+ it != zyppPkgEnd() && ! progress.wasCanceled();
++it )
{
ZyppSel selectable = *it;
@@ -244,7 +253,7 @@
check( selectable, selectable->theObj(), regexp );
- progress.setProgress( count++ );
+ progress.setValue( count++ );
if ( timer.elapsed() > 300 ) // milisec
{
@@ -271,9 +280,8 @@
ZyppObj zyppObj )
{
QRegExp regexp( _searchText->currentText() );
- regexp.setCaseSensitive( _caseSensitive->isChecked() );
- regexp.setWildcard( _searchMode->currentItem() == UseWildcards );
-
+ regexp.setCaseSensitivity( _caseSensitive->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive );
+ regexp.setPatternSyntax( (_searchMode->currentIndex() == UseWildcards) ? QRegExp::Wildcard : QRegExp::RegExp);
return check( selectable, zyppObj, regexp );
}
@@ -316,10 +324,10 @@
QString searchText = _searchText->currentText();
bool match = false;
- switch ( _searchMode->currentItem() )
+ switch ( _searchMode->currentIndex() )
{
case Contains:
- match = att.contains( searchText, _caseSensitive->isChecked() );
+ match = att.contains( searchText, _caseSensitive->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive);
break;
case BeginsWith:
Modified: trunk/qt4/src/pkg/YQPkgSearchFilterView.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt4/src/pkg/YQPkgSearchFilterView.h?rev=42840&r1=42839&r2=42840&view=diff
==============================================================================
--- trunk/qt4/src/pkg/YQPkgSearchFilterView.h (original)
+++ trunk/qt4/src/pkg/YQPkgSearchFilterView.h Sat Dec 8 02:02:48 2007
@@ -21,10 +21,9 @@
#define YQPkgSearchFilterView_h
#include "YQZypp.h"
-#include
-#include
-//Added by qt3to4:
-#include
+#include <QWidget>
+#include <QRegExp>
+#include <QEvent>
class QComboBox;
@@ -39,7 +38,7 @@
/**
* @short Filter view for searching within packages
**/
-class YQPkgSearchFilterView : public Q3VBox
+class YQPkgSearchFilterView : public QWidget
{
Q_OBJECT
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org