summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-09-21 21:15:59 (UTC)
committer harlekin <harlekin>2002-09-21 21:15:59 (UTC)
commit2e6dd40a0ba17ccf5503fa02bec810b0eeb82f8c (patch) (side-by-side diff)
tree5f302398099f158e8df188420e817017b1acb160
parent023b34ea1584474a0ba625be4b099cb9a2de376c (diff)
downloadopie-2e6dd40a0ba17ccf5503fa02bec810b0eeb82f8c.zip
opie-2e6dd40a0ba17ccf5503fa02bec810b0eeb82f8c.tar.gz
opie-2e6dd40a0ba17ccf5503fa02bec810b0eeb82f8c.tar.bz2
code cleanups
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp6
-rw-r--r--core/pim/today/todaybase.cpp2
2 files changed, 3 insertions, 5 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 901a61a..7673df5 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -148,132 +148,132 @@ void Today::loadPlugins() {
qDebug( QString(*it) );
TodayPlugin plugin;
plugin.library = lib;
plugin.iface = iface;
plugin.name = QString(*it);
// find out if plugins should be shown
if ( m_excludeApplets.grep( *it ).isEmpty() ) {
plugin.active = true;
} else {
plugin.active = false;
}
plugin.guiPart = plugin.iface->guiPart();
// package the whole thing into a qwidget so it can be shown and hidden
plugin.guiBox = new QWidget( this );
QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
QPixmap plugPix;
plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 );
OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
plugIcon->setPixmap( plugPix );
// a scrollview for each plugin
QScrollView* sv = new QScrollView( plugin.guiBox );
QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() );
sv->setMinimumHeight( plugin.guiPart->minHeight() );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setHScrollBarMode( QScrollView::AlwaysOff );
sv->setFrameShape( QFrame::NoFrame );
sv->addChild( plugWidget );
// make sure the icon is on the top alligned
boxLayout->addWidget( plugIcon, 0, AlignTop );
boxLayout->addWidget( sv, 0, AlignTop );
boxLayout->setStretchFactor( plugIcon, 1 );
boxLayout->setStretchFactor( sv, 9 );
// "prebuffer" it in one more list, to get the sorting done
tempList.insert( plugin.name, plugin );
// on first start the list is off course empty
if ( m_allApplets.isEmpty() ) {
layout->addWidget( plugin.guiBox );
pluginList.append( plugin );
}
} else {
qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
delete lib;
}
}
- if ( !m_allApplets.isEmpty() ) {
+ if ( !m_allApplets.isEmpty() ) {
TodayPlugin tempPlugin;
QStringList::Iterator stringit;
for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
tempPlugin = ( tempList.find( *stringit ) ).data();
if ( !( (tempPlugin.name).isEmpty() ) ) {
layout->addWidget( tempPlugin.guiBox );
pluginList.append( tempPlugin );
}
}
}
}
/**
* Repaint method. Reread all fields.
*/
void Today::draw() {
if ( pluginList.count() == 0 ) {
QLabel *noPlugins = new QLabel( this );
noPlugins->setText( tr( "No plugins found" ) );
layout->addWidget( noPlugins );
return;
}
uint count = 0;
TodayPlugin plugin;
for ( uint i = 0; i < pluginList.count(); i++ ) {
plugin = pluginList[i];
if ( plugin.active ) {
- qDebug( plugin.name + " is ACTIVE " );
+ // qDebug( plugin.name + " is ACTIVE " );
plugin.guiBox->show();
} else {
- qDebug( plugin.name + " is INACTIVE" );
+ // qDebug( plugin.name + " is INACTIVE" );
plugin.guiBox->hide();
}
count++;
}
if ( count == 0 ) {
QLabel *noPluginsActive = new QLabel( this );
noPluginsActive->setText( tr( "No plugins activated" ) );
layout->addWidget( noPluginsActive );
}
layout->addStretch(0);
}
/**
* The method for the configuration dialog.
*/
void Today::startConfig() {
TodayConfig conf( this, "dialog", true );
TodayPlugin plugin;
QList<ConfigWidget> configWidgetList;
for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) {
plugin = pluginList[i];
// load the config widgets in the tabs
if ( plugin.guiPart->configWidget( this ) != 0l ) {
ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
configWidgetList.append( widget );
conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig()
, plugin.guiPart->appName() );
}
// set the order/activate tab
conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(),
Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) );
}
if ( conf.exec() == QDialog::Accepted ) {
conf.writeConfig();
ConfigWidget *confWidget;
for ( confWidget = configWidgetList.first(); confWidget != 0;
confWidget = configWidgetList.next() ) {
confWidget->writeConfig();
}
refresh();
}
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp
index 800ca5d..1424b95 100644
--- a/core/pim/today/todaybase.cpp
+++ b/core/pim/today/todaybase.cpp
@@ -1,86 +1,84 @@
/*
* todaybase.cpp
*
* copyright : (c) 2002 by Maximilian Reiß
* email : harlekin@handhelds.org
*
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "todaybase.h"
#include <qframe.h>
#include <qlabel.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qapplication.h>
#include <qpe/resource.h>
TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl ) {
QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo
QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla
QPixmap config = Resource::loadPixmap( "today/config" ); // config icon
layout = new QVBoxLayout( this );
- QVBoxLayout *mainLayout = new QVBoxLayout( this );
-
QPalette pal = this->palette();
QColor col = pal.color( QPalette::Active, QColorGroup::Background );
pal.setColor( QPalette::Active, QColorGroup::Button, col );
pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
pal.setColor( QPalette::Normal, QColorGroup::Button, col );
pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
this->setPalette( pal );
// --- logo Section ---
QPalette pal2;
QColorGroup cg;
cg.setColor( QColorGroup::Text, white );
cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) );
pal2.setActive( cg );
// today logo
Frame = new QLabel( this, "Frame" );
Frame->setPalette( pal2 );
Frame->setFrameShape( QFrame::StyledPanel );
Frame->setFrameShadow( QFrame::Raised );
Frame->setLineWidth( 0 );
Frame->setMaximumHeight( 50 );
Frame->setMinimumHeight( 50 );
// Today text
QLabel* TodayLabel = new QLabel( Frame, "TodayText" );
TodayLabel->setGeometry( QRect( 10, 0, 168, 40 ) );
QFont TodayLabel_font( TodayLabel->font() );
TodayLabel_font.setBold( TRUE );
TodayLabel_font.setPointSize( 40 );
TodayLabel->setFont( TodayLabel_font );
TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin );
TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today²") +"</font>" );
// date
DateLabel = new QLabel( Frame, "TextLabel1" );
DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) );
QFont DateLabel_font( DateLabel->font() );
DateLabel_font.setBold( TRUE );
DateLabel->setFont( DateLabel_font );
DateLabel->setBackgroundOrigin( QLabel::ParentOrigin );
DateLabel->setTextFormat( RichText );
// Opiezilla
QLabel* Opiezilla = new QLabel( Frame, "OpieZilla" );
Opiezilla->setPixmap( opiezilla );
Opiezilla->setGeometry( QApplication::desktop()->width()-50 ,1, 45, 47 );
Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin );