Desenvolvimento/Tutoriais

From KDE TechBase
Revision as of 21:48, 3 June 2015 by Aracele (talk | contribs) (Created page with "Uma introdução ao Framework de Scripting Kross.")


Tutoriais são o jeito mais rápido de encontrar o que o KDE pode fazer por você e como conseguir isso. Aqui tem uma lista dos tutoriais disponíveis atualmente para o KDE. Materiais para o KDE3 e KDE2 estãos disponíveis no final desta página.

Fundamentos da Programação KDE 4

Você está interessado em escrever aplicações com o KDE 4? Esta série de tutoriais é voltado para aqueles completamente novos na programação do KDE.

Hello World
Uma introdução ao básico da programação do KDE4
Criando a Janela Principal
Este tutorial mostra a você a mágica de uma das coisas mais importantes de um : A janela principal.
Usando KActions
Como adicionar ações aos menus e as barras de ferramentas. Baseado no tutorial de criação de janelas principais.
Simulação Física
Como realizar uma simulação física: animação e diagrama
Salvar e Abrir
Apresenta a biblioteca KIO ao adicionar suporte à carregamento e salvamento para o nosso aplicativo.
Utilizando bancos de dados SQLite e QtSql
Bases de dados integradas sem a necessidade de um servidor de banco de dados
Argumentos de linha de comando
Adiciona a capacidade de especificar qual arquivo abrir a partir da linha de comando para o nosso editor de texto.
Introdução ao CMake
Como usar o sistema de compilação CMake usado por KDE4.
Erros comuns de programação
Vários erros comuns cometidos durante o desenvolvimento de aplicativos Qt e KDE e como evitá-los.
Depuração de erros de linker
Como entender e depurar erros de linker na hora da compilação.
Usando Qt Creator para desenvolver o seu programa KDE
Como usar Qt Creator como uma IDE para desenvolver programas KDE
Criação de Bibliotecas para compartilhar código
Como adicionar a biblioteca para o sistema de compilação e como preparar o código-fonte.
Gerenciamento de Sessões
Torne o seu aplicativo consciente das sessões X
Ícones
Entregar seu aplicativo com ícones que são automaticamente instalados para os lugares certos. Baseado no Kaction Tutorial.
Arquivo desktop
Deixe seu aplicativo aparecer no menu K e em menus de aplicativo. Com base no Tutorial de Ícones.
Compilando um aplicativo KDE existente

Se você quiser melhorar um aplicativo existente, você pode compilá-lo normalmente e instalá-lo facilmente. Este tutorial mostra como compilar um aplicativo de uma forma que não interfira em seu sistema. Se você não precisa modificar a kdelibs esta pode ser a maneira mais fácil de começar com o desenvolvimento.

Teste e depuração

Depurando seu aplicativo
Dicas, ferramentas e técnicas para aplicar ao depurar o seu aplicativo KDE
Escrevendo UnitTests para Qt4 e KDE4 com QTestLib (Link original)
Tutorial por [mailto: [email protected] Brad Hards] que descreve como escrever testes de unidade usando a estrutura QTestLib. É apresentado como um tutorial baseado em exemplo, e ainda está em desenvolvimento.
Formas semi-automáticas para detectar erros de código
Técnicas que você pode usar para detectar erros no código do KDE

Gerenciando configuração de dados com KConfig

Introdução ao KConfig
Uma visão geral das classes do KConfig e como usá-las no código do seu aplicativo
Usando KConfig XT
Tutorial sobre como usar eficientemente o framework KConfig XT.
Atualizando os arquivos do KConfig
Tutorial sobre como escrever um script de atualização para manter as alterações no formato de arquivo de configuração do aplicativo em sincronia com o arquivo de configuração já existente do usuário

Serviços: Aplicativos e Plugins

Introdução ao Framework de Serviços
Uma visão geral do framework de serviços no KDE e o que ele fornece ao desenvolvedor do aplicativo. Cobre o cache de configuração do sistema (SyCoca), os arquivos de dados de origem e para o que a informação indexada pode ser usada.
Encontrar serviços usando Trader Queries
Como encontrar serviços, tais como plugins ou mimetypes, que são indexados em SyCoCa usando Trader Query Syntax

Criando e carregando plugins usando KService

Aprenda a definir os tipos de plugin personalizados, encontrar plugins instalados (incluindo plugins de terceiros) e carregá-los de uma forma fácil e portátil usando KService.

Localização

Veja também o Portal de localização.

Introdução ao Unicode
Uma introdução ao que é Unicode, bem como a forma de lidar com dados Unicode em aplicativos do KDE.

Escrevendo aplicativos com localização em mente
Este tutorial cobre o que a localização é, por que é importante e como assegurar que seu aplicativo está pronto para ser localizado. Uma leitura obrigatória para todos os desenvolvedores de aplicativos.
Evitando armadilhas comuns em localização
Existem vários erros comuns que impedem que aplicativos sejam adequadamente localizados. Saiba o que são e como evitá-los facilmente neste tutorial.
Compilando o módulo de localização do KDE
Compilar e instalar o suporte ao idioma do módulo de localização (l10n) do KDE é uma boa ideia para aqueles que trabalham em aplicativos no repositório principal do KDE. Fazer isso permitirá que você teste seu aplicativo em outro idioma e localize as áreas problemáticas. Aprenda a fazer isso neste tutorial.
Incorporando i18n ao sistema de compilação
Uma vez que seu aplicativo está pronto para ser localizado, o próximo passo é garantir que os arquivos de tradução sejam compilados automaticamente e mantidos atualizados. Este tutorial abrange as adições CMakeFiles.txt necessárias, bem como o processo de distribuição dos catálogos de mensagens resultantes com seu aplicativo.
Desafios e soluções i18n comuns
Este tutorial aborda desafios que você pode eventualmente enfrentar, como traduzir manuais e outros dados que existem fora do código-fonte, fusão e manipulação de arquivos .po obsoletos, lidar com freezes, codificação em outros idiomas além do Inglês e criação de lançamentos independentes ou troca de aplicativos entre os módulos do KDE.
Marcação semântica de mensagens
Para garantir uma apresentação consistente e representações mais significativas de mensagens em aplicativos, a marcação semântica pode ser aplicada às mensagens marcadas para tradução usando o sistema KUIT. Este tutorial descreve como funciona esse sistema.
Verificação automática de código i18n
O verificador de código Krazy escaneia o código do KDE e relata erros i18n comuns.

Documentação

Documentação da API
Este tutorial explica como documentar suas APIs corretamente.
Páginas de manual
Escrever e gerar páginas de manual de referência.
Código Fonte
http://quickgit.kde.org
http://websvn.kde.org

Accessibility

Visão geral da acessibilidade
Uma lista de tutoriais de acessibilidade e informações gerais.
Lista de verificação de acessibilidade
O que procurar em seu aplicativo para torná-lo acessível para tantas pessoas quanto possível.
Leitor de tela
Este tutorial vai explicar alguns detalhes sobre o uso de leitores de tela com os aplicativos do KDE.
Leitor de texto
Como utilizar o serviço de leitor de texto Jovie no seu aplicativo.

Scripting e automação de aplicativo

D-Bus

Introdução ao D-Bus
Uma introdução simples e direta aos principais conceitos em D-Bus da perspectiva de um desenvolvedor de aplicativos, este tutorial cobre o que o D-Bus é e como ele pode ser usado por aplicativos.
Acessando interfaces D-Bus
Um guia passo-a-passo para chamar métodos de D-Bus e conexão com sinais D-Bus usando QtDBus.
D-Bus intermediário
Sugestões para fazer uso de QtDBus ao confrontado com interfaces reais problemáticas.
Criando interfaces D-Bus
Saiba como expor a funcionalidade em seu aplicativo criando e usando interfaces customizadas do D-Bus. Abora a geração das descrições XML, instanciação de interfaces em tempo de execução e configuração do sistema de compilação com CMake.
Usando tipos customizados com D-Bus
Aprenda a usar os seus próprios tipos em classes exportadas no D-Bus. Aborda marhaling e unmarshaling de objetos, a integração de tipos personalizados em descrições XML e o registro os tipos personalizados com o sistema Qt Meta Object .
Serviços de inicialização automática do D-Bus
Transforme o seu aplicativo em um serviço de inicialização automática do D-Bus com este tutorial. Este recurso do D-Bus, também conhecido como "ativação do serviço D-Bus", irá garantir que, mesmo quando o aplicativo não está sendo executado, as chamadas D-Bus feitas funcionarão por depender do próprio daemon D-Bus para iniciar o seu aplicativo se e quando necessário.
Portar do DCOP para o D-Bus
Portar seus aplicativos do DCOP para o D-Bus com este guia prático.

Konqueror

Criando menus de serviços do Konqueror
Este tutorial mostra como criar ações específicas de Mimetype no menu de contexto do Konqueror (conhecido como "servicemenus").

Kross

Introdução ao Kross
Uma introdução ao Framework de Scripting Kross.
Hello World
A first application with working kross code.
Calling Functions in Kross
Simple demonstration of calling scripting functions
Connecting Signals and Slots in Kross
Simple demonstration of connecting object signals with script slots
Scripts as Plugins with Kross
This tutorial provides a step-by-step introduction how to integrate scripts as plugins into a KDE application.
Placing script actions in your application menus
Simple demonstration on how to extend you application menus to execute script files.
How to use an ActionCollection
A small Tutorial on How to use Kross::ActionCollections.

Calligra Plugin Tutorials

Calligra Overview
This document shows an overview of the different Calligra plugin types and tells you what each of their purpose and strengths are. If you are new with Calligra plugins, this is the place to start.
Calligra Plugin Creation
This gives a technical overview of what it means to write a Calligra plugin.
Creating Calligra Flake Plugins
This tutorial shows you how you can build a plugin for Calligra applications to allow you embed content in ODF documents using Flake.
Calligra Words Scripting
This tutorial shows how to script Calligra Words with Python, or JavaScript using Kross.
Calligra Sheets Scripting
This tutorial shows how to script Calligra Sheets with Python, or JavaScript using Kross.


SuperKaramba

SuperKaramba Tutorial
This tutorial provides an overview of SuperKaramba, theme files and scripting with Python, Ruby and JavaScript.

System Activity

Writing script actions for the process's context menu
This tutorial shows how to add a context menu action to show custom information about a process.

KWin

KWin Scripting Tutorial
This tutorial shows how to write a useful script for KWin.
QML Window Switcher Layouts
This tutorial documents the new QML layouts for the KWin Window Switcher

Plugins and KParts

Using KParts
A kPart is a plugin that you can just load into your application. For example, it is easy to integrate an editor (the katePart) or a console (the konsolePart) into your application's window.
Writing kontact plugins
Kontact plugins are KParts. This tutorial describes how you can write one.
Writing Qt Designer Plugins
Add your widgets to Qt Designer and thus make them usable in UI files.
KCM HowTo
KCM are plugins which are loaded by System Settings to display configuration elements. They can also be used within an application.

Search and Metadata

Strigi

Writing file analyzers
File analyzers extract data from files to display in the file dialogs and file managers. The data gathered this way is also used to search for files. KDE4 allows the use of multiple analyzers per file type. This tutorial describes how you can write new analyzers.

Nepomuk

See Nepomuk tutorials.

Hardware Awareness (Solid)

Introduction to Solid
An introduction to the Solid effort in general and it library in particular.
Listing Devices
How to use the Solid core library to discover the hardware and interact with the system.
Accessing Network Information
How to use the Solid system to get information about the network
Creating a Device Action
When your application is interested in registering actions with the system for removable hardware

Authorization and Privilege escalation (KAuth)

KAuth Basics
An overview of concepts and basic knowledge required to understand and use KAuth effectively
Using KAuth actions in your application
How to execute KAuth actions in your application, and how to integrate them tightly into your UI
Creating a KAuth helper to perform a privileged action
You will learn how to use KAuth's helpers and escalation facilities, and how to seamlessly make a privileged and non privileged portion of your application interact
Creating a KCM requiring authorization upon saving
Learn how to use the high level KCModule API to create KCModules handling authorization, and its UI integration, on their own

Multimedia (Phonon)

Phonon
Introduction to Phonon tells how to compile and run the code. If you like to work in Python, try this version of the same tutorial
Writing Backends
How to start creating a new backend for the multimedia API
Resources
Please have a look at the online documentation for information on the Phonon API. If you prefer using Qt Assistant or Qt Creator you can also use our offline documentation.

Plasma

See Plasma tutorials.

Personal Information Management (Akonadi)

Using Akonadi in Applications
Displaying and modifying data provided by Akonadi
Developing Akonadi Resources
Akonadi Resources are agent programs which transport PIM data between Akonadi and a backend (files, servers, etc)
Using custom data types with Akonadi
Akonadi can handle arbitrary data as item payloads through the use of a plugin based serialization framework
Porting Applications which use KResource API
Applications using KDE's now deprecated KResource APIs, e.g. KABC or KCal, need to be ported to use their Akonadi equivalents

Kate / Kwrite

Getting started with KTextEditor plugins
Creating your first KTextEditor plugin
Developing a plugin with configuration dialog
Adding a configuration dialog to the Time & Date example
A small Editor
Create a small application using KTextEditor

KDevelop

KDevelop-PG-Qt Introduction
Information on the KDevelop parser generator, useful for language plugins.
Creating a class template
Instructions for creating a class template, which can be used to quickly generate classes from KDevelop.
Creating a project template
Instructions for creating a project template, which can be used for starting new project with KDevelop.

Printing

KDE mostly uses the Qt Printing infrastructure.

Hello World
Introduction to the KDE printing system

kioslaves

Collaboration

Open Collaboration Services (libattica)

Introduction to Attica
In this tutorial a simple widget showing information about a Person on the server is created.

Get Hot New Stuff

Get Hot New Stuff 3 - Download
How to use KHotNewStuff3 in your application.
Get Hot New Stuff 3 - Checking for Updates
How to check whether updates for installed stuff are available without showing the dialog/widget.
Get Hot New Stuff 3 - Upload
How to add an upload dialog to your application.

Old links for KNS2 and KNS1 content:

Introduction to Get Hot New Stuff 2
A short tutorial about how to use KHotNewStuff2 in your application. Deprecated, use version 3
Introduction to Get Hot New Stuff
An introduction to the developer-friendly network update system that allows KDE applications to fetch new application data at runtime in a user friendly manner.
KNewStuff Secure (Original Link)
Tutorial showing how to share resources in a secured way (KDE 3.4 and later). By András Mantia <[email protected]>.

Goya

Introduction to Goya usage
An introduction for the Goya subsystem usage, which allows you to easily add widgets to your itemviews and connect their signals to your code, as they were real widgets.
Introduction to Goya usage (part 2)
The second part of the tutorial, with a slightly more complex example than the first part.

Other programming languages

Python

An Introduction to PyQt
Starting off
PyQt by Example
Another introduction to PyQt
PyKDE WebKit Tutorial
A simple web browser application in PyKDE
101 Introduction to signals and slots
A simple introduction to Qt's signal and slot architecture.
PyKDE DBus Tutorial
An introduction to DBus communication using PyKDE
PyKDE KNotify Tutorial
An introduction to Knotify (Notifications and KJobs) using PyKDE

Ruby

KDE Ruby Korundum tutorial
A ruby version of Antonio Larrosa Jiménez's KDE tutorial by Richard Dale. See the Ruby Developers Corner for Qt tutorials and other info.
Qt4 Ruby Tutorial
Nokia's fabulous introductory tutorial to Qt, translated to Ruby.
Creating a Plasma Widget in Ruby
Tutorial that shows how to create your first Plasma Applet using the Ruby language.
Developing Qt4 Applications using Qt Designer and Ruby on Kubuntu
Tutorial that shows how to design a simple User Interface in Qt Designer and then use the resulting widget in a Qt Ruby application we build from scratch.
Ruby-Qt/KDE Book
There is also an approach to create an Ruby-Qt/KDE Book under a free license. The content will be created in this wiki.

Shell

Shell Scripting with KDE dialogs (Original Link)
Tutorial by Brad Hards that describes how to use KDE dialogs in shell scripts with kdialog. It is presented as an example based tutorial.

Graphics Programming

QPainter Perfomance
Hints on avoiding common mistakes leading to poor performance when using QPainter

Using the KDE Games Libraries

KStandardGameAction
Using libkdegames to make your game fit the kdegames standard
Highscores
Implementing a simple highscore table into your game
Theme Selector
Using the libkdegames theme selection dialog
Palapeli Slicers
Creating a slicer plugin for Palapeli

Gluon

Installation and your first KGLItem
start your first kglengine application
kglpong
Now use our knowledge to make a pong
Play hello word sound
Using Gluon for games sound development using openAL

Using the KDE PIM Libraries

iCalendar functionality
Using kcal to manage iCalendar files

Other tutorials

2D Plotting (KPlotWidget)

Using the KDE data-plotting widget
This tutorial introduces KPlotWidget, which is used for 2-D data plotting. It includes information on simple usage of the widget (including adding and modifying data sets, and customizing the plot axes and labels), and advanced customization (including extending the widget through sub-classing).

Spelling and Grammar Checking (Sonnet)

Adding spell-checking or grammar-checking to KDE applications
This tutorial introduces Sonnet and how one may use it to add language correction to your KDE application. Sonnet's auxiliary features shall be described in a separate tutorial.

Pixmap cache (KPixmapCache)

Using the KDE pixmap cache
This tutorial shows how to use KPixmapCache to cache e.g. pixmaps generated from SVGs or some data.

Using MarbleWidget (Marble)

Using MarbleWidget
This short tutorial describes how to use the MarbleWidget in your project

Using local SCM for KDE development

Using Git to develop for KDE
Here you find how to use Git to develop for KDE

Kwin effect tutorial (blog)

blog by Martin Graesslin
This tutorial guides you through the development of a simple KWin effect

Implementing KSysGuard sensors and adding them

Sensors Tutorial
This tutorial shows how to write and KSysGuard sensor and connect it to the systray.

Runners

Porting an application from KSystemTrayIcon to KStatusNotifierItem

Porting from KSystemTrayIcon to KStatusNotifierItem
This tutorials shows how to port an application using KSystemTrayIcon to KStatusNotifierItem

Using the KDE Wallet API for safe storage

KWallet
"Brief introduction to the KWallet API which can be used for storing all kinds of sensitive information."

How to edit a wiki with Libmediawiki

Libmediawiki
This tutorial present how to edit a wiki with Libmediawiki.

KDE2 and KDE3 Materials

Porting Your Application from KDE 3 to KDE 4
These tutorials cover topics related to the migration from KDE 3 to KDE 4.
KDE3 Tutorials
These tutorials cover topics related to KDE3.
KDE2 Tutorials
These tutorials cover topics related to KDE2.