Create Powerful, Custom Clients for Perforce
In fact, it might be more accurate to call Client Kit for Perforce a technique rather than an application. The technique is little more than the idea to put together a web rendering engine with access to a subset of Qt libraries and access to a Perforce server through our C++ API.
You can find an example implementation in the Perforce public depot: Client Kit for Perforce.
All of the code needed to compile and build custom Perforce clients is available under open source licenses (This caused Laura Wingerd to dub it “The People’s Client”). (Qt is a cross-platform application and UI framework for desktop as well as mobile devices currently available under a LGPL v2 license.)
One of the libraries included in Qt is a port of the WebKit browser engine. Client Kit effectively co-opts the browser rendering engine for our goal of displaying custom UI’s.
What’s the “Kit” Part?
One of the features of web development is that it’s relatively easy to remix solutions from previous work. It’s our hope to build, along with the community, a library of Perforce-specific client pieces. For example: a depot tree browser, a local file browser, a Streams graph, a thumbnail viewer; all in HTML5. Anyone can then put these pieces together to mock up a prototype or proof-of-concept quickly. Perforce consulting might be able to build custom clients with markedly less effort (and less cost to our customers)!
I hope to be able to publish “kit parts” regularly to the Perforce Ecosystem as we build them for internal and external projects. Of course, you can also use any existing HTML5 widget or code as a piece of your custom client. This includes data visualizations, photo editors, text translators, text-to-speech interfaces, Twitter feeds, and much more.
Bootstrapping of the web application is intentionally simplistic in the example implementation. Client Kit looks for a configuration file in the executable directory, and tries to load the given HTML file. If that fails, it will try to load “index.html” from the current working directory. But this is only an example, the developer has the freedom to supply the start up file in many different ways.
Security in Your Control
A bonus of making the C++ core publically available is that you have complete control over the security model. For example, one developer might be building a secure application that chooses to prevent WebKit from loading pages from web servers. She could do this by modifying the bootstrap section of the Client Kit code to check for “http:” or “https:” prefixes and reject if found. She could even remove the bootstrap mechanism completely and compile her application into a QResource which is then, in turn, compiled into the binary.
Another developer’s project might tolerate a more open security model, for example, hosting the application centrally on a web server to ease deployment of new UI’s.
|Simplified, internationalized clients for non-technical users|
Reaching the goal of Version Everything often means supporting users with a wide range of technical saavy. This example targets the case where you not only have users that are non-technical users, but are non-English speaking too. This simple command applet provides a quick alternative to teaching them how to use the much more complex, English language P4V.
|Shared, checked out files explorer|
Perforce lets you see who else has files checked out- important information in a collaborative development environment. This example application demonstrates one way to visualize files checked out by more than one person. Making the display of files fade proportionally with the amount of time since their last check out helps determine which checked out files are likely to be active.
This view shows only the files that are checked out by more than one user- a convenient way to see where conflicts might arise.
However, the key point here is that this example was created in just a couple of hours using open source libraries and a few Perforce commands.
It’s Tiny and Flexible
I originally started Client Kit as an experiment: how hard would it be to use only open source libraries to build a C++/Qt application that uses HTML5 to define a UI, and also links in the Perforce C++ API for server access? Turns out, not hard at all! Now Client Kit is freely available to you and your imagination. What will you build with it?