Browse Source

* Large set of SuSE patches to fix bugs and add functionality

* kdemm is included but not used by knotify as it does not work out of the box


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1171141 283d02a7-25f6-0310-bc7c-ecb5cbfe19
tpearson 8 years ago
parent
commit
96900dbce3
100 changed files with 4259 additions and 179 deletions
  1. 1
    1
      Makefile.am.in
  2. 39
    0
      catalog.xml
  3. 5
    0
      dcop/KDE-ICE/Xtranssock.c
  4. 3
    1
      dcop/dcopc.c
  5. 3
    1
      dcop/dcopclient.cpp
  6. 3
    1
      dcop/dcopserver_shutdown.c
  7. 1
    1
      interfaces/kimproxy/library/kimproxy.cpp
  8. 2
    2
      interfaces/kmediaplayer/kfileaudiopreview/kfileaudiopreview.cpp
  9. 3
    3
      kate/part/katehighlight.cpp
  10. 1
    1
      kdecore/eventsrc
  11. 2
    0
      kdecore/fakes.c
  12. 17
    3
      kdecore/kapplication.cpp
  13. 5
    1
      kdecore/kcatalogue.cpp
  14. 18
    0
      kdecore/kconfigbase.cpp
  15. 1
    0
      kdecore/kconfigbase.h
  16. 3
    1
      kdecore/kcrash.cpp
  17. 26
    5
      kdecore/kdesktopfile.cpp
  18. 2
    0
      kdecore/kdesktopfile.h
  19. 8
    1
      kdecore/klocale.cpp
  20. 13
    4
      kdecore/kstandarddirs.cpp
  21. 3
    1
      kdecore/kwinmodule.cpp
  22. 5
    1
      kded/Makefile.am
  23. 18
    10
      kded/khostname.cpp
  24. 54
    0
      kded/kmimelist.cpp
  25. 58
    17
      kdefx/kstyle.cpp
  26. BIN
      kdemm/0.png
  27. 31
    0
      kdemm/DESIGN
  28. 43
    0
      kdemm/Makefile.am
  29. 27
    0
      kdemm/TODO
  30. 78
    0
      kdemm/backend.cpp
  31. 86
    0
      kdemm/backend.h
  32. 69
    0
      kdemm/channel.cpp
  33. 96
    0
      kdemm/channel.h
  34. 296
    0
      kdemm/factory.cpp
  35. 222
    0
      kdemm/factory.h
  36. 41
    0
      kdemm/mixeriface.h
  37. 30
    0
      kdemm/mmbackendinfo.desktop
  38. 53
    0
      kdemm/player.cpp
  39. 259
    0
      kdemm/player.h
  40. 533
    0
      kdemm/reqspec.html
  41. 198
    0
      kdemm/simpleplayer.cpp
  42. 72
    0
      kdemm/simpleplayer.h
  43. 30
    0
      kdemm/test/Makefile.am
  44. 38
    0
      kdemm/test/main.cpp
  45. 299
    0
      kdemm/test/statetest.cpp
  46. 57
    0
      kdemm/test/statetest.h
  47. 194
    0
      kdemm/test/testwidget.cpp
  48. 64
    0
      kdemm/test/testwidget.h
  49. 34
    0
      kdemm/videoplayer.cpp
  50. 54
    0
      kdemm/videoplayer.h
  51. 31
    0
      kdemm/volumecontrold/Makefile.am
  52. 47
    0
      kdemm/volumecontrold/volumecontrold.cpp
  53. 13
    0
      kdemm/volumecontrold/volumecontrold.desktop
  54. 53
    0
      kdemm/volumecontrold/volumecontrold.h
  55. 1
    0
      kdeprint/cups/cupsdconf2/cupsddialog.cpp
  56. 1
    1
      kdeprint/cups/kmcupsmanager.cpp
  57. 8
    2
      kdeprint/kmvirtualmanager.cpp
  58. 3
    0
      kdeprint/kprintpreview.cpp
  59. 18
    8
      kdeprint/management/smbview.cpp
  60. 2
    1
      kdesu/defaults.h
  61. 1
    1
      kdeui/Makefile.am
  62. 11
    0
      kdeui/kaction.cpp
  63. 22
    1
      kdeui/kactionclasses.cpp
  64. 113
    2
      kdeui/kcombobox.cpp
  65. 46
    0
      kdeui/kcombobox.h
  66. 29
    0
      kdeui/kfontcombo.cpp
  67. 112
    9
      kdeui/kjanuswidget.cpp
  68. 9
    0
      kdeui/kjanuswidget.h
  69. 4
    1
      kdeui/kpassdlg.cpp
  70. 1
    1
      kdeui/ksconfig.cpp
  71. 1
    1
      kdeui/ksyntaxhighlighter.cpp
  72. 27
    4
      kdeui/ktip.cpp
  73. 21
    3
      kdeui/qxembed.cpp
  74. 5
    0
      kdeui/qxembed.h
  75. 1
    1
      kdoctools/kio_help.cpp
  76. 11
    11
      khtml/ecma/xmlhttprequest.cpp
  77. 159
    5
      khtml/khtmlview.cpp
  78. 20
    0
      khtml/khtmlview.h
  79. 17
    1
      khtml/rendering/render_form.cpp
  80. 3
    1
      khtml/rendering/render_form.h
  81. 14
    1
      kinit/autostart.cpp
  82. 19
    6
      kinit/lnusertemp.c
  83. 3
    1
      kinit/wrapper.c
  84. 6
    0
      kio/kfile/kfiledialog.cpp
  85. 49
    10
      kio/kfile/kfilesharedlg.cpp
  86. 3
    0
      kio/kfile/kfilesharedlg.h
  87. 12
    1
      kio/kfile/kurlbar.cpp
  88. 2
    1
      kio/kio/kdirwatch.cpp
  89. 63
    11
      kio/kio/kfileshare.cpp
  90. 21
    3
      kio/kio/kfileshare.h
  91. 4
    6
      kio/kio/kmimetype.cpp
  92. 4
    2
      kio/kio/kremoteencoding.cpp
  93. 9
    6
      kio/kio/kservice.cpp
  94. 4
    6
      kio/kio/kservicegroup.cpp
  95. 1
    1
      kio/kio/netaccess.cpp
  96. 19
    3
      kio/kssl/kopenssl.cc
  97. 14
    2
      kio/kssl/kopenssl.h
  98. 1
    1
      kio/kssl/ksmimecrypto.cc
  99. 23
    9
      kio/kssl/ksslcertificate.cc
  100. 0
    0
      kio/misc/kwalletd/kwalletd.cpp

+ 1
- 1
Makefile.am.in View File

@@ -18,7 +18,7 @@
18 18
 #    Boston, MA 02110-1301, USA.
19 19
 
20 20
 
21
-COMPILE_FIRST = dcop libltdl kdefx kdecore kunittest kdeui kdesu kjs kwallet kio kded kded_post
21
+COMPILE_FIRST = dcop libltdl kdefx kdecore kunittest kdeui kdesu kjs kwallet kio kded kded_post kdemm
22 22
 COMPILE_BEFORE_doc = kdoctools
23 23
 COMPILE_AFTER_kparts = kspell2 kmdi kdeprint kinit kate interfaces kcert khtml krandr
24 24
 COMPILE_AFTER_kdeprint = kate khtml

+ 39
- 0
catalog.xml View File

@@ -0,0 +1,39 @@
1
+<?xml version="1.0"?>
2
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" 
3
+"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
4
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
5
+         prefer="public">
6
+<public publicId="-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN"
7
+        uri="dtd/kdex.dtd" />
8
+<public publicId="-//KDE//ELEMENTS DocBook XML Hierarchy Redeclarations 2 V1.0//EN"
9
+       uri="dtd/rdbhier2.elements" />
10
+<public publicId="-//KDE//ELEMENTS DocBook XML Pool Redeclarations V1.1//EN"
11
+       uri="dtd/rdbpool.elements" />
12
+<public publicId="-//KDE//ELEMENTS DocBook XML Modifications (Restrictions) V1.1//EN"
13
+       uri="dtd/modifications.elements" />
14
+
15
+<public publicId="-//KDE//ENTITIES DocBook XML General Entity Declarations V1.2//EN"
16
+       uri="entities/general.entities" />
17
+<public publicId="-//KDE//ENTITIES DocBook XML General Entity Declarations (Persons) V1.0//EN"
18
+       uri="entities/contributor.entities" />
19
+
20
+<public publicId="-//KDE//ENTITIES DocBook XML Localisation Entity Declarations V1.0//EN"
21
+       uri="entities/l10n.entities" />
22
+
23
+<public publicId="-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN"
24
+       uri="obsolete/kdex.dtd" />
25
+<public publicId="-//KDE//ENTITIES DocBook XML General Entity Declarations V1.1//EN"
26
+       uri="obsolete/general.entities" />
27
+<public publicId="-//KDE//ELEMENTS DocBook XML Pool Redeclarations V1.0//EN"
28
+       uri="obsolete/rdbpool.elements" />
29
+<public publicId="-//KDE//ELEMENTS DocBook XML Modifications V1.0//EN"
30
+       uri="obsolete/modifications.elements" />
31
+
32
+
33
+<public publicId="-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.0//EN"
34
+       uri="obsolete/kdex-412-10.dtd" />
35
+
36
+
37
+<public publicId="-//KDE//DTD DocBook XML V4.1-Based Variant V1.0//EN"
38
+       uri="obsolete/kdex-412-10.dtd" />
39
+</catalog>

+ 5
- 0
dcop/KDE-ICE/Xtranssock.c View File

@@ -1444,6 +1444,7 @@ UnixHostReallyLocal (char *host)
1444 1444
 
1445 1445
 {
1446 1446
     char hostnamebuf[256];
1447
+    char* xauthlocalname = getenv("XAUTHLOCALHOSTNAME");
1447 1448
 
1448 1449
     TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf));
1449 1450
 
@@ -1451,6 +1452,10 @@ UnixHostReallyLocal (char *host)
1451 1452
     {
1452 1453
 	return (1);
1453 1454
     }
1455
+    else if(xauthlocalname && strcmp (xauthlocalname, host) == 0)
1456
+    {
1457
+       return (1);
1458
+    }
1454 1459
     else
1455 1460
     {
1456 1461
 	/*

+ 3
- 1
dcop/dcopc.c View File

@@ -684,7 +684,9 @@ dcop_connect()
684 684
     }
685 685
 
686 686
     hostName[0] = '\0';
687
-    if (gethostname(hostName, sizeof(hostName)))
687
+    if (getenv("XAUTHLOCALHOSTNAME"))
688
+            strlcpy(hostName, getenv("XAUTHLOCALHOSTNAME"),sizeof(hostName)-1);
689
+    else if (gethostname(hostName, sizeof(hostName)))
688 690
 	    strcpy(hostName, "localhost");
689 691
     else
690 692
 	    hostName[sizeof(hostName)-1] = '\0';

+ 3
- 1
dcop/dcopclient.cpp View File

@@ -277,7 +277,9 @@ static TQCString dcopServerFile(const TQCString &hostname, bool old)
277 277
     {
278 278
         char hostName[256];
279 279
         hostName[0] = '\0';
280
-        if (gethostname(hostName, sizeof(hostName)))
280
+        if (getenv("XAUTHLOCALHOSTNAME"))
281
+            fName += getenv("XAUTHLOCALHOSTNAME");
282
+        else if (gethostname(hostName, sizeof(hostName)))
281 283
         {
282 284
             fName += "localhost";
283 285
         }

+ 3
- 1
dcop/dcopserver_shutdown.c View File

@@ -95,7 +95,9 @@ static void getDCOPFile(char *dcop_file, char *dcop_file_old, int max_length)
95 95
   strncat(dcop_file, "/.DCOPserver_", n);
96 96
   n -= strlen("/.DCOPserver_");
97 97
 
98
-  if (gethostname(dcop_file+strlen(dcop_file), n) != 0)
98
+  if (getenv("XAUTHLOCALHOSTNAME"))
99
+     strncat(dcop_file+strlen(dcop_file), getenv("XAUTHLOCALHOSTNAME"), n);
100
+  else if (gethostname(dcop_file+strlen(dcop_file), n) != 0)
99 101
   {
100 102
      perror("Error. Could not determine hostname: ");
101 103
      dcop_file[0] = '\0';

+ 1
- 1
interfaces/kimproxy/library/kimproxy.cpp View File

@@ -204,7 +204,7 @@ KIMProxy::KIMProxy( DCOPClient* dc ) : DCOPObject( "KIMProxyIface" ), TQObject()
204 204
 	
205 205
 	// FIXME: make this work when the sender object id is set to KIMIFace
206 206
 	if ( !connectDCOPSignal( 0, 0, method, method, false ) )
207
-		KMessageBox::information( 0, TQString( "Couldn't connect DCOP signal.\nWon't receive any status notifications!" ) );
207
+		kdWarning() << "Couldn't connect DCOP signal. Won't receive any status notifications!" << endl;
208 208
 }
209 209
 
210 210
 KIMProxy::~KIMProxy( )

+ 2
- 2
interfaces/kmediaplayer/kfileaudiopreview/kfileaudiopreview.cpp View File

@@ -13,7 +13,7 @@
13 13
 #include <kmimetype.h>
14 14
 #include <kparts/componentfactory.h>
15 15
 
16
-#include <kplayobjectfactory.h>
16
+#include <kdemm/factory.h>
17 17
 
18 18
 #include <config-kfile.h>
19 19
 
@@ -58,7 +58,7 @@ KFileAudioPreview::KFileAudioPreview( TQWidget *parent, const char *name )
58 58
 {
59 59
     KGlobal::locale()->insertCatalogue("kfileaudiopreview");    
60 60
 
61
-    TQStringList formats = KDE::PlayObjectFactory::mimeTypes();
61
+    TQStringList formats = KDE::Multimedia::Factory::self()->playableMimeTypes();
62 62
     // ###
63 63
     TQStringList::ConstIterator it = formats.begin();
64 64
     for ( ; it != formats.end(); ++it )

+ 3
- 3
kate/part/katehighlight.cpp View File

@@ -3225,7 +3225,7 @@ void KateHlManager::getDefaults(uint schema, KateAttributeList &list)
3225 3225
   list.append(charAttribute);
3226 3226
 
3227 3227
   KateAttribute* string = new KateAttribute();
3228
-  string->setTextColor(TQColor::TQColor("#D00"));
3228
+  string->setTextColor(TQColor("#D00"));
3229 3229
   string->setSelectedTextColor(Qt::red);
3230 3230
   list.append(string);
3231 3231
 
@@ -3242,9 +3242,9 @@ void KateHlManager::getDefaults(uint schema, KateAttributeList &list)
3242 3242
 
3243 3243
   KateAttribute* alert = new KateAttribute();
3244 3244
   alert->setTextColor(Qt::black);
3245
-  alert->setSelectedTextColor( TQColor::TQColor("#FCC") );
3245
+  alert->setSelectedTextColor( TQColor("#FCC") );
3246 3246
   alert->setBold(true);
3247
-  alert->setBGColor( TQColor::TQColor("#FCC") );
3247
+  alert->setBGColor( TQColor("#FCC") );
3248 3248
   list.append(alert);
3249 3249
 
3250 3250
   KateAttribute* functionAttribute = new KateAttribute();

+ 1
- 1
kdecore/eventsrc View File

@@ -2572,7 +2572,7 @@ Comment[wa]=On messaedje critike est håyné
2572 2572
 Comment[zh_CN]=正在显示关键消息
2573 2573
 Comment[zh_HK]=顯示嚴重警告訊息
2574 2574
 Comment[zh_TW]=嚴重的警告訊息已顯示
2575
-default_sound=KDE_Glass_Break.ogg
2575
+default_sound=KDE_Error_1.ogg
2576 2576
 default_presentation=65
2577 2577
 nopresentation=18
2578 2578
 level=4

+ 2
- 0
kdecore/fakes.c View File

@@ -323,6 +323,7 @@ KDECORE_EXPORT int revoke(const char *tty)
323 323
 #endif
324 324
 
325 325
 #ifndef HAVE_STRLCPY
326
+#include <string.h>
326 327
 KDECORE_EXPORT unsigned long strlcpy(char* d, const char* s, unsigned long bufsize)
327 328
 {
328 329
     unsigned long len, ret = strlen(s);
@@ -341,6 +342,7 @@ KDECORE_EXPORT unsigned long strlcpy(char* d, const char* s, unsigned long bufsi
341 342
 #endif
342 343
 
343 344
 #ifndef HAVE_STRLCAT
345
+#include <string.h>
344 346
 KDECORE_EXPORT unsigned long strlcat(char* d, const char* s, unsigned long bufsize)
345 347
 {
346 348
     char *cp;

+ 17
- 3
kdecore/kapplication.cpp View File

@@ -41,6 +41,7 @@
41 41
 #include <tqtooltip.h>
42 42
 #include <tqstylefactory.h>
43 43
 #include <tqmetaobject.h>
44
+#include <tqimage.h>
44 45
 #ifndef QT_NO_SQL
45 46
 #include <tqsqlpropertymap.h>
46 47
 #endif
@@ -87,6 +88,8 @@
87 88
 #include <sys/stat.h>
88 89
 #endif
89 90
 #include <sys/wait.h>
91
+#include <grp.h>
92
+#include <sys/types.h>
90 93
 
91 94
 #ifndef Q_WS_WIN
92 95
 #include "kwin.h"
@@ -776,10 +779,15 @@ void KApplication::init(bool GUIenabled)
776 779
 {
777 780
   d->guiEnabled = GUIenabled;
778 781
   if ((getuid() != geteuid()) ||
779
-      (getgid() != getegid()))
782
+      (getgid() != getegid()) )
780 783
   {
781
-     fprintf(stderr, "The KDE libraries are not designed to run with suid privileges.\n");
782
-     ::exit(127);
784
+     // man permissions are not exploitable and better than 
785
+     // world writable directories
786
+     struct group *man = getgrnam("man");
787
+     if ( !man || man->gr_gid != getegid() ){
788
+       fprintf(stderr, "The KDE libraries are not designed to run with suid privileges.\n");
789
+       ::exit(127);
790
+     }
783 791
   }
784 792
 
785 793
   KProcessController::ref();
@@ -2137,6 +2145,12 @@ void KApplication::propagateSettings(SettingsCategory arg)
2137 2145
     KConfigBase* config = KGlobal::config();
2138 2146
     KConfigGroupSaver saver( config, "KDE" );
2139 2147
 
2148
+#ifdef QT_HAVE_MAX_IMAGE_SIZE
2149
+    TQSize maxImageSize(4096, 4096);
2150
+    maxImageSize = config->readSizeEntry("MaxImageSize", &maxImageSize);
2151
+    TQImage::setMaxImageSize(maxImageSize);
2152
+#endif
2153
+
2140 2154
     int num = config->readNumEntry("CursorBlinkRate", TQApplication::cursorFlashTime());
2141 2155
     if ((num != 0) && (num < 200))
2142 2156
         num = 200;

+ 5
- 1
kdecore/kcatalogue.cpp View File

@@ -66,7 +66,11 @@ KCatalogue::KCatalogue(const TQString & name, const TQString & language )
66 66
     .arg( d->language )
67 67
     .arg( d->name );
68 68
 
69
-  setFileName( locate( "locale", path ) );
69
+  TQString fileName = locate( "locale", path );
70
+  if (fileName.isEmpty())
71
+    fileName = locate( "locale-bundle", path );
72
+
73
+  setFileName( fileName );
70 74
     
71 75
 }
72 76
 

+ 18
- 0
kdecore/kconfigbase.cpp View File

@@ -131,6 +131,24 @@ bool KConfigBase::hasKey(const char *pKey) const
131 131
   return !entry.mValue.isNull();
132 132
 }
133 133
 
134
+bool KConfigBase::hasTranslatedKey(const char* pKey) const
135
+{
136
+  KEntryKey aEntryKey(mGroup, 0);
137
+  aEntryKey.c_key = pKey;
138
+  aEntryKey.bDefault = readDefaults();
139
+
140
+  if (!locale().isNull()) {
141
+    // try the localized key first
142
+    aEntryKey.bLocal = true;
143
+    KEntry entry = lookupData(aEntryKey);
144
+    if (!entry.mValue.isNull())
145
+       return true;
146
+    aEntryKey.bLocal = false;
147
+  }
148
+
149
+  return false;
150
+}
151
+
134 152
 bool KConfigBase::hasGroup(const TQString &group) const
135 153
 {
136 154
   return internalHasGroup( group.utf8());

+ 1
- 0
kdecore/kconfigbase.h View File

@@ -1985,6 +1985,7 @@ public:
1985 1985
 
1986 1986
 protected:
1987 1987
   TQCString readEntryUtf8( const char *pKey) const;
1988
+  bool hasTranslatedKey( const char *pKey ) const;
1988 1989
 
1989 1990
   /**
1990 1991
    * The currently selected group. */

+ 3
- 1
kdecore/kcrash.cpp View File

@@ -466,7 +466,9 @@ static int openSocket()
466 466
      sock_file[strlen(sock_file)-1] = 0;
467 467
   
468 468
   strncat(sock_file, "/socket-", MAX_SOCK_FILE - strlen(sock_file));
469
-  if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
469
+  if( getenv("XAUTHLOCALHOSTNAME"))
470
+      strncat(sock_file, getenv("XAUTHLOCALHOSTNAME"), MAX_SOCK_FILE - strlen(sock_file) - 1);
471
+  else if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
470 472
   {
471 473
      perror("Warning: Could not determine hostname: ");
472 474
      return -1;

+ 26
- 5
kdecore/kdesktopfile.cpp View File

@@ -34,6 +34,8 @@
34 34
 #include "kapplication.h"
35 35
 #include "kstandarddirs.h"
36 36
 #include "kmountpoint.h"
37
+#include "kcatalogue.h"
38
+#include "klocale.h"
37 39
 
38 40
 #include "kdesktopfile.h"
39 41
 #include "kdesktopfile.moc"
@@ -145,6 +147,27 @@ bool KDesktopFile::isAuthorizedDesktopFile(const TQString& path)
145 147
   return false;
146 148
 }
147 149
 
150
+TQString KDesktopFile::translatedEntry(const char* key) const
151
+{
152
+  if (hasTranslatedKey(key))
153
+    return readEntry(key);
154
+
155
+  if (hasKey(key)) {
156
+    TQString value = readEntryUntranslated(key);
157
+    TQString fName = fileName();
158
+    fName = fName.mid(fName.findRev('/')+1);
159
+    TQString po_lookup_key = TQString::fromLatin1(key) + "(" + fName + "): " + value;
160
+    TQString po_value = KGlobal::locale()->translate(po_lookup_key.utf8().data());
161
+
162
+    if (po_value == po_lookup_key)
163
+      return value;
164
+
165
+    return po_value;
166
+  }
167
+
168
+  return TQString::null;
169
+} 
170
+
148 171
 TQString KDesktopFile::readType() const
149 172
 {
150 173
   return readEntry("Type");
@@ -157,17 +180,17 @@ TQString KDesktopFile::readIcon() const
157 180
 
158 181
 TQString KDesktopFile::readName() const
159 182
 {
160
-  return readEntry("Name");
183
+  return translatedEntry("Name");
161 184
 }
162 185
 
163 186
 TQString KDesktopFile::readComment() const
164 187
 {
165
-  return readEntry("Comment");
188
+  return translatedEntry("Comment");
166 189
 }
167 190
 
168 191
 TQString KDesktopFile::readGenericName() const
169 192
 {
170
-  return readEntry("GenericName");
193
+  return translatedEntry("GenericName");
171 194
 }
172 195
 
173 196
 TQString KDesktopFile::readPath() const
@@ -342,5 +365,3 @@ KDesktopFile* KDesktopFile::copyTo(const TQString &file) const
342 365
   config->setDesktopGroup();
343 366
   return config;
344 367
 }
345
-
346
-

+ 2
- 0
kdecore/kdesktopfile.h View File

@@ -236,6 +236,8 @@ private:
236 236
 
237 237
 private:
238 238
 
239
+  TQString translatedEntry(const char*) const;
240
+
239 241
   // copy-construction and assignment are not allowed
240 242
   KDesktopFile( const KDesktopFile& );
241 243
   KDesktopFile& operator= ( const KDesktopFile& );

+ 8
- 1
kdecore/klocale.cpp View File

@@ -408,7 +408,11 @@ TQString KLocale::catalogueFileName(const TQString & language,
408 408
     .arg( language )
409 409
     .arg( catalog.name() );
410 410
 
411
-  return locate( "locale", path );
411
+  TQString fileName = locate( "locale", path );
412
+  if (fileName.isEmpty())
413
+    fileName = locate( "locale-bundle", path );
414
+
415
+  return fileName;
412 416
 }
413 417
 
414 418
 bool KLocale::setLanguage(const TQString & language)
@@ -507,6 +511,9 @@ bool KLocale::isApplicationTranslatedInto( const TQString & language)
507 511
   // kdDebug() << "isApplicationTranslatedInto: filename " << sFileName << endl;
508 512
 
509 513
   TQString sAbsFileName = locate( "locale", sFileName );
514
+  if (sAbsFileName.isEmpty())
515
+    sAbsFileName = locate( "locale-bundle", sFileName );
516
+
510 517
   // kdDebug() << "isApplicationTranslatedInto: absname " << sAbsFileName << endl;
511 518
   return ! sAbsFileName.isEmpty();
512 519
 }

+ 13
- 4
kdecore/kstandarddirs.cpp View File

@@ -94,13 +94,13 @@ KStandardDirsSingleton* KStandardDirsSingleton::self() {
94 94
     return s_self;
95 95
 }
96 96
 
97
-static const char* const types[] = {"html", "icon", "apps", "sound",
98
-			      "data", "locale", "services", "mime",
97
+static const char* const types[] = {"html", "html-bundle", "icon", "apps", "sound",
98
+			      "data", "locale", "locale-bundle", "services", "mime",
99 99
 			      "servicetypes", "config", "exe",
100 100
 			      "wallpaper", "lib", "pixmap", "templates",
101 101
 			      "module", "qtplugins",
102 102
 			      "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu",
103
-			      "xdgdata-icon", "xdgdata-pixmap",
103
+			      "xdgdata-icon", "xdgdata-pixmap", "xdgconf-autostart",
104 104
 			      "kcfg", "emoticons", 0 };
105 105
 
106 106
 static int tokenize( TQStringList& token, const TQString& str,
@@ -719,7 +719,10 @@ void KStandardDirs::createSpecialResource(const char *type)
719 719
 {
720 720
    char hostname[256];
721 721
    hostname[0] = 0;
722
-   gethostname(hostname, 255);
722
+   if( getenv("XAUTHLOCALHOSTNAME"))
723
+       strlcpy(hostname, getenv("XAUTHLOCALHOSTNAME"), 255 );
724
+   else
725
+       gethostname(hostname, 255);
723 726
    TQString dir = TQString("%1%2-%3").arg(localkdedir()).arg(type).arg(hostname);
724 727
    char link[1024];
725 728
    link[1023] = 0;
@@ -1024,6 +1027,8 @@ static int tokenize( TQStringList& tokens, const TQString& str,
1024 1027
 TQString KStandardDirs::kde_default(const char *type) {
1025 1028
     if (!strcmp(type, "data"))
1026 1029
 	return "share/apps/";
1030
+    if (!strcmp(type, "html-bundle"))
1031
+	return "share/doc-bundle/HTML/";
1027 1032
     if (!strcmp(type, "html"))
1028 1033
 	return "share/doc/kde/HTML/";
1029 1034
     if (!strcmp(type, "icon"))
@@ -1036,6 +1041,8 @@ TQString KStandardDirs::kde_default(const char *type) {
1036 1041
 	return "share/applnk/";
1037 1042
     if (!strcmp(type, "sound"))
1038 1043
 	return "share/sounds/";
1044
+    if (!strcmp(type, "locale-bundle"))
1045
+	return "share/locale-bundle/";
1039 1046
     if (!strcmp(type, "locale"))
1040 1047
 	return "share/locale/";
1041 1048
     if (!strcmp(type, "services"))
@@ -1068,6 +1075,8 @@ TQString KStandardDirs::kde_default(const char *type) {
1068 1075
         return "desktop-directories/";
1069 1076
     if (!strcmp(type, "xdgconf-menu"))
1070 1077
         return "menus/";
1078
+    if (!strcmp(type, "xdgconf-autostart"))
1079
+        return "autostart/";
1071 1080
     if (!strcmp(type, "kcfg"))
1072 1081
 	return "share/config.kcfg";
1073 1082
     if (!strcmp(type, "emoticons"))

+ 3
- 1
kdecore/kwinmodule.cpp View File

@@ -436,7 +436,9 @@ TQRect KWinModule::workArea( const TQValueList<WId>& exclude, int desktop ) cons
436 436
 	if ( strut.bottom > 0  )
437 437
 	    r.setBottom( r.bottom() - (int) strut.bottom );
438 438
 
439
-	a = a.intersect(r);
439
+        TQRect tmp;
440
+	tmp = a.intersect(r);
441
+        a = tmp;
440 442
     }
441 443
     return a;
442 444
 }

+ 5
- 1
kded/Makefile.am View File

@@ -36,12 +36,16 @@ kbuildsycoca_la_SOURCES = kbuildsycoca.cpp kbuildservicetypefactory.cpp \
36 36
 				kctimefactory.cpp \
37 37
 				vfolder_menu.cpp
38 38
 
39
-bin_PROGRAMS = kdontchangethehostname kde-menu
39
+bin_PROGRAMS = kdontchangethehostname kde-menu kmimelist
40 40
 
41 41
 kdontchangethehostname_LDFLAGS = $(all_libraries) $(KDE_RPATH)
42 42
 kdontchangethehostname_LDADD = $(LIB_KDECORE) 
43 43
 kdontchangethehostname_SOURCES = khostname.cpp
44 44
 
45
+kmimelist_LDFLAGS = $(all_libraries) $(KDE_RPATH)
46
+kmimelist_LDADD = ../kio/libkio.la
47
+kmimelist_SOURCES = kmimelist.cpp
48
+
45 49
 kde_menu_LDFLAGS = $(all_libraries) $(KDE_RPATH)
46 50
 kde_menu_LDADD = $(LIB_KIO)
47 51
 kde_menu_SOURCES = kde-menu.cpp

+ 18
- 10
kded/khostname.cpp View File

@@ -111,7 +111,8 @@ static QCStringList split(const TQCString &str)
111 111
 
112 112
 void KHostName::changeX()
113 113
 {
114
-   TQString cmd = "xauth list";
114
+   const char* xauthlocalhostname = getenv("XAUTHLOCALHOSTNAME");
115
+   TQString cmd = "xauth -n list";
115 116
    FILE *xFile = popen(TQFile::encodeName(cmd), "r");
116 117
    if (!xFile)
117 118
    {
@@ -123,6 +124,7 @@ void KHostName::changeX()
123 124
       char buf[1024+1];
124 125
       while (!feof(xFile))
125 126
       {
127
+         buf[1024]='\0';
126 128
          TQCString line = fgets(buf, 1024, xFile);
127 129
          if (line.length())
128 130
             line.truncate(line.length()-1); // Strip LF.
@@ -157,12 +159,17 @@ void KHostName::changeX()
157 159
       TQCString newNetId = newName+netId.mid(i);
158 160
       TQCString oldNetId = netId.left(i);
159 161
 
160
-      if(oldNetId != oldName)
161
-         continue;
162
+      if(oldNetId != oldName
163
+        && (!xauthlocalhostname || strcmp(xauthlocalhostname, oldNetId.data()) != 0))
164
+        continue;
162 165
 
163
-      cmd = "xauth remove "+KProcess::quote(netId);
164
-      system(TQFile::encodeName(cmd));
165
-      cmd = "xauth add ";
166
+      // don't nuke the xauth when XAUTHLOCALHOSTNAME points to it
167
+      if (!xauthlocalhostname || oldNetId != xauthlocalhostname)
168
+      {
169
+        cmd = "xauth -n remove "+KProcess::quote(netId);
170
+        system(TQFile::encodeName(cmd));
171
+      }
172
+      cmd = "xauth -n add ";
166 173
       cmd += KProcess::quote(newNetId);
167 174
       cmd += " ";
168 175
       cmd += KProcess::quote(authName);
@@ -276,7 +283,10 @@ void KHostName::changeDcop()
276 283
       }
277 284
    }
278 285
 
279
-   // Remove old entries
286
+   // Remove old entries, but only if XAUTHLOCALHOSTNAME doesn't point
287
+   // to it
288
+   char* xauthlocalhostname = getenv("XAUTHLOCALHOSTNAME");
289
+   if (!xauthlocalhostname || !oldNetId.contains(xauthlocalhostname))
280 290
    {
281 291
       TQString cmd = "iceauth remove "+KProcess::quote("netid="+oldNetId);
282 292
       system(TQFile::encodeName(cmd));
@@ -368,9 +378,7 @@ int main(int argc, char **argv)
368 378
 
369 379
    KHostName hn;
370 380
 
371
-   if(!getenv("XAUTHLOCALHOSTNAME"))
372
-       hn.changeX();
373
-
381
+   hn.changeX();
374 382
    hn.changeDcop();
375 383
    hn.changeStdDirs("socket");
376 384
    hn.changeStdDirs("tmp");

+ 54
- 0
kded/kmimelist.cpp View File

@@ -0,0 +1,54 @@
1
+#include <ktrader.h>
2
+#include <kservice.h>
3
+#include <kmimetype.h>
4
+#include <assert.h>
5
+#include <kstandarddirs.h>
6
+#include <kservicegroup.h>
7
+#include <kimageio.h>
8
+#include <kuserprofile.h>
9
+#include <kprotocolinfo.h>
10
+
11
+#include <kapplication.h>
12
+
13
+#include <stdio.h>
14
+
15
+int main(int argc, char *argv[])
16
+{
17
+   KApplication k(argc,argv,"blurb",false);
18
+
19
+   KMimeType::List mtl = KMimeType::allMimeTypes( );
20
+   assert( mtl.count() );
21
+   qDebug( "Found %d mime types.", mtl.count() );
22
+   TQValueListIterator<KMimeType::Ptr> it(mtl.begin());
23
+   KServiceTypeProfile::OfferList ol;
24
+
25
+   for (; it != mtl.end(); ++it)
26
+   {
27
+     {
28
+      // Application
29
+      printf( "APP:%s:", (*it)->name().latin1() );
30
+      ol = KServiceTypeProfile::offers((*it)->name(), "Application");
31
+      TQValueListIterator<KServiceOffer> it2(ol.begin());
32
+      for (; it2 != ol.end(); ++it2) {
33
+        if ((*it2).allowAsDefault())
34
+           printf( " %s", (*it2).service()->desktopEntryPath().ascii() );
35
+
36
+      }
37
+      printf( "\n" );
38
+     }
39
+
40
+     {
41
+      // Embedded
42
+      printf( "PART:%s:", (*it)->name().latin1() );
43
+      ol = KServiceTypeProfile::offers((*it)->name(), "KParts/ReadOnlyPart");
44
+      TQValueListIterator<KServiceOffer> it2(ol.begin());
45
+      for (; it2 != ol.end(); ++it2) {
46
+        if ((*it2).allowAsDefault())
47
+           printf( " %s", (*it2).service()->desktopEntryPath().ascii() );
48
+
49
+      }
50
+      printf( "\n" );
51
+     }
52
+   }
53
+}
54
+

+ 58
- 17
kdefx/kstyle.cpp View File

@@ -31,6 +31,7 @@
31 31
 
32 32
 #include <tqapplication.h>
33 33
 #include <tqbitmap.h>
34
+#include <tqmetaobject.h>
34 35
 #include <tqcleanuphandler.h>
35 36
 #include <tqmap.h>
36 37
 #include <tqimage.h>
@@ -79,7 +80,7 @@ namespace
79 80
 		TQWidget* w1;
80 81
 		TQWidget* w2;
81 82
 	};
82
-	typedef TQMap<const TQPopupMenu*,ShadowElements> ShadowMap;
83
+	typedef TQMap<const TQWidget*,ShadowElements> ShadowMap;
83 84
         static ShadowMap *_shadowMap = 0;
84 85
         TQSingleCleanupHandler<ShadowMap> cleanupShadowMap;
85 86
         ShadowMap &shadowMap() {
@@ -113,8 +114,13 @@ namespace
113 114
 
114 115
 	const double shadow_strip[4] =
115 116
 		{ 0.565, 0.675, 0.835, 0.945 };
116
-}
117 117
 
118
+	static bool useDropShadow(TQWidget* w)
119
+	{
120
+		return w && w->metaObject() && 
121
+			w->metaObject()->findProperty("KStyleMenuDropShadow") != -1;
122
+	}
123
+}
118 124
 
119 125
 namespace
120 126
 {
@@ -128,12 +134,12 @@ class TransparencyHandler : public QObject
128 134
 
129 135
 	protected:
130 136
 		void blendToColor(const TQColor &col);
131
-		void blendToPixmap(const TQColorGroup &cg, const TQPopupMenu* p);
137
+		void blendToPixmap(const TQColorGroup &cg, const TQWidget* p);
132 138
 #ifdef HAVE_XRENDER
133
-		void XRenderBlendToPixmap(const TQPopupMenu* p);
139
+		void XRenderBlendToPixmap(const TQWidget* p);
134 140
 #endif
135
-		void createShadowWindows(const TQPopupMenu* p);
136
-		void removeShadowWindows(const TQPopupMenu* p);
141
+		void createShadowWindows(const TQWidget* p);
142
+		void removeShadowWindows(const TQWidget* p);
137 143
 		void rightShadow(TQImage& dst);
138 144
 		void bottomShadow(TQImage& dst);
139 145
 	private:
@@ -256,8 +262,16 @@ void KStyle::polish( TQWidget* widget )
256 262
 				widget->installEventFilter(this);
257 263
 		} 
258 264
 	}
259
-}
265
+	if (widget->isTopLevel())
266
+	{
267
+		if (!d->menuHandler && useDropShadow(widget))
268
+			d->menuHandler = new TransparencyHandler(this, Disabled, 1.0, false);
260 269
 
270
+		if (d->menuHandler && useDropShadow(widget))
271
+			widget->installEventFilter(d->menuHandler);
272
+	}
273
+}
274
+
261 275
 
262 276
 void KStyle::unPolish( TQWidget* widget )
263 277
 {
@@ -267,8 +281,10 @@ void KStyle::unPolish( TQWidget* widget )
267 281
 			TQFrame::Shape shape = frame->frameShape();
268 282
 			if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
269 283
 				widget->removeEventFilter(this);
270
-		} 
284
+		}
271 285
 	}
286
+	if (widget->isTopLevel() && d->menuHandler && useDropShadow(widget))
287
+		widget->removeEventFilter(d->menuHandler);
272 288
 }
273 289
 
274 290
 
@@ -2016,7 +2032,7 @@ void TransparencyHandler::bottomShadow(TQImage& dst)
2016 2032
 }
2017 2033
 
2018 2034
 // Create a shadow of thickness 4.
2019
-void TransparencyHandler::createShadowWindows(const TQPopupMenu* p)
2035
+void TransparencyHandler::createShadowWindows(const TQWidget* p)
2020 2036
 {
2021 2037
 #ifdef Q_WS_X11
2022 2038
 	int x2 = p->x()+p->width();
@@ -2063,7 +2079,7 @@ void TransparencyHandler::createShadowWindows(const TQPopupMenu* p)
2063 2079
 #endif
2064 2080
 }
2065 2081
 
2066
-void TransparencyHandler::removeShadowWindows(const TQPopupMenu* p)
2082
+void TransparencyHandler::removeShadowWindows(const TQWidget* p)
2067 2083
 {
2068 2084
 #ifdef Q_WS_X11
2069 2085
 	ShadowMap::iterator it = shadowMap().find(p);
@@ -2089,7 +2105,7 @@ bool TransparencyHandler::eventFilter( TQObject* object, TQEvent* event )
2089 2105
 	// Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
2090 2106
 
2091 2107
 	// Added 'fake' menu shadows <04-Jul-2002> -- Karol
2092
-	TQPopupMenu* p = (TQPopupMenu*)object;
2108
+	TQWidget* p = (TQWidget*)object;
2093 2109
 	TQEvent::Type et = event->type();
2094 2110
 
2095 2111
 	if (et == TQEvent::Show)
@@ -2128,13 +2144,23 @@ bool TransparencyHandler::eventFilter( TQObject* object, TQEvent* event )
2128 2144
 		// * shadows after duplicate show events.
2129 2145
 		// * TODO : determine real cause for duplicate events
2130 2146
 		// * till 20021005
2131
-		if (dropShadow && p->width() > 16 && p->height() > 16 && !shadowMap().contains( p ))
2147
+		if ((dropShadow  || useDropShadow(p))
2148
+		    && p->width() > 16 && p->height() > 16 && !shadowMap().contains( p ))
2132 2149
 			createShadowWindows(p);
2133 2150
 	}
2151
+        else if (et == TQEvent::Resize && p->isShown() && p->isTopLevel())
2152
+        {
2153
+		// Handle drop shadow
2154
+		if (dropShadow || useDropShadow(p))
2155
+		{
2156
+			removeShadowWindows(p);
2157
+			createShadowWindows(p);
2158
+		}
2159
+        }
2134 2160
 	else if (et == TQEvent::Hide)
2135 2161
 	{
2136 2162
 		// Handle drop shadow
2137
-		if (dropShadow)
2163
+		if (dropShadow || useDropShadow(p))
2138 2164
 			removeShadowWindows(p);
2139 2165
 
2140 2166
 		// Handle translucency
@@ -2159,7 +2185,7 @@ void TransparencyHandler::blendToColor(const TQColor &col)
2159 2185
 }
2160 2186
 
2161 2187
 
2162
-void TransparencyHandler::blendToPixmap(const TQColorGroup &cg, const TQPopupMenu* p)
2188
+void TransparencyHandler::blendToPixmap(const TQColorGroup &cg, const TQWidget* p)
2163 2189
 {
2164 2190
 	if (opacity < 0.0 || opacity > 1.0)
2165 2191
 		return;
@@ -2172,7 +2198,10 @@ void TransparencyHandler::blendToPixmap(const TQColorGroup &cg, const TQPopupMen
2172 2198
 		return;
2173 2199
 
2174 2200
 	// Allow styles to define the blend pixmap - allows for some interesting effects.
2175
-	kstyle->renderMenuBlendPixmap( blendPix, cg, p );
2201
+	if (::qt_cast<TQPopupMenu*>(p))
2202
+		kstyle->renderMenuBlendPixmap( blendPix, cg, ::qt_cast<TQPopupMenu*>(p) );
2203
+	else
2204
+		blendPix.fill(cg.button());	// Just tint as the default behavior
2176 2205
 
2177 2206
 	TQImage blendImg = blendPix.convertToImage();
2178 2207
 	TQImage backImg  = pix.convertToImage();
@@ -2185,13 +2214,17 @@ void TransparencyHandler::blendToPixmap(const TQColorGroup &cg, const TQPopupMen
2185 2214
 // Here we go, use XRender in all its glory.
2186 2215
 // NOTE: This is actually a bit slower than the above routines
2187 2216
 // on non-accelerated displays. -- Karol.
2188
-void TransparencyHandler::XRenderBlendToPixmap(const TQPopupMenu* p)
2217
+void TransparencyHandler::XRenderBlendToPixmap(const TQWidget* p)
2189 2218
 {
2190 2219
 	KPixmap renderPix;
2191 2220
 	renderPix.resize( pix.width(), pix.height() );
2192 2221
 
2193 2222
 	// Allow styles to define the blend pixmap - allows for some interesting effects.
2194
-	kstyle->renderMenuBlendPixmap( renderPix, p->colorGroup(), p );
2223
+	if (::qt_cast<TQPopupMenu*>(p))
2224
+	   kstyle->renderMenuBlendPixmap( renderPix, p->colorGroup(),
2225
+			   ::qt_cast<TQPopupMenu*>(p) );
2226
+	else
2227
+		renderPix.fill(p->colorGroup().button());	// Just tint as the default behavior
2195 2228
 
2196 2229
 	Display* dpy = qt_xdisplay();
2197 2230
 	Pixmap   alphaPixmap;
@@ -2229,6 +2262,14 @@ void TransparencyHandler::XRenderBlendToPixmap(const TQPopupMenu* p)
2229 2262
 void KStyle::virtual_hook( int, void* )
2230 2263
 { /*BASE::virtual_hook( id, data );*/ }
2231 2264
 
2265
+// HACK for gtk-qt-engine
2266
+
2267
+KDE_EXPORT extern "C"
2268
+void kde_kstyle_set_scrollbar_type_windows( void* style )
2269
+{
2270
+    ((KStyle*)style)->setScrollBarType( KStyle::WindowsStyleScrollBar );
2271
+}
2272
+
2232 2273
 // vim: set noet ts=4 sw=4:
2233 2274
 // kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;
2234 2275
 

BIN
kdemm/0.png View File


+ 31
- 0
kdemm/DESIGN View File

@@ -0,0 +1,31 @@
1
+There should be at least two libs:
2
+1. kdemm(core)
3
+==============
4
+
5
+Provides the wrapper for the media framework and all needed media functionality.
6
+Whether this lib needs to depend on kdeui? Depends on how we could handle video
7
+without UI... but if possible we should put the video-widget in kdemmwidgets.
8
+
9
+The Requirements & Specification document can be found in reqspec.html
10
+
11
+
12
+2. kdemmwidgets
13
+===============
14
+
15
+Provides convenience widgets for the common widgets that are needed:
16
+- Position slider (display position and move it to seek)
17
+- Volume fader
18
+- Effects dialog (including EQ)
19
+- Video widget
20
+- Player controls as toolbar
21
+
22
+
23
+Also there could be a KPart:
24
+3. kdemmpart
25
+============
26
+
27
+A KPart implementing the KMediaPlayer interface.
28
+
29
+
30
+
31
+// vim: tw=80

+ 43
- 0
kdemm/Makefile.am View File

@@ -0,0 +1,43 @@
1
+#    This file is part of the KDE libraries
2
+#    Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
3
+
4
+#    This library is free software; you can redistribute it and/or
5
+#    modify it under the terms of the GNU Library General Public
6
+#    License version 2 as published by the Free Software Foundation.
7
+
8
+#    This library is distributed in the hope that it will be useful,
9
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+#    Library General Public License for more details.
12
+
13
+#    You should have received a copy of the GNU Library General Public License
14
+#    along with this library; see the file COPYING.LIB.  If not, write to
15
+#    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
+#    Boston, MA 02111-1307, USA.
17
+
18
+INCLUDES = -I$(top_srcdir)/kdecore -I$(top_srcdir)/kio $(all_includes)
19
+
20
+SUBDIRS = . test
21
+
22
+lib_LTLIBRARIES = libkdemm.la
23
+
24
+kdemmincludedir = $(includedir)/kdemm
25
+kdemminclude_HEADERS = backend.h factory.h player.h channel.h videoplayer.h mixeriface.h simpleplayer.h
26
+
27
+libkdemm_la_SOURCES = backend.cpp factory.cpp player.cpp channel.cpp videoplayer.cpp mixeriface.skel simpleplayer.cpp factory.skel
28
+
29
+libkdemm_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(USER_LDFLAGS) -version-info 0:0:0 -no-undefined
30
+libkdemm_la_LIBADD = ../kdecore/libkdecore.la ../kio/libkio.la
31
+
32
+factory_DCOPIDLNG = true
33
+
34
+METASOURCES = AUTO
35
+
36
+kde_servicetypes_DATA = mmbackendinfo.desktop
37
+
38
+SRCDOC_DEST=$(kde_htmldir)/en/kdelibs/kdemm
39
+
40
+DOXYGEN_REFERENCES = dcop kdecore kio
41
+
42
+include ../admin/Doxyfile.am
43
+

+ 27
- 0
kdemm/TODO View File

@@ -0,0 +1,27 @@
1
+Factory
2
+- get a list of available backends
3
+- be able to choose the one you want to use, overriding the KTrader information
4
+- test on the fly switching
5
+
6
+Audio
7
+- function to retrieve the PCM data that currently is played (could be done in
8
+  the Channel as well as in the Player)
9
+
10
+Video
11
+- either a new interface or somehow integrate into the player
12
+  If it's a new interface we have to copy most of the Player class, which I
13
+  wouldn't like to see.
14
+
15
+two wrapper APIs:
16
+- for notifications
17
+  play file and don't care
18
+  automatically use the notification channel if present
19
+- for simple players
20
+  open file and provide seek and volume
21
+
22
+Mixer abstraction
23
+- provide access to the hardware mixer and/or the mixer of the backend
24
+- provide access to software volume controls (like the Channels)
25
+
26
+Record Interface
27
+- simple PCM recording API

+ 78
- 0
kdemm/backend.cpp View File

@@ -0,0 +1,78 @@
1
+/*  This file is part of the KDE project
2
+    Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
3
+
4
+    This library is free software; you can redistribute it and/or
5
+    modify it under the terms of the GNU Library General Public
6
+    License version 2 as published by the Free Software Foundation.
7
+
8
+    This library is distributed in the hope that it will be useful,
9
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+    Library General Public License for more details.
12
+
13
+    You should have received a copy of the GNU Library General Public License
14
+    along with this library; see the file COPYING.LIB.  If not, write to
15
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
+    Boston, MA 02111-1307, USA.
17
+
18
+*/
19
+
20
+#include "backend.h"
21
+#include "player.h"
22
+
23
+#include <tqstringlist.h>
24
+
25
+#include <kglobal.h>
26
+#include <kinstance.h>
27
+#include <kaboutdata.h>
28
+
29
+namespace KDE
30
+{
31
+namespace Multimedia
32
+{
33
+
34
+class Backend::Private
35
+{
36
+	public:
37
+		Channel * channel;
38
+};
39
+
40
+Backend::Backend( TQObject * parent, const char * name )
41
+	: TQObject( parent, name )
42
+	, d( 0 )
43
+{
44
+}
45
+
46
+Backend::~Backend()
47
+{
48
+	delete d;
49
+}
50
+
51
+bool Backend::playSoundEvent( const KURL & url )
52
+{
53
+	if( ! d )
54
+	{
55
+		d = new Private;
56
+
57
+		TQString ctype = "notifications";
58
+		if( availableChannels( Channel::Output ).contains( ctype ) < 1 )
59
+			ctype = "default";
60
+		d->channel = createChannel( KGlobal::instance()->aboutData()->programName(), ctype, Channel::Output );
61
+	}
62
+
63
+	Player * player = createPlayer();
64
+	player->setOutputChannel( d->channel );
65
+	connect( player, TQT_SIGNAL( finished() ), player, TQT_SLOT( deleteLater() ) );
66
+
67
+	if( player->load( url ) )
68
+		if( player->play() )
69
+			return true;
70
+	delete player;
71
+	return false;
72
+}
73
+
74
+}} // namespaces
75
+
76
+#include "backend.moc"
77
+
78
+// vim: sw=4 ts=4 noet

+ 86
- 0
kdemm/backend.h View File

@@ -0,0 +1,86 @@
1
+/*  This file is part of the KDE project
2
+    Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
3
+
4
+    This library is free software; you can redistribute it and/or
5
+    modify it under the terms of the GNU Library General Public
6
+    License version 2 as published by the Free Software Foundation.
7
+
8
+    This library is distributed in the hope that it will be useful,
9
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+    Library General Public License for more details.
12
+
13
+    You should have received a copy of the GNU Library General Public License
14
+    along with this library; see the file COPYING.LIB.  If not, write to
15
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
+    Boston, MA 02111-1307, USA.
17
+
18
+*/
19
+
20
+#ifndef BACKEND_H
21
+#define BACKEND_H
22
+
23
+#include <tqobject.h>
24
+#include <kdemacros.h>
25
+#include <kdemm/channel.h>
26
+#include <kurl.h>
27
+
28
+namespace KDE
29
+{
30
+namespace Multimedia
31
+{
32
+	class Player;
33
+	class VideoPlayer;
34
+	/**
35
+	 * \brief Base class for all KDE Multimedia Backends
36
+	 *
37
+	 * This class provides the interface for Multimedia Backends. Use it to get
38
+	 * a pointer to a new Player or VideoWidget. There are some reserved
39
+	 * functions for later extension of the class.
40
+	 *
41
+	 * \author Matthias Kretz <kretz@kde.org>
42
+	 * \since 4.0
43
+	 */
44
+	class Backend : public QObject
45
+	{
46
+		Q_OBJECT
47
+		public:
48
+			/**
49
+			 * default TQObject constructor
50
+			 */
51
+			Backend( TQObject * parent = 0, const char * name = 0 );
52
+			virtual ~Backend();
53
+
54
+			/**
55
+			 * @return A new instance to a Player from the Backend.
56
+			 */
57
+			virtual Player * createPlayer() = 0;
58
+
59
+			/**
60
+			 * Create a new VideoPlayer object. The Backend does not have to
61
+			 * implement this function.
62
+			 *
63
+			 * @return A new instance to a VideoPlayer from the Backend. Or 0 if
64
+			 * the Backend does not support the VideoPlayer interface.
65
+			 */
66
+			virtual VideoPlayer * createVideoPlayer() { return 0; }
67
+
68
+			virtual bool playSoundEvent(const KURL & url);
69
+
70
+			virtual Channel * createChannel( const TQString & title, const TQString & channeltype,
71
+					Channel::Direction direction ) = 0;
72
+
73
+			virtual TQStringList availableChannels( Channel::Direction direction ) const = 0;
74
+
75
+			virtual TQStringList playableMimeTypes() const = 0;
76
+
77
+		private:
78
+			RESERVE_VIRTUAL_10
79
+
80
+			class Private;
81
+			Private * d;
82
+	};
83
+}} // namespaces
84
+
85
+// vim: sw=4 ts=4 noet tw=80
86
+#endif // BACKEND_H

+ 69
- 0
kdemm/channel.cpp View File

@@ -0,0 +1,69 @@
1
+/*  This file is part of the KDE project
2
+    Copyright (C) 2004 Scott Wheeler <wheeler@kde.org>
3
+
4
+    This library is free software; you can redistribute it and/or
5
+    modify it under the terms of the GNU Library General Public
6
+    License version 2 as published by the Free Software Foundation.
7
+
8
+    This library is distributed in the hope that it will be useful,
9
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+    Library General Public License for more details.
12
+
13
+    You should have received a copy of the GNU Library General Public License
14
+    along with this library; see the file COPYING.LIB.  If not, write to
15
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
+    Boston, MA 02111-1307, USA.
17
+
18
+*/
19
+
20
+#include "channel.h"
21
+
22
+#include <tqstring.h>
23
+
24
+namespace KDE
25
+{
26
+namespace Multimedia
27
+{
28
+
29
+class Channel::Private
30
+{
31
+	public:
32
+		TQString channelName;
33
+		TQString channelType;
34
+		Direction direction;
35
+};
36
+
37
+Channel::Channel( const TQString & channelName, const TQString & type, Direction direction,
38
+		TQObject * parent, const char * name )
39
+	: TQObject( parent, name )
40
+{
41
+	d = new Private;
42
+	d->channelName = channelName;
43
+	d->channelType = type;
44
+	d->direction = direction;
45
+}
46
+
47
+Channel::~Channel()
48
+{
49
+	delete d;
50
+}
51
+
52
+TQString Channel::channelName() const
53
+{
54
+	return d->channelName;
55
+}
56
+
57
+TQString Channel::channelType() const
58
+{
59
+	return d->channelType;
60
+}
61
+
62
+Channel::Direction Channel::direction() const
63
+{
64
+	return d->direction;
65
+}
66
+
67
+}}
68
+#include "channel.moc"
69
+// vim: sw=4 ts=4 noet

+ 96
- 0
kdemm/channel.h View File

@@ -0,0 +1,96 @@
1
+/*  This file is part of the KDE project
2
+    Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
3
+
4
+    This library is free software; you can redistribute it and/or
5
+    modify it under the terms of the GNU Library General Public
6
+    License version 2 as published by the Free Software Foundation.
7
+
8
+    This library is distributed in the hope that it will be useful,
9
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+    Library General Public License for more details.
12
+
13
+    You should have received a copy of the GNU Library General Public License
14
+    along with this library; see the file COPYING.LIB.  If not, write to
15
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
+    Boston, MA 02111-1307, USA.
17
+
18
+*/
19
+
20
+#ifndef KDEMM_CHANNEL_H
21
+#define KDEMM_CHANNEL_H
22
+
23
+#include <kdemm/mixeriface.h>
24
+
25
+class TQString;
26
+
27
+namespace KDE
28
+{
29
+namespace Multimedia
30
+{
31
+	/**
32
+	 * \short Abstraction of different inputs or outputs
33
+	 *
34
+	 * \author Matthias Kretz <kretz@kde.org>
35
+	 * \since 4.0
36
+	 */
37
+	class KDE_EXPORT Channel : public TQObject, virtual public MixerIface
38
+	{
39
+		Q_OBJECT
40
+		public:
41
+			virtual ~Channel();
42
+
43
+			enum Direction
44
+			{
45
+				Input,
46
+				Output
47
+			};
48
+
49
+			/**
50
+			 * The user visible name of the channel
51
+			 */
52
+			virtual TQString channelName() const;
53
+
54
+			/**
55
+			 * The (internal) channel type.
56
+			 */
57
+			virtual TQString channelType() const;
58
+
59
+			/**
60
+			 * Whether it is an Input or Output channel
61
+			 */
62
+			virtual Direction direction() const;
63
+
64
+			/**
65
+			 * If the channel has a volume control this function returns \p true
66
+			 */
67
+			virtual bool hasVolumeControl() const = 0;
68
+			
69
+			/**
70
+			 * The current volume of the channel
71
+			 */
72
+			virtual float volume() const = 0;
73
+
74
+			/**
75
+			 * Set the volume for the channel
76
+			 *
77
+			 * \returns Returns \p true if the volume has been successfully set
78
+			 */
79
+			virtual bool setVolume( float volume ) = 0;
80
+
81
+		protected:
82
+			/**
83
+			 * You can not instantiate channels yourself, use the Factory to
84
+			 * create them.
85
+			 */
86
+			Channel( const TQString & channelName, const TQString & type, Direction direction,
87
+					TQObject * parent = 0, const char * name = 0 );
88
+
89
+		private:
90
+			class Private;
91
+			Private * d;
92
+	};
93
+}} // namespaces
94
+// vim: sw=4 ts=4 noet tw=80
95
+
96
+#endif // KDEMM_CHANNEL_H

+ 296
- 0
kdemm/factory.cpp View File

@@ -0,0 +1,296 @@
1
+/*  This file is part of the KDE project
2
+    Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
3
+
4
+    This library is free software; you can redistribute it and/or
5
+    modify it under the terms of the GNU Library General Public
6
+    License version 2 as published by the Free Software Foundation.
7
+
8
+    This library is distributed in the hope that it will be useful,
9
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+    Library General Public License for more details.
12
+
13
+    You should have received a copy of the GNU Library General Public License
14
+    along with this library; see the file COPYING.LIB.  If not, write to
15
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
+    Boston, MA 02111-1307, USA.
17
+
18
+*/
19
+
20
+#include "factory.h"
21
+#include "backend.h"
22
+#include "player.h"
23
+#include "videoplayer.h"
24
+#include "channel.h"
25
+
26
+#include <ktrader.h>
27
+#include <kservice.h>
28
+#include <klibloader.h>
29
+#include <kmessagebox.h>
30
+#include <tqfile.h>
31
+#include <klocale.h>
32
+#include <kmimetype.h>
33
+#include <kdebug.h>
34
+
35
+namespace KDE
36
+{
37
+namespace Multimedia
38
+{
39
+class Factory::Private
40
+{
41
+	public:
42
+		Private()
43
+			: backend( 0 )
44
+		{
45
+			createBackend();
46
+		}
47
+
48
+		void createBackend()
49
+		{
50
+			KTrader::OfferList offers = KTrader::self()->query( "KDEMultimediaBackend", "Type == 'Service'" );
51
+			KTrader::OfferListIterator it = offers.begin();
52
+			KTrader::OfferListIterator end = offers.end();
53
+			TQStringList errormsg;
54
+			for( ; it != end; ++it )
55
+			{
56
+				KService::Ptr ptr = *it;
57
+				KLibFactory * factory = KLibLoader::self()->factory( TQFile::encodeName( ptr->library() ) );
58
+				if( factory )
59
+				{
60
+					backend = ( Backend* )factory->create( 0, "Multimedia Backend", "KDE::Multimedia::Backend" );
61
+					if( 0 == backend )
62
+					{
63
+						TQString e = i18n( "create method returned 0" );
64
+						errormsg.append( e );
65
+						kdDebug( 600 ) << "Error getting backend from factory for " <<
66
+							ptr->name() << ":\n" << e << endl;
67
+					}
68
+					else
69
+					{
70
+						service = ptr;
71
+						kdDebug( 600 ) << "using backend: " << ptr->name() << endl;
72
+						break;
73
+					}
74
+				}
75
+				else
76
+				{
77
+					TQString e = KLibLoader::self()->lastErrorMessage();
78
+					errormsg.append( e );
79
+					kdDebug( 600 ) << "Error getting factory for " << ptr->name() <<
80
+						":\n" << e << endl;
81
+				}
82
+			}
83
+#if 0
84
+			if( 0 == backend )
85
+			{
86
+				if( offers.size() == 0 )
87
+					KMessageBox::error( 0, i18n( "Unable to find a Multimedia Backend" ) );
88
+				else
89
+				{
90
+					TQString details = "<qt><table>";
91
+					TQStringList::Iterator eit = errormsg.begin();
92
+					TQStringList::Iterator eend = errormsg.end();
93
+					KTrader::OfferListIterator oit = offers.begin();
94
+					KTrader::OfferListIterator oend = offers.end();
95
+					for( ; eit != eend || oit != oend; ++eit, ++oit )
96
+						details += TQString( "<tr><td><b>%1</b></td><td>%2</td></tr>" )
97
+							.arg( ( *oit )->name() ).arg( *eit );
98
+					details += "</table></qt>";
99
+
100
+					KMessageBox::detailedError( 0,
101
+							i18n( "Unable to use any of the available Multimedia Backends" ), details );
102
+				}
103
+			}
104
+#endif
105
+		}
106
+
107
+		Backend * backend;
108
+		KService::Ptr service;
109
+
110
+		TQValueList<void*> objects;
111
+};
112
+
113
+Factory * Factory::m_self = 0;
114
+
115
+Factory * Factory::self()
116
+{
117
+	if( ! m_self )
118
+		m_self = new Factory();
119
+	return m_self;
120
+}
121
+
122
+Factory::Factory()
123
+	: DCOPObject( "KDEMMFactory" )
124
+	, d( new Private )
125
+{
126
+	connectDCOPSignal( 0, 0, "kdemmBackendChanged()", "kdemmBackendChanged()", false);
127
+}
128
+
129
+Factory::~Factory()
130
+{
131
+	delete d;
132
+}
133
+
134
+void Factory::kdemmBackendChanged()
135
+{
136
+	if( d->backend )
137
+	{
138
+		// wouw, if we want to switch on the fly we have to exchange the
139
+		// (Video)Player and Channel classes without the API user noticing. That
140
+		// would mean to implement a kind of smartwrapper:
141
+		// Player: Interface that accesses Player_skel which is abstract and is
142
+		// implemented by the Backend. The API user would only get access to the
143
+		// Player class and if you want to switch the backend you can delete the
144
+		// Player_skel object and put another implementation in its place.
145
+		//
146
+		// Now we tell the kdemm using app to help us. With the first signal we
147
+		// tell 'em to delete all the (Video)Players and Channels and with the
148
+		// second to recreate them all again.
149
+		emit deleteYourObjects();
150
+		if( d->objects.size() > 0 )
151
+		{
152
+			kdWarning( 600 ) << "we were asked to change the backend but the application did\n"
153
+				"not free all references to objects created by the factory. Therefor we can not\n"
154
+				"change the backend without crashing. Now we have to wait for a restart to make\n"
155
+				"backendswitching possible." << endl;
156
+			// in case there were objects deleted give 'em a chance to recreate
157
+			// them now
158
+			emit recreateObjects();
159
+			return;
160
+		}
161
+		delete d->backend;
162
+		d->backend = 0;
163
+	}
164
+	d->createBackend();
165
+	emit recreateObjects();
166
+}
167
+
168
+void Factory::objectDestroyed( TQObject * obj )
169
+{
170
+	kdDebug( 600 ) << k_funcinfo << obj << endl;
171
+	void * p = ( void* )obj;
172
+	d->objects.remove( p );
173
+}
174
+
175
+Player * Factory::createPlayer()
176
+{
177
+	if( d->backend )
178
+	{
179
+		Player * p = d->backend->createPlayer();
180
+		connect( p, TQT_SIGNAL( destroyed( TQObject* ) ), TQT_SLOT( objectDestroyed( TQObject* ) ) );
181
+		d->objects.append( p );
182
+		return p;
183
+	}
184
+	else
185
+		return 0;
186
+}
187
+
188
+VideoPlayer * Factory::createVideoPlayer()
189
+{
190
+	if( d->backend )
191
+	{
192
+		VideoPlayer * vp = d->backend->createVideoPlayer();
193
+		connect( vp, TQT_SIGNAL( destroyed( TQObject* ) ), TQT_SLOT( objectDestroyed( TQObject* ) ) );
194
+		d->objects.append( vp );
195
+		return vp;
196
+	}
197
+	else
198
+		return 0;
199
+}
200
+
201
+bool Factory::playSoundEvent(const KURL & url)
202
+{
203
+	if( d->backend )
204
+		return d->backend->playSoundEvent(url);
205
+	else
206
+		return false;
207
+}
208
+
209
+Channel * Factory::createChannel( const TQString & title, const TQString & channeltype,
210
+		Channel::Direction direction )
211
+{
212
+	if( d->backend )
213
+	{
214
+		Channel * c = d->backend->createChannel( title, channeltype, direction );
215
+		connect( c, TQT_SIGNAL( destroyed( TQObject* ) ), TQT_SLOT( objectDestroyed( TQObject* ) ) );
216
+		d->objects.append( c );
217
+		return c;
218
+	}
219
+	else
220
+		return 0;
221
+}
222
+
223
+TQStringList Factory::availableChannels( Channel::Direction direction ) const
224
+{
225
+	if( d->backend )
226
+		return d->backend->availableChannels( direction );
227
+	else
228
+		return TQStringList();
229
+}
230
+
231
+TQStringList Factory::playableMimeTypes() const
232
+{
233
+	if( d->backend )
234
+		return d->backend->playableMimeTypes();
235
+	else
236
+		return TQStringList();
237
+}
238
+
239
+bool Factory::isMimeTypePlayable( const TQString & type ) const
240
+{
241
+	if( d->backend )
242
+	{
243
+		KMimeType::Ptr mimetype = KMimeType::mimeType( type );
244
+		TQStringList mimetypes = playableMimeTypes();
245
+		for( TQStringList::ConstIterator i=mimetypes.begin(); i!=mimetypes.end(); i++ )
246
+			if( mimetype->is( *i ) )
247
+				return true;
248
+	}
249
+	return false;
250
+}
251
+
252
+TQString Factory::backendName() const
253
+{
254
+	if( d->service )
255
+		return d->service->name();
256
+	else
257
+		return TQString::null;
258
+}
259
+
260
+TQString Factory::backendComment() const
261
+{
262
+	if( d->service )
263
+		return d->service->comment();
264
+	else
265
+		return TQString::null;
266
+}
267
+
268
+TQString Factory::backendVersion() const
269
+{
270
+	if( d->service )
271
+		return d->service->property( "X-KDE-MMBackendInfo-Version" ).toString();
272
+	else
273
+		return TQString::null;
274
+}
275
+
276
+TQString Factory::backendIcon() const
277
+{
278
+	if( d->service )
279
+		return d->service->icon();
280
+	else
281
+		return TQString::null;
282
+}
283
+
284
+TQString Factory::backendWebsite() const
285
+{
286
+	if( d->service )
287
+		return d->service->property( "X-KDE-MMBackendInfo-Website" ).toString();
288
+	else
289
+		return TQString::null;
290
+}
291
+
292
+}} //namespaces
293
+
294
+#include "factory.moc"
295
+
296
+// vim: sw=4 ts=4 noet

+ 222
- 0
kdemm/factory.h View File

@@ -0,0 +1,222 @@
1
+/*  This file is part of the KDE project
2
+    Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
3
+
4
+    This library is free software; you can redistribute it and/or
5
+    modify it under the terms of the GNU Library General Public
6
+    License version 2 as published by the Free Software Foundation.
7
+
8
+    This library is distributed in the hope that it will be useful,
9
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+    Library General Public License for more details.
12
+
13
+    You should have received a copy of the GNU Library General Public License
14
+    along with this library; see the file COPYING.LIB.  If not, write to
15
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
+    Boston, MA 02111-1307, USA.
17
+
18
+*/
19
+
20
+#ifndef KDEMM_FACTORY_H
21
+#define KDEMM_FACTORY_H
22
+
23
+#include <kurl.h>
24
+#include <kdemm/channel.h>
25
+#include <tqstring.h>
26
+#include <tqstringlist.h>
27
+#include <dcopobject.h>
28
+
29
+namespace KDE
30
+{
31
+/**
32
+ * \brief The KDE Multimedia classes
33
+ *
34
+ * In this Namespace you find a few classes to access Multimedia functions like
35
+ * playing audio files and simple video playing. Those classes are not dependent
36
+ * on any specific framework (like they were in pre KDE4 times) but rather use
37
+ * exchangeable backends to do the "dirty" work.
38
+ *
39
+ * If you want to write a new backend you also find the necessary classes in
40
+ * this namespace.
41
+ *
42
+ * \since 4.0
43
+ */
44
+namespace Multimedia
45
+{
46
+class Backend;
47
+class Player;
48
+class VideoPlayer;
49
+
50
+/**
51
+ * \brief Factory to access the preferred Backend.
52
+ *
53
+ * This class is your entry point to KDE Multimedia usage. It provides the
54
+ * necessary objects for playing audio and video.
55
+ *
56
+ * For simple access to just playing an audio file see SimplePlayer.
57
+ *
58
+ * \remarks
59
+ * Extensions to the existing functionality can either be added by using the
60
+ * reserved virtual functions in Backend or by adding a new interface e.g.
61
+ * BackendV2 and creating a BackendV2 instance when the Backend instance is
62
+ * created.
63
+ *
64
+ * \author Matthias Kretz <kretz@kde.org>
65
+ * \since 4.0
66
+ */
67
+class KDE_EXPORT Factory : public TQObject, public DCOPObject
68
+{
69
+	Q_OBJECT
70
+	public:
71
+		/**
72
+		 * Returns a pointer to the factory.
73
+		 * Use this function to get an instance of KLibLoader.
74
+		 *
75
+		 * @return a pointer to the loader. If no loader exists until now then
76
+		 * one is created
77
+		 */
78
+		static Factory * self();
79
+
80
+		/**
81
+		 * Create a new Player.
82
+		 *
83
+		 * You need to call it like this:
84
+		 * \code
85
+		 * Factory::self()->createPlayer();
86
+		 * \endcode
87
+		 *
88
+		 * @return a pointer to the Player the backend provides
89
+		 */
90
+		Player * createPlayer();
91
+
92
+		/**
93
+		 * Create a new VideoPlayer object. The Backend does not have to
94
+		 * implement this functionality so you have to check that it didn't
95
+		 * return 0.
96
+		 *
97
+		 * @return A new instance to a VideoPlayer from the Backend. Or 0 if
98
+		 * the Backend does not support the VideoPlayer interface.
99
+		 */
100
+		VideoPlayer * createVideoPlayer();
101
+
102
+		/**
103
+		 * Play the specified sound-file with no further control. Returns
104
+		 * immediatly.
105
+		 *
106
+		 * @return if the file was be succesfully issued, but is not a
107
+		 * garantie for succes of playing the entire file.
108
+		 */
109
+		bool playSoundEvent(const KURL & url);
110
+
111
+		/**
112
+		 * Creates a new Channel object that you can use for a Player object to
113
+		 * play to.
114
+		 *
115
+		 * \param title A user visible title for the Channel. Most of the time
116
+		 * you will use the application's name.
117
+		 *
118
+		 * \param channeltype \ref availableChannels() returns a list of strings
119
+		 * where you can choose one to be used. Most of the time you will use
120
+		 * the "default" channel. But the Backend could also provide special
121
+		 * purpose channels like one for notifications, one for previews and one
122
+		 * for media playback.
123
+		 *
124
+		 * \param direction Whether it's a Channel::Input or Channel::Output
125
+		 * that you're requesting.
126
+		 *
127
+		 * \returns Returns a Channel object or 0 if your request couldn't be
128
+		 * fullfilled.
129
+		 */
130
+		Channel * createChannel( const TQString & title,
131
+				const TQString & channeltype = TQString::fromLatin1( "default" ),
132
+				Channel::Direction direction = Channel::Output );
133
+
134
+		/**
135
+		 * Returns the names of the channels that can be used to play or record,
136
+		 * depending on the value of \p direction.
137
+		 *
138
+		 * \param direction If set to Channel::Output you will get the names of
139
+		 * all output channels, if set to Channel::Input you get the same for
140
+		 * the input channels.
141
+		 */
142
+		TQStringList availableChannels( Channel::Direction direction = Channel::Output ) const;
143
+
144
+		/**
145
+		 * Returns the mimetypes that can be played.
146
+		 */
147
+		TQStringList playableMimeTypes() const;
148
+
149
+		/**
150
+		 * Checks whether a certain mimetype is playable.
151
+		 */
152
+		bool isMimeTypePlayable( const TQString & mimetype ) const;
153
+
154
+		/**
155
+		 * Get the name of the Backend. It's the name from the .desktop file.
156
+		 */
157
+		TQString backendName() const;
158
+
159
+		/**
160
+		 * Get the comment of the Backend. It's the comment from the .desktop file.
161
+		 */
162
+		TQString backendComment() const;
163
+
164
+		/**
165
+		 * Get the version of the Backend. It's the version from the .desktop file.
166
+		 *
167
+		 * The version is especially interesting if there are several versions
168
+		 * available for binary incompatible versions of the backend's media
169
+		 * framework.
170
+		 */
171
+		TQString backendVersion() const;
172
+
173
+		/**
174
+		 * Get the icon (name) of the Backend. It's the icon from the .desktop file.
175
+		 */
176
+		TQString backendIcon() const;
177
+
178
+		/**
179
+		 * Get the website of the Backend. It's the website from the .desktop file.
180
+		 */
181
+		TQString backendWebsite() const;
182
+
183
+	signals:
184
+		/**
185
+		 * This signal is emitted when the user changes the backend. You then
186
+		 * have to free all your references to Player or Channel objects.
187
+		 */
188
+		void deleteYourObjects();
189
+
190
+		/**
191
+		 * After you got a deleteYourObjects() signal the backend is changed
192
+		 * internally. Then you will receive this signal, and only then should
193
+		 * you reconstruct all your objects again. This time they will
194
+		 * internally use the new backend.
195
+		 */
196
+		void recreateObjects();
197
+
198
+	protected:
199
+		Factory();
200
+		~Factory();
201
+
202
+	private slots:
203
+		void objectDestroyed( TQObject * );
204
+
205
+	private:
206
+		static Factory * m_self;
207
+		class Private;
208
+		Private * d;
209
+
210
+	K_DCOP
211
+	k_dcop:
212
+		/**
213
+		 * \internal
214
+		 * This is called via DCOP when the user changes the KDEMM Backend.
215
+		 */
216
+		void kdemmBackendChanged();
217
+
218
+};
219
+}} // namespaces
220
+
221
+#endif // BACKENDFACTORY_H
222
+// vim: sw=4 ts=4 tw=80 noet

+ 41
- 0
kdemm/mixeriface.h View File

@@ -0,0 +1,41 @@
1
+/*  This file is part of the KDE project
2
+    Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
3
+
4
+    This library is free software; you can redistribute it and/or
5
+    modify it under the terms of the GNU Library General Public
6
+    License version 2 as published by the Free Software Foundation.
7
+
8
+    This library is distributed in the hope that it will be useful,
9
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+    Library General Public License for more details.
12
+
13
+    You should have received a copy of the GNU Library General Public License
14
+    along with this library; see the file COPYING.LIB.  If not, write to
15
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
+    Boston, MA 02111-1307, USA.
17
+
18
+*/
19
+
20
+#ifndef MIXERIFACE_H
21
+#define MIXERIFACE_H
22
+
23
+#include <dcopobject.h>
24
+#include <kdelibs_export.h>
25
+
26
+class KDE_EXPORT MixerIface : public DCOPObject
27
+{
28
+	K_DCOP
29
+	k_dcop:
30
+		virtual TQString channelName() const = 0;
31
+		virtual TQString channelType() const = 0;
32
+		virtual bool hasVolumeControl() const = 0;
33
+		virtual float volume() const = 0;
34
+		virtual bool setVolume( float volume ) = 0;
35
+
36
+	protected:
37
+		MixerIface() : DCOPObject( "MixerIface" ) {}
38
+};
39
+
40
+#endif // MIXERIFACE_H
41
+// vim: sw=4 ts=4 noet tw=80

+ 30
- 0
kdemm/mmbackendinfo.desktop View File

@@ -0,0 +1,30 @@
1
+[Desktop Entry]
2
+Encoding=UTF-8
3
+Type=ServiceType
4
+X-KDE-ServiceType=KDEMultimediaBackend
5
+Name=KDE Multimedia Backend
6
+
7
+[PropertyDef::X-KDE-MMBackendInfo-Version]
8
+Type=QString
9
+
10
+[PropertyDef::X-KDE-MMBackendInfo-Website]
11
+Type=QString
12
+
13
+#[PropertyDef::X-KDE-MMBackendInfo-Supports]
14
+#Type=QStringList
15
+#
16
+#[PropertyDef::X-KDE-MMBackendInfo-Depends]
17
+#Type=QStringList
18
+#
19
+#[PropertyDef::X-KDE-MMBackendInfo-License]
20
+#Type=QString
21
+#
22
+#[PropertyDef::X-KDE-MMBackendInfo-Author]
23
+#Type=QString
24
+#
25
+#[PropertyDef::X-KDE-MMBackendInfo-Email]
26
+#Type=QString
27
+#
28
+#[PropertyDef::X-KDE-MMBackendInfo-Name]
29
+#Type=QString
30
+#

+ 53
- 0
kdemm/player.cpp View File

@@ -0,0 +1,53 @@
1
+/*  This file is part of the KDE project
2
+    Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
3
+
4
+    This library is free software; you can redistribute it and/or
5
+    modify it under the terms of the GNU Library General Public
6
+    License version 2 as published by the Free Software Foundation.
7
+
8
+    This library is distributed in the hope that it will be useful,
9
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+    Library General Public License for more details.
12
+
13
+    You should have received a copy of the GNU Library General Public License
14
+    along with this library; see the file COPYING.LIB.  If not, write to
15
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
+    Boston, MA 02111-1307, USA.
17
+
18
+*/
19
+
20
+#include "player.h"
21
+
22
+namespace KDE {
23
+namespace Multimedia {
24
+Player::Player( TQObject * parent, const char * name )
25
+	: TQObject( parent, name )
26
+	, m_state( Player::NoMedia )
27
+{
28
+}
29
+
30
+Player::~Player()
31
+{
32
+}
33
+
34
+Player::State Player::state() const
35
+{
36
+	return m_state;
37
+}
38
+
39
+void Player::setState( Player::State newstate )
40
+{
41
+	if( m_state != newstate )
42
+	{
43
+		Player::State oldstate = m_state;
44
+		m_state = newstate;
45
+		emit stateChanged( newstate, oldstate );
46
+	}
47
+}
48
+
49
+}} // namespaces
50
+
51
+#include "player.moc"
52
+
53
+// vim: sw=4 ts=4 noet

+ 259
- 0
kdemm/player.h View File

@@ -0,0 +1,259 @@
1
+/*  This file is part of the KDE project
2
+    Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
3
+
4
+    This library is free software; you can redistribute it and/or
5
+    modify it under the terms of the GNU Library General Public
6
+    License version 2 as published by the Free Software Foundation.
7
+
8
+    This library is distributed in the hope that it will be useful,
9
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+    Library General Public License for more details.
12
+
13
+    You should have received a copy of the GNU Library General Public License
14
+    along with this library; see the file COPYING.LIB.  If not, write to
15
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
+    Boston, MA 02111-1307, USA.
17
+
18
+*/
19
+
20
+#ifndef PLAYOBJECT_H
21
+#define PLAYOBJECT_H
22
+
23
+#include <kdelibs_export.h>
24
+#include <tqobject.h>
25
+
26
+class KURL;
27
+
28
+namespace KDE
29
+{
30
+namespace Multimedia
31
+{
32
+	class Channel;
33
+	/**
34
+	 * \short Interface for accessing media playback functions
35
+	 *
36
+	 * \author Matthias Kretz <kretz@kde.org>
37
+	 * \since 4.0
38
+	 */
39
+	class Player : public QObject
40
+	{
41
+		Q_OBJECT
42
+		public:
43
+			/**
44
+			 * The state the playobject is in at the moment
45
+			 */
46
+			enum State
47
+			{
48
+				/**
49
+				 * The load method wasn't called or didn't succeed. If the
50
+				 * object is in this state the next thing you have to do is to
51
+				 * call load.
52
+				 */
53
+				NoMedia,
54
+				/**
55
+				 * After calling load it might take a while before the Player is
56
+				 * ready to play(). Normally this doesn't happen for local
57
+				 * files, but can happen for remote files where the asynchronous
58
+				 * mimetype detection can take a while.
59
+				 */
60
+				Loading,
61
+				/**
62
+				 * The Player has a valid media file loaded and is ready for
63
+				 * playing.
64
+				 */
65
+				Stopped,
66
+				/**
67
+				 * The Player is playing a media file.
68
+				 */
69
+				Playing,
70
+				/**
71
+				 * The Player is waiting for data to be able to continue
72
+				 * playing.
73
+				 */
74
+				Buffering,
75
+				/**
76
+				 * The Player is paused currently.
77
+				 */
78
+				Paused
79
+			};
80
+
81
+			virtual ~Player();
82
+
83
+			/**
84
+			 * Set the output device the Player should use.
85
+			 *
86
+			 * @return Returns \p true on success. If it returns \p false the
87
+			 * output device wasn't changed. This could happen if you pass a
88
+			 * Channel with Channel::direction() == Channel::Input.
89
+			 */
90
+			virtual bool setOutputChannel( Channel * device ) = 0;
91
+
92
+			/**
93
+			 * Get the current state.
94
+			 */
95
+			virtual State state() const;
96
+
97
+			/**
98
+			 * Check whether the Player supports to control the volume.
99
+			 *
100
+			 * @returns Return \p true if the Player can change its volume.
101
+			 */
102
+			virtual bool hasVolumeControl() const = 0;
103
+
104
+			/**
105
+			 * Get the current volume.
106
+			 *
107
+			 * @returns the current volume
108
+			 */
109
+			virtual float volume() const = 0;
110
+
111
+			/**
112
+			 * Get the total time (in milliseconds) of the file currently being played.
113
+			 */
114
+			virtual long totalTime() const = 0;
115
+
116
+			/**
117
+			 * Get the remaining time (in milliseconds) of the file currently being played.
118
+			 */
119
+			virtual long remainingTime() const = 0;
120
+
121
+			/**
122
+			 * Get the current time (in milliseconds) of the file currently being played.
123
+			 */
124
+			virtual long currentTime() const = 0;
125
+
126
+			/**
127
+			 * If the current media may be seeked returns true.
128
+			 *
129
+			 * @returns whether the current media may be seeked.
130
+			 */
131
+			virtual bool seekable() const = 0;
132
+
133
+			/**
134
+			 * Return the time interval in milliseconds between two ticks.
135
+			 */
136
+			virtual long tickInterval() const = 0;
137
+
138
+		public slots:
139
+			/**
140
+			 * Load a media file. If another media is currently loaded it is
141
+			 * stopped and unloaded.
142
+			 *
143
+			 * @param url The location of the media file
144
+			 *
145
+			 * @returns If the call was successfull (the media file was found
146
+			 * and can be read and decoded) returns \p true
147
+			 */
148
+			virtual bool load( const KURL & url ) = 0;
149
+
150
+			/**
151
+			 * Play the media file.
152
+			 */
153
+			virtual bool play() = 0;
154
+
155
+			/**
156
+			 * Pause a playing media. If it was paused before nothing changes.
157
+			 */
158
+			virtual bool pause() = 0;
159
+
160
+			/**
161
+			 * Stop a playback.
162
+			 */
163
+			virtual bool stop() = 0;
164
+
165
+			/**
166
+			 * Set the volume of the playback
167
+			 *
168
+			 * @param volume 0.0 is complete silence and 1.0 is full volume.
169
+			 *               Higher values than 1.0 are possible but might
170
+			 *               result in distortion of the sound.
171
+			 *
172
+			 * @returns returns \p true if the call was successfull, returns \p
173
+			 * false if the volume change didn't work and therefor didn't
174
+			 * change.
175
+			 */
176
+			virtual bool setVolume( float volume ) = 0;
177
+
178
+			/**
179
+			 * Seek to the time indicated.
180
+			 *
181
+			 * @param time The time in milliseconds where to continue playing.
182
+			 *
183
+			 * @returns whether the seek was successfull.
184
+			 */
185
+			virtual bool seek( long time ) = 0;
186
+
187
+			/**
188
+			 * Change the interval the tick signal is emitted. If you set \p ms
189
+			 * to 0 the signal gets disabled.
190
+			 *
191
+			 * \param ms tick interval in milliseconds
192
+			 *
193
+			 * @returns Returns \p true if the tick intervall was changed.
194
+			 */
195
+			virtual bool setTickInterval( long ms ) = 0;
196
+
197
+		signals:
198
+			/**
199
+			 * Emitted when the file has finished playing on its own.
200
+			 * I.e. it is not emitted if you call stop(), pause() or
201
+			 * load(), but only on end-of-file or a critical error.
202
+			 */
203
+			void finished();
204
+
205
+			//XXX do we want a aboutToFinish() signal?
206
+
207
+			/**
208
+			 * Emitted when the state of the Player has changed.
209
+			 * In case you're not interested in the old state you can also
210
+			 * connect to a slot that only has one State argument.
211
+			 *
212
+			 * @param newstate The state the Player is in now
213
+			 * @param oldstate The state the Player was in before
214
+			 */
215
+			void stateChanged( KDE::Multimedia::Player::State newstate, KDE::Multimedia::Player::State oldstate );
216
+
217
+			/**
218
+			 * This signal gets emitted every tickInterval milliseconds.
219
+			 *
220
+			 * \param time The position of the media file in milliseconds.
221
+			 *
222
+			 * \see setTickInterval, tickInterval
223
+			 */
224
+			void tick( long time );
225
+
226
+			/**
227
+			 * This signal is emitted as soon as the length of the media file is
228
+			 * known or has changed.
229
+			 *
230
+			 * @param length The length of the media file in milliseconds.
231
+			 */
232
+			void length( long length );
233
+
234
+		protected:
235
+			/**
236
+			 * You can not instantiate players yourself, use the Factory to
237
+			 * create them.
238
+			 */
239
+			Player( TQObject * parent, const char * name );
240
+
241
+			/**
242
+			 * Call this in your reimplementation for state changes.
243
+			 * It emits the stateChanged signal if the state has really changed.
244
+			 *
245
+			 * @param newstate The new state of the Player. If \p newstate is
246
+			 * equal to the old state() the call will be ignored.
247
+			 */
248
+			void setState( State newstate );
249
+
250
+		private:
251
+			class Private;
252
+			Private * d;
253
+
254
+			State m_state;
255
+	};
256
+}} //namespaces
257
+
258
+// vim: sw=4 ts=4 tw=80 noet
259
+#endif // PLAYOBJECT_H

+ 533
- 0
kdemm/reqspec.html View File

@@ -0,0 +1,533 @@
1
+<HTML><HEAD><TITLE>Requirements & Specification</TITLE></HEAD><BODY BGColor="#FFFFFF" LINK="#0000FF" VLINK="#0000FF">
2
+<H2><CENTER>Requirements & Specification</CENTER></H2>
3
+
4
+<A NAME="Problem Statement" />
5
+<H3>1. Problem Statement</H3>
6
+
7
+<P>KDE needs to integrate better into existing Multimedia solutions for Linux.</P>
8
+
9
+<P>Currently many KDE apps use aRts as media framework and soundserver, while other apps use mplayer, xine and/or gstreamer to do what they need. Sometimes this results in mutually exclusive usage of the soundcard and generally it's an unneeded overhead.</P>
10
+
11
+<P>KDE Developers should be able to "natively" use multimedia functions in the KDE API. The KDE Mulitmedia API (short kdemm) should provide an easy to use and Qt/KDE API like aproach to multimedia functionality.</P>
12
+
13
+<P>Nowadays when a KDE developer wants to add multimedia functionality to his program he can either choose one framework to do it, write all the media code himself (nobody does this, and probably nobody should) or use an abstraction to be able to use more than one framework. Most of the time the development models (object model, programming language) are not the same as a KDE developer is used to. And very often the API of the framework used is more complicated than the task he wants to accomplish. The kdemm API should be useable without any knowledge about media frameworks and how these things work internally.</P>
14
+
15
+<P>The API does not aim to be a general Linux solution to multimedia. It aims to be the solution for all KDE developers.</P>
16
+
17
+<P>KDE should ease the use of pro audio tools on Linux and provide the necessary configuration and integration so that for pro audio tools the DE of choice is KDE.</P>
18
+
19
+<A NAME="Requirements" />
20
+<H3>2. Requirements</H3>
21
+
22
+<A NAME="Actors" />
23
+<H4>2.1. Actors</H4>
24
+
25
+<A NAME="Actor: Admin" />
26
+<H4>Actor: Admin</H4>
27
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
28
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">Administrates a KDE installation. Most users are their own admins...</TD></TR>
29
+
30
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated User Tasks</I></TD><TD COLSPAN="1" VALIGN="top">configure Multimedia sytems</TD></TR>
31
+
32
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">Configure kdemm</TD></TR>
33
+
34
+</TABLE></P>
35
+
36
+<A NAME="Actor: KDE Developer" />
37
+<H4>Actor: KDE Developer</H4>
38
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
39
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">The average KDE Developer who might need some multimedia functionality, like playing a media object, for his program.</TD></TR>
40
+
41
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated User Tasks</I></TD><TD COLSPAN="1" VALIGN="top">add media playback to his program</TD></TR>
42
+
43
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">add media playback functionality to a program, initialize kdemm</TD></TR>
44
+
45
+</TABLE></P>
46
+
47
+<A NAME="Actor: KDE Multimedia Developer" />
48
+<H4>Actor: KDE Multimedia Developer</H4>
49
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
50
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">KDE Developer writing a media application like a jukebox or full-featured media player.</TD></TR>
51
+
52
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated User Tasks</I></TD><TD COLSPAN="1" VALIGN="top">Develop Media Player</TD></TR>
53
+
54
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">media playback, manage video window, modify audio path, play media object, load media object, create reusable audio path, crossfading</TD></TR>
55
+
56
+</TABLE></P>
57
+
58
+<A NAME="Actor: KDE User" />
59
+<H4>Actor: KDE User</H4>
60
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
61
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">User of the K Desktop Environment.</TD></TR>
62
+
63
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated User Tasks</I></TD><TD COLSPAN="1" VALIGN="top">change audio output volume</TD></TR>
64
+
65
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">change audio volume</TD></TR>
66
+
67
+</TABLE></P>
68
+
69
+<A NAME="User Tasks" />
70
+<H4>2.2. User Tasks</H4>
71
+
72
+<P>Actor Admin initilizes the following user tasks</P>
73
+
74
+<A NAME="User Task: configure Multimedia sytems" />
75
+<H4>User Task: configure Multimedia sytems</H4>
76
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
77
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">His aim is to make all multimedia applications work happily side by side.<BR><BR>He has several options to select, like the audio driver backend to use OSS or ALSA, whether he wants to have a soundserver running and what application uses what audio output. He can set the video output method, like e.g. xv or SDL or plain X.<BR><BR>This has to be done so that applications don't block each other and sometimes to make them interact with one another (like you can do with soundservers).<BR><BR>It is important to have it correctly configured else the user will have problems whenever he uses multimedia programs.<BR><BR>This configuration has to be done once until a new program is installed that is incompatible with the setup. Ideally this task has to be done once and never again.</TD></TR>
78
+
79
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Realized in Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">Configure kdemm</TD></TR>
80
+
81
+</TABLE></P>
82
+<BR>
83
+<BR>
84
+
85
+<P>Actor KDE Developer initilizes the following user tasks</P>
86
+
87
+<A NAME="User Task: add media playback to his program" />
88
+<H4>User Task: add media playback to his program</H4>
89
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
90
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">The average KDE Developer might want to add media playback functionality to his program, meaning that his program will be able to play a sound file or even video file.<BR><BR>He can select from a lot of choices how to achieve his goal.<BR>- write the relevant audio/video code himself<BR>- select and use a media framework like gstreamer or aRts<BR>- use existing code from kdelibs (might not be enough for what he's trying to do)<BR><BR>A lot of programs nowadays need to have multimedia functionality.<BR><BR>It's important that KDE developers can add multimedia functionality to their programs.</TD></TR>
91
+
92
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Realized in Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">add media playback functionality to a program</TD></TR>
93
+
94
+</TABLE></P>
95
+<BR>
96
+<BR>
97
+
98
+<P>Actor KDE Multimedia Developer initilizes the following user tasks</P>
99
+
100
+<A NAME="User Task: Develop Media Player" />
101
+<H4>User Task: Develop Media Player</H4>
102
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
103
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">Aim: The developers aim is to write a full featured media player like mplayer, xine, all the frontends for the former, windoze media player :-P, realplayer, you name it.<BR><BR>Options: He can choose from a variety of available code, like NMM, gstreamer, aRts to a certain extend, mplayer or (lib)xine to provide for his multimedia needs. He can choose how to output the audio and video as far as the former choice gives him options. There are constraints on what media formats he can play or what he can do with the data depending on his choice of media backend/framework.<BR><BR>Reason: A modern desktop environment needs to have a modern media player with all the latest bells and whistles.<BR><BR>Priority: It is important that KDE has "native" media players.<BR><BR>Info-In:<BR>- knowledge about what other media players can do<BR>- features asked for by users (e.g. EQ is a must have for some users)</TD></TR>
104
+
105
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Realized in Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">media playback, manage video window, modify audio path, play media object, load media object, create reusable audio path, crossfading</TD></TR>
106
+
107
+</TABLE></P>
108
+<BR>
109
+<BR>
110
+
111
+<P>Actor KDE User initilizes the following user tasks</P>
112
+
113
+<A NAME="User Task: change audio output volume" />
114
+<H4>User Task: change audio output volume</H4>
115
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
116
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">The user wants to change the volume of some program because it is too loud compared to the sound of another program.<BR><BR>This is a tricky task for the user if the program itself doesn't allow to attenuate its sound. If it does he can use the volume control of the program. If it doesn't he has to use a soundserver that allows him to use a volume control for this one specific program only.<BR><BR>It is rather important to have this functionality as it can become pretty anoying if you e.g. want to get notifications when people are chatting with you while you're listening to classical music. The notifications really need attenuation.<BR><BR>It might happen a few times a day that a user needs this functionality.</TD></TR>
117
+
118
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Realized in Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">change audio volume</TD></TR>
119
+
120
+</TABLE></P>
121
+
122
+<A NAME="Domain Data" />
123
+<H4>2.3. Domain Data</H4>
124
+
125
+<P>When I say "sent" in the diagram below I'm actually talking about the data flow in the underlying media framework. kdemm only creates connections so that the data flow is done by the framework.</P>
126
+<IMG SRC="0.png" />
127
+
128
+
129
+<A NAME="Domain Constraints" />
130
+<H4>2.4. Domain Constraints</H4>
131
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
132
+<TR ><TD WIDTH="20%"><B>Network transparency</B></TD><TD >It must be possible to run the desktop over the network, not only the GUI, but also audio output. If it is possible, the system should try to play the audio on the computer where the GUI is shown by default.</TD></TR>
133
+
134
+</TABLE></P>
135
+
136
+<A NAME="Quality Constraints" />
137
+<H4>2.5. Quality Constraints</H4>
138
+
139
+<A NAME="Interaction Data" />
140
+<H4>2.6. Interaction Data</H4>
141
+
142
+<A NAME="Specification" />
143
+<H3>3. Specification</H3>
144
+
145
+<P>When reading the use cases keep in mind that the user often is the Application Developer. So the actor steps are steps the application written by the developer does.</P>
146
+
147
+<A NAME="Use Cases" />
148
+<H4>3.1. Use Cases</H4>
149
+
150
+<A NAME="Use Case: add media playback functionality to a program" />
151
+<H4>Use Case: add media playback functionality to a program</H4>
152
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
153
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
154
+
155
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >the kdemm API has been initialized without errors (see use case "initialize kdemm")</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
156
+
157
+<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
158
+
159
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Tell kdemm what media object you want to play back.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
160
+
161
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Check whether the media object is one of the known types that the backend can decode. If it cannot be decoded error out.</TD></TR>
162
+
163
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Prepare for being asked to play back the media object, to seek in it or other operations.</TD></TR>
164
+
165
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >a) Ask for meta information of the current media object. (e.g. length, bitrate, etc.) --> go on with step 5<BR><BR>or<BR><BR>b) asking kdemm to play the media object --> go on with step 7</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
166
+
167
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">read out meta information, either using the media backend if it supports this function, or using other external libs</TD></TR>
168
+
169
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >display meta information on the GUI while asking kdemm to play the media object</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
170
+
171
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Tell media backend to start playing.</TD></TR>
172
+
173
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Wait for notification that the media object has finished playing. Remove display of meta info and clean up all used datastructures.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
174
+
175
+</TABLE></P>
176
+
177
+<A NAME="Use Case: change audio volume" />
178
+<H4>Use Case: change audio volume</H4>
179
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
180
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE User</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
181
+
182
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >a kdemm using program (let's call it A) is running with its volume being x</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
183
+
184
+<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
185
+
186
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >open KDE Mixer Window</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
187
+
188
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">look for all available volume controls and show them (with informative description what control does what) to the user</TD></TR>
189
+
190
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >locate the control for A and move the fader down</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
191
+
192
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">decrease the output volume of A</TD></TR>
193
+
194
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Postconditions</I></TD><TD >A is running with output volume y < x</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
195
+
196
+</TABLE></P>
197
+
198
+<A NAME="Use Case: Configure kdemm" />
199
+<H4>Use Case: Configure kdemm</H4>
200
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
201
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >Admin</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
202
+
203
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >KDE is installed and the backends the Admin wants to use are installed.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
204
+
205
+<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
206
+
207
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >open kdemm admin tool</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
208
+
209
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">kdemm looks for available options (media frameworks and their output options) and presents these options in a view (see glossary). One framework is already selected as KDE default and kdemm does a good guess (based on audio driver) on what should be the default audio output option.<BR>For the selected media framework there might be more options that need to be shown.<BR>Also if the audio output choice has configuration options they get shown. (e.g. jackd has a lot of options that are more or less important to the admin)</TD></TR>
210
+
211
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >select another media framework</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
212
+
213
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Change audio output options according to what the framework supports.<BR><BR>Provide access to the configuration options of the just selected media framework.</TD></TR>
214
+
215
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >take a look at media framework config options</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
216
+
217
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">show media framework config options (e.g. NMM might show some network related options here)</TD></TR>
218
+
219
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >tweak a few settings</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
220
+
221
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">write config out so that programs using kdemm behave like configured</TD></TR>
222
+
223
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >change default audio output</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
224
+
225
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Set the media framework to use the specified audio output.<BR><BR>Provide access to the configuration options of the newly selected audio output.</TD></TR>
226
+
227
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >save settings and close admin tool</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
228
+
229
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">write out all configuration and tell all kdemm programs to use the new configuration</TD></TR>
230
+
231
+</TABLE></P>
232
+
233
+<A NAME="Use Case: create reusable audio path" />
234
+<H4>Use Case: create reusable audio path</H4>
235
+<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
236
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Multimedia Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
237
+
238
+<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >the kdemm API has been initialized without errors (see use case "initialize kdemm")</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
239
+
240
+<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
241
+
242
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask kdemm for an "audio path"</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
243
+
244
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Create a representation for the flow graph audio normally takes from the media object to the output and return an interface to it.</TD></TR>
245
+
246
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask for a list of effects that can be inserted into the audio path.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
247
+
248
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Look what effects the media framework supports and return a list that describes those effects (1. information for the end-user, 2. info that a computer program can recognize and identify, 3. unique identifier for the effect)</TD></TR>
249
+
250
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Create list of effects and let the user decide what effects he wants. Tell kdemm to insert effects into the audio path.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
251
+
252
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Prepare an audio path with the selected effects for later use.</TD></TR>
253
+
254
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >optional steps:<BR>The user decides to configure the parameters of one effect.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
255
+
256
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Return a Widget showing the parameters the effect has so that the user can configure the effects.</TD></TR>
257
+
258
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask kdemm to save the state of the current audio path to a configuration object.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
259
+
260
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Look at current audio path, the contained effects and the parameters of the effects. Write those values in the configuration object.</TD></TR>
261
+
262
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >load media</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
263
+
264
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Tell kdemm to use the above audio path  for the media object.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
265
+
266
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Change flow graph of media framework to use the selected audio path.</TD></TR>
267
+
268
+<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >play</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
269
+
270
+</TABLE></P>
271
+
272
+<A NAME="Use Case: crossfading" />
273
+<H4>Use Case: crossfading</H4>