How to change SOME/IP configuration file in Qt creator? - qt-creator

I'm trying to build someip UI in Qt creator to display client-side log in the UI based on https://github.com/COVESA/vsomeip/wiki/vsomeip-in-10-minutes.
Basicly I just ported request-sample.cpp into mainwindow.h and add a button to call init() and start(), then log will shown on testBrowser.
void MainWindow::on_pushButton_clicked() {
bool use_tcp = false;
uint32_t cycle = 1000;
sample_ptr = new client_sample(use_tcp, false, cycle);
sample_ptr->start();
My question is I want to change default configuration file, say change vsomeip.json to vsomeip-udp-client.json, but I don't know how to approach this.
From my understanding, the following method in https://github.com/COVESA/vsomeip/blob/master/documentation/vsomeipUserGuide will run ./my_vsomeip_application and show log on terminal. Is there a way to change default configuration file in Qt creator, so the log can display in UI?
[source, bash]
----
#!/bin/bash
export VSOMEIP_APPLICATION_NAME=my_vsomeip_client
export VSOMEIP_CONFIGURATION=my_settings.json
./my_vsomeip_application
----
Any suggestions are appreciated!

Related

Safari (Host App) give selected text to App Extension?

Possible to get a text selection out from safari (host app)to an app extension, or only the URL?
Yes this is possible. You can create a JavaScript file as part of your Action Extension. This is described in the documentation since you also have to add a NSExtensionJavaScriptPreprocessingFile key to your extension's Info.plist.
Inside the JavaScript file you can define a run function which allows you to define values to pass to your native extension code. Here you can get the selected text as shown in other questions and pass this through to your extension.
Here's a quick example of how this might work on the JavaScript side:
var MyExtensionJavaScriptClass = function() {};
MyExtensionJavaScriptClass.prototype = {
run: function(arguments) {
// Pass the selected text through
arguments.completionFunction({"text": window.getSelection().toString()});
}
};
// The JavaScript file must contain a global object named "ExtensionPreprocessingJS".
var ExtensionPreprocessingJS = new MyExtensionJavaScriptClass;

How to retrive the data displayed in Message box for Coded Ui testing

Scenario: After clicking on the submit button,a message box appears with the ticket number. I want to save the ticket number to a string parameter for future purposes. Is it possible in Coded Ui?
Use the Assertion tool to select the textbox and name it "CaptureText()" (Do this to use the tool to capture the object). Once you've done this, transfer the code from the UIMap Designer File to the Coded File. Inside your Coded UIMap File you should see something like this:
public void CaptureText()
{
HtmlCustom uIItemCustom = this.Window.Foo.Bar.UIItem;
//Comment this out
//Assert.IsNull(uIItemCustom);
//Change it to
var foo = uIItemCustom.InnerText;
}
Now the 'foo' variable contains the value of the label / textbox.

Disable Print button in HtmlHelp

I'm performing maintenance on a legacy MFC application. We have a need to disable the Print button in the Help dialog. There is no printer connected to the system and the application crashes if the user presses the Print button in the help window.
The code just uses the standard HtmlHelpA method to bring up the Windows Help dialog:
void CNiftyView::OnHelp()
{
CString csHelpFile;
csHelpFile.Format( "%s/NiftyHelp.chm", NiftyDoc::GetHelpPath() );
::HtmlHelpA( m_hWnd, csHelpFile, HH_HELP_CONTEXT, IDH_NIFTY_SECTION );
}
I've found information that we can suppress the Print button with some code in the Help HTML stylesheet (http://www.sagehill.net/docbookxsl/HtmlHelp.html). But that would require recompiling the help file, and I'd prefer to not do that. I also found some information that says you can customize the HTML Help Viewer by manipulating each pane's HH_WINTYPE structure, but no information on how you actually do that (http://msdn.microsoft.com/en-us/library/ms524435%28v=vs.85%29.aspx).
Is there some way to disable that Print button in the HTML Help viewer programatically?
You can display your CHM help file without the Print button as follows:
Call HtmlHelp with the HH_GET_WIN_TYPE command to get a pointer to a HH_WINTYPE structure containing the HTML Help Viewer parameters defined in your CHM file.
Copy the returned structure. (Modifying the returned structure directly won't work.)
Modify the fsToolBarFlags member of the structure to exclude the HHWIN_BUTTON_PRINT value.
Pass the modified HH_WINTYPE structure back to the HtmlHelp function using the HH_SET_WIN_TYPE command.
Example C++ code*:
HH_WINTYPE *pwt = NULL;
LPCWSTR pszFile = L"MyFile.chm";
LPCWSTR pszWin = L"MyFile.chm>Main"; // "Main" is the window type defined in the CHM file
// Get the window type definition
HWND hWndHelp = HtmlHelp(NULL, pszWin, HH_GET_WIN_TYPE, (DWORD) &pwt);
if (pwt) {
// Copy the contents of the returned structure
HH_WINTYPE wt = *pwt;
// Remove the "Print" toolbar button from the window definition
wt.fsToolBarFlags &= ~HHWIN_BUTTON_PRINT;
wt.cbStruct = sizeof(wt); // force the correct size
// Set the new window type
hWndHelp = HtmlHelp(NULL, pszFile, HH_SET_WIN_TYPE, (DWORD) &wt);
// Display help
hWndHelp = HtmlHelp(NULL, pszFile, HH_DISPLAY_TOPIC, NULL);
}
I almost don't know C++, so it's very amateur code. Please fell free to edit and improve it.
More examples of using HH_WINTYPE, HH_GET_WIN_TYPE and HH_SET_WIN_TYPE:
How To Programmatically Create a Tri-pane HTML Help Window
How to use the unmanaged HTML Help API from a managed Visual C# application

Embedded font from dynamically loaded swf not recognised

I am working on an application which needs to load fonts dynamically based upon the fonts used in a given document that the user opens. The fonts are used in a RichEditableTextControl so need to be CFF format.
If I add the code:
[Embed(source="/assets/fonts/AvenirLTStd Book.otf",
fontFamily="EmbedAvenir LT Std 45 Book",
mimeType="application/x-font",
embedAsCFF="true")]
public const embeddedFont:Class;
to the main SWF then the text displays correctly with the embedded font but moving the code to a separate file and adding a loader as per the information I found at the following link does not load the font - http://www.scottgmorgan.com/blog/index.php/2007/06/18/runtime-font-embedding-in-as3-there-is-no-need-to-embed-the-entire-fontset-anymore/
The loader code is:
private function loadFont(url:String):void {
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, fontLoaded);
loader.load(new URLRequest(url));
}
private function fontLoaded(event:Event):void {
var FontLibrary:Class = event.target.applicationDomain.getDefinition("FontAvenirLTStd") as Class;
Font.registerFont(FontLibrary.embeddedFont);
}
There is an error thrown at the Font.registerFont line to say that the parameter being passed cannot be null. I have checked in debug mode and the issue seems to be that the class exists but does not have any content. The FontLibrary class is instantiated but the only child entry in the debugger is _prototype so trying to access the embeddedFont property does return undefined.
At the moment the font SWF is in the assets folder of the main project so I don't believe there should be any security restrictions and, as I said, the SWF loading part appears to work.
One thing which is hampering my diagnostics is that I am not sure if the problem is the font SWF not being created correctly and having no content or if the main app is unable to load it. Any help on at least being able to narrow that down would be appreciated.
I would appreciate all the help I can get on this as I have been stuck at this problem for some time and it is a key part of the application.
Thanks in advance to everyone.
Just a quick note for anyone who ends up here from Google, the problem was that I had managed to lose the static keyword from the embeddedFont constant definition in the top block. It should have been public static const embeddedFont:Class;
Hope this helps someone.

Styling an extended TextBox control in Windows Phone 7

Totally new to custom control creation in Silverlight.
I'm wanting a custom control that inherits from a TextBox control. I've found plenty of tutorials but they all do something like watermarked text or other attached properties. My goal is only to manipulate text at time of entry using the KeyUp event, so visually my TextBox is no different from a standard TextBox.
I created a class file and inherited from TextBox, but at run-time the textbox doesn't display. From what I can gather I need a themes/generic.xaml file, but all of samples I've seen include styles for the additional properties, and in my ignorance I don't know what to change and/or remove.
I'm hoping someone can point me to a generic plain-jane TextBox style definition or a tutorial of such.
What you described should work, I just tried the following and the TextBoxEx renders just fine:
public class TextBoxEx : TextBox
{
protected override void OnKeyUp(KeyEventArgs e)
{
base.OnKeyUp(e);
}
}
You do not need to add a generic.xaml file. This file is used to provide a template which defines the look of your control. You specify the default look of your control by setting the following property:
DefaultStyleKey = typeof(MyControl);
However, as the above TextBoxEx does not set this property, it uses the value inherited from TextBox and hence it inherits the same template (i.e look).

Resources