author | drw <drw> | 2005-03-02 19:32:43 (UTC) |
---|---|---|
committer | drw <drw> | 2005-03-02 19:32:43 (UTC) |
commit | 9f3e0913c7b01c1e14f907e756999b9d9bf9ceef (patch) (unidiff) | |
tree | c117c38bbbeb630adbe2f25025ff97dc02475a88 | |
parent | af157881a6265b1ea9e74d61853c2d3d865a6080 (diff) | |
download | opie-9f3e0913c7b01c1e14f907e756999b9d9bf9ceef.zip opie-9f3e0913c7b01c1e14f907e756999b9d9bf9ceef.tar.gz opie-9f3e0913c7b01c1e14f907e756999b9d9bf9ceef.tar.bz2 |
Scale icons approprtely
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 56e3282..fd81313 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -107,96 +107,96 @@ void AdvancedFm::populateView() { | |||
107 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 107 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
108 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); | 108 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
109 | bool isDir = FALSE; | 109 | bool isDir = FALSE; |
110 | 110 | ||
111 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 111 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
112 | QFileInfoListIterator it(*list); | 112 | QFileInfoListIterator it(*list); |
113 | QFileInfo *fi; | 113 | QFileInfo *fi; |
114 | while ( (fi=it.current()) ) { | 114 | while ( (fi=it.current()) ) { |
115 | if (fi->isSymLink() ) { | 115 | if (fi->isSymLink() ) { |
116 | QString symLink = fi->readLink(); | 116 | QString symLink = fi->readLink(); |
117 | QFileInfo sym( symLink); | 117 | QFileInfo sym( symLink); |
118 | fileS.sprintf( "%10i", sym.size() ); | 118 | fileS.sprintf( "%10i", sym.size() ); |
119 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 119 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
120 | fileDate = sym.lastModified().toString(); | 120 | fileDate = sym.lastModified().toString(); |
121 | } else { | 121 | } else { |
122 | fileS.sprintf( "%10i", fi->size() ); | 122 | fileS.sprintf( "%10i", fi->size() ); |
123 | fileL = fi->fileName(); | 123 | fileL = fi->fileName(); |
124 | fileDate= fi->lastModified().toString(); | 124 | fileDate= fi->lastModified().toString(); |
125 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 125 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
126 | // if(fileL == "..") | 126 | // if(fileL == "..") |
127 | fileL += "/"; | 127 | fileL += "/"; |
128 | isDir=TRUE; | 128 | isDir=TRUE; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | QFileInfo fileInfo( path + "/" + fileL); | 131 | QFileInfo fileInfo( path + "/" + fileL); |
132 | 132 | ||
133 | if(fileL !="./" && fi->exists()) { | 133 | if(fileL !="./" && fi->exists()) { |
134 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 134 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
135 | 135 | ||
136 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 136 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
137 | 137 | ||
138 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 138 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
139 | pm = Resource::loadPixmap( "lockedfolder" ); | 139 | pm.convertFromImage( Resource::loadImage( "lockedfolder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
140 | else | 140 | else |
141 | pm= Resource::loadPixmap( "folder" ); | 141 | pm.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
142 | } | 142 | } |
143 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 143 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
144 | pm = Resource::loadPixmap( "exec"); | 144 | pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
145 | } | 145 | } |
146 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 146 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
147 | | fileInfo.permission( QFileInfo::ExeGroup) | 147 | | fileInfo.permission( QFileInfo::ExeGroup) |
148 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 148 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
149 | pm = Resource::loadPixmap( "exec"); | 149 | pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
150 | } | 150 | } |
151 | else if( !fi->isReadable() ) { | 151 | else if( !fi->isReadable() ) { |
152 | pm = Resource::loadPixmap( "locked" ); | 152 | pm.convertFromImage( Resource::loadImage( "locked" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
153 | } | 153 | } |
154 | else { //everything else goes by mimetype | 154 | else { //everything else goes by mimetype |
155 | MimeType mt(fi->filePath()); | 155 | MimeType mt(fi->filePath()); |
156 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 156 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
157 | if(pm.isNull()) { | 157 | if(pm.isNull()) { |
158 | pm = unknownXpm; | 158 | pm = unknownXpm; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { | 161 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { |
162 | // odebug << " overlay link image" << oendl; | 162 | // odebug << " overlay link image" << oendl; |
163 | pm= Resource::loadPixmap( "advancedfm/symlink" ); | 163 | pm.convertFromImage( Resource::loadImage( "advancedfm/symlink" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
164 | // pm= Resource::loadPixmap( "folder" ); | 164 | // pm= Resource::loadPixmap( "folder" ); |
165 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 165 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
166 | // QPainter painter( &pm ); | 166 | // QPainter painter( &pm ); |
167 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 167 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
168 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); | 168 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); |
169 | } | 169 | } |
170 | item->setPixmap( 0,pm); | 170 | item->setPixmap( 0, pm ); |
171 | 171 | ||
172 | } | 172 | } |
173 | isDir=FALSE; | 173 | isDir=FALSE; |
174 | ++it; | 174 | ++it; |
175 | } | 175 | } |
176 | 176 | ||
177 | if( path.find("dev",0,TRUE) != -1) { | 177 | if( path.find("dev",0,TRUE) != -1) { |
178 | struct stat buf; | 178 | struct stat buf; |
179 | dev_t devT; | 179 | dev_t devT; |
180 | DIR *dir; | 180 | DIR *dir; |
181 | struct dirent *mydirent; | 181 | struct dirent *mydirent; |
182 | 182 | ||
183 | if((dir = opendir( path.latin1())) != NULL) | 183 | if((dir = opendir( path.latin1())) != NULL) |
184 | while ((mydirent = readdir(dir)) != NULL) { | 184 | while ((mydirent = readdir(dir)) != NULL) { |
185 | lstat( mydirent->d_name, &buf); | 185 | lstat( mydirent->d_name, &buf); |
186 | // odebug << mydirent->d_name << oendl; | 186 | // odebug << mydirent->d_name << oendl; |
187 | fileL.sprintf("%s", mydirent->d_name); | 187 | fileL.sprintf("%s", mydirent->d_name); |
188 | devT = buf.st_dev; | 188 | devT = buf.st_dev; |
189 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 189 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
190 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 190 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
191 | if( fileL.find(".") == -1 ) { | 191 | if( fileL.find(".") == -1 ) { |
192 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 192 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
193 | pm = unknownXpm; | 193 | pm = unknownXpm; |
194 | item->setPixmap( 0,pm); | 194 | item->setPixmap( 0,pm); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | closedir(dir); | 198 | closedir(dir); |
199 | } | 199 | } |
200 | 200 | ||
201 | thisView->setSorting( 3,FALSE); | 201 | thisView->setSorting( 3,FALSE); |
202 | fillCombo( (const QString &) path ); | 202 | fillCombo( (const QString &) path ); |