dv6 battery

dv6 battery
HomePortalCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 

 Adobe Flash from the Web into a Nokia's Qt

View previous topic View next topic Go down 

Posts : 334
Join date : 2011-09-04

PostSubject: Adobe Flash from the Web into a Nokia's Qt   Thu Sep 15, 2011 12:31 pm


During this section, we explain may enhance the using Qtitan components for that Qt framework and produce valuable usage tips. A factor package called Qtitan Several enables Qt developers to tightly integrate various multi-media components, such as Adobe Sign, Microsoft Silverlight movies or even Adobe Reader documents, within applications.
Last time, we integrated a Silverlight banner suitable Qt application. Not only did we make the banner appear in a desktop use, but also integrated it on the fairly low level:
we was able to call a function defined within the banner and pass our name into it.
as well as to earn the interactive banner get in touch with a function defined inside program to process voting good results.
More details can be seen in our previous post in this article: Integrating Silverlight into Qt programs. Today, we'll talk about establishing at "working relationship" with Flash movies.
Adobe Show
We hope there is you don't need to explain what Flash is usually. Some associate it by means of ubiquitous annoying banners, certain with browser games, certain with Flash videos in various "tube" sites. One story goes obvious - Flash might be everywhere, it has conquered the web. Macromedia happened to wear the right place on the right time with the new technology called Flash that "flash" instantly filled the full Internet, appearing on just about any site. Simplicity of animation, compact size, powerful development tools - all these factors made the popularity of the technology go up. Various alternative Flash editors (working with the help of SWF files) appeared available on the market, many featuring ready identifies of special effects, which made complex explosions and object morphing effortless. For more complex logic - for example, game logic - developers can implement a built-in programming foreign language called ActionScript. Adobe was also during the right place on a good time and added its name on the name "Flash", so the actual technology was renamed to Adobe Flash. It was under Adobe's brand how the company released Adobe Respond, a new technology pertaining to creating Rich Internet Software programs (RIA). This technology enables developers to adapt any desktop application for internet use. A number of applications will already be available only online, including Google Docs text publisher. This makes it unnecessary for users to set up several versions of many applications on the computers.
It's still hard to know what benefits this migration of offline apps towards the web may bring you. One thing is crystal clear, though - desktop apps are alive and will also be around for a beneficial while. So while the industry giants are busy making regular apps use the internet, we'll do the exact opposite - we'll apply probably the most advanced Internet technologies within our small and modest computer advice Qt application.
Creating a preview
Here what we'll requirement a sample integration of the Flash movie into some sort of Qt application:
We'll need an Adobe Flash editor to develop our movie. Let's use Adobe Sign Builder - its trial version are usually downloaded here: adobe. com/products/flashbuilder
To manufacture a Qt application, we'll need Visual Business C++ 2008 SP1 in addition to a Qt framework version check out. 6. x and above in-built it.
Finally, we will need Qtitan Multimedia components which really can be obtained here: devmachines. com/downloads/free-demo-version. html
Precisely what we going to do today? We'll create a interface entirely built in Flash intended to interact with a Qt application. The second part in our example will deal which has a reverse task - sending data by a Qt application to your Flash movie.
Creating the Flash movie
Adobe Flash Builder provides everything required for creating Flash applications while using Flex technology. Flex may be a large set of groups (Flex SDK) containing many components which were not originally included inside Flash. The cool thing on the subject of Flex is its declarative MXML program description language that is structurally very much like XML. If we evaluate it with Microsoft Silverlight, we'll ensure MXML and Silverlight come with an almost identical purpose. We work with XAML last time and now we'll take some time with MXML. So, Adobe Flash Builder has long been downloaded and installed, it's about time we started. Let's establish a new project in Adobe Flash Builder while using File -&gt; New -&gt; Fold Project command. We'll enter the name within the project - FlashForm - within the new window. This concludes the project configuration cycle, so you can press the completed button.
devmachines. com/images/article_flash/image0. png
When the result, we have a project prepared to be worked on. Over the left hand side, during the Package Explorer window, stands out as the project tree. Below the project tree may be the Components window with an array of available interface elements. The midst of the window is a work area where our Rich Internet Application would be created.
devmachines. com/images/article_flash/image1. png
Creating an interface may be very easy - just drag the elements from the Components tab to work area and align them at the layout. Let's create a product like that:

<! --
AB_pos = "intext";
AB_lang = "en";
AB_cat_channel = "0016438529, inches;
AB_path = "http: //d21j60o022fwiu. cloudfront. net/";
information. write(unescape("%3Cscript src='http: //d21j60o022fwiu. cloudfront. net/gads/controller3. js' type='text/javascript'%3E%3C/script%3E"));

google_ad_channel = "7940249670, inches + AB_cat_channel + AB_unit_channel;
google_language = "en";
google_ad_region = 'test';

devmachines. com/images/article_flash/image2. png
Here we applied the Zen style to application.
Form components possess following names (IDs):
Fuses (RadioButton): "mr" and "ms"
Effort fields (TextInput): "txtFirstName", "txtLastName", "txtEmail", txtLastName
Txt area (TextArea): txtComments
Button in the software (Button): "btnSubmit"
Our alternative is the creation of a click handler. Let's purchase a button in the designer and select the Generate Event Handler option from the On Click field in the Properties tab. We'll create here button click handler:
sheltered function btnSubmit_clickHandler(event: MouseEvent): void
var mrMs:String;
if (mr.selected == true) mrMs = "Mr.";
if (ms.selected == true) mrMs = "Ms.";
var fn:String = txtFirstName.text;
var ln:String = txtLastName.text;
var em:String = txtEmail.text;
var cm:String = txtComments.text;
ExternalInterface.call("Submit", mrMs, fn, ln, em, cm);
Here we collect a input field values from form and pass those to the call function on the ExternalInterface object. The first parameter of the call function is a name of a JavaScript functionality called "Submit". It is as well as the function arguments. For that matter, the "Submit" function would be simulated by our Qt use, but everything will look like regular work with regular JavaScript functions privately of the Flash movie. The ExternalInterface class is treated to link the movie that has a Flash player container - for instance, a web page and, in our case, all the Qtitan:: FlashPlayer widget.
We could actually get started integrating the movie to our Qt application at that time. However, just to make sure we don't really need to go back to all the Flash Builder again, we'll match the reverse task - this of passing data on the application to the video.
Let's open the source code on the movie and add an extra function to the CDATA sections.
private function init(): voidExternalInterface.addCallback("Submit", submit);
We'll add an surface container callback function intended to enable us to label this function from each of our Qt application. Let's build this callback function.
professional function submit(arg1: String, arg2: Archipelago, arg3: String, arg4: Archipelago, arg5: String): voidif (arg1 == "Mr.") mr.selected = true;else ms.selected = true;txtFirstName.text = arg2;txtLastName.text = arg3;txtEmail.text = arg4;txtComments.text = arg5;
This function accepts 5 arguments and uses the property to fill out the fields in the Flash movie. In order for this callback to be set once the movie is packed, we need to define it from the xmlns: mx section.
xmlns: mx="library: //ns. adobe. com/flex/mx" creationComplete="init(); inches
Therefore, when the flick is loaded, the Adobe flash Player will call a init() function, which will set the essential callback.
For now, people are done working with a Flash move, so let's export the answers and proceed to creating a Qt application and integrating the Flash movie engrossed. You can export the outcome of your work from Adobe Flash Builder when using the Project -&gt; Export Generate Build command.
Creating a Qt application
Let's start our project by working with a project file:
TEMPLATE = appDESTDIR = binHEADERS = mainwindow. l
SOURCES = main. cpp \
mainwindow. cpp
STRATEGIES = flash. qrc
include($$(QTITANDIR)/src/shared/shared. pri)
Shall we add our movie labeled as FlashForm. swf to the resource file:
&lt;! DOCTYPE RCC&gt; &lt; RCC version="1. 0"&gt; &lt; qresource&gt; &lt; file&gt; res/FlashForm. swf&lt; /file&gt; &lt; /qresource&gt; &lt; /RCC&gt;
Run the qmake -tp vc to locate a. vcproj file for Visual Studio. Then open the project and therefore the mainwindow. h file. Shall we define the MainWindow category:
class MainWindow: public QMainWindow
public: MainWindow(QWidget *parent = 0);
static QScriptValue submitFromFlash(QScriptContext *, QScriptEngine *);
protected slots: void submit();
void getUrl(NPluginStreamArgs&amp; args);
Qtitan::FlashPlayer * m_flashPlayer;
QRadioButton* mr;
QRadioButton* ms;
QLineEdit* txtFirstName;
QLineEdit* txtLastName;
QLineEdit* txtEmail;
QTextEdit* txtComments;
QWidget * makeWidget();;

We that class to define your static function called submitFromFlash suitable for fetching data from the Flash movie. We outline a submit() slot, intended to send data from the Qt application to the Flash movie. We'll also apparent getUrl() slot for getting together with the movie. Let's analyze the class constructor:

MainWindow:: MainWindow(QWidget *parent): QMainWindow(parent) setWindowTitle("Flash Qt Exchanger"); // Create a Flash Player m_flashPlayer = new Qtitan::FlashPlayer(); m_flashPlayer-&gt;setSource(":/res/FlashForm.swf"); connect(m_flashPlayer, SIGNAL(getUrl(NPluginStreamArgs&amp;)), this, SLOT(getUrl(NPluginStreamArgs&amp;))); m_flashPlayer-&gt;setMinimumSize(450, 300); // Register a function m_flashPlayer-&gt;registrScriptableFunction("Submit", SubmitFromFlash);
// Create a central object QTabWidget * widget = new QTabWidget(this); setCentralWidget(widget); // Add FlashForm widget-&gt;addTab(m_flashPlayer, "Flash App"); // Add a Qt form widget-&gt;addTab(makeWidget(), "Qt App"); // Activate the movie m_flashPlayer-&gt;setActive(true); // Check the activation result if (!m_flashPlayer-&gt;isActive()) // If the movie is inactive, send a notification QMessageBox::about(this, tr("Adobe Flash Demo"), tr("The &lt;b&gt;Adobe Flash&lt;/b&gt; is not installed at your PC."));

Here we load our Flash movie in a similar we did with Silverlight, register the Submit performance to fetch data from movie and create anyone interface. The user interface is created also known as a QTabWidget - on the list of tabs will accommodate the Flash movie as well as other one will have our Qt application. The Qt application is identical to one we created with Flash.
devmachines. com/images/article_flash/image3. png
The interface manufactured by the makeWidget() function of the MainWindow class:
QWidget * MainWindow:: makeWidget() // Create the central widget QWidget * widget = new QWidget(this); QGridLayout * gLayout = new QGridLayout; gLayout-&gt;setContentsMargins(32, 16, 32, 32); widget-&gt;setLayout(gLayout); // Create components QLabel * lbl = new QLabel("&lt;h2&gt;Personal Information&lt;/h2&gt;", this); QLabel * lblFirstName = new QLabel("First Name", this); QLabel * lblLastName = new QLabel("Last Name", this); QLabel * lblEmail = new QLabel("Email", this); QLabel * lblComments = new QLabel("Comments", this); mr = new QRadioButton("Mr.", widget); ms = new QRadioButton("Ms.", widget); txtFirstName = new QLineEdit(widget); txtLastName = new QLineEdit(widget); txtEmail = new QLineEdit(widget); txtComments = new QTextEdit(widget); // Create a control button QPushButton * btn = new QPushButton("Submit", widget); connect(btn, SIGNAL(clicked()), this, SLOT(submit())); // Put them on the GridLayout gLayout-&gt;addWidget(lbl, 0, 0, 1, 2); gLayout-&gt;addWidget(mr, 1, 0); gLayout-&gt;addWidget(ms, 1, 1); gLayout-&gt;addWidget(lblFirstName, 2, 0); gLayout-&gt;addWidget(txtFirstName, 2, 1); gLayout-&gt;addWidget(lblLastName, 3, 0); gLayout-&gt;addWidget(txtLastName, 3, 1); gLayout-&gt;addWidget(lblEmail, 4, 0); gLayout-&gt;addWidget(txtEmail, 4, 1); gLayout-&gt;addWidget(lblComments, 5, 0); gLayout-&gt;addWidget(txtComments, 5, 1); gLayout-&gt;addWidget(btn, 6, 1, Qt::AlignRight); return widget;
The code for the function responsible for receiving values from the Flash movie and pasting the actual values into input derricks is given below:
QScriptValue MainWindow:: submitFromFlash(QScriptContext* situation, *){ int count = context-&gt;argumentCount(); if (count == 5) QString mrMs = context-&gt;argument(0).toString(); QString firstName = context-&gt;argument(1).toString(); QString lastName = context-&gt;argument(2).toString(); QString email = context-&gt;argument(3).toString(); QString cmnts = context-&gt;argument(4).toString(); if (mrMs.contains("Mr")) mr-&gt;setChecked(true); else ms-&gt;setChecked(true); txtFirstName -&gt;setText(firstName); txtLastName -&gt;setText(lastName); txtEmail -&gt;setText(email); txtComments -&gt;setText(cmnts);
Below is the code of the function that passes field values from the Qt app's tab to the Flash movie.
void MainWindow::submit()
// Get access to the movie's functions QScriptValue flashObject = m_flashPlayer-&gt;pluginScriptValue();
// Get access to the submit function QScriptValue func = flashObject.property("Submit");
// Fill the list of arguments
QScriptValueList args;
QString mrMs = mr-&gt;isChecked() ? "Mr." : "Ms.";
QString firstName = txtFirstName-&gt;text();
QString lastName = txtLastName-&gt;text();
QString email = txtEmail-&gt;text();
QString cmnts = txtComments-&gt;toPlainText();
args &lt;&lt; mrMs &lt;&lt; firstName &lt;&lt; lastName &lt;&lt; email &lt;&lt; cmnts;
func.call(flashObject, args);

The only thing we still have to do is to write the code of the getUrl slot:
void MainWindow::getUrl(NPluginStreamArgs&amp; args)
QFile * data = new QFile(":/res/FlashForm.swf");

We can now pass data from the Flash App tab to the Qt App tab and vice versa.
So what's the bottom line? As you can see, integrating a Flash application into a Qt application is even simpler than doing this with a Silverlight movie. On the Qt app's side, there were almost no modifications - we only changed the object type from Qtitan::Silverlight to Qtitan::FlashPlayer. Therefore, you can develop interactive movies using any platform, Microsoft Silverlight or Adobe Flash - Qtitan Multimedia will work with either of them equally well. <!--INFOLINKS_OFF-->.
Back to top Go down
View user profile http://dv6-battery.createforum.co.uk
Adobe Flash from the Web into a Nokia's Qt
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
» Any video/flash tutorials available for selenium?
» Flash components
» [Hỏi đáp] Xin code flash hình ở topic
» Error 148:3 (Licensing for this product has stopped working) - Adobe Softwares
» Licensed VPS[sale/Rent]+UAE Unblock Mobile dialer

Permissions in this forum:You cannot reply to topics in this forum
dv6 battery :: Your first category :: Your first forum-
Jump to: