SF.net SVN: fclient:[823] trunk/fclient/src/fclient/impl/config.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-30 22:16:51
|
Revision: 823
http://fclient.svn.sourceforge.net/fclient/?rev=823&view=rev
Author: jUrner
Date: 2008-07-30 22:16:59 +0000 (Wed, 30 Jul 2008)
Log Message:
-----------
support for mimetype icons ++ this and that
Modified Paths:
--------------
trunk/fclient/src/fclient/impl/config.py
Modified: trunk/fclient/src/fclient/impl/config.py
===================================================================
--- trunk/fclient/src/fclient/impl/config.py 2008-07-30 22:15:46 UTC (rev 822)
+++ trunk/fclient/src/fclient/impl/config.py 2008-07-30 22:16:59 UTC (rev 823)
@@ -30,6 +30,7 @@
FcDownloadDir = QtCore.QString(os.path.join(_fclientDir, 'downloads'))
FcResDir = QtCore.QString(os.path.join(_implDir, 'res'))
FcSettingsDir = QtCore.QString(os.path.join(_fclientDir, 'settings'))
+FcDefaultStyleSheet = os.path.join(unicode(FcResDir), 'stylesheets', 'default.css')
del _implDir, _fclientDir
#**********************************************************************************
# looks like QObject.findChild() does not always work. docs mention troubles
@@ -106,7 +107,8 @@
('SettingsDir', 'String', QtCore.QString(FcSettingsDir), SettingScopeUser), # if not None, settings are stored locally in the app folder
('SettingsAllUsers', 'Bool', False, SettingScopeUser), # store settings for all users?
- ('IconTheme', 'String', 'crystal', SettingScopeUser), #TODO: global icon theme?
+ ('IconTheme', 'String', QtCore.QString('crystal'), SettingScopeUser), #TODO: global icon theme?
+ ('IconSize', 'UInt', 32, SettingScopeUser),
('DownloadDir', 'String', FcDownloadDir, SettingScopeUser),
)
@@ -161,7 +163,8 @@
#********************************************************************************
#
#********************************************************************************
-#TODO: maybe find a better place
+#TODO: maybe find a better place for the following
+
def qStringToFcpKey(qString):
"""converts a qString to a fcp key
@return: fcp key or None if the key could not be converted
@@ -213,3 +216,61 @@
return key, ''
return r.group(1), r.group(2)
+
+
+# mapping from known mimetypes to icons
+_TmpKnownMimeTypes = (
+ ('mimetype-archive', (
+ 'application/zip',
+ 'application/x-tar',
+ 'application/rar',
+ )
+ ),
+ ('mimetype-audio', (
+ 'audio/x-ms-wma',
+ 'audio/x-wav',
+ 'audio/mpeg',
+ )
+ ),
+ ('mimetype-executable', (
+ 'application/x-msdos-program',
+ )
+ ),
+ ('mimetype-html', (
+ 'text/html',
+ )
+ ),
+ ('mimetype-image', (
+ 'image/gif',
+ 'image/jpeg',
+ 'image/png',
+ 'image/x-icon',
+ 'image/pcx',
+ 'image/pcx',
+ )
+ ),
+ ('mimetype-pdf', (
+ 'application/pdf',
+ )
+ ),
+ ('mimetype-video', (
+ 'video/mpeg',
+ 'video/mp4',
+ 'video/ogg',
+ 'video/x-ms-asf',
+ 'video/x-ms-wmv',
+ 'video/x-msvideo',
+ )
+ ),
+ )
+KnownMimeTypes = {}
+for a, b in _TmpKnownMimeTypes:
+ for b in b:
+ KnownMimeTypes[b] = a
+del _TmpKnownMimeTypes, a, b
+
+def mimeTypeIconName(mimeType):
+ return KnownMimeTypes.get(mimeType, 'mimetype-unknown')
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|