diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2016-09-02 11:50:13 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2016-09-06 13:28:42 +0000 |
commit | 9acce79ce28a022c7dad4fe59f731fac16e90cd0 (patch) | |
tree | 3287804bbf430a93a1e718d9cd96d1f825c3ad06 | |
parent | ba7ef44603087e5de11029f4cf7f7e8a250d7ea9 (diff) |
Implement basic Qt Help System support
Change-Id: Ibf3b3fc46f66f4cf017c573fa3728c5bc8417687
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/qtprojectlib/VersionInformation.cs | 10 | ||||
-rw-r--r-- | src/qtvstools/QtHelpLinkChooser.xaml | 107 | ||||
-rw-r--r-- | src/qtvstools/QtHelpLinkChooser.xaml.cs | 98 | ||||
-rw-r--r-- | src/qtvstools/QtHelpMenu.cs | 289 | ||||
-rw-r--r-- | src/qtvstools/QtMenus.vsct | 66 | ||||
-rw-r--r-- | src/qtvstools/QtVsTools.csproj | 49 | ||||
-rw-r--r-- | src/qtvstools/Vsix.cs | 1 | ||||
-rw-r--r-- | src/qtvstools/packages.config | 4 | ||||
-rw-r--r-- | src/qtvstools/source.extension.vsixmanifest | 10 |
9 files changed, 626 insertions, 8 deletions
diff --git a/src/qtprojectlib/VersionInformation.cs b/src/qtprojectlib/VersionInformation.cs index ac3e3af9..bbc4689a 100644 --- a/src/qtprojectlib/VersionInformation.cs +++ b/src/qtprojectlib/VersionInformation.cs @@ -100,6 +100,16 @@ namespace QtProjectLib } catch (Exception /*e*/) { qtDir = null; } + + try { + var qmakeQuery = new QMakeQuery(this); + QtInstallDocs = qmakeQuery.query("QT_INSTALL_DOCS"); + } catch { } + } + + public string QtInstallDocs + { + get; private set; } public bool IsStaticBuild() diff --git a/src/qtvstools/QtHelpLinkChooser.xaml b/src/qtvstools/QtHelpLinkChooser.xaml new file mode 100644 index 00000000..18d9471f --- /dev/null +++ b/src/qtvstools/QtHelpLinkChooser.xaml @@ -0,0 +1,107 @@ +<!-- + ***************************************************************************** + ** + ** Copyright (C) 2016 The Qt Company Ltd. + ** Contact: https://www.qt.io/licensing/ + ** + ** This file is part of the Qt VS Tools. + ** + ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ + ** Commercial License Usage + ** Licensees holding valid commercial Qt licenses may use this file in + ** accordance with the commercial license agreement provided with the + ** Software or, alternatively, in accordance with the terms contained in + ** a written agreement between you and The Qt Company. For licensing terms + ** and conditions see https://www.qt.io/terms-conditions. For further + ** information use the contact form at https://www.qt.io/contact-us. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3 as published by the Free Software + ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT + ** included in the packaging of this file. Please review the following + ** information to ensure the GNU General Public License requirements will + ** be met: https://www.gnu.org/licenses/gpl-3.0.html. + ** + ** $QT_END_LICENSE$ + ** + ***************************************************************************** +--> + +<local:VsToolsDialogWindow x:Class="QtVsTools.QtHelpLinkChooser" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:QtVsTools" + Width="400" + Height="250" + MinWidth="400" + MinHeight="250" + mc:Ignorable="d" + Title="Choose Topic" + ShowInTaskbar="False" + HasHelpButton="False" + HasMinimizeButton="False" + ResizeMode="CanResizeWithGrip" + WindowStartupLocation="CenterOwner"> + <local:VsToolsDialogWindow.Resources> + <BooleanToVisibilityConverter x:Key="b2v" /> + <Style x:Key="ListBoxDoubleClickStyle" + TargetType="ListBoxItem"> + <EventSetter Event="MouseDoubleClick" + Handler="OnListBoxItem_DoubleClick" /> + </Style> + </local:VsToolsDialogWindow.Resources> + <Grid Margin="10" + FocusManager.FocusedElement="{Binding ElementName=searchBox}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="*" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <TextBlock Grid.Row="0" + Margin="0,0,0,5"> + <Run Text="Choose a topic for " /> + <Run FontWeight="Bold" + Text="{Binding Path=Keyword}" /> + <Run Text=":" /> + </TextBlock> + <Grid Grid.Row="1" + MinHeight="22" + Background="White"> + <TextBlock Text=" Filter..." + Foreground="LightSteelBlue" + VerticalAlignment="Center" + Visibility="{Binding ElementName=searchBox, + Path=Text.IsEmpty, Converter={StaticResource b2v}}" /> + <TextBox Name="searchBox" + Background="Transparent" + TextChanged="OnSearchBox_TextChanged" + VerticalContentAlignment="Center" /> + </Grid> + <ListBox Grid.Row="2" + Margin="0,10,0,0" + Name="linkListBox" + DisplayMemberPath="Key" + SelectedValuePath="Value" + ItemsSource="{Binding Path=Links}" + SelectedValue="{Binding Path=Link}" + SelectionChanged="OnLinkListBox_SelectionChanged" + ItemContainerStyle="{StaticResource ListBoxDoubleClickStyle}" /> + <StackPanel Grid.Row="3" + Orientation="Horizontal" + HorizontalAlignment="Right"> + <Button MinWidth="75" + Content="Show" + IsDefault="True" + Click="OnShowButton_Click" + Margin="0,10,10,0" /> + <Button MinWidth="75" + IsCancel="True" + Content="Cancel" + Margin="0,10,0,0" /> + </StackPanel> + </Grid> +</local:VsToolsDialogWindow> diff --git a/src/qtvstools/QtHelpLinkChooser.xaml.cs b/src/qtvstools/QtHelpLinkChooser.xaml.cs new file mode 100644 index 00000000..83775e6d --- /dev/null +++ b/src/qtvstools/QtHelpLinkChooser.xaml.cs @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt VS Tools. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +using System; +using System.Collections.Generic; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Input; + +namespace QtVsTools +{ + public class VsToolsDialogWindow : Microsoft.VisualStudio.PlatformUI.DialogWindow + { + // Workaround to avoid referencing Microsoft.VisualStudio.Shell.14.0 in XAML. + } + + partial class QtHelpLinkChooser : VsToolsDialogWindow + { + public QtHelpLinkChooser() + { + InitializeComponent(); + + DataContext = this; + Loaded += OnLoaded; + } + + public string Link { get; private set; } + public string Keyword { private get; set; } + public Dictionary<string, string> Links { private get; set; } + + private void OnLoaded(object sender, RoutedEventArgs e) + { + var view = CollectionViewSource.GetDefaultView(linkListBox.ItemsSource); + view.Filter = (obj) => + { + if (string.IsNullOrEmpty(searchBox.Text)) + return true; + + var item = (KeyValuePair<string, string>) obj; + return item.Key.IndexOf(searchBox.Text, StringComparison.OrdinalIgnoreCase) >= 0; + }; + linkListBox.SelectedIndex = 0; + } + + private void OnSearchBox_TextChanged(object sender, TextChangedEventArgs e) + { + CollectionViewSource.GetDefaultView(linkListBox.ItemsSource).Refresh(); + if (linkListBox.Items.Count == 1 || linkListBox.SelectedItem == null) + linkListBox.SelectedIndex = 0; + } + + private void OnListBoxItem_DoubleClick(object sender, MouseButtonEventArgs e) + { + if (e.LeftButton == MouseButtonState.Pressed) + OnShowButton_Click(sender, null); + } + + private void OnShowButton_Click(object sender, System.Windows.RoutedEventArgs e) + { + DialogResult = true; + Close(); + } + + private void OnLinkListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (e.RemovedItems != null && (e.AddedItems == null || e.AddedItems.Count == 0)) { + if (linkListBox.Items.Count != 0) + linkListBox.SelectedIndex = 0; + } + } + } +} diff --git a/src/qtvstools/QtHelpMenu.cs b/src/qtvstools/QtHelpMenu.cs new file mode 100644 index 00000000..50a68e62 --- /dev/null +++ b/src/qtvstools/QtHelpMenu.cs @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt VS Tools. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +using EnvDTE; +using Microsoft.VisualStudio.Settings; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.Shell.Settings; +using QtProjectLib; +using System; +using System.Collections.Generic; +using System.ComponentModel.Design; +using System.Data.Common; +using System.Data.SQLite; +using System.IO; +using System.Linq; + +namespace QtVsTools +{ + internal sealed class QtHelpMenu + { + public static QtHelpMenu Instance + { + get; + private set; + } + + public static void Initialize(Package package) + { + Instance = new QtHelpMenu(package); + } + + const int F1QtHelpId = 0x0100; + const int ViewQtHelpId = 0x0101; + const int OnlineDocumentationId = 0x0102; + const int OfflineDocumentationId = 0x0103; + + readonly Package package; + const string QtVsToolsHelpPreferencePath = @"QtVsTools\Help\Preference"; + static readonly Guid HelpMenuGroupGuid = new Guid("fc6244f9-ec84-4370-a59c-b009b2eafd1b"); + + QtHelpMenu(Package pkg) + { + if (pkg == null) + throw new ArgumentNullException("package"); + package = pkg; + + var commandService = ServiceProvider.GetService(typeof(IMenuCommandService)) + as OleMenuCommandService; + + if (commandService == null) + return; + + var menuCommandID = new CommandID(HelpMenuGroupGuid, F1QtHelpId); + commandService.AddCommand(new MenuCommand(F1QtHelpCallback, menuCommandID)); + + menuCommandID = new CommandID(HelpMenuGroupGuid, ViewQtHelpId); + commandService.AddCommand(new MenuCommand(ViewQtHelpCallback, menuCommandID)); + + var command = new OleMenuCommand(ExecHandler, new CommandID(HelpMenuGroupGuid, + OfflineDocumentationId)); + command.BeforeQueryStatus += BeforeQueryStatus; + commandService.AddCommand(command); + + command = new OleMenuCommand(ExecHandler, new CommandID(HelpMenuGroupGuid, + OnlineDocumentationId)); + command.BeforeQueryStatus += BeforeQueryStatus; + commandService.AddCommand(command); + } + + IServiceProvider ServiceProvider + { + get { return package; } + } + + static bool IsSuperfluousCharacter(string text) + { + switch (text) { + case " ": case ";": case ".": case "<": case ">": case "{": case "}": + case "(": case ")": case ":": case ",": case "/": case "\\": case "^": + case "%": case "+": case "-": case "*": case "\t": case "&": case "\"": + case "!": case "[": case "]": case "|": case "'": case "~": case "#": case "=": + return true; // nothing we are interested in + } + return false; + } + + static string GetString(DbDataReader reader, int index) + { + if (!reader.IsDBNull(index)) + return reader.GetString(index); + return string.Empty; + } + + void ViewQtHelpCallback(object sender, EventArgs args) + { + VsShellUtilities.OpenSystemBrowser("https://www.qt.io/developers"); + } + + async void F1QtHelpCallback(object sender, EventArgs args) + { + try { + var dte = ServiceProvider.GetService(typeof(SDTE)) as DTE; + var objTextDocument = dte.ActiveDocument.Object() as TextDocument; + + var keyword = string.Empty; + var selection = objTextDocument.Selection as TextSelection; + if (selection.IsEmpty) { // no selection inside the document + var line = selection.ActivePoint.Line; // current line + var offset = selection.ActivePoint.LineCharOffset; // current char offset + + selection.CharLeft(true); // try the character before the cursor + if (!selection.IsEmpty) { + keyword = selection.Text; // something in front of the cursor + selection.CharRight(true); // reset to origin + if (!IsSuperfluousCharacter(keyword)) { + // move the selection to the start of the word + selection.WordLeft(true); + selection.MoveToPoint(selection.TopPoint); + } + } + selection.WordRight(true); // select the word + keyword = selection.Text; // get the selected text + selection.MoveToLineAndOffset(line, offset); // reset + } else { + keyword = selection.Text; + } + + keyword = keyword.Trim(); + if (keyword.Length <= 1 || IsSuperfluousCharacter(keyword)) + return; // suppress single character, operators etc... + + var qtVersion = "$(DefaultQtVersion)"; + var project = HelperFunctions.GetSelectedQtProject(dte); + if (project == null) { + project = HelperFunctions.GetSelectedProject(dte); + if (project != null && HelperFunctions.IsQMakeProject(project)) { + var qmakeQtDir = HelperFunctions.GetQtDirFromQMakeProject(project); + qtVersion = QtVersionManager.The().GetQtVersionFromInstallDir(qmakeQtDir); + } + } else { + qtVersion = QtVersionManager.The().GetProjectQtVersion(project); + } + + var docPath = QtVersionManager.The().GetVersionInfo(qtVersion).QtInstallDocs; + if (string.IsNullOrEmpty(docPath) || !Directory.Exists(docPath)) + return; + + var qchFiles = Directory.GetFiles(docPath, "*?.qch"); + if (qchFiles.Length == 0) + return; + + var settingsManager = new ShellSettingsManager(QtHelpMenu.Instance.ServiceProvider); + var store = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings); + var offline = store.GetBoolean(QtVsToolsHelpPreferencePath, "Offline", true); + + var linksForKeyword = string.Format("SELECT d.Title, f.Name, e.Name, " + + "d.Name, a.Anchor FROM IndexTable a, FileNameTable d, FolderTable e, " + + "NamespaceTable f WHERE a.FileId=d.FileId AND d.FolderId=e.Id AND " + + "a.NamespaceId=f.Id AND a.Name='{0}'", keyword); + + var links = new Dictionary<string, string>(); + var builder = new SQLiteConnectionStringBuilder + { + ReadOnly = true + }; + foreach (var file in qchFiles) { + builder.DataSource = file; + using (var connection = new SQLiteConnection(builder.ToString())) { + connection.Open(); + using (var command = new SQLiteCommand(linksForKeyword, connection)) { + using (var reader = await command.ExecuteReaderAsync()) { + while (reader.Read()) { + var title = GetString(reader, 0); + if (string.IsNullOrWhiteSpace(title)) + title = keyword + ':' + GetString(reader, 3); + var path = string.Empty; + if (offline) { + path = "file:///" + Path.Combine(docPath, + GetString(reader, 2), GetString(reader, 3)); + } else { + path = "https://" + Path.Combine("doc.qt.io", "qt-5", + GetString(reader, 3)); + } + if (!string.IsNullOrWhiteSpace(GetString(reader, 4))) + path += "#" + GetString(reader, 4); + links.Add(title, path); + } + } + } + } + } + + var uri = string.Empty; + switch (links.Values.Count) { + case 0: + if (!offline) { + uri = new UriBuilder("http://doc.qt.io/qt-5/search-results.html") + { + Query = "q=" + keyword + }.ToString(); + } + break; + case 1: + uri = links.First().Value; + break; + default: + var dialog = new QtHelpLinkChooser + { + Links = links, + Keyword = keyword, + ShowInTaskbar = false + }; + if (!dialog.ShowModal().GetValueOrDefault()) + return; + uri = dialog.Link; + break; + } + + if (string.IsNullOrEmpty(uri)) { // offline mode without a single search hit + VsShellUtilities.ShowMessageBox(QtHelpMenu.Instance.ServiceProvider, + "Your search - " + keyword + " - did not match any documents.", + string.Empty, OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, + OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); + } else { + VsShellUtilities.OpenSystemBrowser(HelperFunctions.ChangePathFormat(uri)); + } + } catch { } + } + + void ExecHandler(object sender, EventArgs e) + { + var command = sender as OleMenuCommand; + if (command == null) + return; + + var settingsManager = new ShellSettingsManager(ServiceProvider); + var store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); + store.CreateCollection(QtVsToolsHelpPreferencePath); + + var value = command.CommandID.ID == OfflineDocumentationId; + store.SetBoolean(QtVsToolsHelpPreferencePath, "Offline", value); + } + + void BeforeQueryStatus(object sender, EventArgs e) + { + var command = sender as OleMenuCommand; + if (command == null) + return; + + var settingsManager = new ShellSettingsManager(ServiceProvider); + var store = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings); + + switch (command.CommandID.ID) { + case OnlineDocumentationId: + command.Checked = !store.GetBoolean(QtVsToolsHelpPreferencePath, "Offline", true); + break; + case OfflineDocumentationId: + command.Checked = store.GetBoolean(QtVsToolsHelpPreferencePath, "Offline", true); + break; + } + } + } +} diff --git a/src/qtvstools/QtMenus.vsct b/src/qtvstools/QtMenus.vsct index 8d45c82d..8857c474 100644 --- a/src/qtvstools/QtMenus.vsct +++ b/src/qtvstools/QtMenus.vsct @@ -55,6 +55,9 @@ <!-- This header contains the command ids for the menus provided by the shell. --> <Extern href="vsshlids.h"/> + <!-- Include the definitions for images included in the VS image catalog --> + <Include href="KnownImageIds.vsct"/> + <!-- The Commands section is where commands, menus, and menu groups are defined. This section uses a Guid to identify the package that provides the command defined inside it. @@ -76,6 +79,13 @@ <ButtonText>Qt VS Tools</ButtonText> </Strings> </Menu> + + <Menu guid="HelpMenuGroupGuid" id="HelpMenuSubMenuId" priority="0x0700" type="Menu"> + <Parent guid="HelpMenuGroupGuid" id="HelpMenuGroupId" /> + <Strings> + <ButtonText>Set Qt Help Preference</ButtonText> + </Strings> + </Menu> </Menus> <!-- @@ -139,6 +149,14 @@ <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE" /> </Group> + <Group guid="HelpMenuGroupGuid" id="HelpMenuGroupId" priority="0x0600"> + <Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_HELP"/> + </Group> + + <Group guid="HelpMenuGroupGuid" id="HelpMenuSubGroupId" priority="0x0600"> + <Parent guid="HelpMenuGroupGuid" id="HelpMenuSubMenuId"/> + </Group> + </Groups> <!-- @@ -431,6 +449,38 @@ <!-- Endregion Item context menu buttons --> + <Button guid="HelpMenuGroupGuid" id="F1QtHelpId" priority="0x0100" type="Button"> + <Parent guid="HelpMenuGroupGuid" id="HelpMenuGroupId" /> + <CommandFlag>DefaultInvisible</CommandFlag> + <Strings> + <ButtonText>F1 Qt Help</ButtonText> + </Strings> + </Button> + + <Button guid="HelpMenuGroupGuid" id="ViewQtHelpId" priority="0x0100" type="Button"> + <Parent guid="HelpMenuGroupGuid" id="HelpMenuGroupId" /> + <Icon guid="MenuImages" id="QtLogoBitmap" /> + <Strings> + <ButtonText>View Qt Help</ButtonText> + </Strings> + </Button> + + <Button guid="HelpMenuGroupGuid" id="OnlineDocumentationId" priority="0x0100" type="Button"> + <Parent guid="HelpMenuGroupGuid" id="HelpMenuSubGroupId" /> + <CommandFlag>DefaultDisabled</CommandFlag> + <Strings> + <ButtonText>Use Online Documentation</ButtonText> + </Strings> + </Button> + + <Button guid="HelpMenuGroupGuid" id="OfflineDocumentationId" priority="0x0100" type="Button"> + <Parent guid="HelpMenuGroupGuid" id="HelpMenuSubGroupId" /> + <CommandFlag>DefaultDisabled</CommandFlag> + <Strings> + <ButtonText>Use Offline Documentation</ButtonText> + </Strings> + </Button> + </Buttons> <!-- The bitmaps section is used to define the bitmaps that are used for the commands. --> @@ -534,6 +584,18 @@ </GuidSymbol> + <GuidSymbol name="HelpMenuGroupGuid" value="{fc6244f9-ec84-4370-a59c-b009b2eafd1b}"> + + <IDSymbol name="HelpMenuGroupId" value="0x1040" /> + <IDSymbol name="HelpMenuSubMenuId" value="0x1050" /> + <IDSymbol name="HelpMenuSubGroupId" value="0x1060" /> + <IDSymbol name="F1QtHelpId" value="0x0100" /> + <IDSymbol name="ViewQtHelpId" value="0x0101" /> + <IDSymbol name="OnlineDocumentationId" value="0x0102" /> + <IDSymbol name="OfflineDocumentationId" value="0x0103" /> + + </GuidSymbol> + <GuidSymbol name="MenuImages" value="{d7cf9f1c-0f37-4609-8eb3-72589dc5a5ec}" > <IDSymbol name="LaunchDesignerBitmap" value="1" /> <IDSymbol name="LaunchLinguistBitmap" value="2" /> @@ -560,4 +622,8 @@ <VisibilityItem guid="SolutionContextMenuGuid" id="ChangeSolutionQtVersionId" context="UICONTEXT_SolutionHasMultipleProjects" /> </VisibilityConstraints> + + <KeyBindings> + <KeyBinding guid="HelpMenuGroupGuid" id="F1QtHelpId" key1="VK_F1" mod1="ALT" editor="guidVSStd97" /> + </KeyBindings> </CommandTable> diff --git a/src/qtvstools/QtVsTools.csproj b/src/qtvstools/QtVsTools.csproj index 1df4b66f..7f2ccd69 100644 --- a/src/qtvstools/QtVsTools.csproj +++ b/src/qtvstools/QtVsTools.csproj @@ -45,14 +45,15 @@ <RunCodeAnalysis>true</RunCodeAnalysis> </PropertyGroup> <ItemGroup> - <Compile Include="DefaultEditorsHandler.cs" /> - <Compile Include="DteEventsHandler.cs" /> <Compile Include="AddQtVersionDialog.cs"> <SubType>Form</SubType> </Compile> <Compile Include="AddTranslationDialog.cs"> <SubType>Form</SubType> </Compile> + <Compile Include="DefaultEditorsClient.cs" /> + <Compile Include="DefaultEditorsHandler.cs" /> + <Compile Include="DteEventsHandler.cs" /> <Compile Include="ExtLoader.cs" /> <Compile Include="FormChangeQtVersion.cs"> <SubType>Form</SubType> @@ -75,6 +76,10 @@ <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="QMakeWrapper.cs" /> <Compile Include="QtDefaultEditorsHelper.cs" /> + <Compile Include="QtHelpLinkChooser.xaml.cs"> + <DependentUpon>QtHelpLinkChooser.xaml</DependentUpon> + </Compile> + <Compile Include="QtHelpMenu.cs" /> <Compile Include="QtItemContextMenu.cs" /> <Compile Include="QtMainMenu.cs" /> <Compile Include="QtProjectContextMenu.cs" /> @@ -84,26 +89,36 @@ <SubType>Form</SubType> </Compile> <Compile Include="ResClass.cs" /> - <Compile Include="DefaultEditorsClient.cs" /> <Compile Include="Translation.cs" /> <Compile Include="Vsix.cs" /> <Compile Include="VSQtSettings.cs" /> </ItemGroup> <ItemGroup> - <Content Include="..\..\LICENSE.GPL3-EXCEPT"> - <Link>LICENSE.GPL3-EXCEPT</Link> + <Content Include="..\..\Changelog"> + <Link>Changelog</Link> <CopyToOutputDirectory>Always</CopyToOutputDirectory> <IncludeInVSIX>true</IncludeInVSIX> </Content> - <Content Include="..\..\Changelog"> - <Link>Changelog</Link> + <Content Include="..\..\LICENSE.GPL3-EXCEPT"> + <Link>LICENSE.GPL3-EXCEPT</Link> <CopyToOutputDirectory>Always</CopyToOutputDirectory> <IncludeInVSIX>true</IncludeInVSIX> </Content> + <None Include="packages.config" /> <None Include="source.extension.vsixmanifest"> </None> </ItemGroup> <ItemGroup> + <Content Include="..\packages\System.Data.SQLite.Core.1.0.102.0\build\net45\x64\SQLite.Interop.dll"> + <Link>x64\SQLite.Interop.dll</Link> + <IncludeInVSIX>true</IncludeInVSIX> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="..\packages\System.Data.SQLite.Core.1.0.102.0\build\net45\x86\SQLite.Interop.dll"> + <Link>x86\SQLite.Interop.dll</Link> + <IncludeInVSIX>true</IncludeInVSIX> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> <Content Include="..\qtvisualizer\qt5.natvis"> <Link>Visualizer\qt5.natvis</Link> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -248,6 +263,19 @@ <IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly> </ProjectReference> </ItemGroup> + <ItemGroup> + <Reference Include="System.Data" /> + <Reference Include="System.Data.SQLite, Version=1.0.102.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Data.SQLite.Core.1.0.102.0\lib\net45\System.Data.SQLite.dll</HintPath> + <Private>True</Private> + </Reference> + </ItemGroup> + <ItemGroup> + <Page Include="QtHelpLinkChooser.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="..\VS2013.References.targets" Condition=" '$(VisualStudioVersion)' == '12.0' " /> <Import Project="..\VS2015.References.targets" Condition=" '$(VisualStudioVersion)' == '14.0' " /> @@ -274,4 +302,11 @@ <Exec Command="$(QtArchiveGen) source=$(QMakeFileReader) target=$(TargetDir)\$(TargetName).vsix" /> <Message Text="Completed post build target for $(ProjectName)." Importance="high" /> </Target> + <Import Project="..\packages\System.Data.SQLite.Core.1.0.102.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.102.0\build\net45\System.Data.SQLite.Core.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.102.0\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.102.0\build\net45\System.Data.SQLite.Core.targets'))" /> + </Target> </Project>
\ No newline at end of file diff --git a/src/qtvstools/Vsix.cs b/src/qtvstools/Vsix.cs index 35bae720..f4aa8601 100644 --- a/src/qtvstools/Vsix.cs +++ b/src/qtvstools/Vsix.cs @@ -137,6 +137,7 @@ namespace QtVsTools QtProjectContextMenu.Initialize(this); QtItemContextMenu.Initialize(this); DefaultEditorsHandler.Initialize(Dte); + QtHelpMenu.Initialize(this); try { UpdateDefaultEditors(Mode.Startup); diff --git a/src/qtvstools/packages.config b/src/qtvstools/packages.config new file mode 100644 index 00000000..33ddd19a --- /dev/null +++ b/src/qtvstools/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="System.Data.SQLite.Core" version="1.0.102.0" targetFramework="net45" /> +</packages>
\ No newline at end of file diff --git a/src/qtvstools/source.extension.vsixmanifest b/src/qtvstools/source.extension.vsixmanifest index 5c8b95ba..636c7f61 100644 --- a/src/qtvstools/source.extension.vsixmanifest +++ b/src/qtvstools/source.extension.vsixmanifest @@ -61,5 +61,13 @@ <Asset Type="Microsoft.VisualStudio.ItemTemplate" d:Source="Project" d:ProjectName="MainWindow" d:TargetPath="|MainWindow;TemplateProjectOutputGroup|" Path="ItemTemplates" d:VsixSubPath="ItemTemplates" /> <Asset Type="Microsoft.VisualStudio.ItemTemplate" d:Source="Project" d:ProjectName="Widget" d:TargetPath="|Widget;TemplateProjectOutputGroup|" Path="ItemTemplates" d:VsixSubPath="ItemTemplates" /> <Asset Type="NativeVisualizer" d:Source="File" Path="Visualizer\qt5.natvis" /> - </Assets> + <Asset Type="File" + d:Source="File" + Path="x64\SQLite.Interop.dll" + d:VsixSubPath="x64" /> + <Asset Type="file" + d:Source="File" + Path="x86\SQLite.Interop.dll" + d:VsixSubPath="x86" /> + </Assets> </PackageManifest> |