diff options
author | Liang Qi <liang.qi@qt.io> | 2016-10-13 09:49:38 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-10-13 09:49:38 +0200 |
commit | dfc177e3a99dd593db4b1e9445d6243ce75ebf07 (patch) | |
tree | 4e33c7be90a44642e672fff22ea163b500ff3aef /src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | |
parent | 72efb2e6f4af2fd909daaf9104f09fd1425acfb0 (diff) | |
parent | 1d6eb70dcec105af28d6a5e9b59d56c895c70389 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
qmake/library/qmakeevaluator.cpp
(cherry picked from commit 1af6dc2c8fb4d91400fddc5050166f972ae57c9a in qttools)
src/corelib/kernel/qcore_mac_objc.mm
src/gui/painting/qcolor.h
src/plugins/platforms/cocoa/qcocoawindow.mm
Change-Id: I5b3ec468a5a9a73911b528d3d24ff8e19f339f31
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index c0055852c2..7706f39198 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -146,14 +146,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]; @@ -204,12 +204,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]) @@ -220,14 +220,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; @@ -240,12 +240,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 @@ -267,7 +267,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]; @@ -275,7 +275,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){ @@ -322,7 +322,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: @@ -374,7 +374,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]; @@ -408,13 +408,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; } @@ -437,8 +437,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]; @@ -457,7 +457,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); @@ -475,7 +475,7 @@ static QString strippedText(QString s) [mCurrentDir release]; mCurrentDir = [path retain]; - mHelper->QNSOpenSavePanelDelegate_directoryEntered(QCFString::toQString(mCurrentDir)); + mHelper->QNSOpenSavePanelDelegate_directoryEntered(QString::fromNSString(mCurrentDir)); } /* @@ -538,7 +538,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]; @@ -610,7 +610,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; } @@ -618,7 +618,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; @@ -647,7 +647,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)) |