Replace QCFString::to(CF/NS/Q)String usage with QString methods
Slims down QCFString and leaves only one implementation of converting back and forth between CF/NS strings and QStrings. Change-Id: I068568ffa25e6f4f6d6c99dcf47078b7a8e70e10 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
parent
1b567854e4
commit
669add92d9
@ -1863,7 +1863,7 @@ ProjectBuilderMakefileGenerator::pbuilderVersion() const
|
||||
CFStringRef str = CFStringRef(CFBundleGetValueForInfoDictionaryKey(bundle,
|
||||
CFSTR("CFBundleShortVersionString")));
|
||||
if (str) {
|
||||
QStringList versions = QCFString::toQString(str).split(QLatin1Char('.'));
|
||||
QStringList versions = QString::fromCFString(str).split(QLatin1Char('.'));
|
||||
int versionMajor = versions.at(0).toInt();
|
||||
int versionMinor = versions.at(1).toInt();
|
||||
if (versionMajor >= 3) {
|
||||
|
@ -101,13 +101,13 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e
|
||||
|
||||
if (suffix.length() > 0) {
|
||||
// First step: is the extension known ?
|
||||
QCFType<CFStringRef> extensionRef = QCFString::toCFStringRef(suffix);
|
||||
QCFType<CFStringRef> extensionRef = suffix.toCFString();
|
||||
QCFType<CFStringRef> uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
|
||||
if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle))
|
||||
return true;
|
||||
|
||||
// Second step: check if an application knows the package type
|
||||
QCFType<CFStringRef> path = QCFString::toCFStringRef(entry.filePath());
|
||||
QCFType<CFStringRef> path = entry.filePath().toCFString();
|
||||
QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle, true);
|
||||
|
||||
UInt32 type, creator;
|
||||
@ -126,7 +126,7 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e
|
||||
if (application) {
|
||||
QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, application);
|
||||
CFStringRef identifier = CFBundleGetIdentifier(bundle);
|
||||
QString applicationId = QCFString::toQString(identifier);
|
||||
QString applicationId = QString::fromCFString(identifier);
|
||||
if (applicationId != QLatin1String("com.apple.finder"))
|
||||
return true;
|
||||
}
|
||||
@ -222,7 +222,7 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
|
||||
if (!cfstr)
|
||||
return QFileSystemEntry();
|
||||
|
||||
return QFileSystemEntry(QCFString::toQString(cfstr));
|
||||
return QFileSystemEntry(QString::fromCFString(cfstr));
|
||||
}
|
||||
#endif
|
||||
return QFileSystemEntry();
|
||||
@ -412,7 +412,7 @@ QString QFileSystemEngine::bundleName(const QFileSystemEntry &entry)
|
||||
if (QCFType<CFDictionaryRef> dict = CFBundleCopyInfoDictionaryForURL(url)) {
|
||||
if (CFTypeRef name = (CFTypeRef)CFDictionaryGetValue(dict, kCFBundleNameKey)) {
|
||||
if (CFGetTypeID(name) == CFStringGetTypeID())
|
||||
return QCFString::toQString((CFStringRef)name);
|
||||
return QString::fromCFString((CFStringRef)name);
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
|
@ -418,7 +418,7 @@ void QProcessPrivate::startProcess()
|
||||
}
|
||||
if (url) {
|
||||
const QCFString str = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
|
||||
encodedProgramName += (QDir::separator() + QDir(program).relativeFilePath(QCFString::toQString(str))).toUtf8();
|
||||
encodedProgramName += (QDir::separator() + QDir(program).relativeFilePath(QString::fromCFString(str))).toUtf8();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -83,12 +83,12 @@ static QString rotateSlashesDotsAndMiddots(const QString &key, int shift)
|
||||
|
||||
static QCFType<CFStringRef> macKey(const QString &key)
|
||||
{
|
||||
return QCFString::toCFStringRef(rotateSlashesDotsAndMiddots(key, Macify));
|
||||
return rotateSlashesDotsAndMiddots(key, Macify).toCFString();
|
||||
}
|
||||
|
||||
static QString qtKey(CFStringRef cfkey)
|
||||
{
|
||||
return rotateSlashesDotsAndMiddots(QCFString::toQString(cfkey), Qtify);
|
||||
return rotateSlashesDotsAndMiddots(QString::fromCFString(cfkey), Qtify);
|
||||
}
|
||||
|
||||
static QCFType<CFPropertyListRef> macValue(const QVariant &value);
|
||||
@ -160,7 +160,7 @@ static QCFType<CFPropertyListRef> macValue(const QVariant &value)
|
||||
}
|
||||
}
|
||||
|
||||
cfkeys[numUniqueKeys] = QCFString::toCFStringRef(key);
|
||||
cfkeys[numUniqueKeys] = key.toCFString();
|
||||
cfvalues[numUniqueKeys] = singleton ? macValue(values.constFirst()) : macList(values);
|
||||
++numUniqueKeys;
|
||||
}
|
||||
@ -229,7 +229,7 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
|
||||
Sorted grossly from most to least frequent type.
|
||||
*/
|
||||
if (typeId == CFStringGetTypeID()) {
|
||||
return QSettingsPrivate::stringToVariant(QCFString::toQString(static_cast<CFStringRef>(cfvalue)));
|
||||
return QSettingsPrivate::stringToVariant(QString::fromCFString(static_cast<CFStringRef>(cfvalue)));
|
||||
} else if (typeId == CFNumberGetTypeID()) {
|
||||
CFNumberRef cfnumber = static_cast<CFNumberRef>(cfvalue);
|
||||
if (CFNumberIsFloatType(cfnumber)) {
|
||||
@ -285,7 +285,7 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
|
||||
|
||||
QMultiMap<QString, QVariant> map;
|
||||
for (int i = 0; i < size; ++i) {
|
||||
QString key = QCFString::toQString(static_cast<CFStringRef>(keys[i]));
|
||||
QString key = QString::fromCFString(static_cast<CFStringRef>(keys[i]));
|
||||
|
||||
if (CFGetTypeID(values[i]) == arrayTypeId) {
|
||||
CFArrayRef cfarray = static_cast<CFArrayRef>(values[i]);
|
||||
@ -580,7 +580,7 @@ QString QMacSettingsPrivate::fileName() const
|
||||
if ((spec & F_System) == 0)
|
||||
result = QDir::homePath();
|
||||
result += QLatin1String("/Library/Preferences/");
|
||||
result += QCFString::toQString(domains[0].applicationOrSuiteId);
|
||||
result += QString::fromCFString(domains[0].applicationOrSuiteId);
|
||||
result += QLatin1String(".plist");
|
||||
return result;
|
||||
}
|
||||
|
@ -205,13 +205,13 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
|
||||
if (mainBundle) {
|
||||
CFURLRef bundleUrl = CFBundleCopyBundleURL(mainBundle);
|
||||
CFStringRef cfBundlePath = CFURLCopyPath(bundleUrl);
|
||||
QString bundlePath = QCFString::toQString(cfBundlePath);
|
||||
QString bundlePath = QString::fromCFString(cfBundlePath);
|
||||
CFRelease(cfBundlePath);
|
||||
CFRelease(bundleUrl);
|
||||
|
||||
CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
||||
CFStringRef cfResourcesPath = CFURLCopyPath(resourcesUrl);
|
||||
QString resourcesPath = QCFString::toQString(cfResourcesPath);
|
||||
QString resourcesPath = QString::fromCFString(cfResourcesPath);
|
||||
CFRelease(cfResourcesPath);
|
||||
CFRelease(resourcesUrl);
|
||||
|
||||
|
@ -43,37 +43,17 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QString QCFString::toQString(CFStringRef str)
|
||||
{
|
||||
if(!str)
|
||||
return QString();
|
||||
CFIndex length = CFStringGetLength(str);
|
||||
const UniChar *chars = CFStringGetCharactersPtr(str);
|
||||
if (chars)
|
||||
return QString(reinterpret_cast<const QChar *>(chars), length);
|
||||
|
||||
QVarLengthArray<UniChar> buffer(length);
|
||||
CFStringGetCharacters(str, CFRangeMake(0, length), buffer.data());
|
||||
return QString(reinterpret_cast<const QChar *>(buffer.constData()), length);
|
||||
}
|
||||
|
||||
QCFString::operator QString() const
|
||||
{
|
||||
if (string.isEmpty() && type)
|
||||
const_cast<QCFString*>(this)->string = toQString(type);
|
||||
const_cast<QCFString*>(this)->string = QString::fromCFString(type);
|
||||
return string;
|
||||
}
|
||||
|
||||
CFStringRef QCFString::toCFStringRef(const QString &string)
|
||||
{
|
||||
return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(string.unicode()),
|
||||
string.length());
|
||||
}
|
||||
|
||||
QCFString::operator CFStringRef() const
|
||||
{
|
||||
if (!type)
|
||||
const_cast<QCFString*>(this)->type = toCFStringRef(string);
|
||||
const_cast<QCFString*>(this)->type = string.toCFString();
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -55,17 +55,6 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
typedef qint16 (*GestaltFunction)(quint32 selector, qint32 *response);
|
||||
|
||||
NSString *QCFString::toNSString(const QString &string)
|
||||
{
|
||||
// The const cast below is safe: CfStringRef is immutable and so is NSString.
|
||||
return [const_cast<NSString *>(reinterpret_cast<const NSString *>(toCFStringRef(string))) autorelease];
|
||||
}
|
||||
|
||||
QString QCFString::toQString(const NSString *nsstr)
|
||||
{
|
||||
return toQString(reinterpret_cast<CFStringRef>(nsstr));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
QDebug operator<<(QDebug dbg, const NSObject *nsObject)
|
||||
|
@ -126,12 +126,6 @@ public:
|
||||
inline QCFString(const QCFType<CFStringRef> &other) : QCFType<CFStringRef>(other) {}
|
||||
operator QString() const;
|
||||
operator CFStringRef() const;
|
||||
static QString toQString(CFStringRef cfstr);
|
||||
static CFStringRef toCFStringRef(const QString &str);
|
||||
#ifdef __OBJC__
|
||||
static QString toQString(const NSString *nsstr);
|
||||
static NSString *toNSString(const QString &string);
|
||||
#endif
|
||||
|
||||
private:
|
||||
QString string;
|
||||
|
@ -150,7 +150,7 @@ QString QCoreApplicationPrivate::macMenuBarName()
|
||||
QString bundleName;
|
||||
CFTypeRef string = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), CFSTR("CFBundleName"));
|
||||
if (string)
|
||||
bundleName = QCFString::toQString(static_cast<CFStringRef>(string));
|
||||
bundleName = QString::fromCFString(static_cast<CFStringRef>(string));
|
||||
return bundleName;
|
||||
}
|
||||
#endif
|
||||
|
@ -117,7 +117,7 @@ static CFStringRef runLoopMode(NSDictionary *dictionary)
|
||||
if (CFStringCompare(mode, [self currentMode], 0) == kCFCompareEqualTo)
|
||||
m_runLoopModes.pop();
|
||||
else
|
||||
qWarning("Tried to pop run loop mode '%s' that was never pushed!", qPrintable(QCFString::toQString(mode)));
|
||||
qWarning("Tried to pop run loop mode '%s' that was never pushed!", qPrintable(QString::fromCFString(mode)));
|
||||
|
||||
Q_ASSERT(m_runLoopModes.size() >= 1);
|
||||
}
|
||||
@ -285,7 +285,7 @@ bool QEventDispatcherCoreFoundation::processEvents(QEventLoop::ProcessEventsFlag
|
||||
CFTimeInterval duration = (m_processEvents.flags & QEventLoop::WaitForMoreEvents) ?
|
||||
kCFTimeIntervalDistantFuture : kCFTimeIntervalMinimum;
|
||||
|
||||
qEventDispatcherDebug() << "Calling CFRunLoopRunInMode = " << qPrintable(QCFString::toQString(mode))
|
||||
qEventDispatcherDebug() << "Calling CFRunLoopRunInMode = " << qPrintable(QString::fromCFString(mode))
|
||||
<< " for " << duration << " ms, processing single source = " << returnAfterSingleSourceHandled; qIndent();
|
||||
|
||||
SInt32 result = CFRunLoopRunInMode(mode, duration, returnAfterSingleSourceHandled);
|
||||
|
@ -76,7 +76,7 @@ static QByteArray getMacLocaleName()
|
||||
|| (result != "C" && !qt_splitLocaleName(QString::fromLocal8Bit(result), lang, script, cntry))) {
|
||||
QCFType<CFLocaleRef> l = CFLocaleCopyCurrent();
|
||||
CFStringRef locale = CFLocaleGetIdentifier(l);
|
||||
result = QCFString::toQString(locale).toUtf8();
|
||||
result = QString::fromCFString(locale).toUtf8();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -96,7 +96,7 @@ static QString macMonthName(int month, bool short_format)
|
||||
: kCFDateFormatterMonthSymbols));
|
||||
if (values != 0) {
|
||||
CFStringRef cfstring = static_cast<CFStringRef>(CFArrayGetValueAtIndex(values, month));
|
||||
return QCFString::toQString(cfstring);
|
||||
return QString::fromCFString(cfstring);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
@ -114,7 +114,7 @@ static QString macDayName(int day, bool short_format)
|
||||
: kCFDateFormatterWeekdaySymbols));
|
||||
if (values != 0) {
|
||||
CFStringRef cfstring = static_cast<CFStringRef>(CFArrayGetValueAtIndex(values, day % 7));
|
||||
return QCFString::toQString(cfstring);
|
||||
return QString::fromCFString(cfstring);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
@ -293,7 +293,7 @@ QString getMacDateFormat(CFDateFormatterStyle style)
|
||||
QCFType<CFLocaleRef> l = CFLocaleCopyCurrent();
|
||||
QCFType<CFDateFormatterRef> formatter = CFDateFormatterCreate(kCFAllocatorDefault,
|
||||
l, style, kCFDateFormatterNoStyle);
|
||||
return macToQtFormat(QCFString::toQString(CFDateFormatterGetFormat(formatter)));
|
||||
return macToQtFormat(QString::fromCFString(CFDateFormatterGetFormat(formatter)));
|
||||
}
|
||||
|
||||
static QString getMacTimeFormat(CFDateFormatterStyle style)
|
||||
@ -301,21 +301,21 @@ static QString getMacTimeFormat(CFDateFormatterStyle style)
|
||||
QCFType<CFLocaleRef> l = CFLocaleCopyCurrent();
|
||||
QCFType<CFDateFormatterRef> formatter = CFDateFormatterCreate(kCFAllocatorDefault,
|
||||
l, kCFDateFormatterNoStyle, style);
|
||||
return macToQtFormat(QCFString::toQString(CFDateFormatterGetFormat(formatter)));
|
||||
return macToQtFormat(QString::fromCFString(CFDateFormatterGetFormat(formatter)));
|
||||
}
|
||||
|
||||
static QString getCFLocaleValue(CFStringRef key)
|
||||
{
|
||||
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
|
||||
CFTypeRef value = CFLocaleGetValue(locale, key);
|
||||
return QCFString::toQString(CFStringRef(static_cast<CFTypeRef>(value)));
|
||||
return QString::fromCFString(CFStringRef(static_cast<CFTypeRef>(value)));
|
||||
}
|
||||
|
||||
static QLocale::MeasurementSystem macMeasurementSystem()
|
||||
{
|
||||
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
|
||||
CFStringRef system = static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleMeasurementSystem));
|
||||
if (QCFString::toQString(system) == QLatin1String("Metric")) {
|
||||
if (QString::fromCFString(system) == QLatin1String("Metric")) {
|
||||
return QLocale::MetricSystem;
|
||||
} else {
|
||||
return QLocale::ImperialSystem;
|
||||
@ -337,13 +337,13 @@ static QString macCurrencySymbol(QLocale::CurrencySymbolFormat format)
|
||||
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
|
||||
switch (format) {
|
||||
case QLocale::CurrencyIsoCode:
|
||||
return QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencyCode)));
|
||||
return QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencyCode)));
|
||||
case QLocale::CurrencySymbol:
|
||||
return QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencySymbol)));
|
||||
return QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencySymbol)));
|
||||
case QLocale::CurrencyDisplayName: {
|
||||
CFStringRef code = static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencyCode));
|
||||
QCFType<CFStringRef> value = CFLocaleCopyDisplayNameForPropertyValue(locale, kCFLocaleCurrencyCode, code);
|
||||
return QCFString::toQString(value);
|
||||
return QString::fromCFString(value);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
@ -382,10 +382,10 @@ static QString macFormatCurrency(const QSystemLocale::CurrencyToStringArgument &
|
||||
CFNumberFormatterCreate(NULL, locale, kCFNumberFormatterCurrencyStyle);
|
||||
if (!arg.symbol.isEmpty()) {
|
||||
CFNumberFormatterSetProperty(currencyFormatter, kCFNumberFormatterCurrencySymbol,
|
||||
QCFString::toCFStringRef(arg.symbol));
|
||||
arg.symbol.toCFString());
|
||||
}
|
||||
QCFType<CFStringRef> result = CFNumberFormatterCreateStringWithNumber(NULL, currencyFormatter, value);
|
||||
return QCFString::toQString(result);
|
||||
return QString::fromCFString(result);
|
||||
}
|
||||
|
||||
static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &str)
|
||||
@ -394,12 +394,12 @@ static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &
|
||||
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
|
||||
switch (type) {
|
||||
case QSystemLocale::StringToStandardQuotation:
|
||||
begin = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationBeginDelimiterKey)));
|
||||
end = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationEndDelimiterKey)));
|
||||
begin = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationBeginDelimiterKey)));
|
||||
end = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationEndDelimiterKey)));
|
||||
return QString(begin % str % end);
|
||||
case QSystemLocale::StringToAlternateQuotation:
|
||||
begin = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationBeginDelimiterKey)));
|
||||
end = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationEndDelimiterKey)));
|
||||
begin = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationBeginDelimiterKey)));
|
||||
end = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationEndDelimiterKey)));
|
||||
return QString(begin % str % end);
|
||||
default:
|
||||
break;
|
||||
@ -468,7 +468,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
|
||||
QCFType<CFDateFormatterRef> formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterLongStyle, kCFDateFormatterLongStyle);
|
||||
QCFType<CFStringRef> value = static_cast<CFStringRef>(CFDateFormatterCopyProperty(formatter,
|
||||
(type == AMText ? kCFDateFormatterAMSymbol : kCFDateFormatterPMSymbol)));
|
||||
return QCFString::toQString(value);
|
||||
return QString::fromCFString(value);
|
||||
}
|
||||
case FirstDayOfWeek:
|
||||
return QVariant(macFirstDayOfWeek());
|
||||
@ -491,15 +491,15 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
|
||||
const int cnt = CFArrayGetCount(languages.as<CFArrayRef>());
|
||||
result.reserve(cnt);
|
||||
for (int i = 0; i < cnt; ++i) {
|
||||
const QString lang = QCFString::toQString(
|
||||
const QString lang = QString::fromCFString(
|
||||
static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages.as<CFArrayRef>(), i)));
|
||||
result.append(lang);
|
||||
}
|
||||
} else if (typeId == CFStringGetTypeID()) {
|
||||
result = QStringList(QCFString::toQString(languages.as<CFStringRef>()));
|
||||
result = QStringList(QString::fromCFString(languages.as<CFStringRef>()));
|
||||
} else {
|
||||
qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt.io",
|
||||
qPrintable(QCFString::toQString(CFCopyTypeIDDescription(typeId))));
|
||||
qPrintable(QString::fromCFString(CFCopyTypeIDDescription(typeId))));
|
||||
}
|
||||
return QVariant(result);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ QTimeZonePrivate *QMacTimeZonePrivate::clone()
|
||||
void QMacTimeZonePrivate::init(const QByteArray &ianaId)
|
||||
{
|
||||
if (availableTimeZoneIds().contains(ianaId)) {
|
||||
m_nstz = [[NSTimeZone timeZoneWithName:QCFString::toNSString(QString::fromUtf8(ianaId))] retain];
|
||||
m_nstz = [[NSTimeZone timeZoneWithName:QString::fromUtf8(ianaId).toNSString()] retain];
|
||||
if (m_nstz)
|
||||
m_id = ianaId;
|
||||
}
|
||||
@ -98,7 +98,7 @@ void QMacTimeZonePrivate::init(const QByteArray &ianaId)
|
||||
|
||||
QString QMacTimeZonePrivate::comment() const
|
||||
{
|
||||
return QCFString::toQString([m_nstz description]);
|
||||
return QString::fromNSString([m_nstz description]);
|
||||
}
|
||||
|
||||
QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
|
||||
@ -140,9 +140,9 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
|
||||
break;
|
||||
}
|
||||
|
||||
NSString *macLocaleCode = QCFString::toNSString(locale.name());
|
||||
NSString *macLocaleCode = locale.name().toNSString();
|
||||
NSLocale *macLocale = [[NSLocale alloc] initWithLocaleIdentifier:macLocaleCode];
|
||||
const QString result = QCFString::toQString([m_nstz localizedName:style locale:macLocale]);
|
||||
const QString result = QString::fromNSString([m_nstz localizedName:style locale:macLocale]);
|
||||
[macLocale release];
|
||||
return result;
|
||||
}
|
||||
@ -150,7 +150,7 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
|
||||
QString QMacTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const
|
||||
{
|
||||
const NSTimeInterval seconds = atMSecsSinceEpoch / 1000.0;
|
||||
return QCFString::toQString([m_nstz abbreviationForDate:[NSDate dateWithTimeIntervalSince1970:seconds]]);
|
||||
return QString::fromNSString([m_nstz abbreviationForDate:[NSDate dateWithTimeIntervalSince1970:seconds]]);
|
||||
}
|
||||
|
||||
int QMacTimeZonePrivate::offsetFromUtc(qint64 atMSecsSinceEpoch) const
|
||||
@ -191,7 +191,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::data(qint64 forMSecsSinceEpoch) cons
|
||||
data.offsetFromUtc = [m_nstz secondsFromGMTForDate:date];
|
||||
data.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:date];
|
||||
data.standardTimeOffset = data.offsetFromUtc - data.daylightTimeOffset;
|
||||
data.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:date]);
|
||||
data.abbreviation = QString::fromNSString([m_nstz abbreviationForDate:date]);
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc
|
||||
tran.offsetFromUtc = [m_nstz secondsFromGMTForDate:nextDate];
|
||||
tran.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:nextDate];
|
||||
tran.standardTimeOffset = tran.offsetFromUtc - tran.daylightTimeOffset;
|
||||
tran.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:nextDate]);
|
||||
tran.abbreviation = QString::fromNSString([m_nstz abbreviationForDate:nextDate]);
|
||||
return tran;
|
||||
}
|
||||
|
||||
@ -253,18 +253,18 @@ QByteArray QMacTimeZonePrivate::systemTimeZoneId() const
|
||||
{
|
||||
// Reset the cached system tz then return the name
|
||||
[NSTimeZone resetSystemTimeZone];
|
||||
return QCFString::toQString([[NSTimeZone systemTimeZone] name]).toUtf8();
|
||||
return QString::fromNSString([[NSTimeZone systemTimeZone] name]).toUtf8();
|
||||
}
|
||||
|
||||
QList<QByteArray> QMacTimeZonePrivate::availableTimeZoneIds() const
|
||||
{
|
||||
NSEnumerator *enumerator = [[NSTimeZone knownTimeZoneNames] objectEnumerator];
|
||||
QByteArray tzid = QCFString::toQString([enumerator nextObject]).toUtf8();
|
||||
QByteArray tzid = QString::fromNSString([enumerator nextObject]).toUtf8();
|
||||
|
||||
QList<QByteArray> list;
|
||||
while (!tzid.isEmpty()) {
|
||||
list << tzid;
|
||||
tzid = QCFString::toQString([enumerator nextObject]).toUtf8();
|
||||
tzid = QString::fromNSString([enumerator nextObject]).toUtf8();
|
||||
}
|
||||
|
||||
std::sort(list.begin(), list.end());
|
||||
|
@ -104,7 +104,7 @@ static bool isHostExcluded(CFDictionaryRef dict, const QString &host)
|
||||
CFIndex size = CFArrayGetCount(exclusionList);
|
||||
for (CFIndex i = 0; i < size; ++i) {
|
||||
CFStringRef cfentry = (CFStringRef)CFArrayGetValueAtIndex(exclusionList, i);
|
||||
QString entry = QCFString::toQString(cfentry);
|
||||
QString entry = QString::fromCFString(cfentry);
|
||||
|
||||
if (isIpAddress && ipAddress.isInSubnet(QHostAddress::parseSubnet(entry))) {
|
||||
return true; // excluded
|
||||
@ -133,7 +133,7 @@ static QNetworkProxy proxyFromDictionary(CFDictionaryRef dict, QNetworkProxy::Pr
|
||||
&& (protoPort = (CFNumberRef)CFDictionaryGetValue(dict, portKey))) {
|
||||
int enabled;
|
||||
if (CFNumberGetValue(protoEnabled, kCFNumberIntType, &enabled) && enabled) {
|
||||
QString host = QCFString::toQString(protoHost);
|
||||
QString host = QString::fromCFString(protoHost);
|
||||
|
||||
int port;
|
||||
CFNumberGetValue(protoPort, kCFNumberIntType, &port);
|
||||
@ -168,9 +168,9 @@ static QNetworkProxy proxyFromDictionary(CFDictionaryRef dict)
|
||||
proxyType = QNetworkProxy::Socks5Proxy;
|
||||
}
|
||||
|
||||
hostName = QCFString::toQString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyHostNameKey));
|
||||
user = QCFString::toQString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyUsernameKey));
|
||||
password = QCFString::toQString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyPasswordKey));
|
||||
hostName = QString::fromCFString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyHostNameKey));
|
||||
user = QString::fromCFString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyUsernameKey));
|
||||
password = QString::fromCFString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyPasswordKey));
|
||||
|
||||
CFNumberRef portNumber = (CFNumberRef)CFDictionaryGetValue(dict, kCFProxyPortNumberKey);
|
||||
if (portNumber) {
|
||||
@ -229,7 +229,7 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
|
||||
QCFType<CFDataRef> pacData;
|
||||
QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
|
||||
if (!pacUrl) {
|
||||
qWarning("Invalid PAC URL \"%s\"", qPrintable(QCFString::toQString(cfPacLocation)));
|
||||
qWarning("Invalid PAC URL \"%s\"", qPrintable(QString::fromCFString(cfPacLocation)));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -259,9 +259,9 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
|
||||
CFRunLoopRunInMode(pacRunLoopMode, 1000, /*returnAfterSourceHandled*/ true);
|
||||
|
||||
if (!pacInfo.proxies) {
|
||||
QString pacLocation = QCFString::toQString(cfPacLocation);
|
||||
QString pacLocation = QString::fromCFString(cfPacLocation);
|
||||
QCFType<CFStringRef> pacErrorDescription = CFErrorCopyDescription(pacInfo.error);
|
||||
qWarning("Execution of PAC script at \"%s\" failed: %s", qPrintable(pacLocation), qPrintable(QCFString::toQString(pacErrorDescription)));
|
||||
qWarning("Execution of PAC script at \"%s\" failed: %s", qPrintable(pacLocation), qPrintable(QString::fromCFString(pacErrorDescription)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ void QCoreTextFontDatabase::populateFontDatabase()
|
||||
const int numberOfFamilies = CFArrayGetCount(familyNames);
|
||||
for (int i = 0; i < numberOfFamilies; ++i) {
|
||||
CFStringRef familyNameRef = (CFStringRef) CFArrayGetValueAtIndex(familyNames, i);
|
||||
QString familyName = QCFString::toQString(familyNameRef);
|
||||
QString familyName = QString::fromCFString(familyNameRef);
|
||||
|
||||
// Don't populate internal fonts
|
||||
if (familyName.startsWith(QLatin1Char('.')) || familyName == QLatin1String("LastResort"))
|
||||
@ -505,9 +505,9 @@ static QString familyNameFromPostScriptName(NSString *psName)
|
||||
{
|
||||
QCFType<CTFontDescriptorRef> fontDescriptor = (CTFontDescriptorRef) CTFontDescriptorCreateWithNameAndSize((CFStringRef)psName, 12.0);
|
||||
QCFString familyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute);
|
||||
QString name = QCFString::toQString(familyName);
|
||||
QString name = QString::fromCFString(familyName);
|
||||
if (name.isEmpty())
|
||||
qWarning() << "QCoreTextFontDatabase: Failed to resolve family name for PostScript name " << QCFString::toQString((CFStringRef)psName);
|
||||
qWarning() << "QCoreTextFontDatabase: Failed to resolve family name for PostScript name " << QString::fromCFString((CFStringRef)psName);
|
||||
|
||||
return name;
|
||||
}
|
||||
@ -537,7 +537,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
|
||||
for (int i = 0; i < numCascades; ++i) {
|
||||
CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i);
|
||||
QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute);
|
||||
fallbackList.append(QCFString::toQString(fallbackFamilyName));
|
||||
fallbackList.append(QString::fromCFString(fallbackFamilyName));
|
||||
}
|
||||
|
||||
#if defined(Q_OS_OSX)
|
||||
|
@ -213,7 +213,7 @@ void QCoreTextFontEngine::init()
|
||||
|
||||
face_id.index = 0;
|
||||
QCFString name = CTFontCopyName(ctfont, kCTFontUniqueNameKey);
|
||||
face_id.filename = QCFString::toQString(name).toUtf8();
|
||||
face_id.filename = QString::fromCFString(name).toUtf8();
|
||||
|
||||
QCFString family = CTFontCopyFamilyName(ctfont);
|
||||
fontDef.family = family;
|
||||
@ -826,8 +826,8 @@ QFontEngine::Properties QCoreTextFontEngine::properties() const
|
||||
QCFString psName, copyright;
|
||||
psName = CTFontCopyPostScriptName(ctfont);
|
||||
copyright = CTFontCopyName(ctfont, kCTFontCopyrightNameKey);
|
||||
result.postscriptName = QCFString::toQString(psName).toUtf8();
|
||||
result.copyright = QCFString::toQString(copyright).toUtf8();
|
||||
result.postscriptName = QString::fromCFString(psName).toUtf8();
|
||||
result.copyright = QString::fromCFString(copyright).toUtf8();
|
||||
|
||||
qreal emSquare = CTFontGetUnitsPerEm(ctfont);
|
||||
qreal scale = emSquare / CTFontGetSize(ctfont);
|
||||
|
@ -133,7 +133,7 @@ void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys,
|
||||
{
|
||||
for ( long i = 0; i < CFArrayGetCount(changedKeys); i++) {
|
||||
|
||||
QString changed = QCFString::toQString((CFStringRef)CFArrayGetValueAtIndex(changedKeys, i));
|
||||
QString changed = QString::fromCFString((CFStringRef)CFArrayGetValueAtIndex(changedKeys, i));
|
||||
if( changed.contains("/Network/Global/IPv4")) {
|
||||
QCoreWlanEngine* wlanEngine = static_cast<QCoreWlanEngine*>(info);
|
||||
wlanEngine->requestUpdate();
|
||||
@ -162,7 +162,7 @@ void QScanThread::run()
|
||||
QMacAutoReleasePool pool;
|
||||
QStringList found;
|
||||
mutex.lock();
|
||||
CWInterface *currentInterface = [CWInterface interfaceWithName: QCFString::toNSString(interfaceName)];
|
||||
CWInterface *currentInterface = [CWInterface interfaceWithName:interfaceName.toNSString()];
|
||||
mutex.unlock();
|
||||
const bool currentInterfaceServiceActive = currentInterface.serviceActive;
|
||||
|
||||
@ -173,14 +173,14 @@ void QScanThread::run()
|
||||
|
||||
if (!err) {
|
||||
for (CWNetwork *apNetwork in apSet) {
|
||||
const QString networkSsid = QCFString::toQString([apNetwork ssid]);
|
||||
const QString networkSsid = QString::fromNSString([apNetwork ssid]);
|
||||
const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
|
||||
found.append(id);
|
||||
|
||||
QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
|
||||
bool known = isKnownSsid(networkSsid);
|
||||
if (currentInterfaceServiceActive) {
|
||||
if( networkSsid == QCFString::toQString( [currentInterface ssid])) {
|
||||
if (networkSsid == QString::fromNSString([currentInterface ssid])) {
|
||||
state = QNetworkConfiguration::Active;
|
||||
}
|
||||
}
|
||||
@ -223,7 +223,7 @@ void QScanThread::run()
|
||||
}
|
||||
|
||||
if (currentInterfaceServiceActive) {
|
||||
if( networkSsid == QCFString::toQString([currentInterface ssid])) {
|
||||
if (networkSsid == QString::fromNSString([currentInterface ssid])) {
|
||||
state = QNetworkConfiguration::Active;
|
||||
}
|
||||
}
|
||||
@ -287,7 +287,7 @@ void QScanThread::getUserConfigurations()
|
||||
NSSet *wifiInterfaces = [CWInterface interfaceNames];
|
||||
for (NSString *ifName in wifiInterfaces) {
|
||||
|
||||
CWInterface *wifiInterface = [CWInterface interfaceWithName: ifName];
|
||||
CWInterface *wifiInterface = [CWInterface interfaceWithName:ifName];
|
||||
|
||||
NSString *nsInterfaceName = wifiInterface.ssid;
|
||||
// add user configured system networks
|
||||
@ -299,10 +299,10 @@ void QScanThread::getUserConfigurations()
|
||||
|
||||
NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
|
||||
for (NSString *ssidkey in thisSsidarray) {
|
||||
QString thisSsid = QCFString::toQString(ssidkey);
|
||||
QString thisSsid = QString::fromNSString(ssidkey);
|
||||
if(!userProfiles.contains(thisSsid)) {
|
||||
QMap <QString,QString> map;
|
||||
map.insert(thisSsid, QCFString::toQString(nsInterfaceName));
|
||||
map.insert(thisSsid, QString::fromNSString(nsInterfaceName));
|
||||
userProfiles.insert(thisSsid, map);
|
||||
}
|
||||
}
|
||||
@ -315,18 +315,18 @@ void QScanThread::getUserConfigurations()
|
||||
NSEnumerator *enumerator = [networkProfiles objectEnumerator];
|
||||
CWNetworkProfile *wProfile;
|
||||
while ((wProfile = [enumerator nextObject])) {
|
||||
QString networkName = QCFString::toQString([wProfile ssid]);
|
||||
QString networkName = QString::fromNSString([wProfile ssid]);
|
||||
|
||||
if (!userProfiles.contains(networkName)) {
|
||||
QMap<QString,QString> map;
|
||||
map.insert(networkName, QCFString::toQString(nsInterfaceName));
|
||||
map.insert(networkName, QString::fromNSString(nsInterfaceName));
|
||||
userProfiles.insert(networkName, map);
|
||||
}
|
||||
}
|
||||
|
||||
// 802.1X user profiles
|
||||
QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
|
||||
NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile: QCFString::toNSString(userProfilePath)] autorelease];
|
||||
NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:userProfilePath.toNSString()] autorelease];
|
||||
if(eapDict != nil) {
|
||||
NSString *profileStr= @"Profiles";
|
||||
NSString *nameStr = @"UserDefinedName";
|
||||
@ -345,15 +345,15 @@ void QScanThread::getUserConfigurations()
|
||||
QString ssid;
|
||||
for (int i = 0; i < dictSize; i++) {
|
||||
if([nameStr isEqualToString:keys[i]]) {
|
||||
networkName = QCFString::toQString(objects[i]);
|
||||
networkName = QString::fromNSString(objects[i]);
|
||||
}
|
||||
if ([networkSsidStr isEqualToString:keys[i]]) {
|
||||
ssid = QCFString::toQString(objects[i]);
|
||||
ssid = QString::fromNSString(objects[i]);
|
||||
}
|
||||
if (!userProfiles.contains(networkName)
|
||||
&& !ssid.isEmpty()) {
|
||||
QMap<QString,QString> map;
|
||||
map.insert(ssid, QCFString::toQString(nsInterfaceName));
|
||||
map.insert(ssid, QString::fromNSString(nsInterfaceName));
|
||||
userProfiles.insert(networkName, map);
|
||||
}
|
||||
}
|
||||
@ -476,7 +476,7 @@ void QCoreWlanEngine::connectToId(const QString &id)
|
||||
QString interfaceString = getInterfaceFromId(id);
|
||||
|
||||
CWInterface *wifiInterface =
|
||||
[CWInterface interfaceWithName: QCFString::toNSString(interfaceString)];
|
||||
[CWInterface interfaceWithName:interfaceString.toNSString()];
|
||||
|
||||
if (wifiInterface.powerOn) {
|
||||
NSError *err = nil;
|
||||
@ -498,7 +498,7 @@ void QCoreWlanEngine::connectToId(const QString &id)
|
||||
}
|
||||
}
|
||||
|
||||
NSSet *scanSet = [wifiInterface scanForNetworksWithName:QCFString::toNSString(wantedSsid) error:&err];
|
||||
NSSet *scanSet = [wifiInterface scanForNetworksWithName:wantedSsid.toNSString() error:&err];
|
||||
|
||||
if(!err) {
|
||||
for (CWNetwork *apNetwork in scanSet) {
|
||||
@ -533,11 +533,11 @@ void QCoreWlanEngine::connectToId(const QString &id)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
qDebug() <<"associate ERROR"<< QCFString::toQString([err localizedDescription ]);
|
||||
qDebug() <<"associate ERROR"<< QString::fromNSString([err localizedDescription ]);
|
||||
}
|
||||
} //end scan network
|
||||
} else {
|
||||
qDebug() <<"scan ERROR"<< QCFString::toQString([err localizedDescription ]);
|
||||
qDebug() <<"scan ERROR"<< QString::fromNSString([err localizedDescription ]);
|
||||
}
|
||||
emit connectionError(id, InterfaceLookupError);
|
||||
}
|
||||
@ -559,7 +559,7 @@ void QCoreWlanEngine::disconnectFromId(const QString &id)
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
CWInterface *wifiInterface =
|
||||
[CWInterface interfaceWithName: QCFString::toNSString(interfaceString)];
|
||||
[CWInterface interfaceWithName:interfaceString.toNSString()];
|
||||
disconnectedInterfaceString = interfaceString;
|
||||
|
||||
[wifiInterface disassociate];
|
||||
@ -574,9 +574,9 @@ void QCoreWlanEngine::checkDisconnect()
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
CWInterface *wifiInterface =
|
||||
[CWInterface interfaceWithName: QCFString::toNSString(disconnectedInterfaceString)];
|
||||
[CWInterface interfaceWithName:disconnectedInterfaceString.toNSString()];
|
||||
|
||||
const QString networkSsid = QCFString::toQString([wifiInterface ssid]);
|
||||
const QString networkSsid = QString::fromNSString([wifiInterface ssid]);
|
||||
if (!networkSsid.isEmpty()) {
|
||||
const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
|
||||
locker.unlock();
|
||||
@ -601,7 +601,7 @@ void QCoreWlanEngine::doRequestUpdate()
|
||||
|
||||
NSSet *wifiInterfaces = [CWInterface interfaceNames];
|
||||
for (NSString *ifName in wifiInterfaces) {
|
||||
scanThread->interfaceName = QCFString::toQString(ifName);
|
||||
scanThread->interfaceName = QString::fromNSString(ifName);
|
||||
scanThread->start();
|
||||
}
|
||||
locker.unlock();
|
||||
@ -615,7 +615,7 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
|
||||
bool haswifi = false;
|
||||
if(hasWifi) {
|
||||
QMacAutoReleasePool pool;
|
||||
CWInterface *defaultInterface = [CWInterface interfaceWithName: QCFString::toNSString(wifiDeviceName)];
|
||||
CWInterface *defaultInterface = [CWInterface interfaceWithName:wifiDeviceName.toNSString()];
|
||||
if (defaultInterface.powerOn) {
|
||||
haswifi = true;
|
||||
}
|
||||
@ -843,7 +843,7 @@ quint64 QCoreWlanEngine::startTime(const QString &identifier)
|
||||
bool ok = false;
|
||||
for(int i = 0; i < dictSize; i++) {
|
||||
if([ssidStr isEqualToString:keys[i]]) {
|
||||
const QString ident = QString::number(qHash(QLatin1String("corewlan:") + QCFString::toQString(objects[i])));
|
||||
const QString ident = QString::number(qHash(QLatin1String("corewlan:") + QString::fromNSString(objects[i])));
|
||||
if(ident == identifier) {
|
||||
ok = true;
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ id getValueAttribute(QAccessibleInterface *interface)
|
||||
{
|
||||
const QAccessible::Role qtrole = interface->role();
|
||||
if (qtrole == QAccessible::StaticText) {
|
||||
return QCFString::toNSString(interface->text(QAccessible::Name));
|
||||
return interface->text(QAccessible::Name).toNSString();
|
||||
}
|
||||
if (qtrole == QAccessible::EditableText) {
|
||||
if (QAccessibleTextInterface *textInterface = interface->textInterface()) {
|
||||
@ -380,12 +380,12 @@ id getValueAttribute(QAccessibleInterface *interface)
|
||||
// textInterface->textAfterOffset(0, QAccessible2::SentenceBoundary, &begin, &end);
|
||||
text = textInterface->text(begin, end);
|
||||
}
|
||||
return QCFString::toNSString(text);
|
||||
return text.toNSString();
|
||||
}
|
||||
}
|
||||
|
||||
if (QAccessibleValueInterface *valueInterface = interface->valueInterface()) {
|
||||
return QCFString::toNSString(valueInterface->currentValue().toString());
|
||||
return valueInterface->currentValue().toString().toNSString();
|
||||
}
|
||||
|
||||
if (interface->state().checkable) {
|
||||
|
@ -300,9 +300,9 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
||||
} else if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) {
|
||||
if (iface->role() == QAccessible::StaticText)
|
||||
return nil;
|
||||
return QCFString::toNSString(iface->text(QAccessible::Name));
|
||||
return iface->text(QAccessible::Name).toNSString();
|
||||
} else if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute]) {
|
||||
return QCFString::toNSString(iface->text(QAccessible::Description));
|
||||
return iface->text(QAccessible::Description).toNSString();
|
||||
} else if ([attribute isEqualToString:NSAccessibilityEnabledAttribute]) {
|
||||
return [NSNumber numberWithBool:!iface->state().disabled];
|
||||
} else if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
|
||||
@ -439,7 +439,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
||||
if ([attribute isEqualToString: NSAccessibilityAttributedStringForRangeParameterizedAttribute]) {
|
||||
NSRange range = [parameter rangeValue];
|
||||
QString text = iface->textInterface()->text(range.location, range.location + range.length);
|
||||
return [[NSAttributedString alloc] initWithString: text.toNSString()];
|
||||
return [[NSAttributedString alloc] initWithString:text.toNSString()];
|
||||
} else if ([attribute isEqualToString: NSAccessibilityRangeForPositionParameterizedAttribute]) {
|
||||
NSPoint nsPoint = [parameter pointValue];
|
||||
QPoint point(static_cast<int>(nsPoint.x), static_cast<int>(qt_mac_flipYCoordinate(nsPoint.y)));
|
||||
@ -532,7 +532,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
||||
} else {
|
||||
description = qAccessibleLocalizedActionDescription(qtAction);
|
||||
}
|
||||
return QCFString::toNSString(description);
|
||||
return description.toNSString();
|
||||
}
|
||||
|
||||
- (void)accessibilityPerformAction:(NSString *)action {
|
||||
|
@ -296,7 +296,7 @@ QT_END_NAMESPACE
|
||||
Q_UNUSED(sender);
|
||||
|
||||
for (NSString *fileName in filenames) {
|
||||
QString qtFileName = QCFString::toQString(fileName);
|
||||
QString qtFileName = QString::fromNSString(fileName);
|
||||
if (inLaunch) {
|
||||
// We need to be careful because Cocoa will be nice enough to take
|
||||
// command line arguments and send them to us as events. Given the history
|
||||
@ -424,7 +424,7 @@ QT_END_NAMESPACE
|
||||
{
|
||||
Q_UNUSED(replyEvent);
|
||||
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
|
||||
QWindowSystemInterface::handleFileOpenEvent(QUrl(QCFString::toQString(urlString)));
|
||||
QWindowSystemInterface::handleFileOpenEvent(QUrl(QString::fromNSString(urlString)));
|
||||
}
|
||||
|
||||
- (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
|
||||
|
@ -145,14 +145,14 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
|
||||
|
||||
QFileInfo sel(selectFile);
|
||||
if (sel.isDir() && !sel.isBundle()){
|
||||
mCurrentDir = [QCFString::toNSString(sel.absoluteFilePath()) retain];
|
||||
mCurrentDir = [sel.absoluteFilePath().toNSString() retain];
|
||||
mCurrentSelection = new QString;
|
||||
} else {
|
||||
mCurrentDir = [QCFString::toNSString(sel.absolutePath()) retain];
|
||||
mCurrentDir = [sel.absolutePath().toNSString() retain];
|
||||
mCurrentSelection = new QString(sel.absoluteFilePath());
|
||||
}
|
||||
|
||||
[mSavePanel setTitle:QCFString::toNSString(options->windowTitle())];
|
||||
[mSavePanel setTitle:options->windowTitle().toNSString()];
|
||||
[self createPopUpButton:selectedVisualNameFilter hideDetails:options->testOption(QFileDialogOptions::HideNameFilterDetails)];
|
||||
[self createTextField];
|
||||
[self createAccessory];
|
||||
@ -203,12 +203,12 @@ static QString strippedText(QString s)
|
||||
|
||||
- (NSString *)strip:(const QString &)label
|
||||
{
|
||||
return QCFString::toNSString(strippedText(label));
|
||||
return strippedText(label).toNSString();
|
||||
}
|
||||
|
||||
- (void)closePanel
|
||||
{
|
||||
*mCurrentSelection = QCFString::toQString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
|
||||
*mCurrentSelection = QString::fromNSString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
|
||||
if ([mSavePanel respondsToSelector:@selector(close)])
|
||||
[mSavePanel close];
|
||||
if ([mSavePanel isSheet])
|
||||
@ -219,14 +219,14 @@ static QString strippedText(QString s)
|
||||
{
|
||||
if (mOpenPanel){
|
||||
QFileInfo info(*mCurrentSelection);
|
||||
NSString *filepath = QCFString::toNSString(info.filePath());
|
||||
NSString *filepath = info.filePath().toNSString();
|
||||
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||
|| [self panel:nil shouldShowFilename:filepath];
|
||||
|
||||
[self updateProperties];
|
||||
QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder();
|
||||
[mOpenPanel setAllowedFileTypes:nil];
|
||||
[mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""];
|
||||
[mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""];
|
||||
|
||||
[mOpenPanel beginWithCompletionHandler:^(NSInteger result){
|
||||
mReturnCode = result;
|
||||
@ -239,12 +239,12 @@ static QString strippedText(QString s)
|
||||
- (BOOL)runApplicationModalPanel
|
||||
{
|
||||
QFileInfo info(*mCurrentSelection);
|
||||
NSString *filepath = QCFString::toNSString(info.filePath());
|
||||
NSString *filepath = info.filePath().toNSString();
|
||||
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||
|| [self panel:nil shouldShowFilename:filepath];
|
||||
|
||||
[mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]];
|
||||
[mSavePanel setNameFieldStringValue:selectable ? QCFString::toNSString(info.fileName()) : @""];
|
||||
[mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""];
|
||||
|
||||
// Call processEvents in case the event dispatcher has been interrupted, and needs to do
|
||||
// cleanup of modal sessions. Do this before showing the native dialog, otherwise it will
|
||||
@ -266,7 +266,7 @@ static QString strippedText(QString s)
|
||||
- (void)showWindowModalSheet:(QWindow *)parent
|
||||
{
|
||||
QFileInfo info(*mCurrentSelection);
|
||||
NSString *filepath = QCFString::toNSString(info.filePath());
|
||||
NSString *filepath = info.filePath().toNSString();
|
||||
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||
|| [self panel:nil shouldShowFilename:filepath];
|
||||
|
||||
@ -274,7 +274,7 @@ static QString strippedText(QString s)
|
||||
QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder();
|
||||
[mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]];
|
||||
|
||||
[mSavePanel setNameFieldStringValue:selectable ? QCFString::toNSString(info.fileName()) : @""];
|
||||
[mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""];
|
||||
NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent));
|
||||
|
||||
[mSavePanel beginSheetModalForWindow:nsparent completionHandler:^(NSInteger result){
|
||||
@ -321,7 +321,7 @@ static QString strippedText(QString s)
|
||||
}
|
||||
}
|
||||
|
||||
QString qtFileName = QFileInfo(QCFString::toQString(filename)).fileName();
|
||||
QString qtFileName = QFileInfo(QString::fromNSString(filename)).fileName();
|
||||
// No filter means accept everything
|
||||
bool nameMatches = mSelectedNameFilter->isEmpty();
|
||||
// Check if the current file name filter accepts the file:
|
||||
@ -373,7 +373,7 @@ static QString strippedText(QString s)
|
||||
if (filters.size() > 0){
|
||||
for (int i=0; i<filters.size(); ++i) {
|
||||
QString filter = hideDetails ? [self removeExtensions:filters.at(i)] : filters.at(i);
|
||||
[mPopUpButton addItemWithTitle:QCFString::toNSString(filter)];
|
||||
[mPopUpButton addItemWithTitle:filter.toNSString()];
|
||||
}
|
||||
[mPopUpButton selectItemAtIndex:0];
|
||||
[mSavePanel setAccessoryView:mAccessoryView];
|
||||
@ -407,13 +407,13 @@ static QString strippedText(QString s)
|
||||
QList<QUrl> result;
|
||||
NSArray* array = [mOpenPanel URLs];
|
||||
for (NSUInteger i=0; i<[array count]; ++i) {
|
||||
QString path = QCFString::toQString([[array objectAtIndex:i] path]).normalized(QString::NormalizationForm_C);
|
||||
QString path = QString::fromNSString([[array objectAtIndex:i] path]).normalized(QString::NormalizationForm_C);
|
||||
result << QUrl::fromLocalFile(path);
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
QList<QUrl> result;
|
||||
QString filename = QCFString::toQString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
|
||||
QString filename = QString::fromNSString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
|
||||
result << QUrl::fromLocalFile(filename.remove(QLatin1String("___qt_very_unlikely_prefix_")));
|
||||
return result;
|
||||
}
|
||||
@ -436,8 +436,8 @@ static QString strippedText(QString s)
|
||||
[mSavePanel setCanCreateDirectories:!(mOptions->testOption(QFileDialogOptions::ReadOnly))];
|
||||
[mOpenPanel setAllowsMultipleSelection:(fileMode == QFileDialogOptions::ExistingFiles)];
|
||||
[mOpenPanel setResolvesAliases:!(mOptions->testOption(QFileDialogOptions::DontResolveSymlinks))];
|
||||
[mOpenPanel setTitle:QCFString::toNSString(mOptions->windowTitle())];
|
||||
[mSavePanel setTitle:QCFString::toNSString(mOptions->windowTitle())];
|
||||
[mOpenPanel setTitle:mOptions->windowTitle().toNSString()];
|
||||
[mSavePanel setTitle:mOptions->windowTitle().toNSString()];
|
||||
[mPopUpButton setHidden:chooseDirsOnly]; // TODO hide the whole sunken pane instead?
|
||||
|
||||
QStringList ext = [self acceptableExtensionsForSave];
|
||||
@ -456,7 +456,7 @@ static QString strippedText(QString s)
|
||||
{
|
||||
Q_UNUSED(sender);
|
||||
if (mHelper && [mSavePanel isVisible]) {
|
||||
QString selection = QCFString::toQString([[mSavePanel URL] path]);
|
||||
QString selection = QString::fromNSString([[mSavePanel URL] path]);
|
||||
if (selection != mCurrentSelection) {
|
||||
*mCurrentSelection = selection;
|
||||
mHelper->QNSOpenSavePanelDelegate_selectionChanged(selection);
|
||||
@ -474,7 +474,7 @@ static QString strippedText(QString s)
|
||||
|
||||
[mCurrentDir release];
|
||||
mCurrentDir = [path retain];
|
||||
mHelper->QNSOpenSavePanelDelegate_directoryEntered(QCFString::toQString(mCurrentDir));
|
||||
mHelper->QNSOpenSavePanelDelegate_directoryEntered(QString::fromNSString(mCurrentDir));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -537,7 +537,7 @@ static QString strippedText(QString s)
|
||||
(filterToUse == -1 && currentFilter.startsWith(selectedFilter)))
|
||||
filterToUse = i;
|
||||
QString filter = hideDetails ? [self removeExtensions:currentFilter] : currentFilter;
|
||||
[mPopUpButton addItemWithTitle:QCFString::toNSString(filter)];
|
||||
[mPopUpButton addItemWithTitle:filter.toNSString()];
|
||||
}
|
||||
if (filterToUse != -1)
|
||||
[mPopUpButton selectItemAtIndex:filterToUse];
|
||||
@ -609,7 +609,7 @@ void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_filterSelected(int menuInd
|
||||
void QCocoaFileDialogHelper::setDirectory(const QUrl &directory)
|
||||
{
|
||||
if (mDelegate)
|
||||
[mDelegate->mSavePanel setDirectoryURL:[NSURL fileURLWithPath:QCFString::toNSString(directory.toLocalFile())]];
|
||||
[mDelegate->mSavePanel setDirectoryURL:[NSURL fileURLWithPath:directory.toLocalFile().toNSString()]];
|
||||
else
|
||||
mDir = directory;
|
||||
}
|
||||
@ -617,7 +617,7 @@ void QCocoaFileDialogHelper::setDirectory(const QUrl &directory)
|
||||
QUrl QCocoaFileDialogHelper::directory() const
|
||||
{
|
||||
if (mDelegate) {
|
||||
QString path = QCFString::toQString([[mDelegate->mSavePanel directoryURL] path]).normalized(QString::NormalizationForm_C);
|
||||
QString path = QString::fromNSString([[mDelegate->mSavePanel directoryURL] path]).normalized(QString::NormalizationForm_C);
|
||||
return QUrl::fromLocalFile(path);
|
||||
}
|
||||
return mDir;
|
||||
@ -646,7 +646,7 @@ void QCocoaFileDialogHelper::setFilter()
|
||||
if (!mDelegate)
|
||||
return;
|
||||
const SharedPointerFileDialogOptions &opts = options();
|
||||
[mDelegate->mSavePanel setTitle:QCFString::toNSString(opts->windowTitle())];
|
||||
[mDelegate->mSavePanel setTitle:opts->windowTitle().toNSString()];
|
||||
if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
|
||||
[mDelegate->mSavePanel setPrompt:[mDelegate strip:opts->labelText(QFileDialogOptions::Accept)]];
|
||||
if (opts->isLabelExplicitlySet(QFileDialogOptions::FileName))
|
||||
|
@ -162,7 +162,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
|
||||
{
|
||||
mHelper = helper;
|
||||
|
||||
[mFontPanel setTitle:QCFString::toNSString(helper->options()->windowTitle())];
|
||||
[mFontPanel setTitle:helper->options()->windowTitle().toNSString()];
|
||||
|
||||
if (mHelper->options()->testOption(QFontDialogOptions::NoButtons)) {
|
||||
[self restoreOriginalContentView];
|
||||
@ -442,7 +442,7 @@ public:
|
||||
}
|
||||
|
||||
QFontInfo fontInfo(font);
|
||||
nsFont = [mgr fontWithFamily:QCFString::toNSString(fontInfo.family())
|
||||
nsFont = [mgr fontWithFamily:fontInfo.family().toNSString()
|
||||
traits:mask
|
||||
weight:weight
|
||||
size:fontInfo.pointSize()];
|
||||
|
@ -70,7 +70,7 @@ QStringList qt_mac_NSArrayToQStringList(void *nsarray)
|
||||
QStringList result;
|
||||
NSArray *array = static_cast<NSArray *>(nsarray);
|
||||
for (NSUInteger i=0; i<[array count]; ++i)
|
||||
result << QCFString::toQString([array objectAtIndex:i]);
|
||||
result << QString::fromNSString([array objectAtIndex:i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ void qt_mac_transformProccessToForegroundApplication()
|
||||
// Officially it's supposed to be a string, a boolean makes sense, so we'll check.
|
||||
// A number less so, but OK.
|
||||
if (valueType == CFStringGetTypeID())
|
||||
forceTransform = !(QCFString::toQString(static_cast<CFStringRef>(value)).toInt());
|
||||
forceTransform = !(QString::fromCFString(static_cast<CFStringRef>(value)).toInt());
|
||||
else if (valueType == CFBooleanGetTypeID())
|
||||
forceTransform = !CFBooleanGetValue(static_cast<CFBooleanRef>(value));
|
||||
else if (valueType == CFNumberGetTypeID()) {
|
||||
@ -179,7 +179,7 @@ void qt_mac_transformProccessToForegroundApplication()
|
||||
if (valueType == CFBooleanGetTypeID())
|
||||
forceTransform = !CFBooleanGetValue(static_cast<CFBooleanRef>(value));
|
||||
else if (valueType == CFStringGetTypeID())
|
||||
forceTransform = !(QCFString::toQString(static_cast<CFStringRef>(value)).toInt());
|
||||
forceTransform = !(QString::fromCFString(static_cast<CFStringRef>(value)).toInt());
|
||||
else if (valueType == CFNumberGetTypeID()) {
|
||||
int valueAsInt;
|
||||
CFNumberGetValue(static_cast<CFNumberRef>(value), kCFNumberIntType, &valueAsInt);
|
||||
@ -198,7 +198,7 @@ QString qt_mac_applicationName()
|
||||
QString appName;
|
||||
CFTypeRef string = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), CFSTR("CFBundleName"));
|
||||
if (string)
|
||||
appName = QCFString::toQString(static_cast<CFStringRef>(string));
|
||||
appName = QString::fromCFString(static_cast<CFStringRef>(string));
|
||||
|
||||
if (appName.isEmpty()) {
|
||||
QString arg0 = QGuiApplicationPrivate::instance()->appName();
|
||||
|
@ -131,7 +131,7 @@ void QCocoaInputContext::updateLocale()
|
||||
CFArrayRef languages = (CFArrayRef) TISGetInputSourceProperty(source, kTISPropertyInputSourceLanguages);
|
||||
if (CFArrayGetCount(languages) > 0) {
|
||||
CFStringRef langRef = (CFStringRef)CFArrayGetValueAtIndex(languages, 0);
|
||||
QString name = QCFString::toQString(langRef);
|
||||
QString name = QString::fromCFString(langRef);
|
||||
QLocale locale(name);
|
||||
if (m_locale != locale) {
|
||||
m_locale = locale;
|
||||
|
@ -388,7 +388,7 @@ bool QCocoaKeyMapper::updateKeyboard()
|
||||
iso639Code = static_cast<CFStringRef>(CFArrayGetValueAtIndex(array, 0)); // Actually a RFC3066bis, but it's close enough
|
||||
|
||||
if (iso639Code) {
|
||||
keyboardInputLocale = QLocale(QCFString::toQString(iso639Code));
|
||||
keyboardInputLocale = QLocale(QString::fromCFString(iso639Code));
|
||||
keyboardInputDirection = keyboardInputLocale.textDirection();
|
||||
} else {
|
||||
keyboardInputLocale = QLocale::c();
|
||||
|
@ -285,7 +285,7 @@ void QCocoaMenu::setText(const QString &text)
|
||||
{
|
||||
QMacAutoReleasePool pool;
|
||||
QString stripped = qt_mac_removeAmpersandEscapes(text);
|
||||
[m_nativeMenu setTitle:QCFString::toNSString(stripped)];
|
||||
[m_nativeMenu setTitle:stripped.toNSString()];
|
||||
}
|
||||
|
||||
void QCocoaMenu::setMinimumWidth(int width)
|
||||
@ -296,7 +296,7 @@ void QCocoaMenu::setMinimumWidth(int width)
|
||||
void QCocoaMenu::setFont(const QFont &font)
|
||||
{
|
||||
if (font.resolve()) {
|
||||
NSFont *customMenuFont = [NSFont fontWithName:QCFString::toNSString(font.family())
|
||||
NSFont *customMenuFont = [NSFont fontWithName:font.family().toNSString()
|
||||
size:font.pointSize()];
|
||||
m_nativeMenu.font = customMenuFont;
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ NSMenuItem *QCocoaMenuItem::sync()
|
||||
}
|
||||
|
||||
if (!m_native) {
|
||||
m_native = [[NSMenuItem alloc] initWithTitle:QCFString::toNSString(m_text)
|
||||
m_native = [[NSMenuItem alloc] initWithTitle:m_text.toNSString()
|
||||
action:nil
|
||||
keyEquivalent:@""];
|
||||
[m_native setTag:reinterpret_cast<NSInteger>(this)];
|
||||
@ -331,20 +331,20 @@ NSMenuItem *QCocoaMenuItem::sync()
|
||||
bool useAttributedTitle = false;
|
||||
// Cocoa Font and title
|
||||
if (m_font.resolve()) {
|
||||
NSFont *customMenuFont = [NSFont fontWithName:QCFString::toNSString(m_font.family())
|
||||
NSFont *customMenuFont = [NSFont fontWithName:m_font.family().toNSString()
|
||||
size:m_font.pointSize()];
|
||||
if (customMenuFont) {
|
||||
NSArray *keys = [NSArray arrayWithObjects:NSFontAttributeName, nil];
|
||||
NSArray *objects = [NSArray arrayWithObjects:customMenuFont, nil];
|
||||
NSDictionary *attributes = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
|
||||
NSAttributedString *str = [[[NSAttributedString alloc] initWithString:QCFString::toNSString(finalString)
|
||||
NSAttributedString *str = [[[NSAttributedString alloc] initWithString:finalString.toNSString()
|
||||
attributes:attributes] autorelease];
|
||||
[m_native setAttributedTitle: str];
|
||||
useAttributedTitle = true;
|
||||
}
|
||||
}
|
||||
if (!useAttributedTitle) {
|
||||
[m_native setTitle: QCFString::toNSString(finalString)];
|
||||
[m_native setTitle:finalString.toNSString()];
|
||||
}
|
||||
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
|
@ -314,13 +314,13 @@ QT_FORWARD_DECLARE_CLASS(QString)
|
||||
{
|
||||
|
||||
#ifndef QT_NO_TRANSLATION
|
||||
[servicesItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(0))];
|
||||
[hideItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(1).arg(qt_mac_applicationName()))];
|
||||
[hideAllOthersItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(2))];
|
||||
[showAllItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(3))];
|
||||
[preferencesItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(4))];
|
||||
[quitItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(5).arg(qt_mac_applicationName()))];
|
||||
[aboutItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName()))];
|
||||
[servicesItem setTitle:qt_mac_applicationmenu_string(0).toNSString()];
|
||||
[hideItem setTitle:qt_mac_applicationmenu_string(1).arg(qt_mac_applicationName()).toNSString()];
|
||||
[hideAllOthersItem setTitle:qt_mac_applicationmenu_string(2).toNSString()];
|
||||
[showAllItem setTitle:qt_mac_applicationmenu_string(3).toNSString()];
|
||||
[preferencesItem setTitle:qt_mac_applicationmenu_string(4).toNSString()];
|
||||
[quitItem setTitle:qt_mac_applicationmenu_string(5).arg(qt_mac_applicationName()).toNSString()];
|
||||
[aboutItem setTitle:qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName()).toNSString()];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -71,13 +71,13 @@ QCocoaPrintDevice::QCocoaPrintDevice(const QString &id)
|
||||
m_ppd(0)
|
||||
{
|
||||
if (!id.isEmpty()) {
|
||||
m_printer = PMPrinterCreateFromPrinterID(QCFString::toCFStringRef(id));
|
||||
m_printer = PMPrinterCreateFromPrinterID(id.toCFString());
|
||||
if (m_printer) {
|
||||
m_name = QCFString::toQString(PMPrinterGetName(m_printer));
|
||||
m_location = QCFString::toQString(PMPrinterGetLocation(m_printer));
|
||||
m_name = QString::fromCFString(PMPrinterGetName(m_printer));
|
||||
m_location = QString::fromCFString(PMPrinterGetLocation(m_printer));
|
||||
CFStringRef cfMakeAndModel;
|
||||
if (PMPrinterGetMakeAndModelName(m_printer, &cfMakeAndModel) == noErr)
|
||||
m_makeAndModel = QCFString::toQString(cfMakeAndModel);
|
||||
m_makeAndModel = QString::fromCFString(cfMakeAndModel);
|
||||
Boolean isRemote;
|
||||
if (PMPrinterIsRemote(m_printer, &isRemote) == noErr)
|
||||
m_isRemote = isRemote;
|
||||
@ -420,7 +420,7 @@ void QCocoaPrintDevice::loadMimeTypes() const
|
||||
int count = CFArrayGetCount(mimeTypes);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
CFStringRef mimeName = static_cast<CFStringRef>(const_cast<void *>(CFArrayGetValueAtIndex(mimeTypes, i)));
|
||||
QMimeType mimeType = db.mimeTypeForName(QCFString::toQString(mimeName));
|
||||
QMimeType mimeType = db.mimeTypeForName(QString::fromCFString(mimeName));
|
||||
if (mimeType.isValid())
|
||||
m_mimeTypes.append(mimeType);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ QStringList QCocoaPrinterSupport::availablePrintDeviceIds() const
|
||||
CFIndex count = CFArrayGetCount(printerList);
|
||||
for (CFIndex i = 0; i < count; ++i) {
|
||||
PMPrinter printer = static_cast<PMPrinter>(const_cast<void *>(CFArrayGetValueAtIndex(printerList, i)));
|
||||
list.append(QCFString::toQString(PMPrinterGetID(printer)));
|
||||
list.append(QString::fromCFString(PMPrinterGetID(printer)));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@ -96,7 +96,7 @@ QString QCocoaPrinterSupport::defaultPrintDeviceId() const
|
||||
for (CFIndex i = 0; i < count; ++i) {
|
||||
PMPrinter printer = static_cast<PMPrinter>(const_cast<void *>(CFArrayGetValueAtIndex(printerList, i)));
|
||||
if (PMPrinterIsDefault(printer))
|
||||
return QCFString::toQString(PMPrinterGetID(printer));
|
||||
return QString::fromCFString(PMPrinterGetID(printer));
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
|
@ -270,7 +270,7 @@ void QCocoaSystemTrayIcon::updateToolTip(const QString &toolTip)
|
||||
{
|
||||
if (!m_sys)
|
||||
return;
|
||||
[[[m_sys->item item] view] setToolTip:QCFString::toNSString(toolTip)];
|
||||
[[[m_sys->item item] view] setToolTip:toolTip.toNSString()];
|
||||
}
|
||||
|
||||
bool QCocoaSystemTrayIcon::isSystemTrayAvailable() const
|
||||
|
@ -303,7 +303,7 @@ protected:
|
||||
{
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:QCFString::toNSString(fileInfo().canonicalFilePath())];
|
||||
NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:fileInfo().canonicalFilePath().toNSString()];
|
||||
if (!iconImage)
|
||||
return QPixmap();
|
||||
return qt_mac_toQPixmap(iconImage, size);
|
||||
|
@ -937,7 +937,7 @@ void QCocoaWindow::setWindowTitle(const QString &title)
|
||||
if (!m_nsWindow)
|
||||
return;
|
||||
|
||||
CFStringRef windowTitle = QCFString::toCFStringRef(title);
|
||||
CFStringRef windowTitle = title.toCFString();
|
||||
[m_nsWindow setTitle: const_cast<NSString *>(reinterpret_cast<const NSString *>(windowTitle))];
|
||||
CFRelease(windowTitle);
|
||||
}
|
||||
@ -949,7 +949,7 @@ void QCocoaWindow::setWindowFilePath(const QString &filePath)
|
||||
return;
|
||||
|
||||
QFileInfo fi(filePath);
|
||||
[m_nsWindow setRepresentedFilename: fi.exists() ? QCFString::toNSString(filePath) : @""];
|
||||
[m_nsWindow setRepresentedFilename:fi.exists() ? filePath.toNSString() : @""];
|
||||
}
|
||||
|
||||
void QCocoaWindow::setWindowIcon(const QIcon &icon)
|
||||
@ -960,7 +960,7 @@ void QCocoaWindow::setWindowIcon(const QIcon &icon)
|
||||
if (iconButton == nil) {
|
||||
if (icon.isNull())
|
||||
return;
|
||||
NSString *title = QCFString::toNSString(window()->title());
|
||||
NSString *title = window()->title().toNSString();
|
||||
[m_nsWindow setRepresentedURL:[NSURL fileURLWithPath:title]];
|
||||
iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ QMacPasteboard::QMacPasteboard(CFStringRef name, uchar mt)
|
||||
if (err == noErr) {
|
||||
PasteboardSetPromiseKeeper(paste, promiseKeeper, this);
|
||||
} else {
|
||||
qDebug("PasteBoard: Error creating pasteboard: %s [%d]", QCFString::toQString(name).toLatin1().constData(), (int)err);
|
||||
qDebug("PasteBoard: Error creating pasteboard: %s [%d]", QString::fromCFString(name).toLatin1().constData(), (int)err);
|
||||
}
|
||||
resolvingBeforeDestruction = false;
|
||||
}
|
||||
@ -139,7 +139,7 @@ OSStatus QMacPasteboard::promiseKeeper(PasteboardRef paste, PasteboardItemID id,
|
||||
const long promise_id = (long)id;
|
||||
|
||||
// Find the kept promise
|
||||
const QString flavorAsQString = QCFString::toQString(flavor);
|
||||
const QString flavorAsQString = QString::fromCFString(flavor);
|
||||
QMacPasteboard::Promise promise;
|
||||
for (int i = 0; i < qpaste->promises.size(); i++){
|
||||
QMacPasteboard::Promise tmp = qpaste->promises[i];
|
||||
@ -380,7 +380,7 @@ QMacPasteboard::formats() const
|
||||
|
||||
const int type_count = CFArrayGetCount(types);
|
||||
for (int i = 0; i < type_count; ++i) {
|
||||
const QString flavor = QCFString::toQString((CFStringRef)CFArrayGetValueAtIndex(types, i));
|
||||
const QString flavor = QString::fromCFString((CFStringRef)CFArrayGetValueAtIndex(types, i));
|
||||
#ifdef DEBUG_PASTEBOARD
|
||||
qDebug(" -%s", qPrintable(QString(flavor)));
|
||||
#endif
|
||||
@ -423,7 +423,7 @@ QMacPasteboard::hasFormat(const QString &format) const
|
||||
|
||||
const int type_count = CFArrayGetCount(types);
|
||||
for (int i = 0; i < type_count; ++i) {
|
||||
const QString flavor = QCFString::toQString((CFStringRef)CFArrayGetValueAtIndex(types, i));
|
||||
const QString flavor = QString::fromCFString((CFStringRef)CFArrayGetValueAtIndex(types, i));
|
||||
#ifdef DEBUG_PASTEBOARD
|
||||
qDebug(" -%s [0x%x]", qPrintable(QString(flavor)), mime_type);
|
||||
#endif
|
||||
@ -487,13 +487,13 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
|
||||
const int type_count = CFArrayGetCount(types);
|
||||
for (int i = 0; i < type_count; ++i) {
|
||||
CFStringRef flavor = static_cast<CFStringRef>(CFArrayGetValueAtIndex(types, i));
|
||||
if (c_flavor == QCFString::toQString(flavor)) {
|
||||
if (c_flavor == QString::fromCFString(flavor)) {
|
||||
QCFType<CFDataRef> macBuffer;
|
||||
if (PasteboardCopyItemFlavorData(paste, id, flavor, &macBuffer) == noErr) {
|
||||
QByteArray buffer((const char *)CFDataGetBytePtr(macBuffer), CFDataGetLength(macBuffer));
|
||||
if (!buffer.isEmpty()) {
|
||||
#ifdef DEBUG_PASTEBOARD
|
||||
qDebug(" - %s [%s] (%s)", qPrintable(format), qPrintable(QCFString::toQString(flavor)), qPrintable(c->convertorName()));
|
||||
qDebug(" - %s [%s] (%s)", qPrintable(format), qPrintable(QString::fromNSString(flavor)), qPrintable(c->convertorName()));
|
||||
#endif
|
||||
buffer.detach(); //detach since we release the macBuffer
|
||||
retList.append(buffer);
|
||||
@ -502,7 +502,7 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG_PASTEBOARD
|
||||
qDebug(" - NoMatch %s [%s] (%s)", qPrintable(c_flavor), qPrintable(QCFString::toQString(flavor)), qPrintable(c->convertorName()));
|
||||
qDebug(" - NoMatch %s [%s] (%s)", qPrintable(c_flavor), qPrintable(QString::fromNSString(flavor)), qPrintable(c->convertorName()));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -565,7 +565,7 @@ QString qt_mac_get_pasteboardString(PasteboardRef paste)
|
||||
if (pb) {
|
||||
NSString *text = [pb stringForType:NSStringPboardType];
|
||||
if (text)
|
||||
return QCFString::toQString(text);
|
||||
return QString::fromNSString(text);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ static bool _q_dontOverrideCtrlLMB = false;
|
||||
|
||||
- (void)windowNotification : (NSNotification *) windowNotification
|
||||
{
|
||||
//qDebug() << "windowNotification" << QCFString::toQString([windowNotification name]);
|
||||
//qDebug() << "windowNotification" << QString::fromNSString([windowNotification name]);
|
||||
|
||||
NSString *notificationName = [windowNotification name];
|
||||
if (notificationName == NSWindowDidBecomeKeyNotification) {
|
||||
@ -1582,7 +1582,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
||||
// ignore text for the U+F700-U+F8FF range. This is used by Cocoa when
|
||||
// delivering function keys (e.g. arrow keys, backspace, F1-F35, etc.)
|
||||
if (!(modifiers & (Qt::ControlModifier | Qt::MetaModifier)) && (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff))
|
||||
text = QCFString::toQString(characters);
|
||||
text = QString::fromNSString(characters);
|
||||
|
||||
QWindow *window = [self topLevelWindow];
|
||||
|
||||
@ -1745,9 +1745,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
||||
QString commitString;
|
||||
if ([aString length]) {
|
||||
if ([aString isKindOfClass:[NSAttributedString class]]) {
|
||||
commitString = QCFString::toQString(reinterpret_cast<CFStringRef>([aString string]));
|
||||
commitString = QString::fromCFString(reinterpret_cast<CFStringRef>([aString string]));
|
||||
} else {
|
||||
commitString = QCFString::toQString(reinterpret_cast<CFStringRef>(aString));
|
||||
commitString = QString::fromCFString(reinterpret_cast<CFStringRef>(aString));
|
||||
};
|
||||
}
|
||||
QObject *fo = QGuiApplication::focusObject();
|
||||
@ -1777,7 +1777,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
||||
|
||||
if ([aString isKindOfClass:[NSAttributedString class]]) {
|
||||
// Preedit string has attribution
|
||||
preeditString = QCFString::toQString(reinterpret_cast<CFStringRef>([aString string]));
|
||||
preeditString = QString::fromCFString(reinterpret_cast<CFStringRef>([aString string]));
|
||||
int composingLength = preeditString.length();
|
||||
int index = 0;
|
||||
// Create attributes for individual sections of preedit text
|
||||
@ -1806,7 +1806,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
||||
}
|
||||
} else {
|
||||
// No attributes specified, take only the preedit text.
|
||||
preeditString = QCFString::toQString(reinterpret_cast<CFStringRef>(aString));
|
||||
preeditString = QString::fromCFString(reinterpret_cast<CFStringRef>(aString));
|
||||
}
|
||||
|
||||
if (attrs.isEmpty()) {
|
||||
@ -1989,7 +1989,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
||||
NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil];
|
||||
// Add custom types supported by the application.
|
||||
for (int i = 0; i < customTypes.size(); i++) {
|
||||
[supportedTypes addObject:QCFString::toNSString(customTypes[i])];
|
||||
[supportedTypes addObject:customTypes[i].toNSString()];
|
||||
}
|
||||
[self registerForDraggedTypes:supportedTypes];
|
||||
}
|
||||
|
@ -673,7 +673,7 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
|
||||
case PPK_DocumentName: {
|
||||
CFStringRef name;
|
||||
PMPrintSettingsGetJobName(d->settings(), &name);
|
||||
ret = QCFString::toQString(name);
|
||||
ret = QString::fromCFString(name);
|
||||
break;
|
||||
}
|
||||
case PPK_Duplex: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user