Author: dmacvicar
Date: Fri Nov 30 12:03:24 2007
New Revision: 42540
URL: http://svn.opensuse.org/viewcvs/yast?rev=42540&view=rev
Log:
- Various classes
Modified:
branches/tmp/coolo/qt4-port/src/YQDialog.cc
branches/tmp/coolo/qt4-port/src/YQDownloadProgress.cc
branches/tmp/coolo/qt4-port/src/YQDumbTab.cc
branches/tmp/coolo/qt4-port/src/YQGenericButton.cc
branches/tmp/coolo/qt4-port/src/YQImage.cc
branches/tmp/coolo/qt4-port/src/YQInputField.cc
branches/tmp/coolo/qt4-port/src/YQIntField.cc
branches/tmp/coolo/qt4-port/src/YQLogView.cc
branches/tmp/coolo/qt4-port/src/YQMenuButton.cc
branches/tmp/coolo/qt4-port/src/YQMenuButton.h
branches/tmp/coolo/qt4-port/src/YQUI_core.cc
branches/tmp/coolo/qt4-port/src/YQWizard.cc
branches/tmp/coolo/qt4-port/src/YQWizard.h
Modified: branches/tmp/coolo/qt4-port/src/YQDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQDialog.cc?rev=42540&r1=42539&r2=42540&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/YQDialog.cc (original)
+++ branches/tmp/coolo/qt4-port/src/YQDialog.cc Fri Nov 30 12:03:24 2007
@@ -52,7 +52,7 @@
_defaultButton = 0;
setWidgetRep( this );
- setCaption( hasDefaultSize() ? "YaST2" : "" );
+ setWindowTitle( hasDefaultSize() ? "YaST2" : "" );
setFocusPolicy( Qt::StrongFocus );
if ( ! default_size )
@@ -70,10 +70,10 @@
}
QPalette warnPalette( normalBackground );
- QColorGroup normalColors = warnPalette.normal();
- normalColors.setColor( QColorGroup::Text, text );
- normalColors.setColor( QColorGroup::Base, inputFieldBackground );
- warnPalette.setNormal( normalColors );
+ //warnPalette.createColorGroup(Active);
+ warnPalette.setColor( QPalette::Active, QPalette::Text, text );
+ warnPalette.setColor( QPalette::Active, QPalette::Base, inputFieldBackground );
+ warnPalette.setCurrentColorGroup(QPalette::Active);
setPalette( warnPalette );
}
@@ -213,7 +213,7 @@
if ( ! YQUI::ui()->haveWM() )
{
if ( YQUI::ui()->autoActivateDialogs() )
- setActiveWindow();
+ activateWindow();
else
y2milestone( "Auto-activating dialog window turned off" );
}
@@ -311,9 +311,9 @@
if ( _defaultButton && button != _defaultButton )
{
y2error( "Too many default buttons: [%s]",
- (const char *) button->text() );
+ qPrintable(button->text()) );
y2error( "Using old default button: [%s]",
- (const char *) _defaultButton->text() );
+ qPrintable(_defaultButton->text()) );
}
else
{
@@ -441,7 +441,7 @@
else
{
y2error( "Too many `opt(`default) PushButtons: [%s]",
- (const char *) newDefaultButton->text() );
+ qPrintable(newDefaultButton->text()) );
newDefaultButton->setDefaultButton( false );
return;
}
@@ -452,7 +452,7 @@
if ( _defaultButton )
{
_defaultButton->setDefaultButton( true );
- y2debug( "New default button: [%s]", (const char *) _defaultButton->text() );
+ y2debug( "New default button: [%s]", qPrintable(_defaultButton->text()) );
if ( _defaultButton && ! _focusButton )
_defaultButton->showAsDefault( true );
@@ -469,7 +469,7 @@
_focusButton->isEnabled() &&
_focusButton->isShownAsDefault() )
{
- y2debug( "Activating focus button: [%s]", (const char *) _focusButton->text() );
+ y2debug( "Activating focus button: [%s]", qPrintable(_focusButton->text()) );
_focusButton->activate();
return true;
}
@@ -483,7 +483,7 @@
_defaultButton->isEnabled() &&
_defaultButton->isShownAsDefault() )
{
- y2debug( "Activating default button: [%s]", (const char *) _defaultButton->text() );
+ y2debug( "Activating default button: [%s]", qPrintable(_defaultButton->text()) );
_defaultButton->activate();
return true;
}
@@ -547,7 +547,7 @@
return;
}
else if ( event->key() == Qt::Key_F4 && // Shift-F4: toggle colors for vision impaired users
- event->state() == Qt::ShiftButton )
+ event->modifiers() & Qt::ShiftModifier )
{
YQUI::ui()->toggleVisionImpairedPalette();
@@ -565,18 +565,18 @@
return;
}
else if ( event->key() == Qt::Key_F7 && // Shift-F7: toggle y2debug logging
- event->state() == Qt::ShiftButton )
+ event->modifiers() == Qt::ShiftModifier )
{
YQUI::ui()->askConfigureLogging();
return;
}
else if ( event->key() == Qt::Key_F8 && // Shift-F8: save y2logs
- event->state() == Qt::ShiftButton )
+ event->modifiers() & Qt::ShiftModifier )
{
YQUI::ui()->askSaveLogs();
return;
}
- else if ( event->state() == 0 ) // No Ctrl / Alt / Shift etc. pressed
+ else if ( event->modifiers() & Qt::NoModifier ) // No Ctrl / Alt / Shift etc. pressed
{
if ( event->key() == Qt::Key_Return ||
event->key() == Qt::Key_Enter )
@@ -585,7 +585,7 @@
return;
}
}
- else if ( event->state() == ( Qt::ControlButton | Qt::ShiftButton | Qt::AltButton ) )
+ else if ( event->modifiers() & ( Qt::ControlModifier | Qt::ShiftModifier | Qt::AltModifier ) )
{
// Qt-UI special keys - all with Ctrl-Shift-Alt
@@ -656,11 +656,16 @@
void
YQDialog::show()
{
- if ( ! hasDefaultSize() && qApp->mainWidget()->isVisible() )
- center( this, qApp->mainWidget() );
+ //if ( ! hasDefaultSize() && qApp->mainWidget()->isVisible() )
+ if ( ! hasDefaultSize() )
+ {
+ // will use topwidget anyway
+ center( this, 0 );
+ }
else if ( isCentered() )
- center( this, qApp->desktop() );
-
+ {
+ center( this, qApp->desktop() );
+ }
QWidget::show();
}
@@ -669,18 +674,26 @@
YQDialog::center( QWidget * dialog, QWidget * parent )
{
if ( ! dialog )
- return;
+ return;
if ( ! parent )
{
- if ( dialog == qApp->mainWidget() )
- parent = qApp->desktop();
- else
- parent = qApp->mainWidget();
+ //FIXME if not toplevel window
+ // align with top level widget
+ foreach (QWidget *widget, QApplication::topLevelWidgets())
+ {
+ // if it is a top level widget, center with desktop
+ if (dialog == widget) parent = qApp->desktop(); break;
+ }
+
+ if ( QApplication::topLevelWidgets().empty() )
+ return;
+
+ parent = QApplication::topLevelWidgets().first();
}
QPoint pos( ( parent->width() - dialog->width() ) / 2,
- ( parent->height() - dialog->height() ) / 2 );
+ ( parent->height() - dialog->height() ) / 2 );
pos += parent->mapToGlobal( QPoint( 0, 0 ) );
pos = dialog->mapToParent( dialog->mapFromGlobal( pos ) );
Modified: branches/tmp/coolo/qt4-port/src/YQDownloadProgress.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQDownloadProgress.cc?rev=42540&r1=42539&r2=42540&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/YQDownloadProgress.cc (original)
+++ branches/tmp/coolo/qt4-port/src/YQDownloadProgress.cc Fri Nov 30 12:03:24 2007
@@ -60,8 +60,8 @@
connect( _timer, SIGNAL( timeout() ),
this, SLOT ( pollFileSize() ) );
- _timer->start( 250, // millisec
- false ); // single shot?
+ _timer->setSingleShot(false);
+ _timer->start( 250 );// millisec
}
Modified: branches/tmp/coolo/qt4-port/src/YQDumbTab.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQDumbTab.cc?rev=42540&r1=42539&r2=42540&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/YQDumbTab.cc (original)
+++ branches/tmp/coolo/qt4-port/src/YQDumbTab.cc Fri Nov 30 12:03:24 2007
@@ -171,7 +171,7 @@
qDrawWinPanel( &painter,
x_offset, y_offset,
frameWidth, frameHeight,
- colorGroup(),
+ palette(),
false, // sunken
(const QBrush *) 0 ); // brush - don't fill interior
}
Modified: branches/tmp/coolo/qt4-port/src/YQGenericButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQGenericButton.cc?rev=42540&r1=42539&r2=42540&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/YQGenericButton.cc (original)
+++ branches/tmp/coolo/qt4-port/src/YQGenericButton.cc Fri Nov 30 12:03:24 2007
@@ -130,7 +130,7 @@
if ( qIconName.isEmpty() )
{
- _qPushButton->setIconSet( QIcon() );
+ _qPushButton->setIcon( QIcon() );
return;
}
@@ -138,9 +138,9 @@
QPixmap icon( qIconName );
if ( icon.isNull() )
- y2warning( "Can't load icon '%s'", (const char *) qIconName );
+ y2warning( "Can't load icon '%s'", qPrintable(qIconName) );
else
- _qPushButton->setIconSet( icon );
+ _qPushButton->setIcon( icon );
}
@@ -149,7 +149,7 @@
if ( _qPushButton )
_qPushButton->setText( label );
else
- y2error( "NULL button '%s'", (const char *) label );
+ y2error( "NULL button '%s'", qPrintable(label) );
YPushButton::setLabel( toUTF8( label ) );
}
Modified: branches/tmp/coolo/qt4-port/src/YQImage.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQImage.cc?rev=42540&r1=42539&r2=42540&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/YQImage.cc (original)
+++ branches/tmp/coolo/qt4-port/src/YQImage.cc Fri Nov 30 12:03:24 2007
@@ -63,7 +63,7 @@
{
QMovie movie( fromUTF8( imageFileName() ) );
- if ( movie.isNull() )
+ if ( movie.isValid() )
{
y2error( "Couldn't load animation from %s", imageFileName().c_str() );
}
Modified: branches/tmp/coolo/qt4-port/src/YQInputField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQInputField.cc?rev=42540&r1=42539&r2=42540&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/YQInputField.cc (original)
+++ branches/tmp/coolo/qt4-port/src/YQInputField.cc Fri Nov 30 12:03:24 2007
@@ -122,7 +122,7 @@
int YQInputField::preferredWidth()
{
int minSize = shrinkable() ? 30 : 200;
- int hintWidth = _caption->isShown()
+ int hintWidth = !_caption->isHidden()
? _caption->sizeHint().width() + 2 * YQWidgetMargin
: 0;
@@ -179,7 +179,7 @@
if ( ! isValidText( _qt_lineEdit->text() ) )
{
y2error( "Old value \"%s\" of %s \"%s\" invalid according to ValidChars \"%s\" - deleting",
- (const char *) _qt_lineEdit->text(),
+ qPrintable(_qt_lineEdit->text()),
widgetClass(), debugLabel().c_str(),
newValidChars.c_str() );
_qt_lineEdit->setText( "" );
Modified: branches/tmp/coolo/qt4-port/src/YQIntField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQIntField.cc?rev=42540&r1=42539&r2=42540&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/YQIntField.cc (original)
+++ branches/tmp/coolo/qt4-port/src/YQIntField.cc Fri Nov 30 12:03:24 2007
@@ -50,9 +50,11 @@
YUI_CHECK_NEW( _caption );
layout->addWidget( _caption );
- _qt_spinBox = new QSpinBox( minValue, maxValue,
- 1, // step
- this );
+ _qt_spinBox = new QSpinBox(this);
+ _qt_spinBox->setMinimum(minValue);
+ _qt_spinBox->setMaximum(maxValue);
+ _qt_spinBox->setSingleStep(1);
+
YUI_CHECK_NEW( _qt_spinBox );
layout->addWidget( _qt_spinBox );
Modified: branches/tmp/coolo/qt4-port/src/YQLogView.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQLogView.cc?rev=42540&r1=42539&r2=42540&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/YQLogView.cc (original)
+++ branches/tmp/coolo/qt4-port/src/YQLogView.cc Fri Nov 30 12:03:24 2007
@@ -107,7 +107,7 @@
hintHeight += _qt_text->style()->pixelMetric( QStyle::PM_ScrollBarExtent );
hintHeight += _qt_text->frameWidth() * 2;
- if ( _caption->isShown() )
+ if ( !_caption->isHidden() )
hintHeight += _caption->sizeHint().height();
return max( 80, hintHeight );
Modified: branches/tmp/coolo/qt4-port/src/YQMenuButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQMenuButton.cc?rev=42540&r1=42539&r2=42540&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/YQMenuButton.cc (original)
+++ branches/tmp/coolo/qt4-port/src/YQMenuButton.cc Fri Nov 30 12:03:24 2007
@@ -18,7 +18,7 @@
#include