forked from qt-creator/qt-creator
macOS: Do not show numbers in recent files & projects
There are no accelerators on macOS, so these numbers are unnecessary noise. Change-Id: I0402dd961dbe955837e0aa70b92aef33f61d61bd Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Serhii Moroz <frost.asm@gmail.com>
This commit is contained in:
@@ -1070,10 +1070,12 @@ void MainWindow::aboutToShowRecentFiles()
|
|||||||
for (int i = 0; i < recentFiles.count(); ++i) {
|
for (int i = 0; i < recentFiles.count(); ++i) {
|
||||||
const DocumentManager::RecentFile file = recentFiles[i];
|
const DocumentManager::RecentFile file = recentFiles[i];
|
||||||
|
|
||||||
int acceleratorKey = i + 1;
|
const int acceleratorKey = i + 1;
|
||||||
QString textPattern = acceleratorKey < 10 ? QStringLiteral("&%1: %2") : QStringLiteral("%1: %2");
|
const QString textPattern = acceleratorKey < 10 ? QStringLiteral("&%1: %2") : QStringLiteral("%1: %2");
|
||||||
QString filePath = QDir::toNativeSeparators(withTildeHomePath(file.first));
|
const QString filePath = QDir::toNativeSeparators(withTildeHomePath(file.first));
|
||||||
QString actionText = textPattern.arg(acceleratorKey).arg(filePath);
|
const QString actionText = HostOsInfo::isMacHost()
|
||||||
|
? filePath
|
||||||
|
: textPattern.arg(acceleratorKey).arg(filePath);
|
||||||
QAction *action = menu->addAction(actionText);
|
QAction *action = menu->addAction(actionText);
|
||||||
connect(action, &QAction::triggered, this, [file] {
|
connect(action, &QAction::triggered, this, [file] {
|
||||||
EditorManager::openEditor(file.first, file.second);
|
EditorManager::openEditor(file.first, file.second);
|
||||||
|
|||||||
@@ -2830,8 +2830,10 @@ void ProjectExplorerPluginPrivate::updateRecentProjectMenu()
|
|||||||
if (fileName.endsWith(QLatin1String(".qws")))
|
if (fileName.endsWith(QLatin1String(".qws")))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QString textTemplate = acceleratorKey < 10 ? QStringLiteral("&%1: %2") : QStringLiteral("%1: %2");
|
const QString textTemplate = acceleratorKey < 10 ? QStringLiteral("&%1: %2") : QStringLiteral("%1: %2");
|
||||||
QString actionText = textTemplate.arg(acceleratorKey).arg(Utils::withTildeHomePath(fileName));
|
const QString actionText = Utils::HostOsInfo::isMacHost()
|
||||||
|
? Utils::withTildeHomePath(fileName)
|
||||||
|
: textTemplate.arg(acceleratorKey).arg(Utils::withTildeHomePath(fileName));
|
||||||
QAction *action = menu->addAction(actionText);
|
QAction *action = menu->addAction(actionText);
|
||||||
connect(action, &QAction::triggered, this, [this, fileName] {
|
connect(action, &QAction::triggered, this, [this, fileName] {
|
||||||
openRecentProject(fileName);
|
openRecentProject(fileName);
|
||||||
|
|||||||
Reference in New Issue
Block a user