Merge pull request #7351 from ctrlaltdavid/20851

Fix up script editor's "reload scripts?" message box
This commit is contained in:
Clément Brisset 2016-03-16 17:43:41 -07:00
commit f2a5dce34e
5 changed files with 13 additions and 5 deletions

View file

@ -51,6 +51,9 @@ ModalWindow {
property int clickedButton: OriginalDialogs.StandardButton.NoButton;
focus: defaultButton === OriginalDialogs.StandardButton.NoButton
property int titleWidth: 0
onTitleWidthChanged: d.resize();
function updateIcon() {
if (!root) {
return;
@ -72,7 +75,7 @@ ModalWindow {
readonly property int maxHeight: 720
function resize() {
var targetWidth = mainTextContainer.contentWidth
var targetWidth = Math.max(titleWidth, mainTextContainer.contentWidth)
var targetHeight = mainTextContainer.height + 3 * hifi.dimensions.contentSpacing.y
+ (informativeTextContainer.text != "" ? informativeTextContainer.contentHeight + 3 * hifi.dimensions.contentSpacing.y : 0)
+ buttons.height

View file

@ -42,6 +42,9 @@ ModalWindow {
// For combo boxes
property bool editable: true;
property int titleWidth: 0
onTitleWidthChanged: d.resize();
function updateIcon() {
if (!root) {
return;
@ -63,7 +66,7 @@ ModalWindow {
readonly property int maxHeight: 720
function resize() {
var targetWidth = pane.width
var targetWidth = Math.max(titleWidth, pane.width)
var targetHeight = (items ? comboBox.controlHeight : textResult.controlHeight) + 5 * hifi.dimensions.contentSpacing.y + buttons.height
root.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth)
root.height = (targetHeight < d.minHeight) ? d.minHeight: ((targetHeight > d.maxHeight) ? d.maxHeight : targetHeight)

View file

@ -10,7 +10,7 @@ QtObject {
readonly property string animDebugDrawPosition: "Debug Draw Position";
readonly property string antialiasing: "Antialiasing";
readonly property string assetMigration: "ATP Asset Migration";
readonly property string assetServer = "Asset Server";
readonly property string assetServer: "Asset Server";
readonly property string atmosphere: "Atmosphere";
readonly property string attachments: "Attachments...";
readonly property string audioNetworkStats: "Audio Network Stats";

View file

@ -50,6 +50,8 @@ Frame {
width: title.width + (icon.text !== "" ? icon.width + hifi.dimensions.contentSpacing.x : 0)
x: (parent.width - width) / 2
onWidthChanged: window.titleWidth = width
HiFiGlyphs {
id: icon
text: window.iconText ? window.iconText : ""

View file

@ -226,8 +226,8 @@ void ScriptEditorWidget::onWindowActivated() {
if (QFileInfo(_currentScript).lastModified() > _currentScriptModified) {
if (static_cast<ScriptEditorWindow*>(this->parent()->parent()->parent())->autoReloadScripts()
|| OffscreenUi::warning(this, _currentScript,
tr("This file has been modified outside of the Interface editor.") + "\n\n"
|| OffscreenUi::question(this, tr("Reload Script"),
tr("The following file has been modified outside of the Interface editor:") + "\n" + _currentScript + "\n"
+ (isModified()
? tr("Do you want to reload it and lose the changes you've made in the Interface editor?")
: tr("Do you want to reload it?")),