Allow the user to choose to associate common file types.

Especially important if you already assigned the file types
to a different application, or to keep defaults for VS users.

Depends on: https://codereview.qt-project.org/#change,38650

Change-Id: I2b272c25e03bcc264ca73450fd26aa82ec30c296
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
This commit is contained in:
kh1
2012-11-05 14:52:30 +01:00
committed by Eike Ziller
parent d0e055a1f2
commit b8a26af434
3 changed files with 79 additions and 1 deletions

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AssociateCommonFiletypesForm</class>
<widget class="QWidget"
name="AssociateCommonFiletypesForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>557</width>
<height>35</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout"
name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint"
stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox"
name="AssociateCommonFiletypesCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;body&gt;Associate common file types (.c/.h, .cc/.hh, .cxx/.hxx, .c++/.h++, .cpp/.hpp) with Qt Creator.&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Associate common file types with Qt Creator.</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -30,10 +30,21 @@
// constructor
function Component()
{
component.loaded.connect(this, Component.prototype.loaded);
installer.finishButtonClicked.connect(this, Component.prototype.installationFinished);
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
}
Component.prototype.loaded = function()
{
try {
if (installer.value("os") == "win" && installer.isInstaller())
installer.addWizardPageItem(component, "AssociateCommonFiletypesForm", QInstaller.TargetDirectory);
} catch(e) {
print(e);
}
}
Component.prototype.beginInstallation = function()
{
if ( installer.value("os") === "win" ) {
@@ -43,7 +54,7 @@ Component.prototype.beginInstallation = function()
}
}
registerWindowsFileTypeExtensions = function()
registerCommonWindowsFileTypeExtensions = function()
{
var headerExtensions = new Array("h", "hh", "hxx", "h++", "hpp");
@@ -76,6 +87,10 @@ registerWindowsFileTypeExtensions = function()
"text/plain",
"@TargetDir@\\bin\\qtcreator.exe,1",
"ProgId=QtProject.QtCreator.c");
}
registerWindowsFileTypeExtensions = function()
{
component.addOperation( "RegisterFileType",
"ui",
"@TargetDir@\\bin\\qtcreator.exe -client '%1'",
@@ -131,6 +146,15 @@ Component.prototype.createOperations = function()
"workingDirectory=@homeDir@" );
component.addElevatedOperation("Execute", "{0,3010,1638}", "@TargetDir@\\lib\\vcredist_msvc2010\\vcredist_x86.exe", "/norestart", "/q");
registerWindowsFileTypeExtensions();
try {
if (component.userInterface("AssociateCommonFiletypesForm").AssociateCommonFiletypesCheckBox
.checked) {
registerCommonWindowsFileTypeExtensions();
}
} catch(e) {
print(e);
}
}
if ( installer.value("os") == "x11" )
{

View File

@@ -12,4 +12,7 @@
<ForcedInstallation>true</ForcedInstallation>
<Default>true</Default>
<AutoDependOn>org.qtproject.qtcreator</AutoDependOn>
<UserInterfaces>
<UserInterface>associatecommonfiletypesform.ui</UserInterface>
</UserInterfaces>
</Package>