~ubuntu-branches/ubuntu/lucid/lastfm/lucid

« back to all changes in this revision

Viewing changes to src/libUnicorn/UnicornCommonMac.h

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2008-07-14 16:46:20 UTC
  • mfrom: (1.1.7 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080714164620-67hoz9fs177wpgmr
Tags: 1:1.5.1.31879.dfsg-1ubuntu1
* Merge from Debian unstable (LP: #248100), remaining changes:
  - debian/rules: add dh_icons call
  + debian/control:
    - switch iceweasel to firefox in Recommends field
    - modify debhelper version to >= 5.0.51~
    - modify Maintainer to Ubuntu MOTU Developers

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
 
 *   Copyright (C) 2005 - 2007 by                                          *
3
 
 *      Last.fm Ltd <client@last.fm>                                       *
 
2
 *   Copyright (C) 2005 - 2008 by                                          *
 
3
 *      Last.fm Ltd. <client@last.fm>                                      *
4
4
 *                                                                         *
5
5
 *   This program is free software; you can redistribute it and/or modify  *
6
6
 *   it under the terms of the GNU General Public License as published by  *
18
18
 *   51 Franklin Steet, Fifth Floor, Boston, MA  02110-1301, USA.          *
19
19
 ***************************************************************************/
20
20
 
21
 
#ifndef UNICORNCOMMONMAC_H
22
 
#define UNICORNCOMMONMAC_H
 
21
#ifndef UNICORN_COMMON_MAC_H
 
22
#define UNICORN_COMMON_MAC_H
23
23
 
24
24
/** @author <erik@last.fm> */
25
25
 
26
26
#include <QString>
27
27
#include <CoreFoundation/CoreFoundation.h>
28
28
#include <QLocale>
29
 
#include <QDebug>
 
29
#include <QUrl>
30
30
 
31
31
namespace UnicornUtils
32
32
{
38
38
 
39
39
    QLocale::Language
40
40
    osxLanguageCode();
 
41
    
 
42
    QByteArray 
 
43
    CFStringToUtf8( CFStringRef );
41
44
 
42
45
    inline QString
43
46
    CFStringToQString( CFStringRef s )
44
47
    {
45
 
        QString result;
46
 
 
47
 
        if (s != NULL){
48
 
            // Can be 32 bit unicode, hence 4 times + 8 bits for the null --mxcl
49
 
            CFIndex length = 1 + 4 * CFStringGetLength( s );
50
 
            char* buffer = new char[length];
51
 
 
52
 
            if (CFStringGetCString( s, buffer, length, kCFStringEncodingUTF8 ))
53
 
                result = QString::fromUtf8(buffer);
54
 
            else
55
 
                qWarning() << "itunesplayer.cpp: CFString conversion failed.";
56
 
 
57
 
            delete buffer;
58
 
        }
59
 
 
60
 
        return result;
 
48
        return QString::fromUtf8( CFStringToUtf8( s ) );
61
49
    }
62
 
 
 
50
    
 
51
    bool
 
52
    isGrowlInstalled();
 
53
 
 
54
    bool
 
55
    iTunesIsOpen();
 
56
 
 
57
    bool
 
58
    setPreferredAppForUrlScheme( const QUrl& url, const QString& app );
 
59
 
 
60
    QString
 
61
    preferredAppForUrlScheme( const QUrl& url );
63
62
}
64
63
 
65
 
 
66
 
#endif // UNICORNCOMMONMAC_H
 
64
#endif // UNICORN_COMMON_MAC_H