Latest Google Gadget Specification: New Nexus 7

San Francisco – Google officially released its new gadget, New Nexus 7, in the show “Breakfast with Sundar Pichai”, Thursday, July 25, 2013. Sundar Pichai is the Senior Vice President of Google Chrome fields, Android, and Apps.

New Nexus 7 is still holding Taiwanese manufacturer Asus. Body New Nexus 2 millimeters thinner than his brother. Glossy casing. In terms of audio, now Nexus has dual stereo. Also two camera, 1.2 megapixel front and 5-megapixel rear. The size of the screen resolution is also encouraged so 1,920 x 1,200. In the 7-inch screen, the resolution makes the display reaches 323 ppi density, up from 216 ppi on old Nexus.

Offal New Nexus 77 also pretty wild. Cipnya made by Qualcomm, Snapdragon Pro 1.5 Ghz, 2 GB RAM. To connect an HDMI dilengkai slimport, Bluetooth version 4.0, NFC, dual-band Wi-Fi, and LTE high-speed Internet connection (for certain countries).

The New Nexus battery contents can dicas with wireless charging. But the battery capacity shrinks when compared to the previous generation, reaching 4,325 mAh battery. While the New Nexus just 3,950 mAh. Also lighter weight 50 grams. Screen is also thinner bezel.

Although the battery is more stingy, Google promises this gadget is more efficient because the new operating system, Android 4.3 Jelly Bean. Some new things that exist on the Android series of which could be used by the multiuser customize profile, Bluetooth smart, easiertext input, and fast user switching.

One prominent updates on new Nexus series is powered by the Open GL ES 3.0 is very indulgent games enthusiasts. In fact, to complete it, Google also create categories in the application market: Google Play Games.

Android 4.3 will be available starting today. Devices that can instantly update the Android is the Nexus series; Nexus 4, Nexus 7, Nexus 10, and the Galaxy Nexus. New Nexus will be available starting July 30, 2013 coming in a few countries. But Indonesia is not included. New Nexus 7 will be priced at U.S. $ 229 (16 GB + Wi-Fi), U.S. $ 269 (capacity 32 GB + Wi-Fi), and U.S. $ 349 (32GB + 4G).

Share Location, Google Maps Help Increase Accuracy

JAKARTA – Google recognizes that besutannya rudimentary mapping applications. Therefore, the company continues to update and even in this case involve the user. This was stated by Google Indonesia Country Head, Rudy Ramawy.

“That’s when you make the trip? Maybe it’s been accurate. That’s why we have never held a ‘grand launch’ of our products, because the company is aware of updates and updates to keep going” Rudy said while responding to thoughts about the accuracy of the crew Techno Okezone Google Maps in Jakarta , overnight.

“We are aware that our service is not completely perfect, but we continue to make updates. Indonesia with a wide geographical conditions is a challenge to deliver the best service,” he said.

Furthermore, Rudy said that if the Android-based smartphone users to enable or diligently perform ‘share location’, it was very helpful software giant to improve the accuracy of its services. “Of course in this case we appreciate aspects of secrecy,” said Rudy.

“If the big cities such as Jakarta, the accuracy of Google Maps can be relied upon. But if remote areas, we continue to provide the best possible experience. Many ways we are doing, Google Drive one of them,” said Rudy.

Meanwhile, following the Google Maps that can be accessed offline in a number of countries, Indonesia Google promised that the service would go in Indonesia, but companies are reluctant to disclose when exactly the service that can be enjoyed.

“A number of countries able to access Google Maps offline, and Indonesia are also included in the list will receive the service. Certainty but we do not know yet,” alluded Country Marketing Manager for Google Indonesia Krishna Zulkarnain.

Ultrabook Not Be Superhero?

Intel aggressively promote thin laptop “Ultrabook” which recently has begun equipped with a touch screen. Products “2-in-1 ‘was introduced, with various forms of” magic “that can be changed from laptop to tablet and vice versa.

But all of that as not enough to subvert the glory of Apple’s MacBook Air as the pioneer and the most sought after consumer thin laptops, at least for the U.S. market.

In Uncle Sam’s, as revealed by research agency NPD report cited by Cnet, controlled 56 percent of the MacBook Air slim laptop sales during the first five months of 2013.

The remaining 44 percent is divided between partners-manufacturers Intel Ultrabook.

The latest generation MacBook Air (model 2013) also received positive feedback thanks to the durability of the battery reaches a dozen hours and expected to help maintain the market dominance of these devices in a thin laptop.

It should be noted that the battery life of the MacBook Air in 2013 made ​​possible by the Core 4th Generation of Intel. Thus, the processor manufacturers also benefit from the success of the MacBook Air.

But stronghold Windows laptop was not keep silent. In last week’s Build conference, Microsoft CEO Steve Ballmer said that the hybrid device (2-in-1) with touch screen feature will eliminate the need to carry laptops and tablets separately.

On the other hand, Apple considers that the touchscreen is more suitable to be applied to the iPad than a laptop. Most consumers seem to agree.

Intel will offer ‘Broadwell’ SOC to battle Calxeda, AMD

Intel has updated its road map with a new, low-power server chip to help it ward off competition from Calxeda and other makers of low-power chips.

The new chip will be based on Broadwell, a microarchitecture to be introduced next year as the successor to Intel’s Haswell design. But this processor will be a system-on-chip, setting it apart from Intel’s other Xeon server products.

SOCs combine several components onto a single chip to reduce power consumption and space requirements. In the server market, they’re often used in micro-servers, a type of low-power server used for large-scale, online workloads.

Intel already offers SOCs in its Atom family of chips, but Atom has its own microarchitecture. The new chip announced Monday will be Intel’s first SOC that uses the same microarchitecture as its more powerful Xeon chips.

“With this new product, we’ll be delivering the best of both worlds: high performance and high density,” said Diane Bryant, general manager of Intel’s data center and connected systems group, at an Intel event in San Francisco.

She didn’t give a name for the new chip but said it will ship next year. It will be manufactured on a 14-nanometer process and include integrated I/O, networking, and application accelerators, Bryant said.

The chip essentially allows Intel to straddle the gap between its current Atom processors, which focus on low power consumption, and its Xeon processors, which are tuned for higher performance but use more electricity.

“They’re trying to cover the whole market. They’ve decided it’s better to have a little bit of overlap than to have any gaps,” said industry analyst Nathan Brookwood of Insight64.

The chip comes at a time of heightened competition in the server market. Rivals such as Calxeda and Advanced Micro Devices are building low-power SOCs using designs from UK chip architecture company ARM, and the new chip from Intel is its latest response to that trend.

Intel didn’t say on Monday if the new chip will be branded as a Xeon or an Atom. Its place between the two product lines could create some confusion for customers, Brookwood said, though he thinks Intel will eventually decide on Xeon.

It’s not the only chip Intel has for low-power servers. The company recently began shipping a Xeon E3 processor based on the Haswell core, and versions of that chip based on Broadwell are expected next year. They will be “general-purpose” Xeons, as opposed to SOCs specifically for low-power, high-density systems.

In its Atom family, Intel will begin shipping a new chip later this year code-named Avoton, based on a new chip core known as Silvermont. Compared with the current Atom core, Avoton will offer “a 3x improvement in power at the same performance level, or a 5x increase in performance at the same power,” according to Bryant.

Yahoo Acquires AdMovate To Increase Mobile Advertising

News about the acquisition of Yahoo is still a lot to buy the company from a small start-up like Summly to large and are known as Tumblr. Today Yahoo has officially announced that it has acquired AdMovate, a private company. AdMovate focus to the world of advertising on mobile devices, they develop a solution that will bring mobile advertising to the target behavior. AdMovate itself also has confirmed this news, but both Yahoo and AdMovate not want to inform the amount of the approved agreement.
Now a team of technicians will AdMovate integrated with Yahoo advertising display team, based in Silicon Valley. Yahoo said that the acquisition is part of their move to invest more in technology advertising platform, so it will be easier for agencies and advertisers purchase. Yahoo CEO Marissa Mayer has even said many times that the company they represent the future of the mobile world so fair they are trying hard to improve their mobile services.

NVidia Introduces World’s Fastest Graphics Card Quadro K6000

NVidia has just introduced its newest graphics card aimed at the visual computing industry and is claimed as the fastest graphics card in the world. K6000 Quadro graphics cards are built using Kepler architecture.

NVidia party also claims that this graphics card has the ability computational five times better than the Quadro 6000 graphics card before. Not only that, the graphics card is also claimed to have twice the graphical capabilities better than the Quadro 6000.

NVidia Senior VP, Ed Ellet said that this graphics card will give a significant change to the game animator, digital designer or programmer. Furthermore, Ellet said that the graphics card is capable of doing things that were previously impossible to do.

Some of the features possessed by the K6000 Quadro graphics cards are:

– The graphics memory GDDR5 ultra-fast 12GB
– Streaming 2880 core multiprocessor (SMX)
– Support for simultaneous display with a resolution up to 4k using DisplayPort 1.2
– It has ultra low latency video I / O, and support large-scale visualization

Mozilla Releases Firefox 22 with Support 3D Game, Video Call, and File Sharing

Mozilla has just released Firefox 22 browser with integrated support for 3D gaming, video calls, and file sharing. Thus, application developers can create applications that can run in the browser without the need to use third party plugins.
Firefox has aged 15 years, and according to vice president of Firefox Engineering, Johnathan Nightingale, the browser has changed in terms of how people use it. Browser applications have been the key to connect to the internet and used to locate information and software, and therefore the present browser must be built for the needs of people and how they use them more quickly.
Firefox 22 to wear a subset of JavaScript called asm.js through OdinMonkey to run 3D applications and processors directly from web.Untuk chat foro, Firefox 22 is added Web Real-Time Communications (WebRTC), which can be used both video calling application developers from PC or mobile browser. Mozilla has been expressed at the MWC in 2013 and this technology can be integrated seamlessly with mobile phones so that users can make voice calls and file sharing file. In addition to Firefox, Google also integrate it in the Chrome browser since October 2012 last year. One service that supports WebRTC is Tokbox.
To highlight the potential of this feature, Mozilla has made ​​a 3D game called BananaBread. This game utilizing WebRTC, asm.js, WebGL, and Emscripten.
via The Next Web

Seven signs of dysfunctional engineering teams

I’ve been listening to the audiobook of Heart of Darkness this week, read by Kenneth Branagh. It’s fantastic. It also reminds me of some jobs I’ve had in the past.

There’s a great passage in which Marlow requires rivets to repair a ship, but finds that none are available. This, in spite of the fact that the camp he left further upriver is drowning in them. That felt familiar. There’s also a famous passage involving a French warship that’s blindly firing its cannons into the jungles of Africa in hopes of hitting a native camp situated within. I’ve had that job as well. Hopefully I can help you avoid getting yourself into those situations.

There are several really good lists of common traits seen in well-functioning engineering organizations. Most recently, there’s Pamela Fox’s list of What to look for in a software engineering culture. More famous, but somewhat dated at this point, is Joel Spolsky’s Joel Test. I want to talk about signs of teams that you should avoid.

This list is partially inspired by Ralph Peters’ Spotting the Losers: Seven Signs of Non-Competitive States. Of course, such a list is useless if you can’t apply it at the crucial point, when you’re interviewing. I’ve tried to include questions to ask and clues to look for that reveal dysfunction that is deeply baked into an engineering culture.

Preference for process over tools. As engineering teams grow, there are many approaches to coordinating people’s work. Most of them are some combination of process and tools. Git is a tool that enables multiple people to work on the same code base efficiently (most of the time). A team may also design a process around Git — avoiding the use of remote branches, only pushing code that’s ready to deploy to the master branch, or requiring people to use local branches for all of their development. Healthy teams generally try to address their scaling problems with tools, not additional process. Processes are hard to turn into habits, hard to teach to new team members, and often evolve too slowly to keep pace with changing circumstances. Ask your interviewers what their release cycle is like. Ask them how many standing meetings they attend. Look at the company’s job listings, are they hiring a scrum master?

Excessive deference to the leader or worse, founder. Does the group rely on one person to make all of the decisions? Are people afraid to change code the founder wrote? Has the company seen a lot of turnover among the engineering leader’s direct reports? Ask your interviewers how often the company’s coding conventions change. Ask them how much code in the code base has never been rewritten. Ask them what the process is for proposing a change to the technology stack. I have a friend who worked at a growing company where nobody was allowed to introduce coding conventions or libraries that the founding VP of Engineering didn’t understand, even though he hardly wrote any code any more.

Unwillingness to confront technical debt. Do you want to walk into a situation where the team struggles to make progress because they’re coding around all of the hacks they haven’t had time to address? Worse, does the team see you as the person who’s going to clean up all of the messes they’ve been leaving behind? You need to find out whether the team cares about building a sustainable code base. Ask the team how they manage their backlog of bugs. Ask them to tell you about something they’d love to automate if they had time. Is it something that any sensible person would have automated years ago? That’s a bad sign.

Not invented this week syndrome. We talk a lot about “not invented here” syndrome and how it affects the competitiveness of companies. I also worry about companies that lurch from one new technology to the next. Teams should make deliberate decisions about their stack, with an eye on the long term. More importantly, any such decisions should be made in a collaborative fashion, with both developer productivity and operability in mind. Finding out about this is easy. Everybody loves to talk about the latest thing they’re working with.

Disinterest in sustaining a Just Culture. What’s Just Culture? This post by my colleague John Allspaw on blameless post mortems describes it pretty well. Maybe you want to work at a company where people get fired on the spot for screwing up, or yelled at when things go wrong, but I don’t. How do you find out whether a company is like that? Ask about recent outages and gauge whether the person you ask is willing to talk about them openly. Do the people you talk to seem ashamed of their mistakes?

Monoculture. Diversity counts. Gender diversity is really important, but it’s not the only kind of diversity that matters. There’s ethnic diversity, there’s age diversity, and there’s simply the matter of people acting differently, or dressing differently. How homogenous is the group you’ve met? Do they all remind you of you? That’s almost certainly a serious danger sign. You may think it sounds like fun to work with a group of people who you’d happily have as roommates, but monocultures do a great job of masking other types of dysfunction.

Lack of a service-oriented mindset. The biggest professional mistakes I ever made were the result of failing to see that my job was ultimately to serve other people. I was obsessed with building what I thought was great software, and failed to see that what I should have been doing was paying attention to what other people needed from me in order to succeed in their jobs. You can almost never fail when you look for opportunities to be of service and avail yourself of them. Be on the lookout for companies where people get ahead by looking out for themselves. Don’t take those jobs.

There are a lot of ways that a team’s culture can be screwed up, but those are my top seven.

ASUS PQ321Q UltraHD Monitor Review: Living with a 31.5-inch 4K Desktop Display

Many consider me to be a 4K hater. The past few trade shows I’ve attended have been pushing it on consumers to replace their TVs, but I see less value in it. When it comes to a computer display, it is a different game. Unlike a 50” TV, we sit close to our monitors, even if they are 30” in size. We also have no worries about a lack of native content, since everything is rendered on the fly and native. There are no issues with the lack of HDMI 2.0, as DisplayPort 1.2 can drive a 3840×2160 screen at 60 Hz.

When it comes to 4K on the desktop, my main question is: how much difference will I see? ASUS is one of the first with a HiDPI display in the PQ321Q. While not truly 4K, it is a 3840×2160 LCD display that can accept an Ultra High Definition (UHD) signal over HDMI and DisplayPort. It also clocks in at a wallet-stretching $3,500 right now. The question is, are we seeing the future with displays here, or are we seeing a niche product?

What does 4K/UHD/HiDPI bring to the desktop? We’ve seen it for a few years now in smartphones and tablets, making their smaller screens more usable for reading and general work. My initial thought is more desktop space, as that is what it has meant before. With a 32” monitor and a pixel density this high, running it without any DPI scaling leads to a desktop where reading text is a huge pain. Instead I believe most users will opt for DPI scaling so elements are larger and easier to read. Now you have something similar to the Retina screen on the iPhone: No more desktop space compared to a 2560×1440 monitor, but one that is razor sharp and easier to look at.

To get to this pixel density, ASUS has relied upon a panel from Sharp that uses IGZO technology. IGZO (Indium gallium zinc oxide) is a material that replaces amorphous silicon for the active layer of an LCD screen. The main benefit is higher electron mobility that allows for faster reacting, smaller pixels. We have seen non-IGZO panels in smartphones with higher pixel densities, but we don’t have any other current desktop LCDs that offer a higher pixel density than this ASUS display. IGZO also allows for a wide viewing angle.

Integrating C++ with QML

Introduction

Qt Quick’s QML language makes it easy to do many things, especially fancy animated user interfaces. However, some things either can’t be done or are not suitable for implementing in QML, such as:

  1. Getting access to functionality outside of the QML/JavaScript environment.
  2. Implementing performance critical functions where native code is desired for efficiency.
  3. Large and/or complex non-declarative code that would be tedious to implement in JavaScript.

As we’ll see, Qt makes it quite easy to expose C++ code to QML. In this blog post I will show an example of doing this with a small but functional application.

The example is written for Qt 5 and uses the Qt Quick Components so you will need at least Qt version 5.1.0 to run it.

Overview

To expose a C++ type having properties, methods, signals, and/or slots to the QML environment, the basic steps are:

  1. Define a new class derived from QObject.
  2. Put the Q_OBJECT macro in the class declaration to support signals and slots and other services of the Qt meta-object system.
  3. Declare any properties using the Q_PROPERTY macro.
  4. Call qmlRegisterType() in your C++ main program to register the type with the Qt Quick engine.

For all the details I refer you to the Qt documentation section Exposing Attributes of C++ Types to QML and the Writing QML Extensions with C++ tutorial.

Ssh Key Generator

For our code example, we want a small application that will generate ssh public/private key pairs using a GUI. It will present the user with controls for the appropriate options and then run the program ssh-keygen to generate the key pair.

I implemented the user interface using the new Qt Quick Controls since it was intended as a desktop application with a desktop look and feel. I initially developed the UX entirely by running the qmlscene program directly on the QML source.

The UI prompts the user for the key type, the file name of the private key to generate and an optional pass phrase, which needs to be confirmed.

The C++ Class

Now that have the UI, we will want to implement the back end functionality. You can’t invoke an external program directly from QML so we have to write it in C++ (which is the whole point of this example application).

First, we define a class that encapsulates the key generation functionality. It will be exposed as a new class KeyGenerator in QML. This is done in the header file KeyGenerator.h below.

#ifndef KEYGENERATOR_H
#define KEYGENERATOR_H

#include <QObject>
#include <QString>
#include <QStringList>

// Simple QML object to generate SSH key pairs by calling ssh-keygen.

class KeyGenerator : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
    Q_PROPERTY(QStringList types READ types NOTIFY typesChanged)
    Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
    Q_PROPERTY(QString passphrase READ filename WRITE setPassphrase NOTIFY passphraseChanged)

public:
    KeyGenerator();
    ~KeyGenerator();

    QString type();
    void setType(const QString &t);

    QStringList types();

    QString filename();
    void setFilename(const QString &f);

    QString passphrase();
    void setPassphrase(const QString &p);

public slots:
    void generateKey();

signals:
    void typeChanged();
    void typesChanged();
    void filenameChanged();
    void passphraseChanged();
    void keyGenerated(bool success);

private:
    QString _type;
    QString _filename;
    QString _passphrase;
    QStringList _types;
};
#endif

Next, we need to derive our class from QObject. We declare any properties that we want and the associated methods. Notify methods become signals. In our case, we want to have properties for the selected key type, the list of all valid ssh key types, file name and pass phrase. I arbitrarily made the key type a string. It could have been an enumerated type but it would have made the example more complicated.

Incidentally, a new feature of the Q_PROPERTY macro in Qt 5.1.0 is the MEMBER argument. It allows specifying a class member variable that will be bound to a property without the need to implement the setter or getter functions. That feature was not used here.

We declare methods for the setters and getters and for signals. We also declare one slot called generateKey(). These will all be available to QML. If we wanted to export a regular method to QML, we could mark it with Q_INVOCABLE. In this case I decided to make generateKey() a slot since it might be useful in the future but it could have just as easily been an invocable method.

Finally, we declare any private member variables we will need.

C++ Implementation

Now let’s look at the implementation in KeyGenerator.cpp. Here is the source code:

#include <QFile>
#include <QProcess>
#include "KeyGenerator.h"

KeyGenerator::KeyGenerator()
    : _type("rsa"), _types{"dsa", "ecdsa", "rsa", "rsa1"}
{
}

KeyGenerator::~KeyGenerator()
{
}

QString KeyGenerator::type()
{
    return _type;
}

void KeyGenerator::setType(const QString &t)
{
    // Check for valid type.
    if (!_types.contains(t))
        return;

    if (t != _type) {
        _type = t;
        emit typeChanged();
    }
}

QStringList KeyGenerator::types()
{
    return _types;
}

QString KeyGenerator::filename()
{
    return _filename;
}

void KeyGenerator::setFilename(const QString &f)
{
    if (f != _filename) {
        _filename = f;
        emit filenameChanged();
    }
}

QString KeyGenerator::passphrase()
{
    return _passphrase;
}

void KeyGenerator::setPassphrase(const QString &p)
{
    if (p != _passphrase) {
        _passphrase = p;
        emit passphraseChanged();
    }
}

void KeyGenerator::generateKey()
{
    // Sanity check on arguments
    if (_type.isEmpty() or _filename.isEmpty() or
        (_passphrase.length() > 0 and _passphrase.length() < 5)) {
        emit keyGenerated(false);
        return;
    }

    // Remove key file if it already exists
    if (QFile::exists(_filename)) {
        QFile::remove(_filename);
    }

    // Execute ssh-keygen -t type -N passphrase -f keyfileq
    QProcess *proc = new QProcess;
    QString prog = "ssh-keygen";
    QStringList args{"-t", _type, "-N", _passphrase, "-f", _filename};
    proc->start(prog, args);
    proc->waitForFinished();
    emit keyGenerated(proc->exitCode() == 0);
    delete proc;
}

The constructor initializes some of the member variables. For fun, I used the new initializer list feature of C++11 to initialize the _types member variable which is of type QStringList. The destructor does nothing, at least for now, but is there for completeness and future expansion.

Getter functions like type() simply return the appropriate private member variable. Setters set the appropriate variables, taking care to check that the new value is different from the old one and if so, emitting the appropriate signal. As always, please note that signals are created by the Meta Object Compiler and do not need to be implemented, only emitted at the appropriate times.

The only non-trivial method is the slot generateKey(). It does some checking of arguments and then creates a QProcess to run the external ssh-keygen program. For simplicity and because it typically executes quickly, I do this synchronously and block on it to complete. When done, we emit a signal that has a boolean argument that indicates the key was generated and whether it succeeded or not.

QML Code

Now let’s look at the QML code in main.qml:

// SSH key generator UI

import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.0
import com.ics.demo 1.0

ApplicationWindow {
    title: qsTr("SSH Key Generator")

    statusBar: StatusBar {
    RowLayout {
        Label {
            id: status
            }
        }
    }

    width: 369
    height: 166

    ColumnLayout {
        x: 10
        y: 10

        // Key type
        RowLayout {
            Label {
                text: qsTr("Key type:")
            }
            ComboBox {
                id: combobox
                Layout.fillWidth: true
                model: keygen.types
                currentIndex: 2
            }
        }

        // Filename
        RowLayout {
            Label {
                text: qsTr("Filename:")
            }
            TextField {
                id: filename
                implicitWidth: 200
                onTextChanged: updateStatusBar()
            }
            Button {
                text: qsTr("&Browse...")
                onClicked: filedialog.visible = true
            }
        }

        // Passphrase
        RowLayout {
            Label {
                text: qsTr("Pass phrase:")
            }
            TextField {
                id: passphrase
                Layout.fillWidth: true
                echoMode: TextInput.Password
                onTextChanged: updateStatusBar()
            }

        }

        // Confirm Passphrase
        RowLayout {
            Label {
                text: qsTr("Confirm pass phrase:")
            }
            TextField {
                id: confirm
                Layout.fillWidth: true
                echoMode: TextInput.Password
                onTextChanged: updateStatusBar()
            }
        }

        // Buttons: Generate, Quit
        RowLayout {
            Button {
                id: generate
                text: qsTr("&Generate")
                onClicked: keygen.generateKey()
            }
            Button {
                text: qsTr("&Quit")
                onClicked: Qt.quit()
            }
        }

    }

    FileDialog {
        id: filedialog
        title: qsTr("Select a file")
        selectMultiple: false
        selectFolder: false
        nameFilters: 
        selectedNameFilter: "All files (*)"
        onAccepted: {
            filename.text = fileUrl.toString().replace("file://", "")
        }
    }

    KeyGenerator {
        id: keygen
        filename: filename.text
        passphrase: passphrase.text
        type: combobox.currentText
        onKeyGenerated: {
            if (success) {
                status.text = qsTr('<font color="green">Key generation succeeded.</font>')
            } else {
                status.text = qsTr('<font color="red">Key generation failed</font>')
            }
        }
    }

    function updateStatusBar() {
        if (passphrase.text != confirm.text) {
            status.text = qsTr('<font color="red">Pass phrase does not match.</font>')
            generate.enabled = false
        } else if (passphrase.text.length > 0 && passphrase.text.length < 5) {
            status.text = qsTr('<font color="red">Pass phrase too short.</font>')
            generate.enabled = false
        } else if (filename.text == "") {
            status.text = qsTr('<font color="red">Enter a filename.</font>')
            generate.enabled = false
        } else {
            status.text = ""
            generate.enabled = true
        }
    }

    Component.onCompleted: updateStatusBar()
}

The preceding code is a little long, however, much of the work is laying out the GUI components. The code should be straightforward to follow.

Note that we import com.ics.demo version 1.0. We’ll see where this module name comes from shortly. This makes a new QML type KeyGeneratoravailable and so we declare one. We have access to it’s C++ properties as QML properties, can call it’s methods and act on signals like we do withonKeyGenerated.

A more complete program should probably do a little more error checking and report meaningful error messages if key generation fails (we could easily add a new method or property for this). The UI layout could also be improved to make it properly resizable.

Our main program is essentially a wrapper like qmlscene. All we need to do to register our type with the QML engine is to call:

    qmlRegisterType<KeyGenerator>("com.ics.demo", 1, 0, "KeyGenerator");

This makes the C++ type KeyGenerator available as the QML type KeyGenerator in the module com.ics.demo version 1.0 when it is imported.

Typically, to run QML code from an executable, in the main program you would create a QGuiApplication and a QQuickView. Currently, to use the Qt Quick Components there is some additional work needed if the top level element is an ApplicationWindow or Window. You can look at the source code to see how I implemented this. I basically stripped down the code from qmlscene to the minimum of what was needed for this example.

Here is the full listing for the main program, main.cpp:

#include <QApplication>
#include <QObject>
#include <QQmlComponent>
#include <QQmlEngine>
#include <QQuickWindow>
#include <QSurfaceFormat>
#include "KeyGenerator.h"

// Main wrapper program.
// Special handling is needed when using Qt Quick Controls for the top window.
// The code here is based on what qmlscene does.

int main(int argc, char ** argv)
{
    QApplication app(argc, argv);

    // Register our component type with QML.
    qmlRegisterType<KeyGenerator>("com.ics.demo", 1, 0, "KeyGenerator");

    int rc = 0;

    QQmlEngine engine;
    QQmlComponent *component = new QQmlComponent(&engine);

    QObject::connect(&engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));

    component->loadUrl(QUrl("main.qml"));

    if (!component->isReady() ) {
        qWarning("%s", qPrintable(component->errorString()));
        return -1;
    }

    QObject *topLevel = component->create();
    QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);

    QSurfaceFormat surfaceFormat = window->requestedFormat();
    window->setFormat(surfaceFormat);
    window->show();

    rc = app.exec();

    delete component;
    return rc;
}

In case it is not obvious, when using a module written in C++ with QML you cannot use the qmlscene program to execute your QML code because the C++ code for the module will not be linked in. If you try to do this you will get an error message that the module is not installed.