Reduce the usage of QT_PREPEND_NAMESPACE in the Cocoa platform plugin
This is no longer required as QT_USE_NAMESPACE is used most of the time Task-number: QTBUG-23946 Change-Id: Ia6225260531adbf34ec1846805b8fe1d66dbaef8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
parent
d3a8bc803c
commit
c886491ad0
@ -292,9 +292,9 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate);
|
|||||||
return (mResultCode == NSOKButton);
|
return (mResultCode == NSOKButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QT_PREPEND_NAMESPACE(QPlatformDialogHelper::DialogCode))dialogResultCode
|
- (QPlatformDialogHelper::DialogCode)dialogResultCode
|
||||||
{
|
{
|
||||||
return (mResultCode == NSOKButton) ? QT_PREPEND_NAMESPACE(QPlatformDialogHelper::Accepted) : QT_PREPEND_NAMESPACE(QPlatformDialogHelper::Rejected);
|
return (mResultCode == NSOKButton) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)windowShouldClose:(id)window
|
- (BOOL)windowShouldClose:(id)window
|
||||||
|
@ -150,7 +150,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
|
|||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
mOptions = options;
|
mOptions = options;
|
||||||
if (mOptions->acceptMode() == QT_PREPEND_NAMESPACE(QFileDialogOptions::AcceptOpen)){
|
if (mOptions->acceptMode() == QFileDialogOptions::AcceptOpen){
|
||||||
mOpenPanel = [NSOpenPanel openPanel];
|
mOpenPanel = [NSOpenPanel openPanel];
|
||||||
mSavePanel = mOpenPanel;
|
mSavePanel = mOpenPanel;
|
||||||
} else {
|
} else {
|
||||||
@ -236,7 +236,7 @@ static QString strippedText(QString s)
|
|||||||
|
|
||||||
- (void)closePanel
|
- (void)closePanel
|
||||||
{
|
{
|
||||||
*mCurrentSelection = QT_PREPEND_NAMESPACE(QCFString::toQString)([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
|
*mCurrentSelection = QCFString::toQString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
|
||||||
if ([mSavePanel respondsToSelector:@selector(close)])
|
if ([mSavePanel respondsToSelector:@selector(close)])
|
||||||
[mSavePanel close];
|
[mSavePanel close];
|
||||||
if ([mSavePanel isSheet])
|
if ([mSavePanel isSheet])
|
||||||
@ -246,15 +246,15 @@ static QString strippedText(QString s)
|
|||||||
- (void)showModelessPanel
|
- (void)showModelessPanel
|
||||||
{
|
{
|
||||||
if (mOpenPanel){
|
if (mOpenPanel){
|
||||||
QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir));
|
QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QCFString::toQString(mCurrentDir));
|
||||||
NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath());
|
NSString *filepath = QCFString::toNSString(info.filePath());
|
||||||
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||||
|| [self panel:nil shouldShowFilename:filepath];
|
|| [self panel:nil shouldShowFilename:filepath];
|
||||||
|
|
||||||
[self updateProperties];
|
[self updateProperties];
|
||||||
[mOpenPanel setAllowedFileTypes:nil];
|
[mOpenPanel setAllowedFileTypes:nil];
|
||||||
[mOpenPanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())]
|
[mOpenPanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QCFString::toNSString(info.filePath())]
|
||||||
: [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]];
|
: [NSURL fileURLWithPath:QCFString::toNSString(info.path())]];
|
||||||
[mOpenPanel beginWithCompletionHandler:^(NSInteger result){
|
[mOpenPanel beginWithCompletionHandler:^(NSInteger result){
|
||||||
mReturnCode = result;
|
mReturnCode = result;
|
||||||
if (mHelper)
|
if (mHelper)
|
||||||
@ -265,14 +265,14 @@ static QString strippedText(QString s)
|
|||||||
|
|
||||||
- (BOOL)runApplicationModalPanel
|
- (BOOL)runApplicationModalPanel
|
||||||
{
|
{
|
||||||
QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir));
|
QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QCFString::toQString(mCurrentDir));
|
||||||
NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath());
|
NSString *filepath = QCFString::toNSString(info.filePath());
|
||||||
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||||
|| [self panel:nil shouldShowFilename:filepath];
|
|| [self panel:nil shouldShowFilename:filepath];
|
||||||
|
|
||||||
[mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())]
|
[mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QCFString::toNSString(info.filePath())]
|
||||||
: [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]];
|
: [NSURL fileURLWithPath:QCFString::toNSString(info.path())]];
|
||||||
[mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""];
|
[mSavePanel setNameFieldStringValue:selectable ? QCFString::toNSString(info.fileName()) : @""];
|
||||||
|
|
||||||
// Call processEvents in case the event dispatcher has been interrupted, and needs to do
|
// 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
|
// cleanup of modal sessions. Do this before showing the native dialog, otherwise it will
|
||||||
@ -284,22 +284,22 @@ static QString strippedText(QString s)
|
|||||||
return (mReturnCode == NSOKButton);
|
return (mReturnCode == NSOKButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QT_PREPEND_NAMESPACE(QPlatformDialogHelper::DialogCode))dialogResultCode
|
- (QPlatformDialogHelper::DialogCode)dialogResultCode
|
||||||
{
|
{
|
||||||
return (mReturnCode == NSOKButton) ? QT_PREPEND_NAMESPACE(QPlatformDialogHelper::Accepted) : QT_PREPEND_NAMESPACE(QPlatformDialogHelper::Rejected);
|
return (mReturnCode == NSOKButton) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showWindowModalSheet:(QWindow *)parent
|
- (void)showWindowModalSheet:(QWindow *)parent
|
||||||
{
|
{
|
||||||
QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir));
|
QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QCFString::toQString(mCurrentDir));
|
||||||
NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath());
|
NSString *filepath = QCFString::toNSString(info.filePath());
|
||||||
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||||
|| [self panel:nil shouldShowFilename:filepath];
|
|| [self panel:nil shouldShowFilename:filepath];
|
||||||
|
|
||||||
[self updateProperties];
|
[self updateProperties];
|
||||||
[mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())]
|
[mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QCFString::toNSString(info.filePath())]
|
||||||
: [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]];
|
: [NSURL fileURLWithPath:QCFString::toNSString(info.path())]];
|
||||||
[mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""];
|
[mSavePanel setNameFieldStringValue:selectable ? QCFString::toNSString(info.fileName()) : @""];
|
||||||
NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent));
|
NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent));
|
||||||
|
|
||||||
[mSavePanel beginSheetModalForWindow:nsparent completionHandler:^(NSInteger result){
|
[mSavePanel beginSheetModalForWindow:nsparent completionHandler:^(NSInteger result){
|
||||||
@ -325,8 +325,8 @@ static QString strippedText(QString s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString qtFileName = QT_PREPEND_NAMESPACE(QCFString::toQString)(filename);
|
QString qtFileName = QCFString::toQString(filename);
|
||||||
QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C)));
|
QFileInfo info(qtFileName.normalized(QString::NormalizationForm_C));
|
||||||
QString path = info.absolutePath();
|
QString path = info.absolutePath();
|
||||||
if (mCachedEntries->directory() != path) {
|
if (mCachedEntries->directory() != path) {
|
||||||
mCachedEntries->updateDirCache(path);
|
mCachedEntries->updateDirCache(path);
|
||||||
@ -366,7 +366,7 @@ static QString strippedText(QString s)
|
|||||||
if (filters.size() > 0){
|
if (filters.size() > 0){
|
||||||
for (int i=0; i<filters.size(); ++i) {
|
for (int i=0; i<filters.size(); ++i) {
|
||||||
QString filter = hideDetails ? [self removeExtensions:filters.at(i)] : filters.at(i);
|
QString filter = hideDetails ? [self removeExtensions:filters.at(i)] : filters.at(i);
|
||||||
[mPopUpButton addItemWithTitle:QT_PREPEND_NAMESPACE(QCFString::toNSString)(filter)];
|
[mPopUpButton addItemWithTitle:QCFString::toNSString(filter)];
|
||||||
}
|
}
|
||||||
[mPopUpButton selectItemAtIndex:0];
|
[mPopUpButton selectItemAtIndex:0];
|
||||||
[mSavePanel setAccessoryView:mAccessoryView];
|
[mSavePanel setAccessoryView:mAccessoryView];
|
||||||
@ -404,7 +404,7 @@ static QString strippedText(QString s)
|
|||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
QStringList result;
|
QStringList result;
|
||||||
QString filename = QT_PREPEND_NAMESPACE(QCFString::toQString)([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
|
QString filename = QCFString::toQString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
|
||||||
result << filename.remove(QLatin1String("___qt_very_unlikely_prefix_"));
|
result << filename.remove(QLatin1String("___qt_very_unlikely_prefix_"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -415,18 +415,18 @@ static QString strippedText(QString s)
|
|||||||
// Call this functions if mFileMode, mFileOptions,
|
// Call this functions if mFileMode, mFileOptions,
|
||||||
// mNameFilterDropDownList or mQDirFilter changes.
|
// mNameFilterDropDownList or mQDirFilter changes.
|
||||||
// The savepanel does not contain the neccessary functions for this.
|
// The savepanel does not contain the neccessary functions for this.
|
||||||
const QT_PREPEND_NAMESPACE(QFileDialogOptions::FileMode) fileMode = mOptions->fileMode();
|
const QFileDialogOptions::FileMode fileMode = mOptions->fileMode();
|
||||||
bool chooseFilesOnly = fileMode == QT_PREPEND_NAMESPACE(QFileDialogOptions::ExistingFile)
|
bool chooseFilesOnly = fileMode == QFileDialogOptions::ExistingFile
|
||||||
|| fileMode == QT_PREPEND_NAMESPACE(QFileDialogOptions::ExistingFiles);
|
|| fileMode == QFileDialogOptions::ExistingFiles;
|
||||||
bool chooseDirsOnly = fileMode == QT_PREPEND_NAMESPACE(QFileDialogOptions::Directory)
|
bool chooseDirsOnly = fileMode == QFileDialogOptions::Directory
|
||||||
|| fileMode == QT_PREPEND_NAMESPACE(QFileDialogOptions::DirectoryOnly)
|
|| fileMode == QFileDialogOptions::DirectoryOnly
|
||||||
|| mOptions->testOption(QT_PREPEND_NAMESPACE(QFileDialogOptions::ShowDirsOnly));
|
|| mOptions->testOption(QFileDialogOptions::ShowDirsOnly);
|
||||||
|
|
||||||
[mOpenPanel setCanChooseFiles:!chooseDirsOnly];
|
[mOpenPanel setCanChooseFiles:!chooseDirsOnly];
|
||||||
[mOpenPanel setCanChooseDirectories:!chooseFilesOnly];
|
[mOpenPanel setCanChooseDirectories:!chooseFilesOnly];
|
||||||
[mSavePanel setCanCreateDirectories:!(mOptions->testOption(QT_PREPEND_NAMESPACE(QFileDialogOptions::ReadOnly)))];
|
[mSavePanel setCanCreateDirectories:!(mOptions->testOption(QFileDialogOptions::ReadOnly))];
|
||||||
[mOpenPanel setAllowsMultipleSelection:(fileMode == QT_PREPEND_NAMESPACE(QFileDialogOptions::ExistingFiles))];
|
[mOpenPanel setAllowsMultipleSelection:(fileMode == QFileDialogOptions::ExistingFiles)];
|
||||||
[mOpenPanel setResolvesAliases:!(mOptions->testOption(QT_PREPEND_NAMESPACE(QFileDialogOptions::DontResolveSymlinks)))];
|
[mOpenPanel setResolvesAliases:!(mOptions->testOption(QFileDialogOptions::DontResolveSymlinks))];
|
||||||
[mOpenPanel setTitle:QCFString::toNSString(mOptions->windowTitle())];
|
[mOpenPanel setTitle:QCFString::toNSString(mOptions->windowTitle())];
|
||||||
[mSavePanel setTitle:QCFString::toNSString(mOptions->windowTitle())];
|
[mSavePanel setTitle:QCFString::toNSString(mOptions->windowTitle())];
|
||||||
[mPopUpButton setHidden:chooseDirsOnly]; // TODO hide the whole sunken pane instead?
|
[mPopUpButton setHidden:chooseDirsOnly]; // TODO hide the whole sunken pane instead?
|
||||||
@ -435,7 +435,7 @@ static QString strippedText(QString s)
|
|||||||
const QString defaultSuffix = mOptions->defaultSuffix();
|
const QString defaultSuffix = mOptions->defaultSuffix();
|
||||||
if (!ext.isEmpty() && !defaultSuffix.isEmpty())
|
if (!ext.isEmpty() && !defaultSuffix.isEmpty())
|
||||||
ext.prepend(defaultSuffix);
|
ext.prepend(defaultSuffix);
|
||||||
[mSavePanel setAllowedFileTypes:ext.isEmpty() ? nil : QT_PREPEND_NAMESPACE(qt_mac_QStringListToNSMutableArray(ext))];
|
[mSavePanel setAllowedFileTypes:ext.isEmpty() ? nil : qt_mac_QStringListToNSMutableArray(ext)];
|
||||||
|
|
||||||
if ([mSavePanel respondsToSelector:@selector(isVisible)] && [mSavePanel isVisible]) {
|
if ([mSavePanel respondsToSelector:@selector(isVisible)] && [mSavePanel isVisible]) {
|
||||||
if ([mSavePanel respondsToSelector:@selector(validateVisibleColumns)])
|
if ([mSavePanel respondsToSelector:@selector(validateVisibleColumns)])
|
||||||
@ -447,7 +447,7 @@ static QString strippedText(QString s)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(sender);
|
Q_UNUSED(sender);
|
||||||
if (mHelper) {
|
if (mHelper) {
|
||||||
QString selection = QT_PREPEND_NAMESPACE(QCFString::toQString([[mSavePanel URL] path]));
|
QString selection = QCFString::toQString([[mSavePanel URL] path]);
|
||||||
if (selection != mCurrentSelection) {
|
if (selection != mCurrentSelection) {
|
||||||
*mCurrentSelection = selection;
|
*mCurrentSelection = selection;
|
||||||
mHelper->QNSOpenSavePanelDelegate_selectionChanged(selection);
|
mHelper->QNSOpenSavePanelDelegate_selectionChanged(selection);
|
||||||
@ -465,7 +465,7 @@ static QString strippedText(QString s)
|
|||||||
|
|
||||||
[mCurrentDir release];
|
[mCurrentDir release];
|
||||||
mCurrentDir = [path retain];
|
mCurrentDir = [path retain];
|
||||||
mHelper->QNSOpenSavePanelDelegate_directoryEntered(QT_PREPEND_NAMESPACE(QCFString::toQString(mCurrentDir)));
|
mHelper->QNSOpenSavePanelDelegate_directoryEntered(QCFString::toQString(mCurrentDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -492,7 +492,7 @@ static QString strippedText(QString s)
|
|||||||
|
|
||||||
- (QString)removeExtensions:(const QString &)filter
|
- (QString)removeExtensions:(const QString &)filter
|
||||||
{
|
{
|
||||||
QRegExp regExp(QT_PREPEND_NAMESPACE(QString::fromLatin1)(QT_PREPEND_NAMESPACE(QPlatformFileDialogHelper::filterRegExp)));
|
QRegExp regExp(QString::fromLatin1(QPlatformFileDialogHelper::filterRegExp));
|
||||||
if (regExp.indexIn(filter) != -1)
|
if (regExp.indexIn(filter) != -1)
|
||||||
return regExp.cap(1).trimmed();
|
return regExp.cap(1).trimmed();
|
||||||
return filter;
|
return filter;
|
||||||
@ -528,7 +528,7 @@ static QString strippedText(QString s)
|
|||||||
(filterToUse == -1 && currentFilter.startsWith(selectedFilter)))
|
(filterToUse == -1 && currentFilter.startsWith(selectedFilter)))
|
||||||
filterToUse = i;
|
filterToUse = i;
|
||||||
QString filter = hideDetails ? [self removeExtensions:currentFilter] : currentFilter;
|
QString filter = hideDetails ? [self removeExtensions:currentFilter] : currentFilter;
|
||||||
[mPopUpButton addItemWithTitle:QT_PREPEND_NAMESPACE(QCFString::toNSString)(filter)];
|
[mPopUpButton addItemWithTitle:QCFString::toNSString(filter)];
|
||||||
}
|
}
|
||||||
if (filterToUse != -1)
|
if (filterToUse != -1)
|
||||||
[mPopUpButton selectItemAtIndex:filterToUse];
|
[mPopUpButton selectItemAtIndex:filterToUse];
|
||||||
|
@ -307,9 +307,9 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
|
|||||||
return (mResultCode == NSOKButton);
|
return (mResultCode == NSOKButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (QT_PREPEND_NAMESPACE(QPlatformDialogHelper::DialogCode))dialogResultCode
|
- (QPlatformDialogHelper::DialogCode)dialogResultCode
|
||||||
{
|
{
|
||||||
return (mResultCode == NSOKButton) ? QT_PREPEND_NAMESPACE(QPlatformDialogHelper::Accepted) : QT_PREPEND_NAMESPACE(QPlatformDialogHelper::Rejected);
|
return (mResultCode == NSOKButton) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)windowShouldClose:(id)window
|
- (BOOL)windowShouldClose:(id)window
|
||||||
|
@ -55,7 +55,7 @@ bool QCocoaServices::openUrl(const QUrl &url)
|
|||||||
const QString scheme = url.scheme();
|
const QString scheme = url.scheme();
|
||||||
if (scheme.isEmpty())
|
if (scheme.isEmpty())
|
||||||
return openDocument(url);
|
return openDocument(url);
|
||||||
return [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:QT_PREPEND_NAMESPACE(QCFString::toNSString)(url.toString(QUrl::FullyEncoded))]];
|
return [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:QCFString::toNSString(url.toString(QUrl::FullyEncoded))]];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QCocoaServices::openDocument(const QUrl &url)
|
bool QCocoaServices::openDocument(const QUrl &url)
|
||||||
@ -63,7 +63,7 @@ bool QCocoaServices::openDocument(const QUrl &url)
|
|||||||
if (!url.isValid())
|
if (!url.isValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return [[NSWorkspace sharedWorkspace] openFile:QT_PREPEND_NAMESPACE(QCFString::toNSString)(url.toLocalFile())];
|
return [[NSWorkspace sharedWorkspace] openFile:QCFString::toNSString(url.toLocalFile())];
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -61,7 +61,7 @@ QT_FORWARD_DECLARE_CLASS(QCocoaWindow)
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QNSPanel : NSPanel {
|
@interface QNSPanel : NSPanel {
|
||||||
@public QT_PREPEND_NAMESPACE(QCocoaWindow) *m_cocoaPlatformWindow;
|
@public QCocoaWindow *m_cocoaPlatformWindow;
|
||||||
}
|
}
|
||||||
- (void)clearPlatformWindow;
|
- (void)clearPlatformWindow;
|
||||||
- (BOOL)canBecomeKeyWindow;
|
- (BOOL)canBecomeKeyWindow;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user