summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/big-screen/owidgetstack.cpp2
-rw-r--r--libopie2/opieui/ofontselector.cpp1
-rw-r--r--libopie2/opieui/olistview.cpp20
-rw-r--r--libopie2/opieui/oselector.cpp2
-rw-r--r--libopie2/opieui/owait.cpp1
5 files changed, 17 insertions, 9 deletions
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp
index de7f83f..9c9f7ec 100644
--- a/libopie2/opieui/big-screen/owidgetstack.cpp
+++ b/libopie2/opieui/big-screen/owidgetstack.cpp
@@ -409,33 +409,33 @@ void OWidgetStack::switchStack() {
/*
* we will switch to top level mode
* reparent the list of widgets and then delete the stack
*/
void OWidgetStack::switchTop() {
m_mode = BigScreen;
/* this works because it is guaranteed that switchStack was called at least once*/
if (!m_stack && m_mWidget) {
m_mWidget->setGeometry( frameRect() );
return;
}else if (!m_stack)
return;
if (!m_list.isEmpty() ) {
QMap<int, QWidget*>::Iterator it = m_list.begin();
for ( ; it != m_list.end(); ++it ) {
/* better than reparenting twice */
if ( it.data() == m_mWidget ) {
m_mWidget->reparent(this, 0, frameRect().topLeft() );
m_mWidget->setGeometry( frameRect() );
m_mWidget->show();
}else
/* ### FIXME we need to place the widget better */
it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) );
}
}
delete m_stack;
m_stack = 0;
}
}
-} \ No newline at end of file
+}
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp
index 6763ee6..4870cd9 100644
--- a/libopie2/opieui/ofontselector.cpp
+++ b/libopie2/opieui/ofontselector.cpp
@@ -164,64 +164,65 @@ OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *nam
}
else
d->m_preview = 0;
loadFonts ( d->m_font_family_list );
}
OFontSelector::~OFontSelector()
{
delete d;
}
/**
* This methods tries to set the font
* @param f The wishes font
* @return success or failure
*/
bool OFontSelector::setSelectedFont ( const QFont &f )
{
return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet()));
}
/**
* This is an overloaded method @see setSelectedFont
* @param familyStr The family of the font
* @param styleStr The style of the font
* @param sizeVal The size of font
* @param charset The charset to be used. Will be deprecated by QT3
*/
bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset )
{
+ Q_CONST_UNUSED( charset )
QString sizeStr = QString::number ( sizeVal );
QListBoxItem *family = d->m_font_family_list->findItem ( familyStr );
if ( !family )
family = d->m_font_family_list->findItem ( "Helvetica" );
if ( !family )
family = d->m_font_family_list->firstItem();
d->m_font_family_list->setCurrentItem ( family );
fontFamilyClicked ( d->m_font_family_list->index ( family ));
int style = findItemCB ( d->m_font_style_list, styleStr );
if ( style < 0 )
style = findItemCB ( d->m_font_style_list, "Regular" );
if ( style < 0 && d->m_font_style_list->count() > 0 )
style = 0;
d->m_font_style_list->setCurrentItem ( style );
fontStyleClicked ( style );
int size = findItemCB ( d->m_font_size_list, sizeStr );
if ( size < 0 )
size = findItemCB ( d->m_font_size_list, "10" );
if ( size < 0 && d->m_font_size_list->count() > 0 )
size = 0;
d->m_font_size_list->setCurrentItem ( size );
fontSizeClicked ( size );
return (( family ) && ( style >= 0 ) && ( size >= 0 ));
}
/**
* This method returns the name, style and size of the currently selected
* font or false if no font is selected
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp
index b90c786..67b4b83 100644
--- a/libopie2/opieui/olistview.cpp
+++ b/libopie2/opieui/olistview.cpp
@@ -158,114 +158,116 @@ void OListView::serializeTo( QDataStream& s ) const
{
item = item->nextSibling();
items++;
}
// store number of items and the items itself
s << items;
item = firstChild();
for ( int i = 0; i < items; ++i )
{
s << *static_cast<OListViewItem*>( item );
item = item->nextSibling();
}
odebug << "OListview stored." << oendl;
}
void OListView::serializeFrom( QDataStream& s )
{
#warning Caution... the binary format is still under construction...
odebug << "loading OListView..." << oendl;
int cols;
s >> cols;
odebug << "read number of columns = " << cols << oendl;
while ( columns() < cols ) addColumn( QString::null );
for ( int i = 0; i < cols; ++i )
{
QString coltext;
s >> coltext;
- odebug << "read text '" << coltext << "' for column " << i << "" << oendl;
+ odebug << "read text '" << coltext << "' for column " << i << "" << oendl;
setColumnText( i, coltext );
}
int items;
s >> items;
odebug << "read number of items = " << items << oendl;
for ( int i = 0; i < items; ++i )
{
OListViewItem* item = childFactory();
s >> *item;
}
odebug << "OListView loaded." << oendl;
}
void OListView::expand()
{
odebug << "OListView::expand" << oendl;
QListViewItemIterator it( this );
while ( it.current() ) {
it.current()->setOpen( true );
++it;
}
}
void OListView::collapse()
{
odebug << "OListView::collapse" << oendl;
QListViewItemIterator it( this );
while ( it.current() ) {
it.current()->setOpen( false );
++it;
}
}
QDataStream& operator<<( QDataStream& s, const OListView& lv )
{
lv.serializeTo( s );
+ return s;
}
QDataStream& operator>>( QDataStream& s, OListView& lv )
{
lv.serializeFrom( s );
+ return s;
}
#endif // QT_NO_DATASTREAM
/*======================================================================================
* OListViewItem
*======================================================================================*/
OListViewItem::OListViewItem(QListView *parent)
: QListViewItem(parent)
{
init();
}
OListViewItem::OListViewItem(QListViewItem *parent)
: QListViewItem(parent)
{
init();
}
OListViewItem::OListViewItem(QListView *parent, QListViewItem *after)
: QListViewItem(parent, after)
{
init();
}
OListViewItem::OListViewItem(QListViewItem *parent, QListViewItem *after)
: QListViewItem(parent, after)
{
init();
@@ -413,91 +415,93 @@ void OListViewItem::serializeTo( QDataStream& s ) const
// calculate the number of children to serialize
int items = 0;
QListViewItem* item = firstChild();
while ( item )
{
item = item->nextSibling();
items++;
}
// store number of items and the items itself
s << items;
item = firstChild();
for ( int i = 0; i < items; ++i )
{
s << *static_cast<OListViewItem*>( item );
item = item->nextSibling();
}
odebug << "OListviewItem stored." << oendl;
}
void OListViewItem::serializeFrom( QDataStream& s )
{
#warning Caution... the binary format is still under construction...
odebug << "loading OListViewItem..." << oendl;
for ( int i = 0; i < listView()->columns(); ++i )
{
QString coltext;
s >> coltext;
- odebug << "read text '" << coltext << "' for column " << i << "" << oendl;
+ odebug << "read text '" << coltext << "' for column " << i << "" << oendl;
setText( i, coltext );
}
int items;
s >> items;
- odebug << "read number of items = " << items << "" << oendl;
+ odebug << "read number of items = " << items << "" << oendl;
for ( int i = 0; i < items; ++i )
{
OListViewItem* item = childFactory();
s >> (*item);
}
odebug << "OListViewItem loaded." << oendl;
}
QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi )
{
lvi.serializeTo( s );
+ return s;
}
QDataStream& operator>>( QDataStream& s, OListViewItem& lvi )
{
lvi.serializeFrom( s );
+ return s;
}
#endif // QT_NO_DATASTREAM
/*======================================================================================
* OCheckListItem
*======================================================================================*/
OCheckListItem::OCheckListItem( QCheckListItem* parent, const QString& text, Type t )
:QCheckListItem( parent, text, t )
{
init();
}
OCheckListItem::OCheckListItem( QListViewItem* parent, const QString& text, Type t)
:QCheckListItem( parent, text, t )
{
init();
}
OCheckListItem::OCheckListItem( QListView* parent, const QString& text, Type t )
:QCheckListItem( parent, text, t )
{
init();
}
OCheckListItem::OCheckListItem( QListViewItem* parent, const QString& text, const QPixmap& p )
:QCheckListItem( parent, text, p )
{
@@ -586,98 +590,98 @@ void OCheckListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
{
_cg.setColor( QColorGroup::Base, static_cast<OListView*>( listView() )->alternateBackground() );
}
QCheckListItem::paintCell( p, _cg, column, width, alignment );
//FIXME: Use styling here!
const QPen& pen = static_cast<OListView*>( listView() )->columnSeparator();
p->setPen( pen );
p->drawLine( width-1, 0, width-1, height() );
}
/*======================================================================================
* ONamedListView
*======================================================================================*/
ONamedListView::ONamedListView( QWidget *parent, const char *name )
:OListView( parent, name )
{
}
ONamedListView::~ONamedListView()
{
}
void ONamedListView::addColumns( const QStringList& columns )
{
for ( QStringList::ConstIterator it = columns.begin(); it != columns.end(); ++it )
{
- odebug << "adding column " << *it << "" << oendl;
+ odebug << "adding column " << *it << "" << oendl;
addColumn( *it );
}
}
int ONamedListView::findColumn( const QString& text ) const
{
//FIXME: If used excessively, this will slow down performance of updates
//FIXME: because of the linear search over all column texts.
//FIXME: I will optimize later by using a hash map.
for ( int i = 0; i < columns(); ++i )
if ( columnText( i ) == text )
return i;
return -1;
}
ONamedListViewItem* ONamedListView::find( int column, const QString& text, int recurse ) const
{
return find( (ONamedListViewItem*) firstChild(), column, text, recurse );
}
ONamedListViewItem* ONamedListView::find( ONamedListViewItem* item, int column, const QString& text, int recurse ) const
{
ONamedListViewItem* result;
while ( item && item->text( column ) != text )
{
- odebug << "checked " << item->text( column ) << "" << oendl;
+ odebug << "checked " << item->text( column ) << "" << oendl;
if ( recurse < 0 || recurse > 0 )
{
- odebug << "recursion is " << recurse << " - recursing into..." << oendl;
+ odebug << "recursion is " << recurse << " - recursing into..." << oendl;
result = find( (ONamedListViewItem*) item->firstChild(), column, text, recurse-1 );
if ( result ) return result;
}
item = (ONamedListViewItem*) item->itemBelow();
}
if ( item && item->text( column ) == text )
return item;
else
return 0;
}
ONamedListViewItem* ONamedListView::find( const QString& column, const QString& text, int recurse ) const
{
int col = findColumn( column );
if ( col != -1 )
return find( (ONamedListViewItem*) firstChild(), col, text, recurse );
else
return 0;
}
ONamedListViewItem* ONamedListView::find( ONamedListViewItem* item, const QString& column, const QString& text, int recurse ) const
{
int col = findColumn( column );
if ( col != -1 )
return find( item, col, text, recurse );
else
return 0;
}
@@ -696,69 +700,69 @@ ONamedListViewItem::ONamedListViewItem( QListView* parent, const QStringList& te
ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, const QStringList& texts )
:OListViewItem( parent )
{
setText( texts );
}
ONamedListViewItem::ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts )
:OListViewItem( parent, after )
{
setText( texts );
}
ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts )
:OListViewItem( parent, after )
{
setText( texts );
}
ONamedListViewItem::~ONamedListViewItem()
{
}
void ONamedListViewItem::setText( const QStringList& texts )
{
int col = 0;
for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it )
{
- odebug << "setting column " << col << " = text " << *it << "" << oendl;
+ odebug << "setting column " << col << " = text " << *it << "" << oendl;
OListViewItem::setText( col++, *it );
}
}
void ONamedListViewItem::setText( const QString& column, const QString& text )
{
//FIXME: If used excessively, this will slow down performance of updates
//FIXME: because of the linear search over all column texts.
//FIXME: I will optimize later by using a hash map.
int col = ( (ONamedListView*) listView() )->findColumn( column );
if ( col != -1 )
OListViewItem::setText( col, text );
else
- owarn << "ONamedListViewItem::setText(): Warning! Columntext '" << column << "' not found." << oendl;
+ owarn << "ONamedListViewItem::setText(): Warning! Columntext '" << column << "' not found." << oendl;
}
ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const
{
return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse );
}
ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const
{
int col = ( (ONamedListView*) listView() )->findColumn( column );
if ( col != -1 )
return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse );
else
return 0;
}
}
}
diff --git a/libopie2/opieui/oselector.cpp b/libopie2/opieui/oselector.cpp
index 5f6f10f..05543c5 100644
--- a/libopie2/opieui/oselector.cpp
+++ b/libopie2/opieui/oselector.cpp
@@ -117,64 +117,66 @@ void OXYSelector::paintEvent( QPaintEvent *ev )
}
painter.end();
}
void OXYSelector::mousePressEvent( QMouseEvent *e )
{
int xVal, yVal;
valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal );
setValues( xVal, yVal );
emit valueChanged( xPos, yPos );
}
void OXYSelector::mouseMoveEvent( QMouseEvent *e )
{
int xVal, yVal;
valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal );
setValues( xVal, yVal );
emit valueChanged( xPos, yPos );
}
void OXYSelector::wheelEvent( QWheelEvent *e )
{
#if QT_VERSION > 290
if ( e->orientation() == Qt::Horizontal )
setValues( xValue() + e->delta()/120, yValue() );
else
setValues( xValue(), yValue() + e->delta()/120 );
emit valueChanged( xPos, yPos );
+ #else
+ Q_UNUSED( e )
#endif
}
void OXYSelector::valuesFromPosition( int x, int y, int &xVal, int &yVal ) const
{
xVal = ( (maxX-minX) * (x-2) ) / ( width()-4 );
yVal = maxY - ( ( (maxY-minY) * (y-2) ) / ( height()-4 ) );
if ( xVal > maxX )
xVal = maxX;
else if ( xVal < minX )
xVal = minX;
if ( yVal > maxY )
yVal = maxY;
else if ( yVal < minY )
yVal = minY;
}
void OXYSelector::setPosition( int xp, int yp )
{
if ( xp < 2 )
xp = 2;
else if ( xp > width() - 2 )
xp = width() - 2;
if ( yp < 2 )
yp = 2;
else if ( yp > height() - 2 )
yp = height() - 2;
QPainter painter;
diff --git a/libopie2/opieui/owait.cpp b/libopie2/opieui/owait.cpp
index 9519888..ec1f25a 100644
--- a/libopie2/opieui/owait.cpp
+++ b/libopie2/opieui/owait.cpp
@@ -26,64 +26,65 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "owait.h"
/* OPIE */
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
/* QT */
#include <qlayout.h>
#include <qpainter.h>
using namespace Opie::Ui;
static int frame = 0;
/**
* This will construct a modal dialog.
*
* The default timer length is 10.
*
* @param parent The parent of the widget
* @param msg The name of the object
* @param dispIcon Display Icon?
*/
OWait::OWait( QWidget *parent, const char* msg, bool dispIcon )
:QDialog( parent, msg, TRUE, WStyle_Customize )
{
+ Q_UNUSED( dispIcon )
QHBoxLayout * hbox = new QHBoxLayout( this );
m_lb = new QLabel( this );
m_lb->setBackgroundMode ( NoBackground );
hbox->addWidget( m_lb );
hbox->activate();
m_pix = Resource::loadPixmap( "BigBusy" );
m_aniSize = m_pix.height();
resize( m_aniSize, m_aniSize );
m_timerLength = 10;
m_waitTimer = new QTimer( this );
connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) );
}
void OWait::timerEvent( QTimerEvent * )
{
frame = ( ++frame ) % 4;
repaint();
}
void OWait::paintEvent( QPaintEvent * )
{
QPainter p( m_lb );
p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize );
}
void OWait::show()