author | sandman <sandman> | 2002-10-31 03:12:25 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-31 03:12:25 (UTC) |
commit | 702ab550d1f6b06e779935457e5e25748c8e6fc3 (patch) (side-by-side diff) | |
tree | 852cc6e93f2f0e7c7293e1faab09ab19c17d9c0a | |
parent | d4c2baf3d4998001462ac1be04523b216da02500 (diff) | |
download | opie-702ab550d1f6b06e779935457e5e25748c8e6fc3.zip opie-702ab550d1f6b06e779935457e5e25748c8e6fc3.tar.gz opie-702ab550d1f6b06e779935457e5e25748c8e6fc3.tar.bz2 |
launcher side enhancements to support the "use global font" option from
launcher-settings
-rw-r--r-- | core/launcher/launcher.cpp | 5 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 5 | ||||
-rw-r--r-- | core/launcher/launcherview.h | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 5a9ee1b..767efb2 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -1126,97 +1126,100 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) } } void Launcher::cancelSync() { #ifndef QT_NO_COP QCopEnvelope e( "QPE/Desktop", "cancelSync()" ); #endif } void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "setTabView(QString,int)" ) { QString id; stream >> id; int mode; stream >> mode; if ( tabs->view(id) ) tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); } else if ( msg == "setTabBackground(QString,int,QString)" ) { QString id; stream >> id; int mode; stream >> mode; QString pixmapOrColor; stream >> pixmapOrColor; if ( tabs->view(id) ) tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); } else if ( msg == "setTextColor(QString,QString)" ) { QString id; stream >> id; QString color; stream >> color; if ( tabs->view(id) ) tabs->view(id)->setTextColor( QColor(color) ); } else if ( msg == "setFont(QString,QString,int,int,int)" ) { QString id; stream >> id; QString fam; stream >> fam; int size; stream >> size; int weight; stream >> weight; int italic; stream >> italic; if ( tabs->view(id) ) - tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); + if ( !fam. isEmpty ( )) + tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); + else + tabs->view(id)->unsetViewFont(); qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); } else if ( msg == "setBusyIndicatorType(QString)" ) { QString type; stream >> type; tabs->setBusyIndicatorType(type); } } void Launcher::storageChanged() { if ( in_lnk_props ) { got_lnk_change = TRUE; lnk_change = QString::null; } else { updateLink( QString::null ); } } bool Launcher::mkdir(const QString &localPath) { QDir fullDir(localPath); if (fullDir.exists()) return true; // at this point the directory doesn't exist // go through the directory tree and start creating the direcotories // that don't exist; if we can't create the directories, return false QString dirSeps = "/"; int dirIndex = localPath.find(dirSeps); QString checkedPath; // didn't find any seps; weird, use the cur dir instead if (dirIndex == -1) { //qDebug("No seperators found in path %s", localPath.latin1()); checkedPath = QDir::currentDirPath(); } while (checkedPath != localPath) { // no more seperators found, use the local path if (dirIndex == -1) checkedPath = localPath; else { // the next directory to check checkedPath = localPath.left(dirIndex) + "/"; // advance the iterator; the next dir seperator diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 9fc4565..2a051a6 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp @@ -805,96 +805,101 @@ void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) icons->setBackgroundPixmap( (*bgCache)[bgName]->pm ); } else { qDebug( "Loading image: %s", val.latin1() ); QPixmap bg( Resource::loadPixmap( val ) ); if ( bg.isNull() ) { QImageIO imgio; imgio.setFileName( bgName ); QSize ds = qApp->desktop()->size(); QString param( "Scale( %1, %2, ScaleMin )" ); // No tr imgio.setParameters( param.arg(ds.width()).arg(ds.height()).latin1() ); imgio.read(); bg = imgio.image(); } bgCache->insert( bgName, new BgPixmap(bg) ); icons->setBackgroundPixmap( bg ); } break; } // remove unreferenced backgrounds. QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); while ( it != bgCache->end() ) { QMap<QString,BgPixmap*>::Iterator curr = it; ++it; if ( (*curr)->ref == 0 ) { delete (*curr); bgCache->remove( curr ); } } bgType = t; icons->viewport()->update(); } void LauncherView::setTextColor( const QColor &tc ) { textCol = tc; QColorGroup cg = icons->colorGroup(); cg.setColor( QColorGroup::Text, tc ); icons->setPalette( QPalette(cg,cg,cg) ); icons->viewport()->update(); } void LauncherView::setViewFont( const QFont &f ) { icons->setFont( f ); } +void LauncherView::unsetViewFont( ) +{ + icons->unsetFont( ); +} + void LauncherView::resizeEvent(QResizeEvent *e) { QVBox::resizeEvent( e ); if ( e->size().width() != e->oldSize().width() ) sort(); } void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) { icons->clear(); internalPopulate( folder, typefilter ); } QString LauncherView::getAllDocLinkInfo() const { return icons->getAllDocLinkInfo(); } void LauncherView::selectionChanged() { QIconViewItem* item = icons->currentItem(); if ( item && item->isSelected() ) { AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); if ( icons->inKeyEvent() ) // not for mouse press emit clicked( appLnk ); item->setSelected(FALSE); } } void LauncherView::returnPressed( QIconViewItem *item ) { if ( item ) { AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); emit clicked( appLnk ); } } void LauncherView::itemClicked( int btn, QIconViewItem *item ) { if ( item ) { AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); if ( btn == LeftButton ) { // Make sure it's the item we execute that gets highlighted icons->setCurrentItem( item ); emit clicked( appLnk ); } item->setSelected(FALSE); } diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h index 194e4a2..82a319b 100644 --- a/core/launcher/launcherview.h +++ b/core/launcher/launcherview.h @@ -19,87 +19,88 @@ **********************************************************************/ #ifndef LAUNCHERVIEW_H #define LAUNCHERVIEW_H #include <qpe/storage.h> #include <qvbox.h> class AppLnk; class AppLnkSet; class CategorySelect; class LauncherIconView; class QIconView; class QIconViewItem; class MenuButton; class QComboBox; class LauncherView : public QVBox { Q_OBJECT public: LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~LauncherView(); bool removeLink(const QString& linkfile); void addItem(AppLnk* app, bool resort=TRUE); void sort(); void setFileSystems(const QList<FileSystem> &); void setToolsEnabled(bool); void updateTools(); void setBusy(bool); QString getAllDocLinkInfo() const; enum ViewMode { Icon, List }; void setViewMode( ViewMode m ); ViewMode viewMode() const { return vmode; } enum BackgroundType { Ruled, SolidColor, Image }; void setBackgroundType( BackgroundType t, const QString & ); BackgroundType backgroundType() const { return bgType; } void setTextColor( const QColor & ); QColor textColor() const { return textCol; } void setViewFont( const QFont & ); + void unsetViewFont ( ); void setBusyIndicatorType ( const QString &type ); public slots: void populate( AppLnkSet *folder, const QString& categoryfilter ); signals: void clicked( const AppLnk * ); void rightPressed( AppLnk * ); protected slots: void selectionChanged(); void returnPressed( QIconViewItem *item ); void itemClicked( int, QIconViewItem * ); void itemPressed( int, QIconViewItem * ); void sortBy(int); void showType(int); void showCategory( int ); void resizeEvent(QResizeEvent *); protected: void internalPopulate( AppLnkSet *, const QString& categoryfilter ); void paletteChange( const QPalette & ); private: static bool bsy; QWidget* tools; LauncherIconView* icons; QComboBox *typemb; QStringList typelist; CategorySelect *catmb; ViewMode vmode; BackgroundType bgType; QString bgName; QColor textCol; int busyType; }; #endif // LAUNCHERVIEW_H |