author | sandman <sandman> | 2002-10-31 03:12:25 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-31 03:12:25 (UTC) |
commit | 702ab550d1f6b06e779935457e5e25748c8e6fc3 (patch) (unidiff) | |
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 | |||
@@ -1142,65 +1142,68 @@ void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) | |||
1142 | int mode; | 1142 | int mode; |
1143 | stream >> mode; | 1143 | stream >> mode; |
1144 | if ( tabs->view(id) ) | 1144 | if ( tabs->view(id) ) |
1145 | tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); | 1145 | tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); |
1146 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { | 1146 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { |
1147 | QString id; | 1147 | QString id; |
1148 | stream >> id; | 1148 | stream >> id; |
1149 | int mode; | 1149 | int mode; |
1150 | stream >> mode; | 1150 | stream >> mode; |
1151 | QString pixmapOrColor; | 1151 | QString pixmapOrColor; |
1152 | stream >> pixmapOrColor; | 1152 | stream >> pixmapOrColor; |
1153 | if ( tabs->view(id) ) | 1153 | if ( tabs->view(id) ) |
1154 | tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 1154 | tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
1155 | } else if ( msg == "setTextColor(QString,QString)" ) { | 1155 | } else if ( msg == "setTextColor(QString,QString)" ) { |
1156 | QString id; | 1156 | QString id; |
1157 | stream >> id; | 1157 | stream >> id; |
1158 | QString color; | 1158 | QString color; |
1159 | stream >> color; | 1159 | stream >> color; |
1160 | if ( tabs->view(id) ) | 1160 | if ( tabs->view(id) ) |
1161 | tabs->view(id)->setTextColor( QColor(color) ); | 1161 | tabs->view(id)->setTextColor( QColor(color) ); |
1162 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { | 1162 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { |
1163 | QString id; | 1163 | QString id; |
1164 | stream >> id; | 1164 | stream >> id; |
1165 | QString fam; | 1165 | QString fam; |
1166 | stream >> fam; | 1166 | stream >> fam; |
1167 | int size; | 1167 | int size; |
1168 | stream >> size; | 1168 | stream >> size; |
1169 | int weight; | 1169 | int weight; |
1170 | stream >> weight; | 1170 | stream >> weight; |
1171 | int italic; | 1171 | int italic; |
1172 | stream >> italic; | 1172 | stream >> italic; |
1173 | if ( tabs->view(id) ) | 1173 | if ( tabs->view(id) ) |
1174 | tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 1174 | if ( !fam. isEmpty ( )) |
1175 | tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | ||
1176 | else | ||
1177 | tabs->view(id)->unsetViewFont(); | ||
1175 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); | 1178 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); |
1176 | } | 1179 | } |
1177 | else if ( msg == "setBusyIndicatorType(QString)" ) { | 1180 | else if ( msg == "setBusyIndicatorType(QString)" ) { |
1178 | QString type; | 1181 | QString type; |
1179 | stream >> type; | 1182 | stream >> type; |
1180 | tabs->setBusyIndicatorType(type); | 1183 | tabs->setBusyIndicatorType(type); |
1181 | } | 1184 | } |
1182 | } | 1185 | } |
1183 | 1186 | ||
1184 | void Launcher::storageChanged() | 1187 | void Launcher::storageChanged() |
1185 | { | 1188 | { |
1186 | if ( in_lnk_props ) { | 1189 | if ( in_lnk_props ) { |
1187 | got_lnk_change = TRUE; | 1190 | got_lnk_change = TRUE; |
1188 | lnk_change = QString::null; | 1191 | lnk_change = QString::null; |
1189 | } else { | 1192 | } else { |
1190 | updateLink( QString::null ); | 1193 | updateLink( QString::null ); |
1191 | } | 1194 | } |
1192 | } | 1195 | } |
1193 | 1196 | ||
1194 | 1197 | ||
1195 | bool Launcher::mkdir(const QString &localPath) | 1198 | bool Launcher::mkdir(const QString &localPath) |
1196 | { | 1199 | { |
1197 | QDir fullDir(localPath); | 1200 | QDir fullDir(localPath); |
1198 | if (fullDir.exists()) | 1201 | if (fullDir.exists()) |
1199 | return true; | 1202 | return true; |
1200 | 1203 | ||
1201 | // at this point the directory doesn't exist | 1204 | // at this point the directory doesn't exist |
1202 | // go through the directory tree and start creating the direcotories | 1205 | // go through the directory tree and start creating the direcotories |
1203 | // that don't exist; if we can't create the directories, return false | 1206 | // that don't exist; if we can't create the directories, return false |
1204 | 1207 | ||
1205 | QString dirSeps = "/"; | 1208 | QString dirSeps = "/"; |
1206 | int dirIndex = localPath.find(dirSeps); | 1209 | int dirIndex = localPath.find(dirSeps); |
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 | |||
@@ -821,64 +821,69 @@ void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) | |||
821 | break; | 821 | break; |
822 | } | 822 | } |
823 | 823 | ||
824 | // remove unreferenced backgrounds. | 824 | // remove unreferenced backgrounds. |
825 | QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); | 825 | QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); |
826 | while ( it != bgCache->end() ) { | 826 | while ( it != bgCache->end() ) { |
827 | QMap<QString,BgPixmap*>::Iterator curr = it; | 827 | QMap<QString,BgPixmap*>::Iterator curr = it; |
828 | ++it; | 828 | ++it; |
829 | if ( (*curr)->ref == 0 ) { | 829 | if ( (*curr)->ref == 0 ) { |
830 | delete (*curr); | 830 | delete (*curr); |
831 | bgCache->remove( curr ); | 831 | bgCache->remove( curr ); |
832 | } | 832 | } |
833 | } | 833 | } |
834 | 834 | ||
835 | bgType = t; | 835 | bgType = t; |
836 | icons->viewport()->update(); | 836 | icons->viewport()->update(); |
837 | } | 837 | } |
838 | 838 | ||
839 | void LauncherView::setTextColor( const QColor &tc ) | 839 | void LauncherView::setTextColor( const QColor &tc ) |
840 | { | 840 | { |
841 | textCol = tc; | 841 | textCol = tc; |
842 | QColorGroup cg = icons->colorGroup(); | 842 | QColorGroup cg = icons->colorGroup(); |
843 | cg.setColor( QColorGroup::Text, tc ); | 843 | cg.setColor( QColorGroup::Text, tc ); |
844 | icons->setPalette( QPalette(cg,cg,cg) ); | 844 | icons->setPalette( QPalette(cg,cg,cg) ); |
845 | icons->viewport()->update(); | 845 | icons->viewport()->update(); |
846 | } | 846 | } |
847 | 847 | ||
848 | void LauncherView::setViewFont( const QFont &f ) | 848 | void LauncherView::setViewFont( const QFont &f ) |
849 | { | 849 | { |
850 | icons->setFont( f ); | 850 | icons->setFont( f ); |
851 | } | 851 | } |
852 | 852 | ||
853 | void LauncherView::unsetViewFont( ) | ||
854 | { | ||
855 | icons->unsetFont( ); | ||
856 | } | ||
857 | |||
853 | void LauncherView::resizeEvent(QResizeEvent *e) | 858 | void LauncherView::resizeEvent(QResizeEvent *e) |
854 | { | 859 | { |
855 | QVBox::resizeEvent( e ); | 860 | QVBox::resizeEvent( e ); |
856 | if ( e->size().width() != e->oldSize().width() ) | 861 | if ( e->size().width() != e->oldSize().width() ) |
857 | sort(); | 862 | sort(); |
858 | } | 863 | } |
859 | 864 | ||
860 | void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) | 865 | void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) |
861 | { | 866 | { |
862 | icons->clear(); | 867 | icons->clear(); |
863 | internalPopulate( folder, typefilter ); | 868 | internalPopulate( folder, typefilter ); |
864 | } | 869 | } |
865 | 870 | ||
866 | QString LauncherView::getAllDocLinkInfo() const | 871 | QString LauncherView::getAllDocLinkInfo() const |
867 | { | 872 | { |
868 | return icons->getAllDocLinkInfo(); | 873 | return icons->getAllDocLinkInfo(); |
869 | } | 874 | } |
870 | 875 | ||
871 | void LauncherView::selectionChanged() | 876 | void LauncherView::selectionChanged() |
872 | { | 877 | { |
873 | QIconViewItem* item = icons->currentItem(); | 878 | QIconViewItem* item = icons->currentItem(); |
874 | if ( item && item->isSelected() ) { | 879 | if ( item && item->isSelected() ) { |
875 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 880 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
876 | if ( icons->inKeyEvent() ) // not for mouse press | 881 | if ( icons->inKeyEvent() ) // not for mouse press |
877 | emit clicked( appLnk ); | 882 | emit clicked( appLnk ); |
878 | item->setSelected(FALSE); | 883 | item->setSelected(FALSE); |
879 | } | 884 | } |
880 | } | 885 | } |
881 | 886 | ||
882 | void LauncherView::returnPressed( QIconViewItem *item ) | 887 | void LauncherView::returnPressed( QIconViewItem *item ) |
883 | { | 888 | { |
884 | if ( item ) { | 889 | if ( item ) { |
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 | |||
@@ -35,64 +35,65 @@ class QComboBox; | |||
35 | 35 | ||
36 | class LauncherView : public QVBox | 36 | class LauncherView : public QVBox |
37 | { | 37 | { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | 39 | ||
40 | public: | 40 | public: |
41 | LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 41 | LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
42 | ~LauncherView(); | 42 | ~LauncherView(); |
43 | 43 | ||
44 | bool removeLink(const QString& linkfile); | 44 | bool removeLink(const QString& linkfile); |
45 | void addItem(AppLnk* app, bool resort=TRUE); | 45 | void addItem(AppLnk* app, bool resort=TRUE); |
46 | void sort(); | 46 | void sort(); |
47 | 47 | ||
48 | void setFileSystems(const QList<FileSystem> &); | 48 | void setFileSystems(const QList<FileSystem> &); |
49 | void setToolsEnabled(bool); | 49 | void setToolsEnabled(bool); |
50 | void updateTools(); | 50 | void updateTools(); |
51 | 51 | ||
52 | void setBusy(bool); | 52 | void setBusy(bool); |
53 | 53 | ||
54 | QString getAllDocLinkInfo() const; | 54 | QString getAllDocLinkInfo() const; |
55 | enum ViewMode { Icon, List }; | 55 | enum ViewMode { Icon, List }; |
56 | void setViewMode( ViewMode m ); | 56 | void setViewMode( ViewMode m ); |
57 | ViewMode viewMode() const { return vmode; } | 57 | ViewMode viewMode() const { return vmode; } |
58 | 58 | ||
59 | enum BackgroundType { Ruled, SolidColor, Image }; | 59 | enum BackgroundType { Ruled, SolidColor, Image }; |
60 | void setBackgroundType( BackgroundType t, const QString & ); | 60 | void setBackgroundType( BackgroundType t, const QString & ); |
61 | BackgroundType backgroundType() const { return bgType; } | 61 | BackgroundType backgroundType() const { return bgType; } |
62 | 62 | ||
63 | void setTextColor( const QColor & ); | 63 | void setTextColor( const QColor & ); |
64 | QColor textColor() const { return textCol; } | 64 | QColor textColor() const { return textCol; } |
65 | 65 | ||
66 | void setViewFont( const QFont & ); | 66 | void setViewFont( const QFont & ); |
67 | void unsetViewFont ( ); | ||
67 | 68 | ||
68 | void setBusyIndicatorType ( const QString &type ); | 69 | void setBusyIndicatorType ( const QString &type ); |
69 | 70 | ||
70 | public slots: | 71 | public slots: |
71 | void populate( AppLnkSet *folder, const QString& categoryfilter ); | 72 | void populate( AppLnkSet *folder, const QString& categoryfilter ); |
72 | 73 | ||
73 | signals: | 74 | signals: |
74 | void clicked( const AppLnk * ); | 75 | void clicked( const AppLnk * ); |
75 | void rightPressed( AppLnk * ); | 76 | void rightPressed( AppLnk * ); |
76 | 77 | ||
77 | protected slots: | 78 | protected slots: |
78 | void selectionChanged(); | 79 | void selectionChanged(); |
79 | void returnPressed( QIconViewItem *item ); | 80 | void returnPressed( QIconViewItem *item ); |
80 | void itemClicked( int, QIconViewItem * ); | 81 | void itemClicked( int, QIconViewItem * ); |
81 | void itemPressed( int, QIconViewItem * ); | 82 | void itemPressed( int, QIconViewItem * ); |
82 | void sortBy(int); | 83 | void sortBy(int); |
83 | void showType(int); | 84 | void showType(int); |
84 | void showCategory( int ); | 85 | void showCategory( int ); |
85 | void resizeEvent(QResizeEvent *); | 86 | void resizeEvent(QResizeEvent *); |
86 | 87 | ||
87 | protected: | 88 | protected: |
88 | void internalPopulate( AppLnkSet *, const QString& categoryfilter ); | 89 | void internalPopulate( AppLnkSet *, const QString& categoryfilter ); |
89 | void paletteChange( const QPalette & ); | 90 | void paletteChange( const QPalette & ); |
90 | 91 | ||
91 | private: | 92 | private: |
92 | static bool bsy; | 93 | static bool bsy; |
93 | QWidget* tools; | 94 | QWidget* tools; |
94 | LauncherIconView* icons; | 95 | LauncherIconView* icons; |
95 | QComboBox *typemb; | 96 | QComboBox *typemb; |
96 | QStringList typelist; | 97 | QStringList typelist; |
97 | CategorySelect *catmb; | 98 | CategorySelect *catmb; |
98 | ViewMode vmode; | 99 | ViewMode vmode; |