Merge pull request #7728 from ctrlaltdavid/20887

Add link in Running Scripts that opens scripts folder
This commit is contained in:
Brad Hefta-Gaub 2016-04-21 16:01:52 -07:00
commit 0f966e934e
4 changed files with 94 additions and 2 deletions

View file

@ -0,0 +1,67 @@
//
// TextField.qml
//
// Created by David Rowe on 21 Apr 2016
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../styles-uit"
import "../controls-uit" as HifiControls
Item {
property string icon: ""
property int iconSize: 30
property string text: ""
property int colorScheme: hifi.colorSchemes.light
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
signal clicked()
height: Math.max(glyph.visible ? glyph.height - 4 : 0, string.visible ? string.height : 0)
width: glyph.width + string.anchors.leftMargin + string.width
HiFiGlyphs {
id: glyph
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: -2
text: parent.icon
size: parent.iconSize
color: isLightColorScheme
? (mouseArea.containsMouse ? hifi.colors.baseGrayHighlight : hifi.colors.lightGray)
: (mouseArea.containsMouse ? hifi.colors.faintGray : hifi.colors.lightGrayText)
visible: text !== ""
width: visible ? implicitWidth : 0
}
RalewaySemiBold {
id: string
anchors {
left: glyph.visible ? glyph.right : parent.left
leftMargin: visible && glyph.visible ? hifi.dimensions.contentSpacing.x : 0
verticalCenter: glyph.visible ? glyph.verticalCenter : undefined
}
text: parent.text
size: hifi.fontSizes.inputLabel
color: isLightColorScheme
? (mouseArea.containsMouse ? hifi.colors.baseGrayHighlight : hifi.colors.lightGray)
: (mouseArea.containsMouse ? hifi.colors.faintGray : hifi.colors.lightGrayText)
font.underline: true;
visible: text !== ""
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: parent.clicked()
}
}

View file

@ -24,7 +24,7 @@ Window {
resizable: true
destroyOnInvisible: true
x: 40; y: 40
implicitWidth: 400; implicitHeight: 695
implicitWidth: 400; implicitHeight: 728
minSize: Qt.vector2d(200, 300)
HifiConstants { id: hifi }
@ -236,7 +236,23 @@ Window {
}
}
HifiControls.VerticalSpacer { }
HifiControls.VerticalSpacer {
height: hifi.dimensions.controlInterlineHeight - 3
}
HifiControls.TextAction {
id: directoryButton
icon: hifi.glyphs.script
iconSize: 24
text: "Reveal Scripts Folder"
onClicked: fileDialogHelper.openScriptsDirectory()
colorScheme: hifi.colorSchemes.dark
anchors.left: parent.left
}
HifiControls.VerticalSpacer {
height: hifi.dimensions.controlInterlineHeight - 3
}
}
}
}

View file

@ -14,6 +14,9 @@
#include <QtCore/QFile>
#include <QtCore/QDebug>
#include <QtCore/QRegularExpression>
#include <QDesktopServices>
#include "PathUtils.h"
QUrl FileDialogHelper::home() {
@ -103,3 +106,7 @@ QStringList FileDialogHelper::drives() {
}
return result;
}
void FileDialogHelper::openScriptsDirectory() {
QDesktopServices::openUrl(defaultScriptsLocation());
}

View file

@ -58,6 +58,8 @@ public:
Q_INVOKABLE bool validFolder(const QString& path);
Q_INVOKABLE QUrl pathToUrl(const QString& path);
Q_INVOKABLE QUrl saveHelper(const QString& saveText, const QUrl& currentFolder, const QStringList& selectionFilters);
Q_INVOKABLE void openScriptsDirectory();
};