I want to make the maintenance tool window wider. Users are confused by the version page, as it is truncated and they do not see what the new version is.
I tried making a really long title description, but that did not work.
I have not found a scripting solution, but here is my installscript.js
function Component()
{
}
Component.prototype.isDefault = function()
{
// select the component by default
return true;
}
Component.prototype.createOperations = function()
{
try {
component.createOperations();
if (installer.value("os") === "win") {
component.addOperation("CreateShortcut", "#TargetDir#/winnow.exe", "#StartMenuDir#/Winnow.lnk");
}
} catch (e) {
console.log(e);
}
}
Use WizardDefaultWidth WizardDefaultHeight in config.xml
see http://doc.qt.io/qtinstallerframework/ifw-globalconfig.html
Related
I want to load the binary automatically once installation is completed using Qt Installation framework. How this can be achieved?
I am trying to edit this script and added component.addOperation("CreateShortcut", "#TargetDir#/DistributionKit/Abc.sh"); But its not loading the script automatically. What i am missing ?
function Component()
{
installer.installationFinished.connect(this, Component.prototype.installationFinishedPageIsShown);
installer.finishButtonClicked.connect(this, Component.prototype.installationFinished);
}
Component.prototype.createOperations = function()
{
component.createOperations();
}
Component.prototype.installationFinishedPageIsShown = function()
{
try {
if (installer.isInstaller() && installer.status == QInstaller.Success) {
installer.addWizardPageItem( component, "ReadMeCheckBoxForm", QInstaller.InstallationFinished );
}
} catch(e) {
console.log(e);
}
}
Component.prototype.installationFinished = function()
{
try {
if (installer.isInstaller() && installer.status == QInstaller.Success) {
var isReadMeCheckBoxChecked = component.userInterface( "ReadMeCheckBoxForm" ).readMeCheckBox.checked;
if (isReadMeCheckBoxChecked) {
//QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/Abc.sh");
component.addOperation("CreateShortcut", "#TargetDir#/DistributionKit/Abc.sh");
}
}
} catch(e) {
console.log(e);
}
}
Qt installer framework has an executeDetached function in the installer. I believe this is what you need to use to launch your program. In this case, your script would look like (only adding the affected function):
Component.prototype.installationFinished = function()
{
try {
if (installer.isInstaller() && installer.status == QInstaller.Success) {
var isReadMeCheckBoxChecked = component.userInterface( "ReadMeCheckBoxForm" ).readMeCheckBox.checked;
if (isReadMeCheckBoxChecked) {
installer.exectueDetached("bash", installer.value("TargetDir") + "/Abc.sh");
component.addOperation("CreateShortcut", "#TargetDir#/DistributionKit/Abc.sh");
}
}
} catch(e) {
console.log(e);
}
}
Note that you actually need to run "bash" as executeDetached and pass your script as an argument to the bash. If you were running an executable you would not have "bash" in the exectueDetached command.
*Note that I did not add "/DistributionKint/" in the exectueDetached. This is because in the commented line in your original question Abc.sh was directly under #TargetDir#. Obviously, you need to pass the installer.executeDetached the right path to your sh script.
I'm writing a JS Widget using RequireJS. After finishing the widget I'm compiling it with r.js and Almond. All goes well - but I couldn't find an easy way to let the user use the widget without using RequireJS himself - as the widget code loads async (RequireJS uses AMD).
What I'm doing now is busy waiting for the widget code to load and using it only after detecting it has loaded. This is not very user-friendly.
Is there a way to let just do something like this?
var widget = new Widget();
instead of doing busy wait like:
count = 0;
function loadWidget() {
if (typeof Widget != 'undefined') {
var p1 = new Widget();
p1.render();
} else {
if (count > 10) {
console.log('Failed to load the Widget');
return false;
}
setTimeout(loadWidget, 50);
count++;
}
}
$(document).ready(function() {
loadWidget();
});
Thanks!
EDIT:
my build.js
({
name: './lib/almond.js',
out: './deploy/sdk.min.js',
baseUrl: '.',
optimize: 'uglify2',
mainConfigFile: 'sdk.js',
include: ['sdk'],
wrap: true
})
Code on the web page (assume no other script tags on page):
<script src="mywidget.js" data-main="scripts/sdk" id="mywidget"></script>
No sure if the 'data-main' is really required as the js is compiled.
You need to follow the instructions provided with Almond. To summarize the essential points what is in the doc there, what you need in your build config the following configuration:
wrap: {
startFile: 'path/to/start.frag',
endFile: 'path/to/end.frag'
}
And the start.frag should be:
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else {
root.Widget = factory();
}
}(this, function () {
and the end.frag:
return require('main');
}));
The end fragment calls require in its synchronous form, which is really synchronous in this case (and not the pseudo-synchronous sugar that can be used by RequrieJS itself).
I've tried this before. It works.
I use Qt Installer framework 1.5
After the installation, I would like to add a shortcut on the desktop.
In my file installscript.qs, I tried :
Component.prototype.createOperationsForPath = function()
{
if (installer.value("os") === "win")
{
try {
component.addOperation("CreateShortcut", "#TargetDir#/App.exe", "#DesktopDir#/App.lnk");
}
catch (e) {
print(e);
}
}
}
But it doesn't work, the shortcut isn't created and I don't have any error messages.
The documentation on Internet is really light.
Any idea ?
Thank you
Try this. It's working for me.
Component.prototype.createOperations = function()
{
try {
// call the base create operations function
component.createOperations();
if (installer.value("os") == "win") {
try {
var userProfile = installer.environmentVariable("USERPROFILE");
installer.setValue("UserProfile", userProfile);
component.addOperation("CreateShortcut", "#TargetDir#\\MiamPlayer.exe", "#UserProfile#\\Desktop\\MiamPlayer.lnk");
} catch (e) {
// Do nothing if key doesn't exist
}
}
} catch (e) {
print(e);
}
}
I know this answer comes very late, but i hope it can help other users:
(Qt 5.13)
component.addOperation("CreateShortcut",
"#TargetDir#/App.exe",// target
"#DesktopDir#/App.lnk",// link-path
"workingDirectory=#TargetDir#",// working-dir
"iconPath=#TargetDir#/App.exe", "iconId=0",// icon
"description=Start App");// description
Need help..Unable to iterate thru auto suggestions using up and down arrow keys on keyboard here is little code snippet
dojo.require("dojo.NodeList-manipulate");
dojo.require("dojo.NodeList-traverse");
dojo.ready(function () {
var div = dojo.query("#list-of-items");
console.log(dojo.byId("search").getBoundingClientRect());
dojo.connect(dojo.byId("search"), "onkeyup", function (evt) {
if (dojo.byId("search").value.trim() === "") {
dojo.forEach(div.query("li"), function (elm, i) {
dojo.style(elm, {
"display": "block"
});
});
dojo.style(dojo.query("#list-of-items")[0], {
"display": "none"
});
if(evt.keyCode == 40){
return;
}else if(evt.keyCode == 38){
return;
}
} else {
dojo.style(dojo.query("#list-of-items")[0], {
"display": "inline-block"
});
}
searchTable(this.value, evt);
});
function searchTable(inputVal, e) {
console.log(inputVal);
var list = dojo.query('#list-of-items');
dojo.forEach(list.query('li'), function (elm, i) {
var found = false;
var regExp = new RegExp(inputVal, 'i');
if (regExp.test(elm.innerText)) {
found = true;
if(i===0){
dojo.attr(elm, { className: "hlight" });
}
dojo.style(elm, {
"display": "block"
});
return false;
}
if (found == true) {
dojo.style(elm, {
"display": "block"
});
} else {
dojo.style(elm, {
"display": "none"
});
}
});
}
});
and also highlight auto suggest using this css class
.hlight{
background:#faae00;
font-weight:bold;
color:#fff;
}
Please see working Fiddle here
Thanks
The best thing to do is to keep an index that contains the highlighted value, then increment/decrease that index every time the up/down arrow is pressed.
You will also have to send that index with your searchTable() function so that it can add the .hlight class to the correct elements.
The hardest part is to correct that index when someone uses the up arrow when you're already on the first element (or the down arrow when you're on the last arrow). I solved that by adding a class .visible to the elements that are visible (in stead of just adding display: block or display: none), this way you can easily query all items that are visible.
I rewrote your code a bit, ending up with this. But still, my original question is still left, why don't you use the dijit/form/ComboBox or dijit/form/FilteringSelect? Dojo already has widgets that do this for you, you don't have to reinvent the wheel here (because it probably won't be as good).
I want to automatically check if a HTTPS page includes "insecure content" eg HTTP content.
Is there a way to automatically determine that?
It seems phantom just loads the content and ignores that fact.
This works like a charm:
console.log('Loading a web page');
var page = new WebPage();
page.onResourceRequested = function(request) {
if(/^https/.exec(request.url)) {
console.log('i am fine with ' + request.url)
} else {
console.log('i dont like ' + request.url)
}
}
page.viewportSize = { width: 1024, height: 768 };
var url = "https://example.com";
page.open(url, function (status) {
if(status == 'success') {
page.render('test.png');
console.log('loaded')
}
phantom.exit();
});
Interesting approach. Thank you.
I would just suggest checking it really catches all resources and there are no opened phantomjs bugs related to the event.