summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm40
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.mm16
-rw-r--r--src/plugins/platforms/cocoa/qmenu_mac.mm16
7 files changed, 41 insertions, 47 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index c5504b68bb..06d75036bf 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -148,7 +148,7 @@ static QAccessibleInterface *acast(void *ptr)
QSize qtSize = acast(accessibleInterface)->rect().size();
return [NSValue valueWithSize: NSMakeSize(qtSize.width(), qtSize.height())];
} else if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute]) {
- return qt_mac_QStringToNSString(acast(accessibleInterface)->text(QAccessible::Name));
+ return QCFString::toNSString(acast(accessibleInterface)->text(QAccessible::Name));
}
return nil;
@@ -195,7 +195,7 @@ static QAccessibleInterface *acast(void *ptr)
// Return a description from the action interface if this action is not known to the OS.
if (qtAction.isEmpty()) {
QString description = actionInterface->localizedActionDescription(qtAction);
- return qt_mac_QStringToNSString(description);
+ return QCFString::toNSString(description);
}
return NSAccessibilityActionDescription(action);
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 59281ffb80..fc600ebddd 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -219,7 +219,7 @@ static void cleanupCocoaApplicationDelegate()
Q_UNUSED(sender);
/*
for (NSString *fileName in filenames) {
- QString qtFileName = qt_mac_NSStringToQString(fileName);
+ QString qtFileName = QCFString::toQString(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
@@ -336,7 +336,7 @@ static void cleanupCocoaApplicationDelegate()
Q_UNUSED(replyEvent);
/*
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
- QUrl url(qt_mac_NSStringToQString(urlString));
+ QUrl url(QCFString::toQString(urlString));
QFileOpenEvent qtEvent(url);
qt_sendSpontaneousEvent(qAppInstance(), &qtEvent);
*/
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index fff68634d8..ecb732c9da 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -151,14 +151,14 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
QFileInfo sel(selectFile);
if (sel.isDir()){
- mCurrentDir = [qt_mac_QStringToNSString(sel.absoluteFilePath()) retain];
+ mCurrentDir = [QCFString::toNSString(sel.absoluteFilePath()) retain];
mCurrentSelection = new QString;
} else {
- mCurrentDir = [qt_mac_QStringToNSString(sel.absolutePath()) retain];
+ mCurrentDir = [QCFString::toNSString(sel.absolutePath()) retain];
mCurrentSelection = new QString(sel.absoluteFilePath());
}
- [mSavePanel setTitle:qt_mac_QStringToNSString(options->windowTitle())];
+ [mSavePanel setTitle:QCFString::toNSString(options->windowTitle())];
[self createPopUpButton:selectedVisualNameFilter hideDetails:options->testOption(QFileDialogOptions::HideNameFilterDetails)];
[self createTextField];
[self createAccessory];
@@ -197,12 +197,12 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
- (NSString *)strip:(const QString &)label
{
QAction a(label, 0);
- return qt_mac_QStringToNSString(a.iconText());
+ return QCFString::toNSString(a.iconText());
}
- (void)closePanel
{
- *mCurrentSelection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)([mSavePanel filename]);
+ *mCurrentSelection = QT_PREPEND_NAMESPACE(QCFString::toQString)([mSavePanel filename]);
[mSavePanel close];
}
@@ -210,8 +210,8 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
{
if (mOpenPanel){
QFileInfo info(*mCurrentSelection);
- NSString *filename = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.fileName());
- NSString *filepath = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.filePath());
+ NSString *filename = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName());
+ NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath());
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
[mOpenPanel
@@ -227,8 +227,8 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
- (BOOL)runApplicationModalPanel
{
QFileInfo info(*mCurrentSelection);
- NSString *filename = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.fileName());
- NSString *filepath = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.filePath());
+ NSString *filename = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName());
+ NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath());
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
mReturnCode = [mSavePanel
@@ -248,8 +248,8 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
{
Q_UNUSED(docWidget);
QFileInfo info(*mCurrentSelection);
- NSString *filename = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.fileName());
- NSString *filepath = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.filePath());
+ NSString *filename = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName());
+ NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath());
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
[mSavePanel
@@ -277,7 +277,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
}
}
- QString qtFileName = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(filename);
+ QString qtFileName = QT_PREPEND_NAMESPACE(QCFString::toQString)(filename);
QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C)));
QString path = info.absolutePath();
if (path != *mLastFilterCheckPath){
@@ -319,7 +319,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
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:QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(filter)];
+ [mPopUpButton addItemWithTitle:QT_PREPEND_NAMESPACE(QCFString::toNSString)(filter)];
}
[mPopUpButton selectItemAtIndex:0];
[mSavePanel setAccessoryView:mAccessoryView];
@@ -352,7 +352,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
return QT_PREPEND_NAMESPACE(qt_mac_NSArrayToQStringList)([mOpenPanel filenames]);
else{
QStringList result;
- QString filename = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)([mSavePanel filename]);
+ QString filename = QT_PREPEND_NAMESPACE(QCFString::toQString)([mSavePanel filename]);
result << filename.remove(QLatin1String("___qt_very_unlikely_prefix_"));
return result;
}
@@ -390,7 +390,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
{
Q_UNUSED(sender);
if (mHelper) {
- QString selection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename]));
+ QString selection = QT_PREPEND_NAMESPACE(QCFString::toQString([mSavePanel filename]));
if (selection != mCurrentSelection) {
*mCurrentSelection = selection;
mHelper->QNSOpenSavePanelDelegate_selectionChanged(selection);
@@ -417,7 +417,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
[mCurrentDir release];
mCurrentDir = [path retain];
- mHelper->QNSOpenSavePanelDelegate_directoryEntered(QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString(mCurrentDir)));
+ mHelper->QNSOpenSavePanelDelegate_directoryEntered(QT_PREPEND_NAMESPACE(QCFString::toQString(mCurrentDir)));
}
/*
@@ -476,7 +476,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
if (filters->size() > 0){
for (int i=0; i<mNameFilterDropDownList->size(); ++i) {
QString filter = hideDetails ? [self removeExtensions:filters->at(i)] : filters->at(i);
- [mPopUpButton addItemWithTitle:QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(filter)];
+ [mPopUpButton addItemWithTitle:QT_PREPEND_NAMESPACE(QCFString::toNSString)(filter)];
if (filters->at(i).startsWith(selectedFilter))
[mPopUpButton selectItemAtIndex:i];
}
@@ -557,13 +557,13 @@ extern void qt_mac_to_pascal_string(QString s, Str255 str, TextEncoding encoding
void QCocoaFileDialogHelper::setDirectory_sys(const QString &directory)
{
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
- [delegate->mSavePanel setDirectory:qt_mac_QStringToNSString(directory)];
+ [delegate->mSavePanel setDirectory:QCFString::toNSString(directory)];
}
QString QCocoaFileDialogHelper::directory_sys() const
{
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
- return qt_mac_NSStringToQString([delegate->mSavePanel directory]);
+ return QCFString::toQString([delegate->mSavePanel directory]);
}
void QCocoaFileDialogHelper::selectFile_sys(const QString &filename)
@@ -587,7 +587,7 @@ void QCocoaFileDialogHelper::setFilter_sys()
{
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
const SharedPointerFileDialogOptions &opts = options();
- [delegate->mSavePanel setTitle:qt_mac_QStringToNSString(opts->windowTitle())];
+ [delegate->mSavePanel setTitle:QCFString::toNSString(opts->windowTitle())];
if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
[delegate->mSavePanel setPrompt:[delegate strip:opts->labelText(QFileDialogOptions::Accept)]];
if (opts->isLabelExplicitlySet(QFileDialogOptions::FileName))
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index 84bd1c1879..7b1247b739 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -68,12 +68,6 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list);
inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist)
{ return reinterpret_cast<NSMutableArray *>(qt_mac_QStringListToNSMutableArrayVoid(qstrlist)); }
-inline QString qt_mac_NSStringToQString(const NSString *nsstr)
-{ return QCFString::toQString(reinterpret_cast<const CFStringRef>(nsstr)); }
-
-inline NSString *qt_mac_QStringToNSString(const QString &qstr)
-{ return [const_cast<NSString *>(reinterpret_cast<const NSString *>(QCFString::toCFStringRef(qstr))) autorelease]; }
-
CGImageRef qt_mac_image_to_cgimage(const QImage &image);
NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge);
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 7f85afe946..f9b62c7a71 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -58,7 +58,7 @@ QStringList qt_mac_NSArrayToQStringList(void *nsarray)
QStringList result;
NSArray *array = static_cast<NSArray *>(nsarray);
for (NSUInteger i=0; i<[array count]; ++i)
- result << qt_mac_NSStringToQString([array objectAtIndex:i]);
+ result << QCFString::toQString([array objectAtIndex:i]);
return result;
}
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index abaf9d89de..3a1f92fcf9 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -92,7 +92,7 @@ void qt_mac_loadMenuNib(QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader)
}
// Load and instantiate nib file from temp
- NSURL *nibUrl = [NSURL fileURLWithPath : const_cast<NSString *>(reinterpret_cast<const NSString *>(QCFString::toCFStringRef(nibDir)))];
+ NSURL *nibUrl = [NSURL fileURLWithPath : QCFString::toNSString(nibDir)];
[nibUrl autorelease];
NSNib *nib = [[NSNib alloc] initWithContentsOfURL : nibUrl];
[nib autorelease];
@@ -282,13 +282,13 @@ void qt_mac_loadMenuNib(QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader)
qDebug() << "qtTranslateApplicationMenu";
#ifndef QT_NO_TRANSLATION
- [servicesItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(0))];
- [hideItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(1).arg(qt_mac_applicationName()))];
- [hideAllOthersItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(2))];
- [showAllItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(3))];
- [preferencesItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(4))];
- [quitItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(5).arg(qt_mac_applicationName()))];
- [aboutItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName()))];
+ [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()))];
#endif
}
diff --git a/src/plugins/platforms/cocoa/qmenu_mac.mm b/src/plugins/platforms/cocoa/qmenu_mac.mm
index cf2bc6ccfb..68a24101e9 100644
--- a/src/plugins/platforms/cocoa/qmenu_mac.mm
+++ b/src/plugins/platforms/cocoa/qmenu_mac.mm
@@ -237,7 +237,7 @@ static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader()
static NSMenuItem *createNSMenuItem(const QString &title)
{
NSMenuItem *item = [[NSMenuItem alloc]
- initWithTitle:qt_mac_QStringToNSString(title)
+ initWithTitle:QCFString::toNSString(title)
action:@selector(qtDispatcherToQAction:) keyEquivalent:@""];
[item setTarget:nil];
return item;
@@ -636,22 +636,22 @@ void QCocoaMenu::syncAction(QCocoaMenuAction *action)
// Cocoa Font and title
if (action->action->font().resolve()) {
const QFont &actionFont = action->action->font();
- NSFont *customMenuFont = [NSFont fontWithName:qt_mac_QStringToNSString(actionFont.family())
+ NSFont *customMenuFont = [NSFont fontWithName:QCFString::toNSString(actionFont.family())
size:actionFont.pointSize()];
NSArray *keys = [NSArray arrayWithObjects:NSFontAttributeName, nil];
NSArray *objects = [NSArray arrayWithObjects:customMenuFont, nil];
NSDictionary *attributes = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
- NSAttributedString *str = [[[NSAttributedString alloc] initWithString:qt_mac_QStringToNSString(finalString)
+ NSAttributedString *str = [[[NSAttributedString alloc] initWithString:QCFString::toNSString(finalString)
attributes:attributes] autorelease];
[item setAttributedTitle: str];
} else {
- [item setTitle: qt_mac_QStringToNSString(finalString)];
+ [item setTitle: QCFString::toNSString(finalString)];
}
if (action->action->menuRole() == QAction::AboutRole || action->action->menuRole() == QAction::QuitRole)
- [item setTitle:qt_mac_QStringToNSString(text)];
+ [item setTitle:QCFString::toNSString(text)];
else
- [item setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(text))];
+ [item setTitle:QCFString::toNSString(qt_mac_removeMnemonics(text))];
// Cocoa Enabled
[item setEnabled: action->action->isEnabled()];
@@ -873,7 +873,7 @@ void QCocoaMenuBar::syncAction(QCocoaMenuAction *action)
if (submenu) {
bool visible = actualMenuItemVisibility(this, action);
[item setSubmenu: submenu];
- [submenu setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(action->action->text()))];
+ [submenu setTitle:QCFString::toNSString(qt_mac_removeMnemonics(action->action->text()))];
syncNSMenuItemVisiblity(item, visible);
if (release_submenu) { //no pointers to it
[submenu release];
@@ -978,7 +978,7 @@ OSMenuRef QCocoaMenuBar::macMenu()
if (GetCurrentProcess(&mine) == noErr && GetFrontProcess(&front) == noErr) {
if (!qt_mac_no_menubar_merge && !apple_menu) {
apple_menu = qt_mac_create_menu(qtMenuBar);
- [apple_menu setTitle:qt_mac_QStringToNSString(QString(QChar(0x14)))];
+ [apple_menu setTitle:QCFString::toNSString(QString(QChar(0x14)))];
NSMenuItem *apple_menuItem = [[NSMenuItem alloc] init];
[apple_menuItem setSubmenu:menu];
[apple_menu addItem:apple_menuItem];